R3_GET_JOBS

Use the R3_GET_JOBS script element to select background jobs in SAP and list the results either in the activation report or in a file. The selection criteria are assigned in the form of parameters. These parameters comply with the fields of the SAP Dictionary Structure BAPIXMJSEL. Use the dictionary or BAPI Browser for detailed information about the individual fields.

Tip: You can use scripts in the Post Process page to analyze the result of your selection. Use the following script functions:

For example, use R3_GET_JOBS to find scheduled jobs, analyze the output with PREP_PROCESS_FILE, and initiate further actions such as commands or jobs. For more information, see Process Pages

Transaction: SM37
Interface: AE and Standard

Syntax

R3_GET_JOBS

    NAME=...
    [,JOBCOUNT=...]
    [,GROUP=...]
    [,USER=...]
    [,START_D[ATE]=...]
    [,START_T[IME]=...]
    [,END_D[ATE]=...]
    [,END_TIME=...]
    [,NO_DATE=...]
    [,WITH_PRED=...]
    [,EVENT_ID=...]
    [,EVENT_PARM=...]
    [,PRELIM=...]
    [,SCHEDUL=...]
    [,READY=...]
    [,RUNNING=...]
    [,FINISHED=...]
    [,ABORTED=...]
    [,NOFOUND=...]
    [,FILE=...]
    [,ENCODING=...]

Parameters

  • R3_GET_JOBS
    Selects background jobs in SAP and lists the results either in the activation report or in a file

  • NAME=
    Selects one or several intercepted jobs on the basis of their names. Use it together with the JOBCOUNT (SAP job number) parameter to clearly identify a unique SAP job. To select several jobs, you can use the * wildcard character, such as xxx*, for example.
    Format: script literal or AE name

  • JOBCOUNT=
    (Optional) Number of the SAP job
    Use it together with the NAME (SAP job name) parameter to clearly identify a unique SAP job.
    Format: script literal

  • GROUP=
    (Optional) Selects jobs on the basis of groups such as xxx*, for example.
    Format: script literal or AE name
    Default value: "*"

  • USER=
    (Optional) Selects jobs on the basis of a user such as xxx*, for example.
    Format: script literal or AE name
    Default value: "*"

  • START_D[ATE]=
    (Optional) Start date for the selected scheduled jobs.
    Format: script literal or AE name
    Date format: YYYYMMDD
    Default value: 20000101

  • START_T[IME]=
    (Optional) Start time for the selected scheduled jobs.
    Format: script literal or AE name
    Time format: HHMMSS
    Default value: 000000

  • END_D[ATE]=
    (Optional) End date for the selected scheduled jobs.
    Format: script literal or AE name
    Date format: YYYYMMDD
    Default value: current date

  • END_T[IME]=
    (Optional) End time for the selected scheduled jobs.
    Format: script literal AE name
    Time format: HHMMSS
    Default value: 235959

  • NO_DATE=
    (Optional) Applies to jobs that do not have a start date
    Format: script literal or AE name
    Allowed values:

    • "" (default)

    • X

  • WITH_PRED=
    (Optional) Applies to jobs that have the start condition with predecessor
    Format: script literal or AE name
    Allowed values:

    • "" (default)

    • X

  • EVENT_ID=
    (Optional) Can be used with jobs that are linked to an event, it defines the name of the event
    Format: script literal or AE name

  • EVENT_PARM=
    (Optional) Can be used with jobs that are linked to an event, it defines the parameter of the event
    Format: script literal or AE name

  • PRELIM=
    (Optional) Can be used for jobs that are in a scheduled status
    Format: script literal or AE name
    Allowed values:

    • "" (default)

    • X

  • SCHEDUL=
    (Optional) Can be used for jobs that are in a released status
    Format: script literal or AE name
    Allowed values:

    • "" (default)

    • X

  • READY=
    (Optional) Can be used for jobs that are in a ready status
    Format: script literal or AE name
    Allowed values:

    • "" (default)

    • X

  • RUNNING=
    (Optional) Can be used for jobs that are in an active status
    Format: script literal or AE name
    Allowed values:

    • "" (default)

    • X

  • FINISHED=
    (Optional) Can be used for jobs that are in a finished status
    Format: script literal or AE name
    Allowed values:

    • "" (default)

    • X

  • ABORTED=
    (Optional) Can be used for jobs that are in a terminated status
    Format: script literal or AE name
    Allowed values:

    • "" (default)

    • X

  • NOFOUND=
    (Optional) Action that should be taken if no jobs are found
    Format: script literal or AE name
    Allowed values:

    • NORMAL (default)

      Script execution continues, the AE job ends normally

    • ABEND
      Script execution stops, the AE job ends abnormally

  • FILE= 
    (Optional) Name of the file in which the SAP jobs that were found should be stored. By default, this file is stored on the computer on which the agent is installed.
    Format: script literal
    Structure of the file: The file uses columns. The first line of the file contains information about the column sizes and their contents. Each SAP job that is found is written to a separate line. The individual lines are also structured in columns. The first 33 characters of a line contain the respective SAP job name, the other 9 characters its number.

    Note: If you use this parameter, the result of your selection is not written to the activation report. The lines are structured differently in the activation report. The activation report splits all information within a line with semicolon. A timestamp and an AE message number is additionally shown at the beginning of the line. For details, see the examples below.

  • ENCODING=

  • (Optional) Encoding that should be used for the generated output file (FILE= parameter).

    Example: UTF-8

    Default value: ISO-8859-1

    When you specify an encoding format that is not supported or invalid, the job aborts with an error message.

    The SAP Forms provide an input assistant for this field which lists all the supported encoding formats.

Examples

The first example selects all scheduled SAP jobs that start with REL.

R3_GET_JOBS NAME="REL*",PRELIM="X"

The result is written to the activation reportbecause the FILE= parameter is not used:

20200922/134303.567 - U2004943 ;RELEASE;13450801
20200922/134303.567 - U2004943 ;RELEASE;13455501
20200922/134303.567 - U2004943 ;RELEASE;16221501
20200922/134303.567 - U2004943 ;RELEASE;16225101
20200922/134303.567 - U2004943 ;RELEASE;16234801

The second example selects all SAP jobs that have the name EU_REORG and are in a finished status. The selection result should be stored in a file.

R3_GET_JOBS NAME='EU_REORG',FINISHED='X',FILE='jobs.txt'

These are the first lines of the file:

COL=LENGTH,LENGTH_TAB='33=JOBNAME,9=JOBCOUNT'
EU_REORG                         01404301
EU_REORG                         01405401

See also:

seealso

About SAP JCL