‎2005 Sep 13 3:10 PM
Hi ABAP-ers,
how can I enable some dynpro to be event driven and that is refreshing it self after some time. For exmple, I have transaction that monitors some Jobs in system and if I need to see what happens right now, I need to press F5. So question is, can system in this case refresh it self after every 5 secs?
Thx
Mario
‎2005 Sep 13 3:15 PM
THere are some solutions in the net suggesting to use a call to a FM in new task in combination with a wait command - but this means that all the time a process is blocked (although it does nothing but wait or sleep)
I prefer the solution with CL_GUI_TIMER (I think there is a weblog from Thomas Jung)
Christian
check that link:
Message was edited by: Christian Finkbeiner
‎2005 Sep 13 3:15 PM
If this is your own transaction, then introduce a loop at the refresh process. Just before the endloop, introduce a 'wait up to n seconds'. To avoid an infinite loop, introduce some kind of exit, may be a key when pressed you come out of the loop. You may need SAPGUI_PROGRESS_INDICATOR call inside to avoid timeout.
Regards,
Srinivas
‎2005 Sep 15 8:07 AM
Thanks all,
this sample of code work just fine for me:
****TOP
data: lcl_max_time type SY-INDEX value '5',
lcl_timer type ref to CL_GUI_TIMER,
lcl_container TYPE REF TO cl_gui_custom_container.
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: on_finished FOR EVENT finished OF cl_gui_timer.
ENDCLASS. "lcl_event_handler DEFINITION
CLASS lcl_event_handler IMPLEMENTATION.
METHOD on_finished.
Start Timer again
lcl_timer->interval = lcl_max_time .
CALL METHOD lcl_timer->run.
cause PAI
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'REFR'.
ENDMETHOD. "on_finished
ENDCLASS. "lcl_event_handler IMPLEMENTATION
DATA event_handler TYPE REF TO lcl_event_handler.
PBO
create the thinies container just because of timer
kreirati mali container samo radi timer-a
if lcl_timer is initial.
CREATE OBJECT lcl_container
EXPORTING container_name = 'LCL_CONTAINER'.
CREATE OBJECT lcl_timer EXPORTING parent = lcl_container.
create object event_handler.
SET HANDLER event_handler->on_finished FOR lcl_timer.
lcl_timer->interval = lcl_max_time.
CALL METHOD lcl_timer->run.
ENDIF.
What do you think about this sample of code?
Thx for help
Mario