SAP to Logic App Error – “SEGMENT_UNKNOWN”

After working through our first issues with SAP that I talked about in my last blog post, we started to see that not all our outbound IDOCS where making it to our receiving Logic App.

When investigating we came across another issue, this time we saw errors on both the SAP side and Logic App side:

1. SAP errors in SM58

The RequestContext on the IReplyChannel was closed

SAP developer did find that we had errors in our SAP outbound queue (SM58 – Transactional RFC) and the Status Text on the outbound messages was “The RequestContext on the IReplyChannel was closed“.

2. Errors on On-Premise Data Gateway

Exception Details: SAP.Middleware.Connector.RfcAbapException: SEGMENT_UNKNOWN

This error shows up when you have enabled extended SAP logging on the On-Premise Data Gateway.

David Burg a Senior Software Engineer at Microsoft explains in this blog article how to turn on the extended logging.

The Fix

As we were investigating these errors we also noticed that the outbound IDOC that was working was a standard out of the box IDOC. We noticed that the IDOCS that were failing have SAP Extensions on them. If you haven’t heard of SAP IDOC extensions, they are a method to extend out of the box messages with custom fields/elements. You can read more about extensions here.

When you look up these errors, you start to get a lot of articles related to BizTalk Server integration with SAP. Having been a BizTalk Developer in the past I can recall having similar issues.

Kent Weare who has written many blog posts on integrating with SAP had written this blog post on integrating with SAP when you have extended IDOCS: https://kentweare.blogspot.com/2008/09/biztalk-sap-adapter-and-extended-sap.html In one of the comments he mentioned about ensuring IDOC Extensions are released.

So you have to work with your SAP Developer to ensure your IDOC extensions are released. If you are moving from SAP PI/PO like our situation, the IDOCS did not have to be released, so you could run into this situation.

IDOC extensions are release using TCODE WE31 and you can find the segment names that are associated with the IDOC extension using TCODE WE30.

Here is the display extension screen for the standard ORDERS05 with our company extension:

In TCODE WE31, your IDOC needs to have the “Released” field checked:

What this does then when using Logic Apps is it creates another IDOC in your list, with your company prefix.

Hope this helped you out if you ran into this issue. Please let me know if you found this article helpful and be sure to follow me on twitter.