Parsing Log Files to set Status of SAP Jobs

SAP jobs reach status Completed when no error was returned and Error when an error occurred. You can force an SAP job into Error or Completed based on a specific message in the log file. This is done by mapping specific messages to return codes; the return code 0 maps to Completed, other return codes map to Error. The return code can be configured per SAP instance, on the Return Code Mapping tab of SAP Systems in Redwood Server.

Note that you can also set system-wide return code mapping for SAP jobs that would appear as killed in Redwood Server with the KilledMessages registry entry.

Matching a Log Entry

The following information is required to match a log entry:

  • Message Class - The type of message; it can be found in the log, usually the third column.
  • Message Number - The number of the message; it can be found in the log, usually the fourth column.
  • Message Type - The type of the message, see list below. The message class and number usually uniquely identify the message, so this can be set to asterisk (*) in most cases.
  • Message Text (optional) - The text of the message, it can be found in the log.

The message type can be any of the following:

  • A - Termination
  • E - Error Message
  • I - Information
  • S - Status Message
  • W - Warning
  • X - Exit

The message type can only be retrieved if one of the following is true:

  • transports are used
  • if the SAP Note 603919 - Reading job log by XBP: Message type is missing is implemented
  • 6.40 or newer SAP releases

Based on the criteria, Redwood Server parses the log file and when it finds a matching entry, it will set the return code of the process to the one configured for the rule. Optionally, you may have Redwood Server create a note, which will inform operators, that return code mapping was used on this process. All criteria must be fulfilled for the match to be successful.

The following is the contents of a log file:

Copy
180006 20100613 00 516 Job started  0
180007 20100613 00 550 Step 001 started (program BTCTEST, variant , user ID REDWOOD)  0 001 BTCTEST  REDWOOD
180007 20100613 00 544 TEST: SY-BATCH indicates background processing  0
180007 20100613 00 517 Job finished  0

In the above message, we see the following message 180007 20100613 00 544 TEST: SY-BATCH indicates background processing 0 that indicates that no background processing jobs were created, so we would like to force the process into error.

The following rules would catch this log entry:

  • Message Class - 00
  • Message Number - 544
  • Message Type - S
  • Message Text - TEST: SY-BATCH*

It is easier with SAP error messages, see the following error:

Copy
BAPI exception: RFC function module = BAPI_XBP_NEW_FUNC_CHECK, message type=E, id=XM,
number=233, text=I:XM:233 BAPI_XBP_NEW_FUNC_CHECK,
msgv1=BAPI_XBP_NEW_FUNC_CHECK, msgv2=, msgv3=, msgv4=

The following rule would match this log entry:

  • Message Class - XM
  • Message Number - 233
  • Message Type - E
  • Message Text - I:XM:233 BAPI_XBP_NEW_FUNC_CHECK*

Specifying the Jobs Logs to be Parsed

The following criteria is available to specify which job logs are to be parsed:

  • Client Number Mask - a client number mask can be a specific client or a range of clients defined with wildcards. For example, 2* would match clients 200 and 250, but not 300.
  • Jobname Mask - a job name mask can be a specific job name, or range of job names specified with wildcards. For example, BI * would match BI PostProcessing but not Backup Production System 12/03.
  • Username Mask - a username mask should be left as * unless you are sure the job will always be started by the same user.

This allows you to limit the rule to a more or less specific range of jobs. For performance reasons, Redwood recommends to avoid parsing logs of all jobs. All criteria must be fulfilled for the match to be successful.

When you configure more than one rule, you should ensure that the most restrictive rules need to have a lower processing order than more generic rules.

Procedure

  1. Navigate to "Environment > SAP".
  2. Choose Edit from the context menu of an SAP System.
  3. Choose the Return code mapping tab.
  4. Choose Add and fill in the details of the rule, check the Values section below for a description of the available fields.
  5. Click Save & Close when you are done.

Values

Field Description
Processing Order The order in which rules are processed, the lower the value, the earlier the rule is processed.
Description An optional description of the rule.
Client Number Mask The client number(s) this rule applies to.
Jobname Mask The job names this rule applies to.
Username Mask The users this rule applies to.
Message Class The type of message; it can be found in the log, usually the third column.
Message Number The number of the message; it can be found in the log, usually the fourth column.
Message Type The type of the message, S for strings and E for errors, for example.
Message Text The text of the message, it can be found in the log.
Return Code The return code to use when the rule matches.
Create Note Should a note be created when this rule is applied?

See Also

SAP Systems