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

Function Job_Close

Former Member
0 Likes
829

Hi,

I try to use following function:


    CALL FUNCTION 'JOB_CLOSE'
      EXPORTING
        jobcount             = u_f_jobcount
        jobname              = u_f_jobname
        predjob_checkstat    = 'X'
        pred_jobcount        = pred_jobcount
        pred_jobname         = pred_jobname
      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.

But I alway get the exception invalid startdate although I want to start the job after the first job (pred_jobcount and red_jobname) is finished. Is there more parameters which I have to use when I want to start the second job after the first job?

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
683

Look at SAP's sample at [cheduling a Job: Full-Control Method|http://help.sap.com/SAPHELP_NW70/helpdata/EN/fa/096ce5543b11d1898e0000e8322d00/frameset.htm] like [Sample Program: Wait for Predecessor Job with JOB_CLOSE|http://help.sap.com/SAPHELP_NW70/helpdata/EN/fa/096db5543b11d1898e0000e8322d00/frameset.htm] your syntax is correct, so check your values for predecessor job.

Regards,

Raymond

4 REPLIES 4
Read only

RaymondGiuseppi
Active Contributor
0 Likes
684

Look at SAP's sample at [cheduling a Job: Full-Control Method|http://help.sap.com/SAPHELP_NW70/helpdata/EN/fa/096ce5543b11d1898e0000e8322d00/frameset.htm] like [Sample Program: Wait for Predecessor Job with JOB_CLOSE|http://help.sap.com/SAPHELP_NW70/helpdata/EN/fa/096db5543b11d1898e0000e8322d00/frameset.htm] your syntax is correct, so check your values for predecessor job.

Regards,

Raymond

Read only

0 Likes
683

Hi Raymond,

thank you for your answer, I have checked my values and debug the function, What I found is that I have an entry in table TBTCO for my pred_jobname and pred_jobcount, the only difference is that my status in TBTCO is F but in the function he want P or S, but I don't know how he set the status.

Read only

0 Likes
683

I have found the solutions, thank you raymond for the link:

Important: If you specify a predecessor job directly in your

  • program (not interactively chosen), then be sure that the

  • predecessor job has the status Scheduled or Released when

  • you schedule the successor job. Otherwise, the successor

  • scheduling will fail. That is, a job that is active or

  • already completed cannot be specified as a predecessor job.

you have to be sure that the pred_job is not already completed.

Read only

0 Likes
683

Yes the job should not be "finished" else the event END_OF_JOB (hidden behind the predecessor relation) will not be raised. I noticed the same behavior when directly scheduling a job via SM36.

Regard,

Raymond