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

Call the same program via job

Hi,

I have a requiremnt such that in program A based on some condition i want to call it again after certain intervals,, is it possible thru jobs??

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jul 25, 2008 at 04:34 AM

    Hi,

    It is possible....

    Refer to Below Code:-

    DATA: number TYPE tbtcjob-jobcount,

    name TYPE tbtcjob-jobname VALUE 'JOB_TEST',

    print_parameters TYPE pri_params.

    ...

    CALL FUNCTION 'JOB_OPEN'

    EXPORTING

    jobname = name

    IMPORTING

    jobcount = number

    EXCEPTIONS

    cant_create_job = 1

    invalid_job_data = 2

    jobname_missing = 3

    OTHERS = 4.

    IF sy-subrc = 0.

    SUBMIT submitable TO SAP-SPOOL

    SPOOL PARAMETERS print_parameters

    WITHOUT SPOOL DYNPRO

    VIA JOB name NUMBER number

    AND RETURN.

    IF sy-subrc = 0.

    CALL FUNCTION 'JOB_CLOSE'

    EXPORTING

    jobcount = number

    jobname = name

    strtimmed = 'X'

    EXCEPTIONS

    cant_start_immediate = 1

    invalid_startdate = 2

    jobname_missing = 3

    job_close_failed = 4

    job_nosteps = 5

    job_notex = 6

    lock_failed = 7

    OTHERS = 8.

    IF sy-subrc <> 0.

    ...

    ENDIF.

    ENDIF.

    ENDIF.

    you can take help for SAP help.

    Make sure to check Sy-batch for background jobs

    and also put proper logic to terminate your program execution, otherwise your program will go in endless loop.

    Regards,

    Nikhil

    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.