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

Auto-Refresh in RF

Former Member
0 Likes
2,369

Hello All

I am using the CL_GUI_TIMER to auto-refresh a program every 60 seconds. This works perfect in SAP GUI but when I am trying to test the same in RF and it dumps with the following error:

The termination occurred in the ABAP program "CL_GUI_CONTROL================CP" in "SET_REGISTERED_EVENTS".

The following is the code that calls triggers the auto-refresh:

CREATE OBJECT gui_timer.

SET HANDLER event_handler->on_finished FOR gui_timer.

gui_timer->interval = timeout.

CALL METHOD gui_timer->run.

Is there a setting on SAP console which needs to be turned on for handling the events? Would be thankful for any help.

Thanks

Sunil Achyut

Hello All

I am using the CL_GUI_TIMER to auto-refresh a program every 60 seconds. This works perfect in SAP GUI but when I am trying to test the same in RF and it dumps with the following error:

The termination occurred in the ABAP program "CL_GUI_CONTROL================CP" in "SET_REGISTERED_EVENTS".

The following is the code that calls triggers the auto-refresh:

CREATE OBJECT gui_timer.

SET HANDLER event_handler->on_finished FOR gui_timer.

gui_timer->interval = timeout.

CALL METHOD gui_timer->run.

Is there a setting on SAP console which needs to be turned on for handling the events? Would be thankful for any help.

Thanks

Sunil Achyut

12 REPLIES 12
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,059

This class is dependent on the frontend, meaning the gui. Since it is running thru sapconsole, the gui is being stripped off. Therefore when using the class, it can not reach a gui. You cannot use such classes when running thru sapconsole.

Regards,

Rich Heilman

Read only

0 Likes
2,059

You will need to use another method for doing auto refreshing of the screen.

Regards,

Rich Heilman

Read only

0 Likes
2,059

Here is a different method of autofreshing screens. This example shows how to do it with a list display.

Example program code.



REPORT ZRICH_0010
       no standard page heading.


START-OF-SELECTION.

    CALL FUNCTION 'Z_ENQUE_SLEEP'
             STARTING NEW TASK 'WAIT'
             PERFORMING WHEN_FINISHED ON END OF TASK.
    Write:/ sy-datum, sy-uzeit.


END-OF-SELECTION.

AT USER-COMMAND.
  SY-LSIND = SY-LSIND - 1.
  CALL FUNCTION 'Z_ENQUE_SLEEP'
            STARTING NEW TASK 'INFO'
            PERFORMING WHEN_FINISHED ON END OF TASK.
  Write:/ sy-datum, sy-uzeit.


***********************************************************************
*   WHEN_FINISHED
***********************************************************************
FORM WHEN_FINISHED USING TASKNAME.

* Trigger an event to run the at user-command
  RECEIVE RESULTS FROM FUNCTION 'Z_ENQUE_SLEEP'.
  SET USER-COMMAND 'BUMM'.

ENDFORM.

Function Module Code




FUNCTION Z_ENQUE_SLEEP.

  CALL FUNCTION 'ENQUE_SLEEP'
       EXPORTING
            SECONDS = 1.

ENDFUNCTION.




Regards,

Rich HEilman

Read only

0 Likes
2,059

Hello Rich

Thanks for the quick reply, is there any other way to refresh as time-out is causing a lot of problems for us. I was somewhat relieved when I saw your earlier post and included in my program only to realize it dumps :(.

Thanks

Sunil Achyut

Read only

0 Likes
2,059

Should appreciate your interest, patience, and knowledge in answering queries, as even before I posted reply I got the solution. I did look at that post, I was thinking this is was for lists and thus couldnt use in my screens and also was looking if there was an OO way of doing the same.

Thanks

Sunil Achyut

Message was edited by: Sunil K Achyut

Read only

0 Likes
2,059

Here is an example using a dynpro instead of a list display, you still need the function module.

Create screen 100, add a field of type TIMS and call it SY-UZEIT. Implement the code. You will see a dynpro with the time, and it will increment every second or so.



report zrich_0003 .

data: ok_code type sy-ucomm.

start-of-selection.


  call function 'Z_ENQUE_SLEEP'
     starting new task 'WAIT'
       performing when_finished on end of task.

  call screen 100.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module status_0100 output.
  set pf-status '0100'.
*  SET TITLEBAR 'xxx'.

endmodule.
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module user_command_0100 input.

  case ok_code.
    when 'BACK'.
      clear ok_code.
      leave program.
    when others.
      clear ok_code.
  endcase.

  call function 'Z_ENQUE_SLEEP'
     starting new task 'INFO'
         performing when_finished on end of task.

endmodule.


*---------------------------------------------------------------------*
*       FORM WHEN_FINISHED                                            *
*---------------------------------------------------------------------*
form when_finished using taskname.

* Trigger an event to run the at user-command

  receive results from function 'Z_ENQUE_SLEEP'.

  set user-command 'BUMM'.

endform.

Please remember to award points for helpful answers and mark you post as solved when solved completely. Thanks.

Regards,

Rich Heilman

Read only

0 Likes
2,059

Also, make sure that you function module is Remote Enabled. You can set this on the Attributes tab when creating the function module.

Regards,

RIch Heilman

Read only

0 Likes
2,059

Rich

This solves the problem but, the reason I will not be able to use this is, it takes up 1 dialog process in the application server for the program and in my production environment this might not be a feasible solution. I know I have to make a choice, thanks for your help.

Thanks

Sunil Achyut

Read only

0 Likes
2,059

Oh yea, you are very much correct. Not sure how you are going to achieve this for your rf devices. Just curious, can you please explain the business requirement for auto refresh on the rf device?

Regards,

Rich Heilman

Read only

0 Likes
2,059

We are implementing WM extension set 2.0 which includes cross docking, yard management and TRM. The out-of-box was not flexible enough so we changed (would be good if I say we re-wrote) in the way things are done. The auto-refresh is for loading activity wherein the RF device shows the shipment the user is working on and once confirmed updates serial nos, pgi and also updates yard activities. Because of the timeout they have to log back into RF and there is a manual work that needs to be done by the office people because of timeout. I wanted to eliminate the manual work of the office people. I will show the possible options to them and let them make a decision.

Thanks

Sunil Achyut

Read only

0 Likes
2,059

Sunil, what is this "timeout" that you speakof? Our users let the rf units on 24 hours a day and there is no "timeout". Can you please explain the "timeout" thing. Thanks.

Regards,

Rich Heilman

Read only

0 Likes
2,059

Rich

The timeout is basically the amount of time they can be in the system without doing any activity. Lets say a loader is loading a shipment, since he is busy loading the materials in the trailer he wouldn't do anything on the RF device. Normally loading a shipment is relative to number of units but average time it takes is 30-60 minutes. The SAP policies in our company restrict the idle time to 30 minutes and thus the need for refreshing the screen so that the in-activity doesn't log them out. We pursued the basis option to change the time for RF users without any result.

We are using SAP console with Georgia Soft character based telnet I/O engine. The timeout on telnet session is 60 minutes. But since the SAP logs out after 30 minutes, is there a way we can keep the session active without any activity on the RF device.

Thanks

Sunil Achyut