Class com.sap.basis.ukm.AddKeyMapping
The class provides methods for adding key mappings using RFC function module UKM_ADD_KEYMAPPINGS.
The namespace extensions for the classes of the unified key mapping that are used are declared in the header of the xslt transformation. An AddKeyMapping instance for the required key store is created in the global part of the transformation and stored in a reference variable $ref. Of course the variable can be renamed.
The required mappings are defined in the template with identifier instances and passed to the AddKeyMapping instance referenced with $ref with method addMapping(). The flagged mapping requests are executed with method getMessages(). At the same time, any error messages that occurred are retrieved. These are returned as xml fragment and stored in a variable $messages. The xslt context must be restored before the first access.
Example
A complete coding example for creating a new key mapping is given below.
<?xml version="1.0" encoding="UTF-8" ?> <xsl:transform version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:Identifier="java:com.sap.basis.ukm.Identifier" xmlns:AddKeyMapping="java:com.sap.basis.ukm.AddKeyMapping"> <xsl:param name="mappingTrace"/> !-- Get a reference to the default key store --> <xsl:variable name="ref" select="AddKeyMapping:new($MappingTrace)"/> <xsl:template match="/"> <!-- Create source key --> <xsl:variable name="sourceID" select="Identifier:new('PartnerGUID', 'QM3_300', 'B123')"/> <!-- Create target key --> <xsl:variable name="targetID" select="Identifier:new('CustomerID', 'EU3_003', 'B456')"/> <!-- Add mapping request --> <xsl:variable name="void" select="AddKeyMapping:addMapping($ref, 'BUS1006', $sourceID, $targetID)"/> <!-- Execute the pending keymapping calls and get the messages --> <xsl:variable name="messages" select="AddKeyMapping:getMessages($ref)"/> <!-- Always restore context after calling an extension function --> <xsl:for-each select="$messages"/> <!-- Output messages of the call --> <xsl:copy-of select="$messages"/> </xsl:template> </xsl:transform>