2009 Nov 18 5:44 AM
Hello,
I want to schedule a background job using Function module.
I have searched on SDN forums for the same, n got some function modules but they are not variant based.
I am providing job name, report name, date , time & variant name to the code.
I want a function module for the same.
Please if anyone can help me out with this?
Regards,
Krutika
2009 Nov 18 6:54 AM
Hi, Try these steps. The details are enough to follow the below step. <li>JOB_OPEN function module is used to create a background job <li>JOB_SUBMIT function module is used to add a job step to a background job that you have opened with JOB_OPEN <li>JOB_CLOSE function module is used to submit a background job to the background processing system for execution Thanks Venkat.O
Hello,
I want to schedule a background job using Function module.
I have searched on SDN forums for the same, n got some function modules but they are not variant based.
I am providing job name, report name, date , time & variant name to the code.
I want a function module for the same.
Please if anyone can help me out with this?
Regards,
Krutika
2009 Nov 18 5:56 AM
Hi,
Check FM JOB_SUBMIT.
You can give variant in this FM.
Regards,
Dhan
2009 Nov 18 6:03 AM
There are no date or time relevent fields in this FM where start date and time can be defined hence it will run immediately by default.
Regards,
Krutika
2009 Nov 18 6:43 AM
Hello Krutika,
You need to use JOB_OPEN, JOB_SUBMIT & JOB_CLOSE.
Also, you can use RS_CREATE_VARIANT for creating dynamic variants.
In JOB_CLOSE you can use following parameters:
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
* AT_OPMODE = ' '
* AT_OPMODE_PERIODIC = ' '
* CALENDAR_ID = ' '
* EVENT_ID = ' '
* EVENT_PARAM = ' '
* EVENT_PERIODIC = ' '
jobcount =
jobname =
* LASTSTRTDT = NO_DATE
* LASTSTRTTM = NO_TIME
* PRDDAYS = 0
* PRDHOURS = 0
* PRDMINS = 0
* PRDMONTHS = 0
* PRDWEEKS = 0
* PREDJOB_CHECKSTAT = ' '
* PRED_JOBCOUNT = ' '
* PRED_JOBNAME = ' '
* SDLSTRTDT = NO_DATE
* SDLSTRTTM = NO_TIME
* STARTDATE_RESTRICTION = BTC_PROCESS_ALWAYS
* STRTIMMED = ' '
* TARGETSYSTEM = ' '
* START_ON_WORKDAY_NOT_BEFORE = SY-DATUM
* START_ON_WORKDAY_NR = 0
* WORKDAY_COUNT_DIRECTION = 0
* RECIPIENT_OBJ =
* TARGETSERVER = ' '
* DONT_RELEASE = ' '
* TARGETGROUP = ' '
* DIRECT_START =
Hope this resolves your issue!
Thanks,
Augustin.
2009 Nov 18 6:02 AM
2009 Nov 18 6:54 AM
Hi, Try these steps. The details are enough to follow the below step. <li>JOB_OPEN function module is used to create a background job <li>JOB_SUBMIT function module is used to add a job step to a background job that you have opened with JOB_OPEN <li>JOB_CLOSE function module is used to submit a background job to the background processing system for execution Thanks Venkat.O
2009 Nov 18 8:48 AM
Dear all,
The problem that i am facing is not of background job scheduling, but that the function module which i am using is not considering the variant name.
As my requirement is scheduling a job with the program variant as given by the user.
The FM that i am using is SUBST_SCHEDULE_BATCHJOB which has a option of variant name. But when the job is scheduled the variant name is not considered.
Kindly help me with the same .....
regards
Krutika
2009 Nov 18 10:44 AM
Hello Krutika,
In that case you can use JOB_SUBMIT.
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
* ARCPARAMS =
authcknam =
* COMMANDNAME = ' '
* OPERATINGSYSTEM = ' '
* EXTPGM_NAME = ' '
* EXTPGM_PARAM = ' '
* EXTPGM_SET_TRACE_ON = ' '
* EXTPGM_STDERR_IN_JOBLOG = 'X'
* EXTPGM_STDOUT_IN_JOBLOG = 'X'
* EXTPGM_SYSTEM = ' '
* EXTPGM_RFCDEST = ' '
* EXTPGM_WAIT_FOR_TERMINATION = 'X'
jobcount =
jobname =
* LANGUAGE = SY-LANGU
* PRIPARAMS = ' '
* REPORT = --------> Provide report name here
* VARIANT = ---------> Provide variant name here
* IMPORTING
* STEP_NUMBER =
* EXCEPTIONS
* BAD_PRIPARAMS = 1
....
.......
I hope this will resolve issue.
Thanks,
Augustin.
2009 Nov 20 8:42 AM
I traied with job_submit, bt its not accepting report name and varient. the job is scheduled with some else report name.
Kindly help.
Is there any other function module?
Regards,
Krutika
2009 Nov 20 9:14 AM
Try this
DATA: number TYPE tbtcjob-jobcount,
name TYPE tbtcjob-jobname VALUE 'JOB_TEST',
print_parameters TYPE pri_params.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT YKRTEST2 TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
USING SELECTION-SET variant "<---Variant
VIA JOB name NUMBER number
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = number
jobname = name
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 <> 0.
ENDIF.
ENDIF.
ENDIF.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |