2014 Feb 18 7:44 PM
Hi,
I am using the EVENT FINISHED of CL_GUI_TIMER in the MODULE POOL by setting the interval to 3 secs. The method registered to the event is getting triggered perfectly after 3 secs. Now inside this event method , I am setting the value of an input fields of the module pool screen to 20 (The initial value of this inp fields is 10) . I checked in debugging , the program control while executing the method , sets the value of the variable to 20 but after the method execution , as soon as the PAI is about to be executed , the valye of the inp field is autoamtically set to initialy value 10. I am not able to understand this behaviour.
I am calling the PAI by using the func module METHOD CL_GUI_CFW=>SET_NEW_OK_CODE in the method at the last to call the PAI.
METHOD AFTER_DELAY.
MESSAGE 'Test' TYPE 'I'.
VAR_TEST = 20. " This is the input field defined in layout whose initial value was 10
CALL METHOD CL_GUI_CFW=>SET_NEW_OK_CODE
EXPORTING
NEW_CODE = 'ABC'
ENDMETHOD.
2014 Feb 20 6:56 PM
Hi Amber,
This is standard behavior of system . As all we know , in module pool we have screen fields and ABAP fields (Program) and data transfer happens with same name(data type also matters) . Screen fields value will copied to ABAP fields value in PAI and ABAP fields value copied to screen fields in PBO.
In your case your are changing the ABAP field value in event method (it not yet transferred to screen, it only happens in end of PBO ) it getting overwritten with screen value (still has old value only )once control moved PAI.
To check with behavior, in PAI event keep FIELD statement on VAR_TEST. In debug mode check the value VAR_TEST , till FIELD statement executed VAR_TEST will be 20 once this statement executed it overwritten with screen value 10.
http://help.sap.com/saphelp_nw04s/helpdata/en/9f/dbabb035c111d1829f0000e829fbfe/frameset.htm
To solve this program, declare global variable and set value for this global variable in event method and copy this global variable value to VAR_TEST in PAI.
And also check return code of CL_GUI_CFW=>SET_NEW_OK_CODE
http://help.sap.com/saphelp_sm32/helpdata/en/06/3fa1b79f2811d2bd68080009b4534c/content.htm
Thanks & Regards
aRun
2014 Feb 20 5:24 PM
Hi Guys,
Any solutions or hints for the above problem???? I am stuck up badly.
Regards
Amber
2014 Feb 20 5:41 PM
you should use set_new_ok_code only with handler methods of a system event (like for handlers of enjoy controls for example). I'm not sure if your case is the same.
2014 Feb 20 5:46 PM
Yes you are right . The above method AFTER_DELAY is the handler method only for the event FINISHED of the class CL_GUI_TIMER.
2014 Feb 20 6:56 PM
Hi Amber,
This is standard behavior of system . As all we know , in module pool we have screen fields and ABAP fields (Program) and data transfer happens with same name(data type also matters) . Screen fields value will copied to ABAP fields value in PAI and ABAP fields value copied to screen fields in PBO.
In your case your are changing the ABAP field value in event method (it not yet transferred to screen, it only happens in end of PBO ) it getting overwritten with screen value (still has old value only )once control moved PAI.
To check with behavior, in PAI event keep FIELD statement on VAR_TEST. In debug mode check the value VAR_TEST , till FIELD statement executed VAR_TEST will be 20 once this statement executed it overwritten with screen value 10.
http://help.sap.com/saphelp_nw04s/helpdata/en/9f/dbabb035c111d1829f0000e829fbfe/frameset.htm
To solve this program, declare global variable and set value for this global variable in event method and copy this global variable value to VAR_TEST in PAI.
And also check return code of CL_GUI_CFW=>SET_NEW_OK_CODE
http://help.sap.com/saphelp_sm32/helpdata/en/06/3fa1b79f2811d2bd68080009b4534c/content.htm
Thanks & Regards
aRun
2014 Feb 21 2:13 PM