Updating Value Mapping via SAP Data Services (Part 1)
Within my organization, within our homegrown loyalty system, we maintain both live card holders and test card holders. The latter is used for testing offers before they are rolled out to the larger audience. These two types of card holders are maintained in separate databases within our landscape. The addition and subtraction of test card holders is completely contained within that organization.
Moving forward, we will be accepting an offer activation through our SAP PI system. This means that we will have to segregate the live card holders from the test card holders. Given that the number of test card holders is very small, and we did not want to do a database look up each message, we decided to use a value mapping. This raised the question of how to keep our SAP PI system in sync with our test loyalty system.
We currently use SAP Data Services for our batch jobs. Therefore I decided to look for a solution that would integrate our Data Services system with our SAP PI system. Given that it is web-service based, this solution could be adapted to fit whatever tools are in use at your organization.
Within SAP PI, value mappings are maintained within the Integration Builder or via the Process Integration Run-time in NWDS. Value mappings combine two scheme agency id’s and scheme id’s to create a unique relationship. Behind the scenes, SAP PI assigns a guid called a value mapping id. When updating or deleting a value mapping, the value mapping is required. Also, consistent with all changes within SAP PI, value mappings must be activated from a change list.
In order to create a value mapping, launch the integration builder and choose value mapping from the Tools menu.
Then specify the scheme agency id and scheme id for both the source and target. You will use these values both from within the SAP PI mapping and within Data Services.
Then you can maintain the values that correspond for each agency.
When you are done, you can save and activate your change list.
In order to automate this process we will use built-in web services provided by SAP PI. You can find the services within your SAP PI system by going into NetWeaver Administrator and choosing the SOA profile.
From there, navigate to Single Service Administration
Then you go just click go to open all of the services currently available. For this specific scenario, we will use the services associated with changes lists and value mapping as shown below.
First, we will use the Query operation on the value mappings to read the value mapping id’s that meet our requirement (e.g. group). Then, using these value mapping id’s, use the read operation to read the actual mapping values. We will store these for later comparison when creating, updating, and deleting entries.
Next, we will read from our data source within Data Services to stage the value mappings to be migrated to SAP PI.
Then we will create a change list, via the create operation of the change list service. Using this change list and the staged data, we will compare the staged data to the values read from SAP PI to generate change, create, and delete messages via the change, create, and delete value mapping operations, respectively.
If these are successful, we will activate the change list via the activate operation, or, in the event of an error, revert the change list via the revert operation.
What’s in Store For Next Time
In part 2, we will explore the setup and integration with Data Services.