R3_GET_SESSIONS

The R3_GET_SESSIONS script element selects batch input sessions and lists the result in the activation report, or in a file. There is a line for each found SAP job. The structures of the lines in the activation report differ from those in the file. In the activation report, you see the information within a line separated by a semicolon. Additionally, a timestamp and an AE message number are output at the beginning of the line. In a file, you see columns. The first line of the file contains information about the size and content of the columns. The individual lines are split according to these specifications. The first 13 positions contain the name of the relevant batch input session. The following 21 positions include the queue ID. The last 13 positions output the creator of the batch input session (user). By default, created files are stored on the computer on which the agent has been installed (for example, R3_GET_JOB_SPOOL; FILE=).

Tip: You can analyze the results of your selection with script functions.

  • Use PREP_PROCESS_REPORT in the Post Process page to analyze the activation report. For more information, see Process Pages and PREP_PROCESS_REPORT.
  • Use PREP_PROCESS_FILE when the selection result is stored in a file. For more information, see PREP_PROCESS_FILE.

Transaction: SM35
Interface: AE

Syntax

R3_GET_SESSIONS

    NAME=...
    CREDATE_FROM=...
    CREDATE_TO=...
    STATUS=...
    [,FILE=...]
    [,NOFOUND=...]
    [,ORDER_BY=...]

Parameters

  • R3_GET_SESSIONS
    Selects batch input sessions and lists the result in the activation report or a file

  • NAME=
    Selects batch input sessions by name. You can use the "*" and "?" wildcard characters. "*" stands for any character, "?" for exactly one.
    Format: script literal

  • CREDATE_FROM=
    Selects batch input sessions by their date of creation (end date of the selection)
    Format: script literal
    Date format: YYYYMMDD 

  • CREDATE_TO=
    Selects batch input sessions by their date of creation (end date of the selection)
    Format: script literal
    Date format: YYYYMMDD

  • STATUS=
    Selects batch input sessions according to their states
    Format: script literal
    Allowed values:

    • " " (default)
      Selects batch input sessions that are still to be processed

    • R
      Running. Selects batch input sessions that are currently being processed

    • F
      Finished. Selects batch input sessions that have finished processing

    • E
      Error. Selects batch input sessions that resulted in errors during processing

  • FILE=
    (Optional) Name of a file to which the selection results (found batch input session) should be written. You can use this parameter to write the result to a specified file (not to the activation report). There is a line for each located batch input session. The first 13 positions contain the names of the sessions, and the additional 21 positions the queue ID.
    Format: script literal

  • NOFOUND=
    (Optional) Handling if the batch input sessions could not be found
    Format: script literal
    Allowed values:

    • NORMAL (default)
      The script continues, the AE job ends normally

    • ABEND
      The script is aborted, the AE job ends abnormally

  • ORDER_BY=
    (Optional) Use this parameter to sort the batch input sessions according to particular criteria. You can use all field names of the APQI SAP table for this purpose.
    Example:  ORDER_BY=GROUPID

  • 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 batch input sessions that should be processed today and show the name "NI".

:SET &TODAY# = SYS_DATE(YYYYMMDD)
R3_GET_SESSIONS NAME='NI',CREDATE_FROM='&TODAY#',CREDATE_TO='&TODAY#',STATUS=" "

The activation report shows lines the are similar to the following ones:

20220313/135601.000 - U2004943 ;AE_TEST;20220312NI;NI

The second example selects all batch input sessions between 1/1/2015 and 1/1/2022 that resulted in errors while they were processed. The result of the selection is stored in a file.

R3_GET_SESSIONS NAME='*',CREDATE_FROM='20200101',CREDATE_TO='20220101',STATUS='E',FILE='sessions.txt'

The first lines of the file may look as follows:

COL=LENGTH,LENGTH_TAB='13=GROUPID,21=QID,13=CREATOR'
AE_TEST     20220314095728031322 NI           
AE_TEST     20220314095823023148 NI           
AE_TEST     20220314100932031323 NI

See also:

seealso

About SAP JCL