none
Question about SAP IDOC to X12 856 RRS feed

  • Question

  • In my mapping of the EDI 856, I am creating the correct amount of HLLoops, however the first line item that is displaying in LIN01 is actually the third line item in the SAP IDOC. It seems that my HLLoop logic for creating the HL01, and HL02 is consuming these line items. I am using the POSEX value to create the HLLoop iterations for the line items <HL03>I</HL03>. For creating the <HL03>S</HL03> and<HL03>0</HL03>  i am using TABNAM and MANDT, under the EDI_DC40 record. 

    Example:

    <ns0:HLLoop1>

    - <ns0:HL>
      <HL01>2</HL01>
      <HL02>1</HL02>
      <HL03>0</HL03>
     </ns0:HL>
    - <ns0:PRF>
      <PRF01>po number</PRF01>
      <PRF02>20110623</PRF02>
      </ns0:PRF>
    - <ns0:REF>
      <REF01>CR</REF01>
      <REF02>0000826737</REF02>
      </ns0:REF>
      </ns0:HLLoop1>

     

    - <ns0:HLLoop1>
    - <ns0:HL>
      <HL01>3</HL01>
      <HL02>2</HL02>
      <HL03>I</HL03>
      </ns0:HL>
    - <ns0:LIN>
      <LIN01>3rd line item, expecting 1st</LIN01>
      ...
      </ns0:LIN><ns0:LIN>
     
    ...
    </ns0:LIN>
    - <ns0:SN1>  I appreciate any help or insight anyone can provide.  Thank you

     Update:

    I was able to grab these values, using an XPATH expression however as the XPATH can not hold a variable for the index, as far as I know, this approach does not seem very pratical. Does anyone have thoughts on how else that can be accomplished?

    Thanks again

    • Edited by JohnBon Tuesday, December 13, 2011 2:01 AM
    Sunday, December 11, 2011 10:16 PM

Answers

  • Thanks, Geordie. I did check out the book, and was able to leverage the HLLoop segment creation from those examples, however with the SAP IDOC being more complicated than the input schema in the example, I still seemed to have the same issue. To overcome it I used an ArrrayList to hold the values and then use them later in the LIN and SN1 (see below)public string, with the input being the HLLoop value - 3 . Maybe XSLT would have been better, but it just did not seem to work for me when it came to conditional logic.

    public string AccessGlobalArrayListPOSEX(int i)
    {
     string retValue = "";
                    if (i >= 0 && i <= (_globalArrayListPOSEX.Count -1))

    {
      retValue += (string)_globalArrayListPOSEX[i];

    }
     return retValue;
    }

    Thanks Torben and Geordie for the feedback.
    • Edited by JohnBon Thursday, December 15, 2011 3:42 PM
    • Marked as answer by JohnBon Thursday, December 15, 2011 3:42 PM
    Thursday, December 15, 2011 3:42 PM

All replies

  • Hi

    Use a custom XSLT functoid to create PRF and REF section and then those two wouldn't have been used when you come to your line section is just one way to solve you mapping issue.

     

    /Torben


    Torben Christiansen www.snatchedmoments.com
    Tuesday, December 13, 2011 7:20 AM
  • Thanks for the response, Torben. So, for the REF i will have different values. For a custom XSLT functoid, can I use a conditional statement? If, so can you provide what that looks like?

     

     

    Wednesday, December 14, 2011 2:16 AM
  • Hi

    you can do almost anything you want in a custom XSLT functoid and if you have a really hard logic you can on the mapper use a complete XSLT file instead of your mapper. Here are some info about the XSLT functoid: http://msdn.microsoft.com/en-us/library/aa561574(v=BTS.10).aspx


    Torben Christiansen www.snatchedmoments.com
    Wednesday, December 14, 2011 7:50 AM
  • Hi John,

    I have yet to try to create the map you are working on but it is an upcomming project.  In preperation I bought a book called 'Pro Mapping in BizTalk Server 2009'.  It contains a chapter (19) called 'Taming the Dreaded 856 ASN HL Loop'.  It presents some alternative approaches to implementing this mapping using static mapping variables for loop counting.  This might be a good place to look for some ideas.

    Good luck, Geordie

    • Marked as answer by JohnBon Thursday, December 15, 2011 3:35 PM
    • Unmarked as answer by JohnBon Thursday, December 15, 2011 3:36 PM
    Thursday, December 15, 2011 2:41 AM
  • Thanks, Geordie. I did check out the book, and was able to leverage the HLLoop segment creation from those examples, however with the SAP IDOC being more complicated than the input schema in the example, I still seemed to have the same issue. To overcome it I used an ArrrayList to hold the values and then use them later in the LIN and SN1 (see below)public string, with the input being the HLLoop value - 3 . Maybe XSLT would have been better, but it just did not seem to work for me when it came to conditional logic.

    public string AccessGlobalArrayListPOSEX(int i)
    {
     string retValue = "";
                    if (i >= 0 && i <= (_globalArrayListPOSEX.Count -1))

    {
      retValue += (string)_globalArrayListPOSEX[i];

    }
     return retValue;
    }

    Thanks Torben and Geordie for the feedback.
    • Edited by JohnBon Thursday, December 15, 2011 3:42 PM
    • Marked as answer by JohnBon Thursday, December 15, 2011 3:42 PM
    Thursday, December 15, 2011 3:42 PM