Sample Program: Adding an ABAP Job Step

Use

* 
* Add a job step: ABAP program 
* 
CALL FUNCTION 'JOB_SUBMIT' 
EXPORTING 
AUTHCKNAM = SY-UNAME " Runtime authorizations 
" user
JOBCOUNT = JOBNUMBER " Value from JOB_OPEN
JOBNAME = JOBNAME " Value from JOB_OPEN
REPORT = 'REPORT' " Report to be run
VARIANT = 'VARIANT' " Variant to use with 
" report
PRIPARAMS = USER_PRINT_PARAMS " User printing options
ARCPARAMS = USER_ARC_PARAMS " User archiving options
" Both sets of options 
" come from 
" GET_PRINT_PARAMETERS
EXCEPTIONS 
BAD_PRIPARAMS = 01 
INVALID_JOBDATA = 02 
JOBNAME_MISSING = 03 
JOB_NOTEX = 04 
JOB_SUBMIT_FAILED = 05 
LOCK_FAILED = 06 
PROGRAM_MISSING = 07 
PROG_ABAP_AND_EXTPG_SET = 08 
OTHERS = 99. 

IF SY-SUBRC > 0. 
<Error processing>
ENDIF. 

* Error processing in the event of a non-recoverable error should 
* include a call to BP_JOB_DELETE with FORCEDMODE = 'X' to remove 
* the job from the database. This is required for error 
* processing in all calls after JOB_OPEN. (The background system 
* cleans up automatically in the event of a problem in JOB_OPEN). 
* 

         

More Information