2016 Oct 07 4:19 AM
Hi,
I am written below code to create a job in background .
Some time job runs successfully and status 'finished', sometime job status 'Scheduled' .
For same user this happens.
We have three instances of application server.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
* DELANFREP = ' '
* JOBGROUP = ' '
JOBNAME = JOBNAME
SDLSTRTDT = DAT
SDLSTRTTM = TIM
* JOBCLASS =
* CHECK_JOBCLASS =
IMPORTING
JOBCOUNT = JOBNUMBER
* INFO =
* CHANGING
* RET =
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4.
SUBMIT ZMM_MIGO_AUTOGR_POST
WITH P_JOBID = SHMRY_NAME
WITH S_ZEILE IN R_ZEILE
AND RETURN
USER SY-UNAME "WF_BATCH_ADMIN "SY-UNAME
VIA JOB JOBNAME NUMBER JOBNUMBER.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = JOBNUMBER
JOBNAME = JOBNAME
SDLSTRTDT = DAT
SDLSTRTTM = TIM
TARGETSYSTEM = SY-HOST
IMPORTING
JOB_WAS_RELEASED = JOB_RELEASED
EXCEPTIONS
INVALID_STARTDATE = 01
JOBNAME_MISSING = 02
JOB_CLOSE_FAILED = 03
JOB_NOSTEPS = 04
JOB_NOTEX = 05
LOCK_FAILED = 06
OTHERS = 99.
2016 Oct 07 5:51 AM
Do you check the exceptions after making the calls to those 2 function modules? That might give you a good clue as to what is going wrong.
2016 Oct 07 6:04 AM
2016 Oct 07 6:33 AM
2016 Oct 07 6:48 AM
Hi Pramoth,
What value are you passing to the following export parameters for JOB_OPEN?
SDLSTRTDT = DAT
SDLSTRTTM = TIM
These are not mandatory, try without using these 2 export variables.
2016 Oct 07 6:57 AM
SDLSTRTDT = DAT
SDLSTRTTM = TIM
I tried without date and time in job_open but , no effect.
Same result.
2016 Oct 07 6:52 AM
Which value do you pass for start date/time, are you sure they are i the future and valid, also did you fully analyzis error message and or authorization (seems you tryed to change the user name in some version of your program?)
Regards,
Raymond
2016 Oct 07 7:01 AM
Hi, Raymond Giuseppi
I am not changing username , I use sy-uname .
I pass sy-datum and sy-uzeit, is it correct or should I add some time ( sy-uzeit + 10 ) future time.
Regards
Pramoth CG
2016 Oct 07 7:03 AM
So you want to schedule the job immediately, don't use those date/time parameters but use
STRTIMMED = 'X' (There are samples in online documentation look at Sample Program: Immediate Start with JOB_CLOSE)
Regards,
Raymond
2016 Oct 07 7:25 AM
2016 Oct 07 7:33 AM
Use the link I already provided for the samples, some line earlier you got a Authorizations for Background Processing chapter, look for Releasing jobs to start. But this is most useful when scheduling with another user profile, I mentioned that due to the WF_BATCH_ADMIN in your source code.
All users can schedule, cancel, delete, and check the status of their own jobs with no additional special authorizations.
Hint: Use SE53 to get failed authorization check or execute an authorization trace with ST01.
Regards,
Raymond