05-07-2008 11:22 AM
HI
I have a report in which i have to call the same report using SUBMIT statement as a background process. can anyone help me?
Regards
Aditya
05-07-2008 10:30 PM
Here is a code fragment that I used for a report to force the execution in background (even when users don't select background process). It has a selection screen and stuff but when the users attemt to run it in the foreground, it just schedules itself in a background job. When it runs in the background job (sy-batch = 'X'), then the main code is executed.
START-OF-SELECTION.
IF sy-batch IS INITIAL.
* Open a job
jobname = sy-repid.
CLEAR jobcount.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = jobname
IMPORTING
jobcount = jobcount.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
SUBMIT <your program name here>
WITH ...
VIA JOB jobname
NUMBER jobcount
AND RETURN.
* Close the job and run immediately
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = jobcount
jobname = jobname
strtimmed = 'X'. " Start immediately
IF sy-subrc = 0.
MESSAGE 'Job started' type 'I'.
ELSE.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE.
" do all stuff here
ENDIF.
05-07-2008 11:30 PM
05-12-2008 10:31 AM
05-12-2008 2:20 PM
What exactly did not work and how did you solve the problem then?
Thank you.