Automation Engine Script Guide > AE JCL for Applications > SAP > R3_GET_SESSIONS

R3_GET_SESSIONS

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

Transaction: SM35

Interface: AE

Syntax

R3_GET_SESSIONS

Syntax

Description/Format

NAME= 

Selection of batch input sessions by name.
Format: script literal

The wildcard characters "*" and "?" can be used. "*" stands for any character, "?" for exactly one. 

CREDATE_FROM= 

Selection of batch input sessions by their date of creation (Start date of the selection).
Format: Scrip literal
Date format: YYYYMMDD 

CREDATE_TO= 

Selection of batch input sessions by their date of creation (End date of the selection).
Format: script literal
Date format: YYYYMMDD 

STATUS= 

Selection of batch input sessions by their status.
Format: script literal

Allowed values: " " (default value), "R", "F" and "E"

" " - Batch input sessions that are still to be processed.
"R" - Batch input sessions that are currently being processed (Running).
"F" - Batch input sessions that have finished processing (Finished).
"E" - Batch input sessions that resulted in errors during processing (Error).

FILE= 

Name of a file to which the selection results (found batch input session) should be written.
Format: script literal

This parameter can be used 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.

NOFOUND=

Handling if the batch input sessions have not been found.
Value format: script literal

Allowed values: "NORMAL" (default value) and "ABEND" 

"NORMAL" - The script continues, the AE job ends normally.
"ABEND" - The script is aborted, the AE job ends abnormally.

ORDER_BY=

Criterion according to which selected sessions are sorted. All field names of the SAP table APQI can be used. For example:  ORDER_BY=GROUPID

This parameter is available for SAP versions 4.6 and later.

ENCODING=

Encoding for the generated output file (Parameter FILE=).

For example: UTF-8

Default value: ISO-8859-1

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

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

Description

The result of the selection is either written to an activation report or to a file. There is a line for each located SAP job. Structures of the lines in the activation report differ from those in the file. 

Columns are used in the file. The first line of the file contains information about the size and content of the columns. The individual lines are divided according to these specifications. The first 13 positions contain the name of the respective batch input session, the next 21 contain the queue ID - and in the last 13, the creator of the batch input session (user) is output.

The parameter ORDER_BY can be used to sort the selected batch input sessions according to particular criteria.

In the activation report, the information within a line is separated with a semicolon. Additionally, a time stamp and AE Message number are output at the beginning of the line.

The result of the selection can be analyzed using script functions. In the Post Process tab, PREP_PROCESS_REPORT can be used to analyze the activation report. PREP_PROCESS_FILE can be used when the selection result was saved in a file.

With Automation Engine version 2.63E, the creator of the batch input session is also output at the end of each line in the activation report or file. This can sometimes cause problems in existing AE Scripts when the data sequence created with PREP_PROCESS_* is not divided into columns. This can be when the entire line is processed with string functions.

Note that by default, created files are stored on the computer on which the agent has been installed (for example, R3_GET_JOB_SPOOL; FILE=).

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=" "

In the activation report, lines similar to those shown below are output:

20020313/135601.000 - U2004943 ;AE_TEST;20020312NI;NI

The second example selects all batch input sessions between 1/1/2000 and 1/1/2002 that resulted in errors while they have been processed. The result of the selection is saved in a file.

R3_GET_SESSIONS NAME='*',CREDATE_FROM='20000101',CREDATE_TO='20020101',STATUS='E',FILE='sessions.txt'

The first lines in the file can look as follows:

COL=LENGTH,LENGTH_TAB='13=GROUPID,21=QID,13=CREATOR'
AE_TEST     20020314095728031322 NI           
AE_TEST     20020314095823023148 NI           
AE_TEST     20020314100932031323 NI

 

See also: