2012 Aug 08 5:09 AM
Hi all,
When i call FM job_close , it return sy-subrc = 5. that is job_nosteps.
So , Why sy-subrc = 5 is coming instead of 0?
My code is :
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_jobcount
jobname = l_jobname
sdlstrtdt = lv_date
sdlstrttm = lv_time
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.
Thanx ,
Satyen Trivedi
Hi all,
When i call FM job_close , it return sy-subrc = 5. that is job_nosteps.
So , Why sy-subrc = 5 is coming instead of 0?
My code is :
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_jobcount
jobname = l_jobname
sdlstrtdt = lv_date
sdlstrttm = lv_time
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.
Thanx ,
Satyen Trivedi
2012 Aug 08 5:21 AM
Maybe you have given a wrong job name or you have not scheduled a job with the correct program(Program name is wrong).
Debug the JOB_CLOSE and see where you are getting the error.
If you are not able to solve, put your code here from JOB_OPEN.
Thanks,
Shambu
2012 Aug 08 5:28 AM
thanx for reply,
My job name is same and my program name is also correct.
In my report , total 12 job created , in that on 3 job is in active state and 9 job is in scheduled state because job_close sy-subrc = 5.
My code is :
CONCATENATE 'Vendor_ledger_' sy-datum '_' sy-uzeit INTO l_jobname .
job_class = 'A'.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = l_jobname
jobclass = job_class
IMPORTING
jobcount = l_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SORT tywt_zvendor BY recodate.
LOOP AT tywt_zvendor INTO wa_zvendor.
IF wa_zvendor-recodate IS INITIAL.
tywt_msg_temp-lifnr = wa_zvendor-lifnr.
tywt_msg_temp-msg = 'Reconciliation Date Not Maintained for the Vendor'.
tywt_msg_temp-flag = 'A'.
APPEND tywt_msg_temp.
CLEAR tywt_msg_temp.
ELSEIF wa_zvendor-recodate > sy-datum.
tywt_msg_temp-lifnr = wa_zvendor-lifnr.
tywt_msg_temp-msg = 'Reconciliation Date Grater than the current date for the Vendor'.
tywt_msg_temp-flag = 'B'.
APPEND tywt_msg_temp.
CLEAR tywt_msg_temp.
ELSE.
AT NEW recodate.
r_burks-sign = 'I'.
r_burks-option = 'EQ'.
r_burks-low = '0101'.
APPEND r_burks.
CLEAR r_burks.
r_datum-sign = 'I'.
r_datum-option = 'BT'.
r_datum-low = wa_zvendor-recodate.
r_datum-high = sy-datum.
APPEND r_datum.
CLEAR r_datum.
ENDAT.
r_lifnr-sign = 'I'.
r_lifnr-option = 'EQ'.
r_lifnr-low = wa_zvendor-lifnr.
APPEND r_lifnr.
CLEAR r_lifnr.
AT END OF recodate.
SUBMIT zrfidpl10_vrmp
WITH kd_lifnr IN r_lifnr
WITH kd_bukrs IN r_burks
WITH b_date IN r_datum
WITH shb_info = 'X'
VIA JOB l_jobname
NUMBER l_jobcount
AND RETURN.
REFRESH : r_lifnr , r_burks , r_datum.
ENDAT.
ENDIF.
ENDLOOP.
IF NOT tywt_msg_temp[] IS INITIAL.
PERFORM write_to_file.
ENDIF.
lv_date = sy-datum. "Added by satyen
lv_time = sy-uzeit + 20. "added by satyen
******Job_close
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_jobcount
jobname = l_jobname
sdlstrtdt = lv_date
sdlstrttm = lv_time
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.
Regards ,
Satyen Trivedi
2012 Aug 08 5:39 AM
Your jobs maybe scheduled because of the unavailibility of free background processes.
2012 Aug 08 5:49 AM
hii shambu,
But every that when i run the report only 3 job is created.
In remaining job status 5 is return.
Can u please tell me what is the job_nostep exception in job_close FM?
When this exception is coming?
2012 Aug 08 6:16 AM
When your job is scheduled, it doesnt have any steps.
When this is the case, FM will give this exception.
You can also go to SM37 and click on Step button for your scheduled job.
Check if you are getting a error.
Thanks,
Shambu
2012 Aug 08 6:22 AM
yes getting error,
This is because of exception 5.
But why this exception is coming ?
2012 Aug 08 6:50 AM
Put a sy-sburc check after the Submit statement to see if the job is correctly scheduled.
Also, try submitting to SAP-SPOOL WITHOUT SPOOL DYNPRO and check if that changes anything.
Thanks,
Shambu
2012 Aug 08 1:29 PM
Don't open job when internal table table tywt_zvendor[] is empty (initial).
Hint: put job open and close in the loop in AT FISRT and AT LAST blocks.
Regards,
Raymond
PS: Please could you close discussion job is scheduled instead of released.
Regards,
Raymond
2012 Aug 08 6:29 AM
Hi sir
check it with sm36 and sm37 job s done is background or not
2012 Aug 08 6:38 AM
Job is created but it is in scheduled status.
and can't change the status manually because of exception.