Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
stephen_xue
Active Participant

The integrated Configuration(ICO) is recommended to be used in PI 730 because of the high performance of AAE. However the mapping error track mechanism is not as user friendly as that in ABAP stack. For the traditional ID contents combination in ABAP stack, no matter message mapping, java mapping or XSLT mapping is used, the error message can either simplly send out by throwing an exception or using <xsl:message/> and the error message will be shown in the ERROR tag in tcode: SXI_MONITOR. By analysing the error message in SXI_MONITOR is one of the most effective ways for a PI developer to locate the defect.

However when ICO is used, this becomes a different story. In the audit log of runtime workbench, the log just shows information like message is retrieved into the queue, the mapping is failed/successful etc. It won't display mapping error message, nor can it show the message from the exception directly. Java class like Abstracttrack cannot populate message to the audit log either.

I just found a way to write message from mapping to RWB audit log by using Java class AuditAccess. Wish you find it useful for you. Here is the tutorial when XSLT mapping is used. For message mapping or Java mapping, the process is almost the same.

Prerequisits:

1. you have to know how to use NWDI to develop Java class

2. you have to know how to create imported archive in PI ESR

3. you have to know how to get the source message id in the mapping process.

Steps:

1. download the JAR file com.sap.aii.af.ms.ifc_api.jar

2. create a Java class in NWDS and import the JAR file as the external source. Here is the Java source code ( i am totally new to Java. please ignore silly mistakes made in Java programming)

package com.xxx.util;
import com.sap.engine.interfaces.messaging.api.*;
import com.sap.engine.interfaces.messaging.api.auditlog.*;

public class errorLog {

public static void execute(String errorMsg,String messageid) {
  MessageKey key = null;
  AuditAccess audit = null;
  try{
   audit = PublicAPIAccessFactory.getPublicAPIAccess().getAuditAccess();
   key = new MessageKey(messageid, MessageDirection.OUTBOUND);
   audit.addAuditLogEntry(key, AuditLogStatus.ERROR, errorMsg);
  }catch (Exception e) {
   Exception me = new Exception(e);
  }
}
}

Info: there are two import parameters of the method:

a) The message you want to displayed in the audit log;

b) The source message id.

3. Create an imported archive by using the JAR file exported from the developed Java class.

4. In your XSLT mapping, insert the following relevant code:

     4.1 Add a namespace prefix definition like this

<xsl:stylesheet version="1.0" ....  xmlns:el="com.xxx.util.errorLog">

     4.2 Receive runtime constant messageid. For message mapping or java mapping, message id can be get by deriving dynamic configuration.

     4.3 Pass message by calling Java method

    <xsl:choose>

     <xsl:when test="function-available('el:execute')">

      <xsl:value-of select="el:execute($message,$MessageId)"/>

     </xsl:when>

     <xsl:otherwise>errorLog->execute is not available.</xsl:otherwise>

    </xsl:choose>

      info:

          Constant $message will be the error message to be displayed in the audit log;

          Constant $MessageId is the message ID from runtime

Here is the sceenshot of the result:

wish you find it useful. 🙂

10 Comments
Labels in this area