2009 Mar 12 11:18 PM
I want to schedule and execute a batch job with the start date and time with another program.
In program1 im doing the below.
job_open
getting job_count
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
no_dialog = abap_true
IMPORTING
out_parameters = ls_params
valid = lv_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
SUBMIT (c_test) VIA JOB lv_jobname
NUMBER lv_jobcount
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS ls_params
AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = lv_jobcount
JOBNAME = lv_jobname
LASTSTRTDT = p_sdate
LASTSTRTTM = p_stime
targetserver = lv_targetserver
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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
in the job_closei gave start date and time, but the job is getting scheduled but not to released/cancelled status.
I want the job to happen at that given time and date,
is there anything im missing,
pls help
I want to schedule and execute a batch job with the start date and time with another program.
In program1 im doing the below.
job_open
getting job_count
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
no_dialog = abap_true
IMPORTING
out_parameters = ls_params
valid = lv_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
SUBMIT (c_test) VIA JOB lv_jobname
NUMBER lv_jobcount
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS ls_params
AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = lv_jobcount
JOBNAME = lv_jobname
LASTSTRTDT = p_sdate
LASTSTRTTM = p_stime
targetserver = lv_targetserver
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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
in the job_closei gave start date and time, but the job is getting scheduled but not to released/cancelled status.
I want the job to happen at that given time and date,
is there anything im missing,
pls help
2009 Mar 12 11:30 PM
Maybe you could check the authorizations. In the function module documentation, it says:
The function module returns an indicator as to whether the job was automatically released or not. A job is automatically released to run only if the user who scheduled the job has RELE release authorization for the authorization object Operations on background jobs.
Rugmani
2009 Mar 12 11:37 PM
Rajan,
In the same documentation it says : Note: if a user does not have the authorization to release a job, then the job is scheduled with the status planned.
Now after i run this program , and check SM37, the status is scheduled. so this tells not an authorization issue.
Also i can go and schedule on a given time from SM36.
Now after reading that i also passed the parameter JOB_WAS_RELEASED importing it is geting blank value.
but documentation says, it shud be X if Job is released.
any idea pls....
Niraja
2009 Mar 12 11:50 PM
Niraja,
The only suggestion I have is to debug the job_close function. Within this function, it makes a call to another function 'BP_JOB_MODIFY'. The sy-subrc value of this function is what sets the job status.
You could try debugging this and checking where your code is failing.
Sorry, no other ideas.
Rugmani
2009 Apr 06 8:35 PM
job_close does all, i was giving wrong parameter value
it worked
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |