Just a short real life story I want to share with you all, in case you too have experienced some strange behavior with conversion of messages in the SAP PI/PO B2B Add-on.
A few weeks ago, we started to see some strange behavior with our EDI messages sent to a transport forwarding company. In some cases the messages we sent to them was delivered in xml structure and not EDIFACT, which we expected.
After some thorough investigation we found out that the messages with wrong structure all have failed in SAP PO at some point.
This strange behavior was finally explained when we found out that the EdifactConversionModule step in our SFTP adapter module was actually being run through twice, when an error occurred.
As you can see in the screenshot below we have 4 steps:
..but why is it run through twice?
Well, this was caused, as the failed message was persisted after step 3 (we had set the “Store on error” for Mapping step in “Advanced Settings” of the ICO)
So then we had a persisted failed message that was already converted from XML to EDIFACT.
Now what does the adapter do when we resend the message? It sends it through all 4 steps once again. And if you know about the “EdifactConversionModule”, then you know that is converts between xml and edifact and vice versa. So the second time it runs through the steps, the message is now converted back again from edifact to xml 😕
We raised a ticket with SAP and suggested them to change the behavior to do one of these 2 things in case this issue happens:
- Restart the processing sequence with the original xml message (not the persisted edifact converted in step 3)
- Restart from step 4 as step 1-3 was completed and persisted.
Furthermore we suggested them to ad a module parameter, allowing us to control how the module is converting (e.g. always convert xml-> edifact and not the other way)
SAP said they would get back with a patch for controlling the behavior, but till then, the solution would be to remove the “Store on error” for Mapping step in “Advanced Settings” of the ICO.
I am currently not aware if this behavior is the same with some of the other converter modules available (EANCOM, ODETTE, TRADACOM, etc). But please leave a comment if you experience this.
I Hope this will help some of you out 😉