Unreleased Segment Problem in SAP

For some standard IDOC, Sometimes, SAP team would hesitate to release all the segments due to maintenance overheads,

On the BizTalk side, To enable us to work with these Idoc’s we need to follow the below steps:

In the importing of the schema
Change the properties: GenerateFlatFileCompatible, ReceiveIdocFormat and FlatFileSegmentIndicator
Add the extension Flat File Extension to the schema generated

In the configuration of the receive port
Change the handling of the message body to a specific XPath
Use a pipeline with a Disassemble stage configured to use a Flat File Disassembler
Change the ReceiveIdocFormat property

Beyond the configuration steps above, we need to create one pipeline to each Idoc or at least add one more component in the Disassemble stage of the receiving pipeline for each Idoc.
I also looked if this schema generated in this specific way, is going to work even in case the SAP team does not release all the segments..

These are the configurations I did on the Receive Location:, Note ReceiveIdocFormat should be “String” not Typed (There is a mistake in the screenshot)

  • Where Path = “/*[local-name()=’ReceiveIdoc’]/*[local-name()=’idocData’]”

    For the schema importing process you should change the following properties:



Errors encountered in BRE deploying utility for SWIFT Schemas

Recently in one of my training session,  we encountered the following error, apparently it turns out to occur during the accidental double deployment of the policies for of an assembly.

Additionally, the environment which was on windows server 2012 did not seem to run the BRE utility, though it gave the success status message in the wizard, So we had to manually browse to the folder and all the appropriate vocabulary and policies.

Folder to find policies :- C:\Program Files (x86)\Microsoft BizTalk Accelerator for SWIFT 2013 Message Pack\SWIFT Messages\A4SWIFT-SRG2013\Base Policies


System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Microsoft.Solutions.FinancialServices.SWIFT.Utilities.BreDeployment.DeploymentDriver.GetMessageTypesFromAssemblies(ObjectCollection objCollection)
at Microsoft.Solutions.FinancialServices.SWIFT.Utilities.BreDeployment.MainForm.Deploy()
at Microsoft.Solutions.FinancialServices.SWIFT.Utilities.BreDeployment.MainForm.btnDeploy_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Troubleshooting SAP connectivity Issues

  • Elevate the privileges to SAP user account the highest possible permissions temporarily.
  •  Make sure your IP address is in the SAP acceptable access range.
  •  Install network monitor tool like wireshark from wireshark.org to see if any interesting traffic is
  • flowing between the BizTalk server and SAP server.
  •  While configuring to receive IDOC, SAP Basis team should have the visibility whether the
  • connection is success/not.
  •  Make sure the SAP connection is configured as Unicode

Click here for the detailed document.

The document consists some of the hands on errors encountered while connecting with SAP and the procedure to resolve it. a sample of one such error is

Error in Wireshark
*ERR*.1.registration of tp BIZTALK from host WQDESB12 not allowed.720.SAPGateway.
720.2.gwxxrd.c.3641..Tue Nov 12 15:08:07 2013….3972841.SAP-Gateway on host
HYPLABSSECC01.HYPLABS.iadb.org / sapgw00…..*ERR*

Error in Eventlog
The adapter “WCF-Custom” raised an error message. Details “Microsoft.Adapters.SAP.RFCException: Details: ErrorCode=RFC_FAILURE.
AdapterErrorMessage=An exception has occurred on the listener while executing RfcWaitForRequest..
at Microsoft.ServiceModel.Channels.Common.Channels.AdapterReplyChannel.EndTryReceiveRequest(IAsyncResult result, RequestContext&
eceiveRequest(IAsyncResult result, RequestContext& context)
at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext)”.



One of the partners we had integrated with wanted us to send the extended characters in the output file.

Those characters would look something like this  »    «

It was a easy change for us in code, so we made, deployed to production as well.. Later we realized that a different character shows along with the ones intended to show.

The file had an output as   «   instead of just «.

To add more to the perplexity, This character «  would not show up when the file is opened in text editors like notepad or notepad++, but shows up in other editors like “7-Edit”. So at first we ignored considering that problem is with the editor.

Later we heard back from the client with the same issue and they wanted us to fix it.

On deep diving, we realized that, in-fact it was an issue in one of our pipeline component, where we converted the output message to UTF8 encoding using the code below

byteArray = Encoding.UTF8.GetBytes(strMessage);

pInMsg.BodyPart.Data = new MemoryStream(byteArray);

But instead it should be left to default encoding.

byteArray = Encoding.GetEncoding(0).GetBytes(strMessage);

pInMsg.BodyPart.Data = new MemoryStream(byteArray);

So once the code was changed, the issue got fixed and made our client happySmile

Articles referred :-



Deployed zillion times to fix this error.

Error Description :-

The adapter failed to transmit message going to send port "WcfSendPort_MyWebService_MyWebServiceSoap" with URL http://localhost/MyWebService/MyWebService.asmx. It will be retransmitted after the retry interval specified for this Send Port. Details:"System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (400) Bad Request. —> System.Net.WebException: The remote server returned an error: (400) Bad Request.
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
   — End of inner exception stack trace —

Server stack trace:
   at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannel.EndRequest(IAsyncResult result)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at System.ServiceModel.Channels.IRequestChannel.EndRequest(IAsyncResult result)
   at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result)".


My Remarks:-

I feel little nauseating after deploying close to zillion timesSmile with tongue out (Hypothetically) in attempt to fix this error since this morning. All I am doing is call a web service using a WCF-BasicHTTP adapter in my BizTalk Project.

The webmethod takes the string as the input parameter and return string..Plain simple right? but the catch is I am send a huge XML serialized to string to the Webmethod.

At first, I thought it to be a problem with the size of the data, But no..that was not the case. I realised that after increasing the maxReceivedRequestSize on the send port and similarly on the web service by modifying web.config with the below

<system.web>     <httpRuntime maxRequestLength="2097150" executionTimeout="3000"/>   </system.web>

Second, I had to identify the problem using brute force / Trail and error basis, As the great BizTalk would not allow you to debug the Message Assignment shape. After trying and retrying couple of times, I realized that interfacing is good – I am able to send huge XML message from Orchestration to Web Service without issue.

Third, It was the problem with how I constructed the SOAP request in the message assignment shape (because I did not want to use Transform shape), I was assigning a part of my input multipart message direclly to my SOAP Request XML, So this was messing up the entire intention of the code and made be run this errand to fix it.

Finally, Voilà – the issue is fixed and I can sign off happily and enjoy my weekend.


Error Information:-

"Could not load file or assembly file:///C:\Program Files (x86)\Microsoft BizTalk 2010 Accelerator for HL7\bin\Microsoft.Solutions.BTAHL7.MLLP.dll’ or one of its dependencies. An attempt was made to load a program with an incorrect format."

Resolution :-

Make sure that the Biztalk host used by HL7 Accelerator is running under 32bit mode, if it is running in 64 bit mode, you will get this error!

Read more: http://blog.hl7-info.com/#ixzz1IaDzlyzC