Application Development 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: 

Refresh Screen functionality

Former Member
0 Kudos

Hi Friends,

I have a report program that has a selection screen. When the user enters his selections and clicks on execute button, the program displays results on another screen. Currently, the user has to go back to the previous screen and enter his selections again in order

to get the latest results (Refresh results)

/people/rich.heilman2/blog/2005/10/18/a-look-at-clguitimer-in-46c

Can I use the auto refresh functionality mentioned in your weblog for my program? If yes, How can I do that?

Also I would like to mention that I am in SAP BW environment.

Thank you for your help

Deepthi

3 REPLIES 3

Former Member
0 Kudos

Deepthi,

I am guessing that what you have is an ALV REPORT. If you are talking about CLASSICAL report, then REFRESH will be difficult unless you go back and come.

If using ALV:

For AUTO REFRESH, yes you can implement the code Rich's blog.

You can even provide a REFRESH button on the toolbar, and when user hits that, get the data again update the internal table and call the REFRESH_TABLE_DISPLAY method of the grid.

Regards,

Ravi

NOTE : Please mark all the helpful answers

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Please see this sample program, it uses the class CL_GUI_TIMER. Make sure to check that you system has this class.



report zrich_0002 no standard page heading.

*---------------------------------------------------------------------*
*       CLASS lcl_event_handler DEFINITION
*---------------------------------------------------------------------*
class lcl_event_handler definition.

  public section.

    class-methods: on_finished for event finished of lcl_gui_timer.

endclass.


data: gui_timer type ref to cl_gui_timer.
data: event_handler type ref to lcl_event_handler.
data: timeout type i value '2'.

parameters : p_check type c.


start-of-selection.

  create object gui_timer.

  set handler event_handler->on_finished for gui_timer.

  gui_timer->interval = timeout.
  call method gui_timer->run.

  perform write_list.


at user-command.

  case sy-ucomm.
    when 'REFR'.
      sy-lsind = sy-lsind - 1.
      perform write_list.
  endcase.

*----------------------------------------------------
* FORM  write_list
*----------------------------------------------------
form write_list.

  write:/ sy-datum, sy-uzeit.

endform.

*---------------------------------------------------------------------*
*       CLASS lcl_event_handler IMPLEMENTATION
*---------------------------------------------------------------------*
class lcl_event_handler implementation.

  method on_finished.

* Start Timer again
    gui_timer->interval = timeout.
    call method gui_timer->run.

* cause PAI
    call method cl_gui_cfw=>set_new_ok_code
          exporting
                 new_code = 'REFR'.

  endmethod.


This sample program has selection screen and when user runs it will display the date and time, every two seconds the list display is refreshed automatically.

Regards,

RIch Heilman

Former Member
0 Kudos

I implemented this code and the ALV report refreshes every few seconds as coded. After about 7 refreshes I get the 'Maximum internal sessions reached' error message and the refresh stops.

Can somebody help me to explain or solve this problem?

Thanks in advance

Dhaval