Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
udo_martens
Active Contributor
0 Kudos

Background

For some reasons it can be necessary to log messages at XI, for example:
  • You want to realize an own caching mechanism
  • You want to realize an own recovering mechanism
  • You want to realize an individual error monitoring
The logging is implemented in ABAP stack to use comfortable and performant SAP tables. Some alternatives like Java or XSLT are thinkable.

The basic mechanism can be reduced to:
  1. A message, which should be logged, is going to a an outbound interface
  2. An additional ABAP mapping is logging the message in a cluster table (strings!)
  3. The "normal" mapping is executed before filling of inbound interface
Reading is nearly the same:
  1. A message, which should be mapped with logged parts of another message, is going to a an outbound interface
  2. An additional ABAP mapping is reading a message from that cluster table
  3. The "normal" mapping is executed before filling of inbound interface

Implementation

Prepare of ABAP Mappings

Please put an additional parameter into your exchange profile:
IB / Administration / Exchange Profile / IntegrationServer.MappingRuntime
Value: com.sap.aii.repository.mapping.additionaltypes=R3_ABAP|Abap-class;R3_XSLT|XSL (ABAP Engine)
Have a look to SAP Library: Mapping Development with the ABAP Workbench

Create a ABAP Mapping

  • Create a new ABAP class with interface "IF_MAPPING"
  • Put your source code into method "execute"
  • The parameters "SOURCE" and "RESULT" are typed with "XSTRING", which has to be converted for the most reasons
  • Have a look to SAP Library: ABAP Mappings
  • Have a look to the guide (pdf): How to...Use ABAP Mappings in XI

Create the Cluster Table

  1. Copy SAP table "INDX" into your namespace
  2. Don't touch fields MANDT, RELID, SRTF2, CLUSTR, CLUSTD
  3. Put a field "MESSAGE_ID" directly after RELID. It's a key field, can be inittial and is typed with CHAR32
  4. You don't need fields SRTFD, LOEKZ, SPERR, AEDAT, USERA, PGMID, BEGDT, ENDDT - delete them
  5. Put your own fields after SRTF2. You can log there some for you important values to have an intelligent search
  6. Have a look to SAP Library: INDX-Type Databases

Converting XSTRING to STRING and back

Your method parameters are typed with XSTRING but you need for loggging and reading type STRING.
Convert with this code:

Get the Message ID

Write a Message into Cluster Table

Read a Message from Cluster Table

Repository

Finally you have (of course) to add the ABAP mapping to your interface mapping