none
Issues with creating and sending BOM XML IDOC to SAP using 2010 WCF-SAP Adapter (without using Biztalk Server) RRS feed

  • Question

  •   I'm trying to replace an existing Biztalk 2006 Send BOM IDOC process, and completely remove Biztalk server from the equation.   The existing Bizatalk 2006 server receives an input BOM (Bill of Materials) flat file, and using a Biztalk Map (BM08), and Orchestration, generates an Idoc and sends it to SAP.

      In my replacement C# program, I'm using the 2010 WCF-SAP Adapter, and am trying to generate the BOMMAT03 XML IDOC it to SAP.  

      I generated the BOMMAT03 schema from SAP using the Add Adapter Service in VS 2010.  I was able to generate a BM08 XSLT from the existing BMO8 map in the current Biztalk 2006 process.  I am able to run a XSLT transform on the input BOM flat file, and generate an XML file from that.  

      However, I've run into a few issues.   First of which, is that the XML file that is generated from the XSLT transform is NOT the same schema as the BOMMAT03 schema expects.  It's somewhat similar, but different enough that I have to manually translate between the two in my code.  I've verified that both the original Bitztalk 2006 process and my replacement program use BOMMAT V3 from SAP.  Question--Is Biztalk 2006 server doing some other magic to turn that transormed XML into the BOMMAT03 schema?    

     I ended writing code which translates the transformed XML into the BOMMAT03 schema (which is a strong typed XML IDOC at this point).

      However, when I try to send the BOMMAT03 XML IDOC, I get an exception "Object reference not set to an instance of an object."

                   idocClient.Send(idocData, ref sadapterTxGuid);

    idocData is of type BOMMAT03, and I've verified that the various fields are populated.  

      Any help is appreciated. 

    Monday, August 25, 2014 3:22 PM

Answers

  • Well, putting in a MSDN subscription support ticket for Biztalk server actually helped with the issue.  They didn't find, or fix the issue directly.  But one of the examples (https://randypaulo.wordpress.com/tag/idoc/) they sent over, jogged my memory, and I realized in the code snippet below, I had accidentally deleted the 1st line.  Such a simple mistake, yet was easy to overlook.  The URL example is almost EXACTLY like my code, but without the transform and translation code to convert from input XML file to IDOC XML.  If someone is interested in that, let me know.    

    //Forgot the 1st line.  

    idocClient = new IdocBOMMAT03SIEIS_WED_BOMMAT03V3R700Client(binding, endpointAddress);

     idocClient.Send(idocData, ref sadapterTxGuid);

    For anyone else interested in knowing, you CAN send a strongly typed IDOC to SAP using C#.NET and the WCF SAP 2010 Adapter, using the IDOC Binding Client class you generated using the Add Adapter Service Reference in VS2010.  

    The one difference, which no one, not even the tech support from MS could tell me, was why the XSLT which I generated from the original map, did not transform the input BOM XML into the BOMMAT03 XML.  Instead, it transformed it into an intermediate XML, which resembled the BOMMAT03 IDOC XML, but still needed to be translated to the BOMMAT03 IDOC format.  

    The tech support person swore up and down that it should.  But I believe that something happens in Biztalk server, after the Mapping occurs, maybe in the Pipeline, which converts that intermediate XML into the final BOMMAT03 IDOC XML format.

    I do think that the examples are severely lacking in showing how to send a strong typed IDOC using C# and the WCF-SAP Adapter.  Even worse, the examples are completely lacking in how to actually generate a weakly typed IDOC.  They show how to send that weakly typed IDOC, but show me, or give me a class to be able to generate it.

    I realize that this is not quite the "recommended way" to do it, but in reality, not everyone wants or even needs a full Biztalk installation.   For some simple stuff like this, a C#.NET program and WCF-SAP adapter do the trick.  


    • Edited by GeorgeSidor Tuesday, August 26, 2014 7:43 PM Edited my remarks
    • Proposed as answer by Angie Xu Monday, September 1, 2014 2:30 AM
    • Marked as answer by Angie Xu Tuesday, September 2, 2014 6:02 AM
    Tuesday, August 26, 2014 7:40 PM

All replies

  • Just to be clear: You do know that using the BizTalk Adapter Pack 2010 in production does require at least a Standard BizTalk Server 2010 License?

    Morten la Cour

    Monday, August 25, 2014 3:39 PM
  • Yes, we have Microsoft Software Assurance, and have licenses for Biztalk 2010 and 2013.  We simply want to begin transitioning projects from running on Biztalk server, to running in a C# program using the Biztalk SAP adapter.  It's not my decision, and personally, I'd have kept it running on Biztalk server.


    Monday, August 25, 2014 5:53 PM
  • That's too bad.  Understanding the transition is already underway, if there's any way we can help you justify keeping the apps in BizTalk, we're happy to help.

    Tuesday, August 26, 2014 12:45 AM
  • Well, putting in a MSDN subscription support ticket for Biztalk server actually helped with the issue.  They didn't find, or fix the issue directly.  But one of the examples (https://randypaulo.wordpress.com/tag/idoc/) they sent over, jogged my memory, and I realized in the code snippet below, I had accidentally deleted the 1st line.  Such a simple mistake, yet was easy to overlook.  The URL example is almost EXACTLY like my code, but without the transform and translation code to convert from input XML file to IDOC XML.  If someone is interested in that, let me know.    

    //Forgot the 1st line.  

    idocClient = new IdocBOMMAT03SIEIS_WED_BOMMAT03V3R700Client(binding, endpointAddress);

     idocClient.Send(idocData, ref sadapterTxGuid);

    For anyone else interested in knowing, you CAN send a strongly typed IDOC to SAP using C#.NET and the WCF SAP 2010 Adapter, using the IDOC Binding Client class you generated using the Add Adapter Service Reference in VS2010.  

    The one difference, which no one, not even the tech support from MS could tell me, was why the XSLT which I generated from the original map, did not transform the input BOM XML into the BOMMAT03 XML.  Instead, it transformed it into an intermediate XML, which resembled the BOMMAT03 IDOC XML, but still needed to be translated to the BOMMAT03 IDOC format.  

    The tech support person swore up and down that it should.  But I believe that something happens in Biztalk server, after the Mapping occurs, maybe in the Pipeline, which converts that intermediate XML into the final BOMMAT03 IDOC XML format.

    I do think that the examples are severely lacking in showing how to send a strong typed IDOC using C# and the WCF-SAP Adapter.  Even worse, the examples are completely lacking in how to actually generate a weakly typed IDOC.  They show how to send that weakly typed IDOC, but show me, or give me a class to be able to generate it.

    I realize that this is not quite the "recommended way" to do it, but in reality, not everyone wants or even needs a full Biztalk installation.   For some simple stuff like this, a C#.NET program and WCF-SAP adapter do the trick.  


    • Edited by GeorgeSidor Tuesday, August 26, 2014 7:43 PM Edited my remarks
    • Proposed as answer by Angie Xu Monday, September 1, 2014 2:30 AM
    • Marked as answer by Angie Xu Tuesday, September 2, 2014 6:02 AM
    Tuesday, August 26, 2014 7:40 PM