Skip to Content
Author's profile photo Ravikanth Talagana

How to control the flow of EDI messages using custom control keys

Recently, we had a production issue with an inbound EDI 214 signal from one of our trading partners. We use SAP PI/PO 7.4 system’s out of the box B2B adapter for processing the messages. The issue was that the adapter was unable to successfully parse the inbound message and consequently creating a negative acknowledgement in the form of an EDI 997 message.

The communication channel log on the EDIReceiver communication channel was something on the lines of,


X12 message with message transaction set {0} and Message ID {1} has errors. The message shall not be disptached.

The error was quite vague and since we did not use the “split” option the in communication channel, the EDI 997 also did not point to the exact error.

We had to raise an OSS message with SAP and finally it was found that the data in the EDI element N104 (City name in shipper address) was causing the error.

In other words, the standard EDI definition of 214 message has the N104 element defined with a minimum length of 2 characters. However, when the data has a single character, the parser was throwing an error.

To fix this, SAP corrected the adapter level code and suggested a patch implementation as described in the SAP Note 2391095 .

However, we could not implement the patch as suggested by SAP, due to dependencies of other projects. As an alternative, I have come up with a way to bypass the standard EDI conversion routines, using a custom control key. Essentially, we are diverting certain edi interfaces to use a custom control key in place of the standard .

Here are the steps to create a custom control key and modify the element level validations.

  1. Create a custom key : Launch the b2bic tool using the URL https://<SAP PI/PO host>:<port>/b2bic
  2. Click the link EDI Content Manager.
  3. Chose from Menu Ansi X12>Editor>Control Key description editor
  4. Give a name to your control key and a description.
  5. Chose from menu, ANSIX12>Editor> Control Key Scenario Association and click insert to add a new association. This step is key to tell your system to invoke the new control key for a set of interfaces defined by the condition. Make sure you choose the new control key defined in previous step.Click save.
  6. Choose from menu Ansi X12->Editor->Message Editor.
  7. In the subsequent screen, chose your new custom control key, version(In my case 4010, EDI Set (In my case 214).
  8. Traverse the message structure to the element for which you want to modify the specifications (In my case i wanted to change the  minimum acceptable length of N104 element to 1 character instead of 2 characters.
  9. Click save button to save your changes.

That is about it. When the next EDI 214 message arrived from our partner, it no longer used the standard default control key and instead was forced to use our new control key, thereby avoiding the validation and circumvented the error due to the validation.

I hope this weblog helps you and that you do not have to go through the trouble we went through 🙂

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.