What’s in a Naming Convention? Part II
In my last post, I discussed naming the naming convention that DataXstream recommends for SAP PI Integration Directory (ID) objects. I would like to say that I had a great DataXstream ESR-specific naming convention, however the SAP naming convention guide for PI 7.1 does the job perfectly. Here is the link to the PI 7.1 naming convention guide http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40a66d0e-fe5e-2c10-8a85-e418b59ab36a?QuickLink=index&overridelayout=true . I would like to point out some things that I feel most people miss, as well as some things that I think are particularly interesting.
Object Name Prefixes
I have seen a lot of places use prefixes or suffixes before objects such as or dt_ or _mt. I have never really been a fan of these prefixes and suffixes, and apparently neither is the above linked naming convention guide. The reason being is that they are unnecessary. It would be difficult to confuse a message type with a data type in a real interface scenario, even if troubleshooting an unknown broken object. Plus it makes message mapping unnecessarily confusing and long since it’s not clear whether to add the prefix, i.e. MT_one_to_MT_two. Good descriptive names are usually all that you need e.g. DEBMAS_to_Customer. The only possible exception to a no-suffix-or-prefix-policy is the service interface, as sometimes it is useful to know which direction and type a service interface is. An argument for a prefix or a suffix to describe a service interface would be to assist in understanding the flow from an SAP perspective in the event that someone who didn’t develop the interface had to come behind and troubleshoot. A argument against would be the fact that it looks silly if you use it for a web service, because you have a name that doesn’t mean anything to a third party user (note operation mappings are told to omit the prefix of direction and mode in the SAP guide).
One interesting thing that I noticed in my investigation of PI 7.1 EHP1 is that it appears that naming conventions on PI can be validated. If the object names do not conform to a naming convention a message will appear. Ter perform this check in the ESR go to menu Tools>Component Check.
Select “Governance” and “Interface Name Checks”:
If the service interface does not end with (In/Out)(SYNC/ASY) the interface check will show as an error (does not impact interface processing). I created 2 interfaces: one good and one bad to show this error.
My suspicion is that SAP will put more in place to force consistent naming standards depending on the service interface pattern in future releases.
Using a software component and Namespace for each “side” of an interface
All objects of an interface should not be grouped in a single namespace. They should to be split among the Software Component Versions of the systems being interfaced. Otherwise when you go to configure, you will not be able to see your operational mapping (OM) in the dropdown box without having to select all in the dropdown menu. A general rule of thumb is: if it’s not easy to configure, odds are you have probably done something wrong. Another reason why an object might not appear in the dropdown menu (for example for an operations mapping on an interface mapping) would be if the installed checkbox is not clicked on the SLD. When done correctly, most interfaces should be able to be configured quickly and intuitively in the integration directory (ID) without the need to select from all SWCV from dropdown menus on the integration builder.
Whatever naming convention you choose to use for the ESR, the important thing to remember is that adhering to the standard makes production support and troubleshooting faster and easier.
Troubleshooting the Services Registry
Recently I set up the services registry for PI 7.1 EHP1 for a client of ours. Although it seemed like it would be a simple process, I ran into a 401 authorization issue and another issue where web services were not publishing to the services registry. Looking online there are a lot of people who ran into the same issues as I did, so I am providing, here, the steps to perform if your services registry isn’t working.
Changed RFC Structure Not Propagating to XI/PI Runtime
In support of an synchronous XI interface (SOAP->XI->RFC), I changed the underlying structure of one of the RFC parameters. I appended some fields to the end of a return structure in ECC. I re-imported the RFC meta data to the Integration Repository as always and mapped the fields accordingly. When I executed the interface, the fields that I added did NOT appear in the XML. This is because the XI runtime cache did not have the updated metadata for the RFC.
To update the runtime cache (called CPA Cache), enter the following URL in your web browser http://<host>:5<sys#>00/CPACache/refresh?mode=full. XI will do the rest of the work for you. After the CPA cache is refreshed, the new RFC meta data reflects the newly added fields.
These other CPA Cache URLs may also be helpful:
CPA Cache Monitoring: http://<host>:5<sys#>00/CPACache
Delta CPA Cache Refresh: http://<host>:5<sys#>00/CPACache/refresh?mode=delta
Full CPA Cache Refresh: http://<host>:5<sys#>00/CPACache/refresh?mode=full
Allow Additional Mapping Types in SAP XI/PI
SAP PI is a powerful integration engine that allows developers a variety of methods for implementing transformation logic. As a long-time ABAP developer, one of my favorite methods to implement transformation logic is using ABAP. This transformation option is not enabled in SAP XI/PI out of the box. While information regarding how to enable ABAP transformations can be found in SAP help, I have found it easier to have step-by-step instructions.
Fun With SAP PI Message-Mapping
My previous post discussed the “hidden” menu in the SAP PI message mapping tool that can only be unlocked by pressing <Ctrl> + <Shift> while right clicking in the data flow editor area. Hands down, the best feature of this menu is the import/export functionality. I have no idea why the SAP developers buried such a useful feature in such a hard-to-find menu. Whatever the reason, now that we know that we can import and export message mappings, we can exploit this fact to make our map-developing lives easier.
Most SAP PI developers have had a situation where a relatively minor change to the target message causes real havoc to the entire message mapping. For relatively small maps, it may not be a big deal. For maps with complex logic, this can be a big deal requiring hours of tedious rework. Recently, I was faced with a requirement change that required my message mapping to change correlations from 1:1 to 1:N. Since this interface used the RFC adapter (which supports multiple messages), I was able to implement a 1:N multi-mapping message split. In the new interface design, the file adapter will process one file and pass it to the integration engine. The integration engine will perform a multi-mapping message split to break-up the message. The new, individual messages will be sent via one adapter engine call to the RFC adapter. The RFC adapter will handle each message individually, calling each in a separate logical unit of work (LUW).
The steps below will detail how to switch a message mapping from a 1:1 correlation to a 1:N correlation without remapping anything! Read more
PI Message Mapping Editor “Hidden” Menu
When I was young, one of my favorite Nintendo games was Contra by Konami Corporation (old-skool NES). Standard play with Contra afforded you with 3 lives. I was not particularly adept at Contra (I only excel at driving games) and 3 lives was not nearly enough for me. The only way the game was fun for me was to enter the Konami “cheat code”. This cheat code gave me 3o lives! I could get 10x the Contra playing excitement before I got obliterated by one of the many end-of-level “bosses”. It was with the help of that cheat code that my friend Jeff and I were able to beat the game during a marathon, overnight Contra session. It has been over 20 years since I played Contra, but I still remember the cheat code key sequence:
up, up, down, down, left, right, left, right, B, A, start
Now that I’m a little older, I’ve graduated from NES to SAP PI. It’s not nearly as fun, but every bit as challenging. And at least I get paid to do it. I looked, but could not find anybody to pay me to play Contra. Instead of the many end of level “bosses” the only boss I have to worry about is my project manager–I don’t know which one is more evil.
Similar to Contra, the message mapping editor in XI/PI has a menu with helpful items that is “hidden.” Unless, that is, you know the secret key combination to unlock it. In PI, open any message mapping in edit mode. While holding the <Ctrl>+<Shift> keys, right click in the data flow editor window. You will be rewarded with this menu.
Here is a short rundown of some of the menu options:
- Last Used This menu keeps track of recently used mapping functions. It can be a real time saver if you are using mapping functions from multiple function groups.
- Tools\Export Tools\Import The import/export functionality of the message mapping editor is, single handedly, the best feature of the hidden menu. The import functionality allows you to transfer message mappings from disparate SAP PI systems. The import/export functions also can reduce work in other ways that I will discuss in detail in later blogs.
- Tools\Export Tools\Export The export function downloads the source of your message mapping to your local hard drive. The file includes the map’s header data, data flow logic, user-defined functions, test cases, and documentation.
- Tools\Color schema\Schema XI20 SP3 This option changes the data flow editor color scheme to look like it did in XI2.0 SP3. I never used XI 2.0, so I don’t know if this color scheme is accurate. I can tell you, however, that the brick colors are brighter in this color scheme

- Tools\Color schema\Schema XI30 “accessible” Personally, I really like this color scheme. The data flow editor’s ugly grey background is replaced with a more eye-pleasing white. I switch to this color scheme whenever I am capture screen grabs of the data flow editor for documentation purposes.

- Tools\Local Compilation While I’m not quite sure exactly what this option does, I would assume that it changes on which system the compilation of the map occurs. When checked I think the compilation of the map would occur on your workstation instead of the server, but I have not been able to confirm this thru testing, nor have I found any documentation to support this claim.
- Tools\JarClassTest This togges the JarClassTest option. I have yet to detect a difference in the behavior when compiling/testing, nor have I found any documentation on this item. If anybody out there has any information, please post a comment.
- Tools\Autosize Bricks This function is useful, especially if you have fields or user-defined functions (UDFs) that have long names. By selecting this menu, you no longer have to guess what field or function each brick is for.
vs. 
- Encoding This option allows you to change the encoding in the XML tag of the target message
1:N IDOC Receiver Without BPM. Yes It’s Possible!
For those of you familiar with PI, you know that it likes to deal with single messages, and not multiple messages in bulk. Many interfaces to “legacy” systems require single file interfaces. If you are using a file sender adapter and an IDOC receiver adapter, I have a little tip for you that will allow you to process one file into many IDOCs.
At a client of mine, I had to develop an interface to accept a file with IDOC acknowledgments. Our SAP system was sending data to an external system and the external system was sending back status messages that we were to post using ALEAUD. The status file was written periodically and could contain any number of records. Each record needed to be its own IDOC. The problem is that there is no “out of the box” solution that allows 1:N file to IDOC mapping. I searched a bit on SDN and found that there were others with my same problem. All of the responses, however, suggested using BPM. That just didn’t seem right to me. BPMs are great and all, but I don’t feel like I should need to implement a BPM to do something as simple as 1:N correlations. I set out to find a better way to do 1:N correlations with IDOCs and found that is actually was real easy.
After doing my research, I found that the issue is not with the IDOC adapter nor mapping engine, but rather the issue lies in the meta-data imported from the ECC instance. The meta-data describing the IDOCs has an element occurs of “1..1″–i.e. each message that contains an IDOC can contain one and only one IDOC. As it turns out, SAP handles the case if multiple IDOCs are passed to the receiver IDOC adapter. The mapping engine can easily handle multiple IDOC occurrence. The only limitation is the IDOC meta-data and, as I will show you below, that is an easy limitation to overcome.
- First, in your XI integration repository, download the IDOC definition from your ECC/R/3 instance as you normally would for any standard IDOC integration scenario.

- Complete the message mapping and the rest of the integration scenario development as usual.
Notice how the source message has an occurrence of 1..unbounded, but destination message is limited to an occurrence of 1..1. If the mapping were to remain this way, no matter how many IDOC tags would be in the source XML, one and only one IDOC tag will be created in the resultant XML. We’ll take care of this next. - Export the XSD for the IDOC to a file on your PC.

- Open the file in a text editor and change the element named “IDOC”. Add the following text:
minOccurs="1" maxOccurs="unbounded"
Save and close the XSD file. - In the message mapping created in step 2, import the XSD created in the previous step as the message reference for the IDOC. Notice how the evil “1..1″ occurrence constraint on the IDOC tag is now “1..unbounded”!

- Multiple rows in the file will create multiple IDOCs! Are you as excited as I am?
So, what did we learn today?
- You aren’t completely locked into the meta-data derived by SAP.
- The reciver IDOC adapter is pretty forgiving (much more so than the sender IDOC adapter–more on that another day)
- Most importantly, it is possible for a 1:N multi-message IDOC reciver correlation without BPM!
Welcome to the DataXstream XI/PI Blog
Hello. Welcome to the DataXstream XI/PI Blog. SAP XI/PI means SAP Exchange Infrastructure/Process Integration. SAP XI (the old name) and SAP PI (the new name) are SAP’s applications for integrating software solutions. Our team of consultants will post to this blog with tips, tricks, and experiences regarding SAP PI.
This blog was originally created on another blogging site. Recently, DataXstream migrated its web server to a platform that makes it easy to blog. The first couple of posts to this blog will be reposts of entries from the old site.
Some topics in this blog will be very technical and may need some clarification. Please don’t hesitate to post questions, comments, or concerns.





