Start of Content Area

This graphic is explained in the accompanying text XSLT Mapping of Adapter-Specific Message Attributes  Locate the document in its SAP Library structure

The message header of an XI message contains a header for adapter-specific message attributes that the sender adapter can use to write additional information to the message header. This enables sender adapters to write information that is not known until runtime to the message (see: Adapter-Specific Attributes in the Message Header).

To change the fields of this header in a mapping program, you usually use a Java mapping program (see also: Java Mapping of Adapter-Specific Attributes). Nevertheless, you can also use the relevant classes as a Java enhancement in an XSLT program.

In this example, the Java classes for a mapping of the message header for adapter-specific message attributes are used in an XSLT program to change the parameter Directory of the file adapter. The XSLT program is structured thus:

...

       1.      First, the required Java classes are declared as namespaces:

     java.util.map to be able to access the constants of the mapping runtime. The header for the adapter-specific message attributes is saved as a Map with the name DynamicConfiguration.

     com.sap.aii.mapping.api.DynamicConfiguration and com.sap.aii.mapping.api.DynamicConfigurationKey for the header mapping.

       2.      The parameter name inputparam is defined and enables you to transfer the constants of the StreamTransformationConstants class to the Java runtime.

       3.      To change the header for the dynamic configuration, the XSLT program gets the Map for the header, creates a key for the parameter Directory in the file adapter, gets the current value for this parameter by using the method get(), links this directory path with the XSLT method concat and replaces the value by using the method put().

XSLT Mapping Program with Java Enhancement

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:map="java:java.util.Map"
  xmlns:dyn="java:com.sap.aii.mapping.api.DynamicConfiguration"
  xmlns:key="java:com.sap.aii.mapping.api.DynamicConfigurationKey">

<xsl:output indent="no" />
<xsl:param name="inputparam"/>


<xsl:template match="/">

    <!-- change dynamic configuration -->
    <xsl:variable name="dynamic-conf"  
        select="map:get($inputparam, 'DynamicConfiguration')" />
    <xsl:variable name="dynamic-key"   
        select="key:create('http://sap.com/xi/XI/System/File', 'Directory')" />
    <xsl:variable name="dynamic-value" 
        select="dyn:get($dynamic-conf, $dynamic-key)" />
    <xsl:variable name="new-value"     
        select="concat($dynamic-value, 'subfolder\')" />
    <xsl:variable name="dummy" 
        select="dyn:put($dynamic-conf, $dynamic-key, $new-value)" /> 
  
    <!-- copy payload -->
    <xsl:copy-of select="." />
</xsl:template>

</xsl:stylesheet>

 

 

 

 

 

 

 

End of Content Area