PI Mapping Runtime can require external data for serveral reasons. Most common are different names for same unities in different systems. For example material classes vary often as well as names for organizations. A mapping program requires in such cases an access to a table where the values from different systems are correlated. There are quite different strategies to implement such a scenario:
- Put the data direct into the mapping program: Most serios disadvantage would be a bad maintenance; the program has to be changed and retested in case of new or changed values .
- Reading the data from an external file or a PI table: Unusual maintenance and no control of authorization
- Access the data during runtime via lookup: Can lead to performance issues. Analyzing any errors could be difficult as the monitoring isnt that smooze as for message traffic. A temporary connection problem to the value mapping storage would be an additional risc.
- Storing the data in a SAP ECC table for usual maintenance (SM30) and good control of authorization and replicating them by any change to PI Java Runtime Cache for a good runtime performance
Description of the scenario
The external data (correlation of different values) are stored in SAP ECC z-table. By any change of the table content an ABAP program calls a proxy, which replicates the whole table content. There wont be any performance issues if the data are not changed too often and if this are not too much data. This preconditions shouldnt be a problem in the most cases. The full table replication is much easier than a delta load and can be implemented within a few hours.
The data are replicated to Java Runtime Mapping Cache, they can be controlled from Runtime Workbench. A standard function from Message Mapping can make use of the correlated values, the Runtime performance for this sceanrio is better than for any scenario with lookup.
Suppose we have different purchase organizations in a SAP system and a third party system. We are planning to add later organizations and we might want to add another third party system in future. To exchange messages we need to map that organizations by an external table.
Mapping Table at SAP System
The mapping table is created at the SAP system (transaction SE11).
The context is individual for our mapping case (and therefore for our scenario and our third party system). The context and at least one of the mapping values should be key of the table.
Table Maintenance Generator
The function Utilities / Table Maintenance Generator at SE11 allows to create a quick controlled table maintenance from SM30). We can choose directly a Authorization Group for a control of access. The Function Group, which later will be extended, must be in the customers namespace. From this dialog we can jump to the event handling: Environment / Modification / Events
Events from Table Maintenance
An event can be defined in that step, for example “02 – After saving in the database”, and a FORM routine what should be called if that event was raised. A own FORM should be typed in here, which will be created in the next step.
A new include needs to created in the Function Group (SE80), what was typed in at the Table Maintenance Dialog. It has to be in the customers namespace. During the activation there could popup some confusing messages which can be ignored. The include just contains the FORM routine from the last step.
ABAP Outbound Proxy
With the SAP BASIS Software Component two ABAP outbound proxies were delivered (transaction SPROXY). In our example the synchronous proxy is used.
It can be used to send messages directly (as XML) to the PI Integration Engine. The view tabs are very helpful during implementation of the ABAP program (the FORM) routine. They provide an overview about the structure and by clicking on an element the type can be copied from “ABAP Name Ref.”.
- Operation: Fixed Value: Insert, Delete, DeleteGroup, DeleteContext or DeleteContextGenerice. This value determines the action. In our example we use “Insert” and “DeleteContext”.
- GroupID: 2 Values with the same GroupID belong together (correlation). To create that 32 character hexadecimal number function module ICF_CREATE_GUID is used.
- Context: Values of one context belong to one scenario. For values of one context can be searched at RTW and one context can be deleted by only one message.
- Identifier(VALUE): The value of the parameter in the different systems. In our case the value for the purchase organization.
- scheme: A scheme what the value is about. In our case the fix value “PurchaseOrg”. The scheme would allow to extend the scenario for other mapping tasks to use only one ECC table for a lot PI scenarios. In our example a constant is used, the more generic scenario would require a variable value there.
- agency: The system (or the “agency”) what the value is belonging to. In our case SAP or the the third party system.
Source Code of FORM routine:
Java Inbound Proxys
The Java inbound proxies on the Integration Server can easily be activated by calling a simple URL:
Integration Builder Configuration
- Sending System: SAP System >= WAS 6.20
- Receiving System: Integration Server
- Receiver Determination: Sender: SAP-System / IF: ValueMappingReplicationSynchronous / NS: http://sap.com/xi/XI/System – Receiver: Integration Server
- Interface Determination: Sender: SAP-System / IF: ValueMappingReplicationSynchronous / NS: http://sap.com/xi/XI/System – Receiver: Integration Server Inbound-IF: ValueMappingReplicationSynchronous / Inbound-NS: http://sap.com/xi/XI/System – no Mapping
- Communication Channel: Component: Integration Server – Adapter Type: XI-Receiver – HTTP Destination: Destination to Integration Engine
- Destination: Type: H, Host: Java host, Service No: Java Port, Path-Prefix: /MessagingSystem/receive/JPR/XI
- Receiver Agreement: Sender: SAP-System – Receiver: Integration Server / IF: ValueMappingReplicationSynchronous / NS: http://sap.com/xi/XI/System – Receiver Channel: like above
The proxy replication can be monitored at transaction SXMB_MONI either at SAP and at PI. The values are available at Runtime Workbench / Cache Monitoring / Cache Instance: Mapping Runtime Cache, CAche Object: Value Mapping Groups
Use in Message Mapping
Value Mappings can maintained with standard function “Value Mapping”. The context must be typed in, as well the Schema (“PurchaseOrg” for our example). The organizations are mapped by the typed in values for source and target agency. The behaviour regarding exceptions of the function can be maintained: Source value, default value or runtime exception