Dehydrating Messages and Orchestration due to SAP port error RRS feed

  • Question

  • Hi All,
    I am facing some problem in a solution i developed where i get employee vouchers from SQL ..then in Pipeline i do debatching of to segregate individual employee messages.
    Now i send these voucher messages to two way SAP port to park response SAP gives voucher number which i again store in SQL table..

    Now sometimes i get error at SAP port as 

    The Messaging Engine received an error from transport adapter "SAP" when notifying the adapter with the BatchComplete event. Reason "Value does not fall within the expected range"

    or as Time Out Error 
    Due to this the messages i got when SQL adapter polled SQL table ..all of these messages gets into Dehydrated State..
    Now to come out of this i suspend messages and then terminate Orchestration and messages.
    But as i noticed some of the vouchers gets parked in SAP and there where no response XML ..
    Only i see all messages go in dehydrated state..

    Otherwise i do get Response XML..which i store in SQL table..
    So as i don't know which vouchers has been parked ...i try again resetting status in SQL table so that it can again ready for parking..

    Could anyone pls help me what  would have caused SAP port Error..

    Pls Advise..

    -- Regards Sandeep
    Tuesday, March 16, 2010 4:51 AM

All replies

  • A BatchComplete event occurs when the adapter tries to submit a batch (for you to SAP) and it fails for some reason. This is an adapter (or supporting infrastructure) failure and usually the resolutions are to change something about the adapter - which is not relevant in your case. One recommendation would be to make the batch smaller or the timeout longer so that you are less likely to get a timeout when submitting the batch.

    Here is an article on increasing the timeout:

    This link gives you more info on the BatchComplete event but this is targeted for adapter developers:

    If this answers your question, please use the "Answer" button to say so | Ben Cline
    Thursday, March 18, 2010 5:39 PM
  • Hi Ben,

    Many thanks for your reply..

    One thing i can't able to figure out why i am not getting response XML..when request XML has been send to SAP. Also in a batch it could be not more than 10 request XML to SAP would go...


    I checked when request XML has been sent to SAP and request XML is parked in SAP and SAP generates voucher number in response..then why orchestration gop in dehydrated state with request XML with status Active...

    Normally the biztalk solution working perfectly fine...i do get response XML and with no error.

    One thing i noticed: When i get BatchComplete event error , in the batch of messages there would be one message which have error like "Invalid Posting Key" this error is application specific error and normally i can able to catch exception in orchestration  with exception Object Type as"System.Web.Services.Protocols.SoapException" and within catch exception scope

    i called stored procedure to reset status in database and then i use terminate shape to terminate the operation..

    Also i am using BizTalk Adapter v2.0 SAP where i can set the setting you advised..


    Pls Advise...





    Friday, March 19, 2010 5:03 AM
  • Maybe try adding another exception handler that is more general than SoapException? It sounds like a different exception type is being thrown perhaps for your application error or some other error.

    What do you do in the SoapException exception handler block? If you do not suspend the message then this explains why it does not show up in the admin console. The exception handler "eats the exception" (catches it) and the orchestration can continue to execute without suspending.

    If you are using the older SAP adapter, the timeout I mentioned earlier does not apply.


    If this answers your question, please use the "Answer" button to say so | Ben Cline
    Friday, March 19, 2010 7:19 AM
  • Hi Ben ..

    Thanks for your reply..


    In exception block i wrote below mentioned code in construct message shape which constructs NACK message

    And i call class method which actually execute sql command to update sql table to reset the voucher for sending to SAP again...then after message construct block i have terminate shape to terminate the operation..


    SAPError_Xml_TE = new System.Xml.XmlDocument();
    Message_SAP_NACK_TE_Skelta = SAPError_Xml_TE;
    SAPError_Xml_TE = null;
    ErrorSAP_TE = xpath(Message_SAP_NACK_TE_Skelta,"string(/*[local-name()='NACK' and namespace-uri()='']/*[local-name()='ErrorDescription' and namespace-uri()=''])");
    ObjExcep_TE = new SAP_Exception.Class_SAP_Exception();


    I catch exception which is mentioned below, sometimes i can catch such exceptions but when BatchComplete event error occurs then all the orchestrations gets dehydrated: 



    Microsoft.XLANGs.Core.XlangSoapException: An error occurred while processing the message, refer to the details section for more information 
    Message ID: {F77E3A23-CF5E-48FB-B5B6-7DFBC192D5BD}
    Instance ID: {F9D766D1-ADC7-4E7A-B405-27FEABF81348}
    Error Description: Posting key 31 does not permit specification of a special G/L indicator
       at Microsoft.BizTalk.XLANGs.BTXEngine.BTXPortBase.VerifyTransport(Envelope env, Int32 operationId, Context ctx)
       at Microsoft.XLANGs.Core.Subscription.Receive(Segment s, Context ctx, Envelope& env, Boolean topOnly)
       at Microsoft.XLANGs.Core.PortBase.GetMessageId(Subscription subscription, Segment currentSegment, Context cxt, Envelope& env, CachedObject location)
       at BizTalk_Skelta_TE_Voucher.Orchestration_Skelta_TE.segment2(StopConditions stopOn)
       at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
    For more information, see Help and Support Center at


    One thing i noticed: When i get BatchComplete event error , in the batch of messages there would be one message which have error  as mentioned above(Posting key 31 does not permit specification of a special G/L indicator)

    Due to BatchComplete event error all orchestrations which are in process gets dehydrated..

    I  mean the messages which is picked by SQL adapter in a lot ..all of this messages orchestrations gets dehydrated...

    Pls Advise...




    -- Regards Sandeep
    Friday, March 19, 2010 8:20 AM