Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem with Job Close FM

Former Member
0 Likes
3,880

  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

10 REPLIES 10
Read only

Former Member
0 Likes
2,392

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

Read only

0 Likes
2,392

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

Read only

0 Likes
2,392

Your jobs maybe scheduled because of the unavailibility of free background processes.

Read only

0 Likes
2,392

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?

Read only

0 Likes
2,392

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

Read only

0 Likes
2,392

yes getting error,

Definition of job  is incomplete. Operation is not possible

This is because of exception 5.

But why this exception is coming ?

Read only

0 Likes
2,392

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

Read only

0 Likes
2,392

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

Read only

Former Member
0 Likes
2,392

Hi sir

check it with sm36 and sm37 job s done is background or not

Read only

0 Likes
2,392

Job is created but it is in scheduled status.

and can't change the status manually because of exception.