Skip to Content
avatar image
Former Member

piece of code to be used in report, to make that report to run in backgrnd

Hi,

Can any one can give me the piece of code, which is to be included in report.....so that, particular report can be executed in background?

Harani

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Oct 09, 2007 at 07:46 PM

    HI Harani,

    Welcome to SDN

    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.

    Hope the above helps you.

    ~~Guduri

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 09, 2007 at 07:49 PM

    Hi

    As mentioned above is the correct way of creatign the JOb from your program. For further verification check the program RFEBBU01.

    Thanks

    Lincon

    Add comment
    10|10000 characters needed characters exceeded