Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Batch Job Creation

Former Member
0 Likes
731

Hi all,

i have a requirement where i need to create Background Job for a program when another program is being executed.

Can some one tell me any Function modules for the same along with parameters.

Regards,

AJ

1 ACCEPTED SOLUTION
Read only

former_member761936
Active Participant
0 Likes
696

>

> Hi all,

>

> i have a requirement where i need to create Background Job for a program when another program is being executed.

> Can some one tell me any Function modules for the same along with parameters.

>

> Regards,

> AJ

Hi Anurag,

Yes, you can do it.

follow the bellow example



CALL FUNCTION 'JOB_OPEN'
         EXPORTING
              JOBNAME          = 'GCERTS'
        IMPORTING
             JOBCOUNT          = JOBCOUNT
        EXCEPTIONS
             CANT_CREATE_JOB  = 1
             INVALID_JOB_DATA = 2
             JOBNAME_MISSING  = 3
             OTHERS           = 4.

    IF SY-SUBRC <> 0.
      MESSAGE E050 WITH TEXT-024.
    ENDIF.


    SUBMIT RSBDCSUB AND RETURN
                    USER SY-UNAME
                    VIA  JOB 'GCERTS' NUMBER JOBCOUNT
                    WITH MAPPE    = 'GCERTS'
                    WITH VON      = SY-DATUM
                    WITH BIS      = SY-DATUM
                    WITH Z_VERARB = 'X'.

    CLEAR JOB_RELEASED.
    CALL FUNCTION 'JOB_CLOSE'
         EXPORTING
              JOBCOUNT                    = JOBCOUNT
              JOBNAME                     = 'GCERTS'
              STRTIMMED                   = 'X'
         IMPORTING
              JOB_WAS_RELEASED            = JOB_RELEASED
         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.


Here first we need to open the job first and then submit your program through that job to schedule for particular date and time

and after words close job.It will run the Job when it reaches that particular date and time

5 REPLIES 5
Read only

former_member761936
Active Participant
0 Likes
697

>

> Hi all,

>

> i have a requirement where i need to create Background Job for a program when another program is being executed.

> Can some one tell me any Function modules for the same along with parameters.

>

> Regards,

> AJ

Hi Anurag,

Yes, you can do it.

follow the bellow example



CALL FUNCTION 'JOB_OPEN'
         EXPORTING
              JOBNAME          = 'GCERTS'
        IMPORTING
             JOBCOUNT          = JOBCOUNT
        EXCEPTIONS
             CANT_CREATE_JOB  = 1
             INVALID_JOB_DATA = 2
             JOBNAME_MISSING  = 3
             OTHERS           = 4.

    IF SY-SUBRC <> 0.
      MESSAGE E050 WITH TEXT-024.
    ENDIF.


    SUBMIT RSBDCSUB AND RETURN
                    USER SY-UNAME
                    VIA  JOB 'GCERTS' NUMBER JOBCOUNT
                    WITH MAPPE    = 'GCERTS'
                    WITH VON      = SY-DATUM
                    WITH BIS      = SY-DATUM
                    WITH Z_VERARB = 'X'.

    CLEAR JOB_RELEASED.
    CALL FUNCTION 'JOB_CLOSE'
         EXPORTING
              JOBCOUNT                    = JOBCOUNT
              JOBNAME                     = 'GCERTS'
              STRTIMMED                   = 'X'
         IMPORTING
              JOB_WAS_RELEASED            = JOB_RELEASED
         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.


Here first we need to open the job first and then submit your program through that job to schedule for particular date and time

and after words close job.It will run the Job when it reaches that particular date and time

Read only

0 Likes
696

Hi Soma,

I have gone through ur reply but in SUBMIT i didnt get the significant of

WITH MAPPE = 'GCERTS'

WITH VON = SY-DATUM

WITH BIS = SY-DATUM

WITH Z_VERARB = 'X'.

Can you please explain ...

Best regards Dev

Read only

Former Member
0 Likes
696

Hi,

You can use the function module SUBST_SCHEDULE_GENERATOR to schedule a background job.


CALL FUNCTION 'SUBST_SCHEDULE_GENERATOR'
 EXPORTING
   JOBNAME            = 'Z_TEST_JOB'
   REPNAME            = 'Z_TEST_PROG'
   VARNAME            = 'Z_VAR1'
*   AUTHCKNAM          = 'DDIC'
*   BATCHHOST          = ' '
*   LANGUAGE           = SY-LANGU
*   PRIPARAMS          = ' '
*   IV_SCHEDEVER       = ' '
*   PARAM              = 0
*   SDLSTRTDT          = '         '
*   SDLSTRTTM          = '        '
*   STRTIMMED          = 'X'
* IMPORTING
*   JOBCOUNT           =
*   RC_START           =
* TABLES
*   SELTAB             = .

This will instantly start the background job for this program. In case you want to give a start date and time, you can mention the same in the parameter SDLSTRTDT and SDLSTRTTM.

Reward points if helpful.

Biswa...

Read only

0 Likes
696

Thnks for the useful response.

Anyways, The FM specified was not working in my case.

Regards,

AJ

Read only

Former Member
0 Likes
696

Hi,

Use function modules(Job_open,Job_submit and job_close).

Use submit command for scheduling like below.

SUBMIT RSBDCSUB AND RETURN

USER SY-UNAME

VIA JOB 'GCERTS' NUMBER JOBCOUNT

WITH MAPPE = 'GCERTS'

WITH VON = SY-DATUM

WITH BIS = SY-DATUM

WITH Z_VERARB = 'X'.

Regards,

mani