Skip to Content
author's profile photo
Former Member

Background jobs issue

Hi,

I have a program creating two jobs programmamtically(job_open,job_close,job_submit). 2nd job actually triggers a 2nd program submitted as a job in the background using SUBMIT VIA JOBNAME statement.

In the job_close of the 2nd job i have made use of 2 parameters PRED_JOBNAME & PRED_JOBCOUNT assigning jobname & jobcount of the 1st job.

Now,when i execute the 1st prog(main prog).only 1 job is visible thru sm37,but when i use extended job selection(after job criteria) the 2nd job also becums visible with status as <b>Released</b>and no start date ,time.After this the 2nd job never gets processed.This means The Job never gets assigned a work process.

What can be the reason for this?? is it somethin to do with the code.

Answers will be rewarded,

Regards,

Rohan

Message was edited by:

rohan sudan

Add comment
10|10000 characters needed characters exceeded

4 Answers

  • author's profile photo
    Former Member
    Posted on Aug 23, 2007 at 09:30 AM

    Rohan, This could be bcos the second job is dependant on the first job based on the definition you have mentioned. Probably the dependency is being wrongly set and so its not getting trigerred at all...

    Reward points if this reply helps you.

    Balaji

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      But the only dependency that i have given is thru Job_Close params PRED_JOBNAME & PRED_JOBCOUNT.

      Also,

      how can my dependency thru program logic can stop a job from being moved to <b>Released to Active or Complete state</b> ??

  • Posted on Aug 23, 2007 at 11:50 AM

    If the second job is dependent on the 1st job, then use following logic which will let you know the status of 1st job. Once 1st job is completed, call JOB_OPEN of 2nd job.

    • ENDLESS loop till 1st job is completed

    DO.

    CALL FUNCTION 'BP_JOB_READ'

    EXPORTING

    job_read_jobcount = w_jobcount

    job_read_jobname = w_jobname

    job_read_opcode = '20'

    IMPORTING

    job_read_jobhead = wa_jobhead

    TABLES

    job_read_steplist = i_jobsteplist

    EXCEPTIONS

    invalid_opcode = 1

    job_doesnt_exist = 2

    job_doesnt_have_steps = 3

    OTHERS = 4.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    *----


    • To Display the status text as per the status type

    *----


    CASE wa_jobhead-status.

    WHEN 'S'. WRITE: / text-006. "'Scheduled'.

    WHEN 'R'. WRITE: / text-007. "'Released'.

    WHEN 'F'. WRITE: / text-008. "'Completed'.

    WHEN 'A'. WRITE: / text-009. "'Cancelled'.

    WHEN OTHERS.

    ENDCASE.

    IF wa_jobhead-status = 'F'.

    exit.

    ENDIF.

    ENDDO.

    PERFORM OPEN_2nd_JOb.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Prashant,

      I m aware of this logic but wnt it affect the performace of the system...

      I m lookin for a logic which is performance friendly

      Any suggestions or alternative method to the one u mentioned

      Rohan

  • author's profile photo
    Former Member
    Posted on Aug 23, 2007 at 11:58 AM

    do u want to start the 2nd job imediately?

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 23, 2007 at 12:42 PM

    One other option is to set up the second job as an event periodic job, then have a final step in the first job that sets the event via an FM call.

    Just create a specific "Z" event for your job.

    Andrew

    Add comment
    10|10000 characters needed characters exceeded