Skip to Content

Multireference to same base Line number (Delivery Note / Invoice)

Dear Experts,

the DI-API does not allow to reference several times in a Delivery Note or AR Invoice on the same base line (e.g. of Purchase Order).

This issue happens in purchasing integration with SAP ECC and B1.

In SAP ECC we create e.g. collective Delivery Notes or collective Invoices which will be transformed in B1iSN to Goods Receipt,AR Invoice or AR Reserve Invoices.

In SAP ECC it is allowed to reference several times on the same LINE of Sales Orders (B1-Purchase Orders).

B1 does not allow such a multireference so we can only see the chance to summarize somehow same base lines and base entries to one line and handle it over to DI-API.

Are there already some experiences or examples in XSLT existing?

Thanks for your held,


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Jan 03, 2014 at 09:30 AM

    Hi Gerrit!

    Unfortunately the DI-API does not allow referencing the same baseline more than once per document. Neither does the DI-Proxy or B1 client. This is a pity because I cannot see any technical reason for this, it works if you use several documents.

    Yes, I have experienced this limitation a couple of times.

    There are only two alternatives to solve this:

    1. Change in ECC so that the delivery note or invoice is grouped on baseEntry and baseLine.

    2. Change in B1i xsl so that you are making the grouping here, i.e. you have to create 1 line in the document for each baseEntry-baseLine combination.



    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Gerrit!

      The main challenge with this is making the grouping in xsl. As it is only functions in xslt 1.0 that we can use it is not that obvious how to do. In xslt 2.0 and above there are a built-in distinct-values() function.

      This is how you can do the grouping:

      <xsl:for-each select="/test/item/baseEntry[not(.=preceding::*)]">

      <xsl:variable name="baseEntry" select="."/>

      <xsl:for-each select="/test/item[baseEntry=$baseEntry]/baseLine[not(.=preceding::*)]">

      <xsl:variable name="baseLine" select="."/>

      <!-- insert your code here: create a Document_Lines node -->



      You have to replace the xpath so it matches your IDOC. But the main thing to keep is the [not(.=preceding::*].

      Inside the loop, get the sum using the sum() function:


      <xsl:value-of select="sum(/test/item[baseEntry=$baseEntry and baseLine=$baseLine]/Qty)"/>




Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.