Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Scheduling periodic background job by job_close .

Hi Folks ,

I have a critical situation , I have schedule a background job by function module Job_Open , submit and Job_close .

its working fyn when I schedule the program and the cursor is moving in every part of the program and a small mail program send a message the perfect data .

But when I wait and watch for the schedule job I really shocked . after completion of schedule job , correct data is not coming  means cursor is not move into submit statement  and wrong mail generated . But After finishing of job , I had debug the program through sm37 through tcode JDBG , its showing correct movement of submit statement . I am not getting what the mistake I did .Please help me with solution , which work like sm36 background job .

My code is

CALL FUNCTION 'JOB_OPEN'

       EXPORTING

         JOBNAME  = D_JOBNAME

       IMPORTING

         JOBCOUNT = D_JOB_COUNT.


SUBMIT YOS

           VIA JOB D_JOBNAME

           NUMBER D_JOB_COUNT

           WITH PLANT    IN I_WERKS

           WITH DEPOTS   IN I_VKBUR

           WITH MATERIAL IN I_MATNR

           WITH CUSTOMER IN I_KUNNR

           WITH PRCTR    IN I_PRCTR

           WITH DATE     IN I_DATE

           WITH RB       EQ P_RB

           WITH RP       EQ P_RP

           WITH CHSUM1   EQ P_CHSUM1

           WITH RDOM     EQ P_RDOM

           AND RETURN.

     SUBMIT Y_EX_POS

           VIA JOB D_JOBNAME

           NUMBER D_JOB_COUNT

           WITH PLANT    IN I_WERKS

           WITH MATERIAL IN I_MATNR

           WITH CUSTOMER IN I_KUNNR

           WITH DATE     IN I_DATE

           WITH RB       EQ P_RB

           WITH RP       EQ P_RP

           WITH CHSUM    EQ P_CHSUM1

           AND RETURN.

     SUBMIT ZSTOCK

           VIA JOB D_JOBNAME

           NUMBER D_JOB_COUNT

           WITH I_WERKS  IN I_WERKS

           WITH I_VKBUR  IN I_VKBUR

           WITH I_MATNR  IN I_MATNR

           WITH I_KUNNR  IN I_KUNNR

           WITH I_PRCTR  IN I_PRCTR

           WITH I_DATE   IN I_DATE

           WITH P_RB     EQ P_RB

           WITH P_RP     EQ P_RP

           WITH P_CHSUM1 EQ P_CHSUM1

           WITH P_RDOM   EQ P_RDOM

           WITH P_CHSUM1 EQ P_CHSUM1

           WITH P_CHSUM2 EQ P_CHSUM2

           WITH P_CHSUM3 EQ P_CHSUM3

           WITH MAILID   IN MAILID

           WITH P_BCK    EQ P_BCK

           AND RETURN.


     CALL FUNCTION 'JOB_CLOSE'

       EXPORTING

         JOBNAME              = D_JOBNAME

         JOBCOUNT             = D_JOB_COUNT

*        STRTIMMED            = 'X'

         SDLSTRTDT            = DATE

         SDLSTRTTM            = TIME

        PRDDAYS              = DAYS  "For periodic job .

       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.

     CLEAR V_FLAG .

     MESSAGE S001(ZMAPAS) WITH D_JOBNAME.



Joy .

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question