Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Guidance for using Z_ENQUE_SLEEP logic for my program

Hi Experts,

I have a Classic report program with a selection screen where the user enters the userid and date and based on these values, the program accesses some db tables and fetches results.

I want to refresh these results automatically without user intervention.

Can I make use of the program below for my purpose(courtesy: Rich Heilman)

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.

*********************************************************

My program currently is like this:

  • TABLES DECLARATION

----


tables: zsel_param.

  • INTERNAL TABLE DECLARATIONS

----


data: itab_sel type zsel_param occurs 0 with header line.

data: itab_sel1 type zsel_param occurs 0 with header line.

types: begin of z_stlog,

type like rspcprocesslog-type,

state like rspcprocesslog-state,

end of z_stlog.

data: zprocesslog type z_stlog occurs 0 with header line.

----


  • PROGRAM VARIABLE DECLARATIONS

----


DATA:

v_userid LIKE sy-uname,

v_date like sy-datum.

data: l_t_msg TYPE BAL_S_MSG.

data: zchg_time like sy-uzeit,

zchg_time1 like sy-uzeit.

data: z_jbcount like tbtco-jobcount,

zlogid like rspcprocesslog-log_id.

data: zstatus like rspcprocesslog-state,

zstatus1 like rspcprocesslog-state.

----


  • SELECTION SCREEN DECLARATIONS

----


SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME.

PARAMETER: userid LIKE sy-uname obligatory,

date like sy-datum obligatory.

SELECTION-SCREEN END OF BLOCK 1.

  • AT SELECTION-SCREEN ON VALUE-REQUEST EVENT

----


START-OF-SELECTION.

v_userid = userid.

v_date = date.

PERFORM success_or_fail USING userid date.

END-OF-SELECTION.

Form Success_or_fail actually does the entire table processing and displays results.

Tags:
replied

Yes, just put your PERFORM call where you see the WRITE statements in my program.


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.
<b>*Write:/ sy-datum, sy-uzeit.
v_userid = userid.
v_date = date.
PERFORM success_or_fail USING userid date.</b>

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.
<b>*Write:/ sy-datum, sy-uzeit.
v_userid = userid.
v_date = date.
PERFORM success_or_fail USING userid date.</b>
PERFORM 

Regards,

Rich Heilman

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question