Knowledge Base > Automation Engine and Target Systems > SAP > Compare values in SAP Spool lists

Compare Values in SAP Spool Lists

SAP Spool lists show print jobs that have not yet been transferred to a device. The data needed for printing or output on a device is temporarily saved to an intermediate format until they will be called. The values for such spool requests in the respective lists may be compared by using Automation EngineThis component drives an Automation Engine system and consists of different types of server processes. SAP jobs.

Comparing Spool Request Values - Workflow

Create a workflowAn object of the Automation Engine that can include several executable objects and which runs them in a specified order. [Formerly called "ProcessFlow" and "JobPlan."] with two SAP Job objects. Each Job produces a spool listShows entities in a grid view. A third Job objectAutomation Engine controlled activities and processes are structured in the form of objects. See also: Task will be used to compare the numbers of the spool list values.

When both Jobs have been finished, the values will be extracted from the spool lists and be passed to the third Job in the workflow.

The statusThis represents the condition of a task (such as active, blocked, generating). of the workflow is set according to the comparison:

Numbers are equal ==> ENDED_OK

Numbers are unequal ==> ENDED_NOT_OK

 

Transferring Spool List Content to Job Report

Below you find an example of one of the two SAP Jobs in the workflow, each of them consisting of two steps:

In the first step the program is executed and in the second step the content of the spool list is added to the reportA report provides more detailed information about a task's execution or a component..

The report of this jobAn Automation Engine object type for a process that runs on a target system. look like this:

It contains the Job log from SAP followed by the spool list.

Extracting Values

Job 1:

To extract the value from the spool list the following UC4 Script is used in the post process tab of the Job.

This scriptA particular Automation Engine object type. is executed after the Job has finished. It processes the report and extracts the values:

The PREP_PROCESS_REPORT functionPre-defined run book template in the Automation Engine. One single step only, e.g. Start Windows Service, Copy file,… filters all rows which contain a "|" character.

This returns these values only:

| USD 123.456.789,01 1.234.567,89 |
| BEF 12.345.678.901 123.456.789 |
| KUD 123.456.789,01 365.413.243,87 |
| KUD 123.456.789,01 365.413.243,87

With PSET the object variable &JOB1_SUMME# of the Workflow is updated.

The workflow also contains a second variable &JOB2_SUMME# which is set by the second SAP Job.

 

Job 2:

The report of the second Job looks like this:

UC4 Script is also used in this case to get the value:

This script filters for all rows containing the word "SQ".The result is one row:

|SQ| 26|28.02.1995|365.413.243,86 | |DC-10-10| 380 | 2 |1.684,00 | 0 | 0 | 0 | 0 |

The character "|" is defined as separator of columns. Therefore the value 5 (variable &column#) can be used directly get 365.413.243,86 from the report.

STR_TRIM is used to remove spaces. The result is published as &JOB2_SUMME#

 

Compare Jobs

Both Jobs must have finished before the compare job may be started:

It has access to the variables &JOB1_SUMME# and &JOB2_SUMME#.

This Job has the setting "Generate at runtimeThe duration of a task's execution. It refers to the period between a task's start and end. It does not include its activation period (see also: activation and start)." activated on the "Attributes" tab.

In this example it starts an SAP program with parameters that depend on the result of the comparison.

The simple program Z_INFO uses MESSAGE of the I or type E depending on the SUCCESS parameter:

REPORT Z_INFO.
parameter text1 type string.
parameter text2 type string.
parameter text3 type string.
parameter success type c.
if success is initial.
MESSAGE I002(SY) WITH text1.
MESSAGE I002(SY) WITH text2.
MESSAGE E002(SY) WITH text3.
else.
MESSAGE I002(SY) WITH text1.
endif.

 

The workflow can be set to ENDED_NOT_OK when the compare jobs fails:

Comments

The special parameter value (REPORT,REP) for the FILE parameter in the R3_GET_JOB_SPOOL command is not documented, but exists since v9.
Normally the R3_GET_JOB_SPOOL command can only write files. However the SAP Agent cannot read them. An OS Agent would be required to extract the values with PREP_PROCESS_FILE and delete the old files when they are not needed anymore. This would also be a possible solution, but more complex than the one described here.

See also:

SAP - Custom Solutions

 

 


Automic Documentation - Tutorials - Automic Blog - Resources - Training & Services - Automic YouTube Channel - Download Center - Support

Copyright © 2016 Automic Software GmbH