Hello,
I'm trying to set the focus on the distribution reference field in window 'CMTrx_Distributions' of form 'CM_Transaction_Entry' in the scrolling window POST script when the reference typed in is invalid.
This is my script declaration:
Result = Trigger_RegisterFocus(anonymous(window CMTrx_Distributions of form CM_Transaction_Entry), TRIGGER_FOCUS_POST, TRIGGER_BEFORE_ORIGINAL, script CMTrx_Distributions_Post);
if Result <> SY_NOERR then
warning "Trigger 'CMTrx_Distributions_Post' registration failed.";
end if;
This is the script 'CMTrx_Distributions_Post' content:
local string strDistributionReference;
strDistributionReference = trim('Distribution Reference' of window CMTrx_Distributions of form CM_Transaction_Entry);
if empty('Account Number' of window CMTrx_Distributions of form CM_Transaction_Entry) then
abort script;
end if;
if length(strDistributionReference) > 0 then
clear table POP_PO;
'PO Number' of table POP_PO = strDistributionReference;
get table POP_PO;
if err(table POP_PO) <> OKAY then
if ask("Invalid reference. Do you want to continue?", "Yes", "No", "Cancel") = ASKBUTTON1 then
run script 'Scrolling Window Expand Button' of window CM_Transaction_Entry of form CM_Transaction_Entry;
focus 'Distribution Reference' of window CMTrx_Distributions of form CM_Transaction_Entry;
end if;
end if;
else
if ask("Invalid reference. Do you want to continue?", "Yes", "No", "Cancel") = ASKBUTTON1 then
run script 'Scrolling Window Expand Button' of window CM_Transaction_Entry of form CM_Transaction_Entry;
focus 'Distribution Reference' of window CMTrx_Distributions of form CM_Transaction_Entry;
end if;
end if;
The script 'CMTrx_Distributions_Post' will verify if the reference is a valid PO number and if not the user must change the value. If this operation is repeated multiple times (PO number never exists) the new value typed in the distribution field is not available in the script, it looks like it always the initial value.
There's probably a synchronization issue with the scrolling window and the table buffer due to the 'focus field' I'm doing.
I was expecting the table buffer to be properly positioned in the POST script but this is not the case.
Does anyone has ever seen this situation?
Thank you.
Philippe
*This post is locked for comments