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

Wait until background jobs completed

Former Member
0 Likes
3,767

Hi All

I have developed custom program inside and i am calling the standard report in background mode. In program level i need to wait until the background jobs will complete the process. Please confirm how to specify.

In program level i am using

SUBMIT (p_name)

VIA SELECTION-SCREEN

USING SELECTION-SET P_GL_VAR

USING SELECTION-SETS OF PROGRAM c_rfitemgl

TO SAP-SPOOL SPOOL PARAMETERS job_pri_parm

WITHOUT SPOOL DYNPRO

VIA JOB gl_name NUMBER number

AND RETURN.

Any function module available wait until the background jobs completed.

Regards

K.Gunasekar

Edited by: KGUNASEKAR on Aug 6, 2010 11:12 AM

Hi All

I have developed custom program inside and i am calling the standard report in background mode. In program level i need to wait until the background jobs will complete the process. Please confirm how to specify.

In program level i am using

SUBMIT (p_name)

VIA SELECTION-SCREEN

USING SELECTION-SET P_GL_VAR

USING SELECTION-SETS OF PROGRAM c_rfitemgl

TO SAP-SPOOL SPOOL PARAMETERS job_pri_parm

WITHOUT SPOOL DYNPRO

VIA JOB gl_name NUMBER number

AND RETURN.

Any function module available wait until the background jobs completed.

Regards

K.Gunasekar

Edited by: KGUNASEKAR on Aug 6, 2010 11:12 AM

1 REPLY 1
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,616

You can check the FM 'SHOW_JOBSTATE' to check the status of the job.

Try something like this:

SUBMIT (p_name)
VIA SELECTION-SCREEN
USING SELECTION-SET p_gl_var
USING SELECTION-SETS OF PROGRAM c_rfitemgl
TO SAP-SPOOL SPOOL PARAMETERS job_pri_parm
WITHOUT SPOOL DYNPRO
VIA JOB gl_name NUMBER number
AND RETURN.

DO.
  CALL FUNCTION 'SHOW_JOBSTATE'
    EXPORTING
      jobcount         = gl_name
      jobname          = number
    IMPORTING
      finished         = v_fin
    EXCEPTIONS
      jobcount_missing = 1
      jobname_missing  = 2
      job_notex        = 3
      OTHERS           = 4.
  IF sy-subrc = 0.
    CHECK v_fin IS NOT INITIAL.
    EXIT.
  ELSE.
    EXIT.
  ENDIF.

ENDDO.

BR,

Suhas