cancel
Showing results for 
Search instead for 
Did you mean: 

autorefresh dynpro with enque_sleep?

Former Member
0 Kudos

Hi there,

i need to build an autorefresh-function for a normal R/3 dynpro application. i found an autorefresher for a report which features the function "ENQUE_SLEEP" and is based on the event AT USER-COMMAND

here goes the main-source

-->

at user-command.

case sy-ucomm.

when 'KICK'.

add 1 to i.

write / i.

subtract 1 from sy-lsind.

call function 'DUMMY'

starting new task 'foo' performing kick on end

of task.

endcase.

  • Coroutines

form kick using taskname.

set user-command 'KICK'.

perform delay using t.

endform.

form delay using t type i.

" delay for t seconds w/o CPU load

call function 'ENQUE_SLEEP'

exporting seconds = t

exceptions system_failure = 01.

endform.

(von http://rohner.com/Abaps/ZEXP_AUTOREFRESH.htm)

--> the program shows a report with counter counting endlessly - the function 'DUMMY' is really a DUMMY and is empty - it's pupose is for the 'starting new task' only.

in the case of a dynpro i have to deal with PBO and PAI.

If it was possible to simulate an AT USER-COMMAND (a PAI sy-ucomm)

I think everything would be fine. Any ideas???

what i tried is to call a function during PBO which calls ENQUE_SLEEP

and after that leaves to transaction 'MYDYNP' all this in background task.

This works but opens a new SAP GUI MODE.

HERE GOES MY BIG QUESTION:

IS THERE A WAY TO AVOID THE OPENING OF A NEW MODE? or

Is there a way to SIMULATE PAI-Stimulus?

Any other ideas welcome, maybe some magic ABAP Object might help?

Thanx a lot for your input,

mk

Accepted Solutions (1)

Accepted Solutions (1)

ralf_rubel
Advisor
Advisor
0 Kudos

Hi mk,

the magic OO solution could look like this:

  • 1) you need an event handler and some global variables

CLASS lcl_event_handler DEFINITION.

PUBLIC SECTION.

CLASS-METHODS: on_finished FOR EVENT finished OF cl_gui_timer.

ENDCLASS. "lcl_event_handler DEFINITION

DATA ti_container TYPE REF TO cl_gui_custom_container.

DATA timer TYPE REF TO cl_gui_timer.

DATA event_handler TYPE REF TO lcl_event_handler.

DATA timeout TYPE i VALUE '20'.

  • 2) Place a container (as small as possible) on your dynpro

  • 3) In PBO of your dynpro, you have to instance the timer control

IF ti_container IS INITIAL.

CREATE OBJECT ti_container

EXPORTING container_name = 'TI_CONTAINER'.

CREATE OBJECT timer EXPORTING parent = ti_container.

SET HANDLER event_handler->on_finished FOR timer.

  • 4) and start your timer

timer->interval = timeout.

CALL METHOD timer->run.

ENDIF.

  • 5) At least you have to react on the event on_finished

CLASS lcl_event_handler IMPLEMENTATION.

METHOD on_finished.

  • Start Timer again

timer->interval = timeout.

CALL METHOD 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

Best regards

Ralf

Former Member
0 Kudos

Superb work, your solution works perfect!!!

Thanx a lot,

matthias kasig

Answers (0)