Skip to Content
author's profile photo Former Member
Former Member

Regarding : back ground jobs

Hi,

Please let me know , in how many ways we can shedule a program as a background job, and how we pass variants to the job.

Thanks in advance

jogu

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Nov 22, 2007 at 09:11 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 22, 2007 at 09:16 AM

    hi,

    There are two ways for you to handle,

    one manually setting up the job through SM36 which is better and convinient,

    secondly through program using FM's JOB_OPEN, SUBMIT, JOB_CLOSE.

    Find below steps in doing both:

    Procedure 1:

    1. Goto Trans -> SM36

    2. Define a job with the program and variant if any

    3. Click on start condition in application tool bar

    4. In the pop-up window, click on Date/Time

    5. Below you can see a check box "Periodic Job"

    6. Next click on Period Values

    7. Select "Other Period"

    8. Now give '15' for Minutes

    9. Save the job

    In SM37 u can check the status of the jobs that u have assigned to background...

    Here u mention the job name or the report name to check the status of the job...

    After mentioning the job name or program name u just execute it.. ( without any name also u can execute then it gives u all the jobs set by your user name..

    the status colud be released,active,finished etc..

    Procedure 2 via Program:

    Below is a sample code for the same. Note the ZTEMP2 is the program i am scheduling with 15mins frequency.

    DATA: P_JOBCNT LIKE TBTCJOB-JOBCOUNT,

    L_RELEASE(1) TYPE c.

    CALL FUNCTION 'JOB_OPEN'

    EXPORTING

    JOBNAME = 'ZTEMP2'

    IMPORTING

    JOBCOUNT = P_JOBCNT

    EXCEPTIONS

    CANT_CREATE_JOB = 1

    INVALID_JOB_DATA = 2

    JOBNAME_MISSING = 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.

    SUBMIT ZTEMP2 VIA JOB 'ZTEMP2' NUMBER P_JOBCNT

    TO SAP-SPOOL WITHOUT SPOOL DYNPRO

    WITH DESTINATION = 'HPMISPRT'

    WITH IMMEDIATELY = SPACE

    WITH KEEP_IN_SPOOL = 'X' AND RETURN.

    CALL FUNCTION 'JOB_CLOSE'

    EXPORTING

    JOBCOUNT = P_JOBCNT

    JOBNAME = 'ZTEMP2'

    STRTIMMED = 'X'

    PRDMINS = 15

    IMPORTING

    JOB_WAS_RELEASED = L_RELEASE

    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.

    http://help.sap.com/saphelp_bw30b/helpdata/en/c4/3a7f87505211d189550000e829fbbd/content.htm

    <b>Reward if usefull</b>

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.