‎2009 Dec 22 1:15 PM
Hi,
I'm learning Dialog programming. I created a Dialog program to get the Details of a Particular plane on a given date. I also created a GUI STATUS.
As far I know, value in OK_CODE field is set automatically during runtime. I have defined it as follows:
DATA ok_code like sy_ucomm.
The problem is : ok_code value is initial during runtime. There is no value in OKCODE field. When I use sy-ucomm directly, the code works fine.
I need to use EXIT, BACK, and CANCEL buttons. Unable to do so due to this problem.
I have no idea how to over come this. Could any one please help me,
Thanks
Ashish
‎2009 Dec 22 1:25 PM
Set the value of OK_CODE field just before, you want to use it. It automatically does not hold any value. So wherever you are performing any operation based on OK_CODE, use this stmt. OK_CODE = SY-UCOMM. and ignore using sy-ucomm directly in your program. And define this OK_CODE field at both places, once in the screen's element list and another in your program.
Edited by: Sujeet Karn on Dec 22, 2009 6:55 PM
‎2009 Dec 22 1:20 PM
Hi,
Have you defined OK_CODE in the screen layout - Element list?
‎2009 Dec 22 1:24 PM
Hi,
I have defined OK_CODE field in the TOP include of the program.
‎2009 Dec 22 1:25 PM
Set the value of OK_CODE field just before, you want to use it. It automatically does not hold any value. So wherever you are performing any operation based on OK_CODE, use this stmt. OK_CODE = SY-UCOMM. and ignore using sy-ucomm directly in your program. And define this OK_CODE field at both places, once in the screen's element list and another in your program.
Edited by: Sujeet Karn on Dec 22, 2009 6:55 PM
‎2009 Dec 22 1:36 PM
Hi,
Thank you very much for the reply. I'll try that. Could you please tell how to define OK_CODE field in Screen Element list?
I have defined this field only in TOP Include of the dialog program as follows. DATA ok_code like sy-ucomm.
Ashish
‎2009 Dec 22 1:49 PM
Go to SE51 and enter your program name and screen number. Dont click on 'Layout' button. There you can see three tabs.. 1. Attributes, 2. Element List, 3. Flow Logic. Click on 2nd Tab.
You need to define this OK_CODE in this under 'General Attributes'.
‎2009 Dec 22 2:04 PM
Sujeet already explained the way how it must be done to work. I only would like to add some useful link which I think you should get familiar with
http://help.sap.com/saphelp_nw04s/helpdata/en/9f/dbaa1335c111d1829f0000e829fbfe/frameset.htm
I will help you to uderstand the concept of saving ok_code .
Regards
Marcin
‎2009 Dec 22 2:17 PM
Thank you very much. Defining the OK_CODE field in the Screen Element List solved the problem.
Full Points awarded to you. Thanks a lot.
Ashish
‎2009 Dec 22 2:23 PM
Hi Marcin,
Thank you very much for the link. Helped me a lot.
There are 2 methods according to TAW12 material:
1) MODULE clear_okcode OUTPUT.
CLEAR OK_CODE.
ENDMODULE.
2) MODULE clear_okcode INPUT.
save_ok = OK_CODE.
CLEAR OK_CODE.
ENDMODULE.
But they failed to mention that OK_CODE had to be defined in SCREEN Element List as well.
Thanks a lot for the help guys.
Ashish