Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CL_GUI_TIMER Event FINISHED resetting input fields value to initial

abaper_guy
Active Participant
0 Likes
1,197

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,062

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

5 REPLIES 5
Read only

abaper_guy
Active Participant
0 Likes
1,062

Hi Guys,

     Any solutions or hints for the above problem???? I am stuck up badly.

Regards

Amber

Read only

0 Likes
1,062

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.

Read only

0 Likes
1,062

Yes you are right . The above method AFTER_DELAY is the handler method only for the event FINISHED of the class CL_GUI_TIMER.

Read only

Former Member
0 Likes
1,063

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

Read only

0 Likes
1,062

Thank you very much Aruna .My problem was solved