02-14-2007 12:45 PM
Hello all
I m creating a program to delete old entries from tables.This can be done
1. Foreground
2. Background
I have created 2 reports
Report A - MAin report
Report B -has the following stmts
REPORT b.
DATA: i_JOBCOUNT LIKE TBTCJOB-JOBCOUNT,
i _JOBNAME LIKE TBTCJOB-JOBNAME .
SUBMIT A AND RETURN
USER SY-UNAME
VIA JOB I_JOBNAME NUMBER I_JOBCOUNT
.
In the background option of report A I have used
job_open with jobname as Report A.
Submit B
user sy-uname
via jobname jobnumber
and return.
Job_close
with jobname, jobnumbr and start immediately = 'x'.
Now when I execute this pgm with foreground option,
I get the records deleted from the table
but the same does not happen in background option.
kindly guide me.
Thanks
Tharani
02-14-2007 12:50 PM
Hi
Why don't you run the report A directly in background mode?
Anyway your report should be:
va_jobname = <REPORT B>
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = VA_JOBNAME
IMPORTING
JOBCOUNT = VN_JOBCOUNT
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4.
IF SY-SUBRC = 0.
SUBMIT <REPORT A> USER SY-UNAME
VIA JOB VA_JOBNAME NUMBER VN_JOBCOUNT
AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = VN_JOBCOUNT
JOBNAME = VA_JOBNAME
STRTIMMED = 'X'
EXCEPTIONS
CANT_START_IMMEDIATE = 1
INVALID_STARTDATE = 2
JOBNAME_MISSING = 3
JOB_CLOSE_FAILED = 4
JOB_NOSTEPS = 5
JOB_NOTEX = 6
LOCK_FAILED = 7
OTHERS = 8.
IF SY-SUBRC NE 0.
MESSAGE E999 WITH TEXT-E05.
ENDIF.
ENDIF.
Max
02-14-2007 12:56 PM
Hi max
I believe that would call report A recursively.
Thanks Tharani
02-14-2007 12:58 PM
02-14-2007 1:04 PM
Hi,
Why do you need 2 programs ? Same program can run both in Foreground & Background. Please explain your question in detail.
Regards,
Mukul
02-14-2007 1:21 PM