R3_GET_JOBS

Use the R3_GET_JOBS script element to select background jobs in SAP and list the results in the activation report or in a file. Selection criteria are assigned as parameters, which correspond to the fields of the SAP Dictionary Structure BAPIXMJSEL. Use the SAP Dictionary or BAPI Browser for detailed information about individual fields.

Tip: Use scripts on the Post Process page to analyze the selection results. Use PREP_PROCESS_REPORT to analyze the activation report, or PREP_PROCESS_FILE if the selection result was saved to a file. 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.

More information:

Transaction: SM37

Interface: AE and Standard

Syntax

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

Parameters

Parameter Description Format Allowed Values Default Value
NAME= Selects one or more jobs by name. Use together with JOBCOUNT= to uniquely identify a specific SAP job. Wildcard characters such as xxx* are supported. Script literal or AE name n.a. n.a.
JOBCOUNT=

(Optional)

SAP job number. Use together with NAME= to uniquely identify a specific SAP job. Script literal n.a. n.a.
GROUP=

(Optional)

Selects jobs by group. Wildcard characters such as xxx* are supported. Script literal or AE name n.a. *
USER=

(Optional)

Selects jobs by user. Wildcard characters such as xxx* are supported. Script literal or AE name n.a. *
START_D[ATE]=

(Optional)

Start date for selecting scheduled jobs Script literal or AE name n.a. 20000101 (YYYYMMDD)
START_T[IME]=

(Optional)

Start time for selecting scheduled jobs Script literal or AE name n.a. 000000 (HHMMSS)
END_D[ATE]=

(Optional)

End date for selecting scheduled jobs Script literal or AE name n.a. Current date (YYYYMMDD)
END_T[IME]=

(Optional)

End time for selecting scheduled jobs Script literal or AE name n.a. 235959 (HHMMSS)
NO_DATE=

(Optional)

Selects jobs that do not have a start date Script literal or AE name
  • "" — Not selected
  • X — Selected
""
WITH_PRED=

(Optional)

Selects jobs with the start condition with predecessor Script literal or AE name
  • "" — Not selected
  • X — Selected
""
EVENT_ID=

(Optional)

Selects jobs linked to a specific event by event name Script literal or AE name n.a. n.a.
EVENT_PARM=

(Optional)

Selects jobs linked to a specific event by event parameter Script literal or AE name n.a. n.a.
PRELIM=

(Optional)

Selects jobs with a scheduled status Script literal or AE name
  • "" — Not selected
  • X — Selected
""
SCHEDUL=

(Optional)

Selects jobs with a released status Script literal or AE name
  • "" — Not selected
  • X — Selected
""
READY=

(Optional)

Selects jobs with a ready status Script literal or AE name
  • "" — Not selected
  • X — Selected
""
RUNNING=

(Optional)

Selects jobs with an active status Script literal or AE name
  • "" — Not selected
  • X — Selected
""
FINISHED=

(Optional)

Selects jobs with a finished status Script literal or AE name
  • "" — Not selected
  • X — Selected
""
ABORTED=

(Optional)

Selects jobs with a terminated status Script literal or AE name
  • "" — Not selected
  • X — Selected
""
NOFOUND=

(Optional)

Handling if no jobs are found Script literal or AE name
  • NORMAL — Script execution continues; the AE job ends normally
  • ABEND — Script execution stops; the AE job ends abnormally
NORMAL
FILE=

(Optional)

Full path and name of the file in which the found SAP jobs are stored. By default, the file is stored on the computer where the agent is installed. When this parameter is specified, the selection result is not written to the activation report.

Note: The file uses fixed-width columns. The first line contains column size and content information. Each found SAP job is written to a separate line: the first 33 characters contain the job name, the next 9 characters contain the job number.
In the activation report (when FILE= is not used), lines are delimited by semicolons and include a timestamp and an AE message number at the beginning.

Script literal n.a. n.a.
ENCODING=

(Optional)

(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.

n.a. n.a. ISO-8859-1

Examples

The following example selects all scheduled SAP jobs whose names start with REL. Because FILE= is not specified, the result is written to the activation report.

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

The activation report output looks like this:

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 following example selects all SAP jobs named EU_REORG with a finished status and saves the result to a file.

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

The first lines of the output file look like this:

COL=LENGTH,LENGTH_TAB='33=JOBNAME,9=JOBCOUNT'

EU_REORG                         01404301

EU_REORG                         01405401

See also: