I am trying below piece of code in already existing program:
IF confirm1 = Yes THEN
on choose of btn-ok In frame Frame-A:
DO:
.......
if true then
DO WITH FRAME FRAME-V:
IF SESSION:SET-WAIT-STATE("GENERAL") THEN.
IF SESSION:SET-WAIT-STATE("") THEN.
FOR EACH ttvoucher :
DISPLAY tt-voucher tt-ErrMsg WITH FRAME FRAME-V VIEW-AS DIALOG-BOX.
END.
ENABLE cancel-button WITH FRAME FRAME-V.
WAIT-FOR CHOOSE OF cancel-button IN FRAME FRAME-V.
end.
END.
After selecting "Close" Button, I am getting error "WAIT-FOR statement is not waiting for any event in active dialog box. (4124) ".
NOTE: Other Frames and browse are created in existing program by app-builder.
The best way to get help with a question like this is to create the smallest example which can be compiled and run that demonstrates the problem. If possible it should work without a database but if a database is required either use sports2000 or define a temp-table so that we can easily run the code.
You are doing a conditional WAIT-FOR and that is asking for trouble. Try to use only one WAIT-FOR in your program. Second - minor point - is that you do not need to use IF .. THEN. for a SESSION:SET-WAIT-STATE. They can appear without any surrounding code on a single line, like:
SESSION:SET-WAIT-STATE('general').
I assume that in your real program there is some code between the two session:set-wait-state statements that you left out, otherwise this does not make much sense.
For your code I think it is easier to create a separate .w to display the ttVoucher records. That way you keep the code simple.