2009 Jan 06 11:49 AM
Hi Experts,
Is there any standard function module available to create a batch job?
Thanks.
Best Regards,
Wei Shan
2009 Jan 06 11:53 AM
Hi,
use this function module.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = jobname
IMPORTING
jobcount = jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE e888(sabapdocu) WITH 'JOB_OPEN FAILED'.
EXIT.
ENDIF.
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
authcknam = sy-uname
jobcount = jobcount
jobname = jobname
report = program
variant = ''
EXCEPTIONS
bad_priparams = 1
bad_xpgflags = 2
invalid_jobdata = 3
jobname_missing = 4
job_notex = 5
job_submit_failed = 6
lock_failed = 7
program_missing = 8
prog_abap_and_extpg_set = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE e888(sabapdocu) WITH 'JOB_SUBMIT FAILED'.
EXIT.
ENDIF.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = jobcount
jobname = 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
invalid_target = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE e888(sabapdocu) WITH 'JOB_CLOSE FAILED'.
EXIT.
ENDIF.
regards,
Santosh Thorat
There are several FMs available for Jobs..creation scheduling..
Try looking in FunctionGroup BTCH and BTC2 you will find what you need.
2009 Jan 06 11:52 AM
HI.
Iam not sure about this function module. but it may be helpfull to you.
SUBST_START_BATCHJOB
SUBST_SCHEDULE_BATCHJOB
SALP_UI_REPORT_BATCH_JOB
Regards.
Jay
2009 Jan 06 11:53 AM
Hi,
use this function module.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = jobname
IMPORTING
jobcount = jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE e888(sabapdocu) WITH 'JOB_OPEN FAILED'.
EXIT.
ENDIF.
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
authcknam = sy-uname
jobcount = jobcount
jobname = jobname
report = program
variant = ''
EXCEPTIONS
bad_priparams = 1
bad_xpgflags = 2
invalid_jobdata = 3
jobname_missing = 4
job_notex = 5
job_submit_failed = 6
lock_failed = 7
program_missing = 8
prog_abap_and_extpg_set = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE e888(sabapdocu) WITH 'JOB_SUBMIT FAILED'.
EXIT.
ENDIF.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = jobcount
jobname = 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
invalid_target = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE e888(sabapdocu) WITH 'JOB_CLOSE FAILED'.
EXIT.
ENDIF.
regards,
Santosh Thorat
2009 Jan 07 3:58 AM
Hi,
I had used job_open, job_submit and job_close to create batch job and it's working.
Just another question, will i be able to define what data needs to be input into the defined program for job submit instead of using variant?
or, is there any way i can create a variant for the program (in terms of programming)?
thanks.
best regards,
weishan
2009 Jan 06 11:57 AM
2009 Jan 06 11:58 AM
Hi,
Try to use the following fm.
Job_open
submit
job_close
thanks.
2009 Jan 06 11:58 AM
There are several FMs available for Jobs..creation scheduling..
Try looking in FunctionGroup BTCH and BTC2 you will find what you need.
2009 Jan 07 4:25 AM
Hi,
Try with these FMs 'JOB_OPEN'
'JOB_SUBMIT'
'JOB_CLOSE'
You can try with this FM 'BAPI_BATCH_CREATE'.
Regards,
Jyothi CH.
2009 Jan 07 5:38 AM
2009 Jan 07 5:51 AM
Hi,
Use the following steps to craete a batch job :
Create a job using function module JOB-OPEN and collect the job specifications, add a job step to the job with the function module JOB-SUBMIT and then close the job and pass it to Background processing system for execution with the function module JOB-CLOSE.
Tcodes are :-
SM36(Job creation)
SM37(Job selection and execution).
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |