cancel
Showing results for 
Search instead for 
Did you mean: 

Error creating delivery notes with batch numbers and bin locations

Former Member
0 Kudos

Hello everyone,

im having the following error when trying to add multiple items from a sales order to a delivery using batch numbers and bin locations.

As long as i am using a single item its fine. using multiple items causes the following error

Payload Role="C" id="atom1" system="0010000119" status="success" b1login="Technical User" method="Synchronous Insert" objectid="15" payload="atom2" keyname="DocEntry" keyvalue="0" DIresult="failure" DImsg="Exception : DI Error: (-5002) Invalid value [DLN1.BaseLine][line: 1]" />

this is the message i prepared and no matter how i assing line number, seriallinenumbers etc. it wont work.


<?xml version='1.0' encoding="UTF-8"?>

<CreateDelivery>

  <Document>

  <CardCode>K100002</CardCode>

  <DocDate>2014-01-08</DocDate>

  <DocDueDate>2014-01-08</DocDueDate>

  <DocNum>200027</DocNum>

  <DocumentLines>

  <row>

  <DocEntry>42</DocEntry>

  <LineNum>0</LineNum>

  <ItemCode>8705</ItemCode>

  <Quantity>10</Quantity>

  <WarehouseCode>SB</WarehouseCode>

  </row>

  <row>

  <DocEntry>42</DocEntry>

  <LineNum>1</LineNum>

  <ItemCode>8705</ItemCode>

  <Quantity>10</Quantity>

  <WarehouseCode>LH</WarehouseCode>

  </row>

  </DocumentLines>

  <BatchNumbers>

  <row>

  <BatchNumber>20150701</BatchNumber>

  <Quantity>10</Quantity>

  <BaseLineNumber>0</BaseLineNumber>

  </row>

  <row>

  <BatchNumber>20141229</BatchNumber>

  <Quantity>10</Quantity>

  <BaseLineNumber>1</BaseLineNumber>

  </row>

  </BatchNumbers>

  <DocumentLinesBinAllocations>

  <row>

  <BinAbsEntry>4</BinAbsEntry>

  <Quantity>5</Quantity>

  <BaseLineNumber>0</BaseLineNumber>

  <SerialAndBatchNumbersBaseLine>0</SerialAndBatchNumbersBaseLine>

  </row>

  <row>

  <BinAbsEntry>5</BinAbsEntry>

  <Quantity>5</Quantity>

  <BaseLineNumber>0</BaseLineNumber>

  <SerialAndBatchNumbersBaseLine>0</SerialAndBatchNumbersBaseLine>

  </row>

  </DocumentLinesBinAllocations>

  </Document>

</CreateDelivery>

Accepted Solutions (1)

Accepted Solutions (1)

bastian_schaefer
Active Contributor
0 Kudos

Hi Simon,

the problem seems to be structure of your Document.

Your schema is the following:


<CreateDelivery>

     <Document>

          <DocumentLines>

               ...

          </DocumentLines>

               ...

          </BatchNumbers>

     </Document>

</CreateDelivery>

Please run the metadata retrieval (Maintenance -> Cfg Metadata) and check the B1 object help via Help -> B1 Object Help, display the Object List and check the Object Template for DeliveryNotes:


<Documents>

     <row>

          <!--multiple such elements are allowed-->

          ...

     </row>

</Documents>
<Document_Lines>
       <row>

          <!--multiple such elements are allowed-->

          ...

</row>

</Document_Lines>

<BatchNumbers>

<row>

<!--multiple such elements are allowed-->

...

</row>

</BatchNumbers>

<DocumentLinesBinAllocations>

<row>

<!--multiple such elements are allowed-->

...

</row>

</DocumentLinesBinAllocations>

Best regards

Bastian

Former Member
0 Kudos

Hello Bastian,

you are partially right. I have not exactly followed the structure. Since my structure worked for a single item (including batch and bin locations) i didnt think about rechecking the structure. Anyway, i changed the structure so i could erase this source of errors.

This is my atom2 which prepares the statement:


<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:b1e="urn:com.sap.b1i.sim:b1event" xmlns:b1ie="urn:com.sap.b1i.sim:b1ievent" xmlns:b1im="urn:com.sap.b1i.sim:b1imessage" xmlns:bfa="urn:com.sap.b1i.bizprocessor:bizatoms" xmlns:jdbc="urn:com.sap.b1i.adapter:jdbcadapter" xmlns:rfc="urn:sap-com:document:sap:rfc:functions" xmlns:sim="urn:com.sap.b1i.sim:entity" xmlns:utils2="com.sap.b1i.bpc_tools.Utilities" xmlns:vpf="urn:com.sap.b1i.vplatform:entity" xmlns:xci="urn:com.sap.b1i.xcellerator:intdoc" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" bfa:force="" vpf:force="" jdbc:force="" rfc:force="" b1ie:force="" b1e:force="" xci:force="" sim:force="" utils2:force="" b1im:force="">

  <xsl:output method="xml" encoding="UTF-8" indent="yes"/>

  <xsl:param name="atom"/>

  <xsl:param name="sessionid"/>

  <xsl:variable name="msg" select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role=&apos;S&apos;]"/>

  <xsl:variable name="vpSender" select="/vpf:Msg/vpf:Header/vpf:Sender/@Id"/>

  <xsl:variable name="vpObject" select="/vpf:Msg/vpf:Header/vpf:Sender/@ObjId"/>

  <xsl:variable name="vpReceiver" select="/vpf:Msg/vpf:Header/vpf:ReceiverList/vpf:Receiver[./@handover=&apos;P&apos;]/@Id"/>

  <xsl:template match="/">

  <Msg xmlns="urn:com.sap.b1i.vplatform:entity">

  <xsl:copy-of select="/vpf:Msg/@*"/>

  <xsl:copy-of select="/vpf:Msg/vpf:Header"/>

  <Body>

  <xsl:copy-of select="/vpf:Msg/vpf:Body/*"/>

  <Payload Role="X" id="{$atom}">

  <xsl:call-template name="transform"/>

  </Payload>

  </Body>

  </Msg>

  </xsl:template>

  <xsl:template name="transform">

  <BOM xmlns="">

  <BO>

  <AdmInfo>

  <Object>15</Object>

  <Version>2</Version>

  </AdmInfo>

  <QueryParams>

  <DocEntry>0</DocEntry>

  </QueryParams>

  <Documents>

  <xsl:for-each select="$msg/CreateDelivery/Documents/row">

  <row>

  <!--multiple such elements are allowed-->

  <DocNum>

  <xsl:value-of select="DocNum"/>

  </DocNum>

  <DocType>I</DocType>

  <DocDate>

  <xsl:value-of select="DocDate"/>

  </DocDate>

  <DocDueDate>

  <xsl:value-of select="DocDueDate"/>

  </DocDueDate>

  <CardCode>

  <xsl:value-of select="CardCode"/>

  </CardCode>

  </row>

  </xsl:for-each>

  </Documents>

  <Document_Lines>

  <xsl:for-each select="$msg/CreateDelivery/DocumentLines/row">

  <row>

  <!--multiple such elements are allowed-->

  <LineNum>

  <xsl:value-of select="LineNum"/>

  </LineNum>

  <ItemCode>

  <xsl:value-of select="ItemCode"/>

  </ItemCode>

  <Quantity>

  <xsl:value-of select="Quantity"/>

  </Quantity>

  <WarehouseCode>

  <xsl:value-of select="WarehouseCode"/>

  </WarehouseCode>

  <BaseEntry>

  <xsl:value-of select="DocEntry"/>

  </BaseEntry>

  <BaseType>17</BaseType>

  <TreeType>N</TreeType>

  </row>

  </xsl:for-each>

  </Document_Lines>

  <BatchNumbers>

  <xsl:for-each select="$msg/CreateDelivery/BatchNumbers/row">

  <row>

  <BatchNumber>

  <xsl:value-of select="BatchNumber"/>

  </BatchNumber>

  <ExpiryDate>

  <xsl:value-of select="ExpiryDate"/>

  </ExpiryDate>

  <Quantity>

  <xsl:value-of select="Quantity"/>

  </Quantity>

  <BaseLineNumber>

  <xsl:value-of select="BaseLineNumber"/>

  </BaseLineNumber>

  </row>

  </xsl:for-each>

  </BatchNumbers>

  <DocumentLinesBinAllocations>

  <xsl:for-each select="$msg/CreateDelivery/DocumentLinesBinAllocations/row">

  <row>

  <BinAbsEntry>

  <xsl:value-of select="BinAbsEntry"/>

  </BinAbsEntry>

  <AllowNegativeQuantity>Y</AllowNegativeQuantity>

  <Quantity>

  <xsl:value-of select="Quantity"/>

  </Quantity>

  <SerialAndBatchNumbersBaseLine>

  <xsl:value-of select="SerialAndBatchNumbersBaseLine"/>

  </SerialAndBatchNumbersBaseLine>

  <BaseLineNumber>

  <xsl:value-of select="BaseLineNumber"/>

  </BaseLineNumber>

  </row>

  </xsl:for-each>

  </DocumentLinesBinAllocations>

  </BO>

  </BOM>

  </xsl:template>

</xsl:stylesheet>

This is my inbound message when using the TEST functionality in the processing


<?xml version='1.0' encoding="UTF-8"?>

<CreateDelivery>

  <Documents>

  <row>

  <CardCode>K100002</CardCode>

  <DocDate>2014-01-09</DocDate>

  <DocDueDate>2014-01-09</DocDueDate>

  <DocNum>200030</DocNum>

  </row>

  </Documents>

  <DocumentLines>

  <row>

  <DocEntry>44</DocEntry>

  <LineNum>0</LineNum> 

  <ItemCode>8705</ItemCode>

  <Quantity>10</Quantity>

  <WarehouseCode>LH</WarehouseCode>

  </row>

  <row>

  <DocEntry>44</DocEntry>

  <LineNum>1</LineNum>

  <ItemCode>1010</ItemCode>

  <Quantity>10</Quantity>

  <WarehouseCode>LH</WarehouseCode>

  </row>

  </DocumentLines>

  <BatchNumbers>

  <row>

  <BatchNumber>20150701</BatchNumber>

  <ExpiryDate>07.07.2015</ExpiryDate>

  <Quantity>10</Quantity>

  <BaseLineNumber>0</BaseLineNumber>

  </row>

  <row>

  <BatchNumber>20141229</BatchNumber>

  <ExpiryDate>29.10.2015</ExpiryDate>

  <Quantity>10</Quantity>

  <BaseLineNumber>1</BaseLineNumber>

  </row>

  </BatchNumbers>

  <!-- <DocumentLinesBinAllocations>

  <row>

  <BinAbsEntry>4</BinAbsEntry>

  <Quantity>5</Quantity>

  <BaseLineNumber>0</BaseLineNumber>

  <SerialAndBatchNumbersBaseLine>0</SerialAndBatchNumbersBaseLine>

  </row>

  <row>

  <BinAbsEntry>5</BinAbsEntry>

  <Quantity>5</Quantity>

  <BaseLineNumber>0</BaseLineNumber>

  <SerialAndBatchNumbersBaseLine>0</SerialAndBatchNumbersBaseLine>

  </row>

  </DocumentLinesBinAllocations> -->

</CreateDelivery>

and this is the result:


<Msg xmlns="urn:com.sap.b1i.vplatform:entity" MessageId="15011015241755705762C0A80209124C" BeginTimeStamp="20150110152417" logmsg="0000" SubMessageId="" status="success" owntst="true" test="true">

  <Header>

  <IPO Id="vPlatform_Test" />

  <Sender Id="" ObjId="CreateDelivery" />

  <Receiver Id="" />

  <ReceiverList>

  <Receiver Id="" handover="P" />

  </ReceiverList>

  <Identification Ident="Root Tag" IdPar="n.a." />

  <nsList />

  <vBIU Id="Z.CreateDelivery" ver="1.0.0" SId="Z.MobileLager" filter="" phase="" />

  <Variables>

  <var id="userid" value="" />

  <var id="username" value="" />

  </Variables>

  <Properties />

  <SysTypeProperties type="B1if" offline="" snd="senderdummy" rcv="receiverdummy" ssystype="" rsystype="" />

  <LocalProperties type="B1if" biu="Z.CreateDelivery" snd="senderdummy" rcv="receiverdummy" sid="Z.MobileLager" offline="" />

  <VarProperties />

  </Header>

  <Body>

  <Payload Role="T" Type="Call" />

  <Payload Role="S">

  <CreateDelivery xmlns="">

  <Documents>

  <row>

  <CardCode>K100002</CardCode>

  <DocDate>2014-01-09</DocDate>

  <DocDueDate>2014-01-09</DocDueDate>

  <DocNum>200030</DocNum>

  </row>

  </Documents>

  <DocumentLines>

  <row>

  <DocEntry>44</DocEntry>

  <LineNum>0</LineNum>

  <ItemCode>8705</ItemCode>

  <Quantity>10</Quantity>

  <WarehouseCode>LH</WarehouseCode>

  </row>

  <row>

  <DocEntry>44</DocEntry>

  <LineNum>1</LineNum>

  <ItemCode>1010</ItemCode>

  <Quantity>10</Quantity>

  <WarehouseCode>LH</WarehouseCode>

  </row>

  </DocumentLines>

  <BatchNumbers>

  <row>

  <BatchNumber>20150701</BatchNumber>

  <ExpiryDate>07.07.2015</ExpiryDate>

  <Quantity>10</Quantity>

  <BaseLineNumber>0</BaseLineNumber>

  </row>

  <row>

  <BatchNumber>20141229</BatchNumber>

  <ExpiryDate>29.10.2015</ExpiryDate>

  <Quantity>10</Quantity>

  <BaseLineNumber>1</BaseLineNumber>

  </row>

  </BatchNumbers>

  <!--

<DocumentLinesBinAllocations>

  <row>

  <BinAbsEntry>4</BinAbsEntry>

  <Quantity>5</Quantity>

  <BaseLineNumber>0</BaseLineNumber>

  <SerialAndBatchNumbersBaseLine>0</SerialAndBatchNumbersBaseLine>

  </row>

  <row>

  <BinAbsEntry>5</BinAbsEntry>

  <Quantity>5</Quantity>

  <BaseLineNumber>0</BaseLineNumber>

  <SerialAndBatchNumbersBaseLine>0</SerialAndBatchNumbersBaseLine>

  </row>

  </DocumentLinesBinAllocations>

  -->

  </CreateDelivery>

  </Payload>

  <Payload Role="X" id="atom2">

  <BOM xmlns="">

  <BO>

  <AdmInfo>

  <Object>15</Object>

  <Version>2</Version>

  </AdmInfo>

  <QueryParams>

  <DocEntry>0</DocEntry>

  </QueryParams>

  <Documents>

  <row>

  <DocNum>200030</DocNum>

  <DocType>I</DocType>

  <DocDate>2014-01-09</DocDate>

  <DocDueDate>2014-01-09</DocDueDate>

  <CardCode>K100002</CardCode>

  </row>

  </Documents>

  <Document_Lines>

  <row>

  <LineNum>0</LineNum>

  <ItemCode>8705</ItemCode>

  <Quantity>10</Quantity>

  <WarehouseCode>LH</WarehouseCode>

  <BaseEntry>44</BaseEntry>

  <BaseType>17</BaseType>

  <TreeType>N</TreeType>

  </row>

  <row>

  <LineNum>1</LineNum>

  <ItemCode>1010</ItemCode>

  <Quantity>10</Quantity>

  <WarehouseCode>LH</WarehouseCode>

  <BaseEntry>44</BaseEntry>

  <BaseType>17</BaseType>

  <TreeType>N</TreeType>

  </row>

  </Document_Lines>

  <BatchNumbers>

  <row>

  <BatchNumber>20150701</BatchNumber>

  <ExpiryDate>07.07.2015</ExpiryDate>

  <Quantity>10</Quantity>

  <BaseLineNumber>0</BaseLineNumber>

  </row>

  <row>

  <BatchNumber>20141229</BatchNumber>

  <ExpiryDate>29.10.2015</ExpiryDate>

  <Quantity>10</Quantity>

  <BaseLineNumber>1</BaseLineNumber>

  </row>

  </BatchNumbers>

  <DocumentLinesBinAllocations />

  </BO>

  </BOM>

  </Payload>

  <Payload Role="C" id="atom1" system="0010000119" status="success" b1login="Technical User" method="Synchronous Insert" objectid="15" payload="atom2" keyname="DocEntry" keyvalue="0" DIresult="failure" DImsg="Exception : DI Error: (-5002) Invalid value [DLN1.BaseLine][line: 1]" />

  </Body>

</Msg>

Former Member
0 Kudos

I have found out something. No matter what entry I am using for the BaseLineNumber, the entry is NULL in the database. This works if there is only one line apparently. So maybe this is a hint for furhter investigations.

Regards SImon

bastian_schaefer
Active Contributor
0 Kudos

Hi Simon,

Among some other issues, your main problem seems to be a entered reference to Sales Order, which you added into segment <Document_Lines>.

The rows you're trying to add with the delivery seems not to fit to the rows of your referenced SalesOrder 44, the <BaseLine> is not mentioned.


<Document_Lines>

     <BaseEntry>44</BaseEntry>

    <BaseLine>??</BaseLine>

     <BaseType>17</BaseType>

          ...

</Document_Lines>

Best regards

Bastian

P.S.:

The QueryParams segment is only needed if you need to update an existing document in via B1 OUTBOUND, For B1 call atoms it's irrelevant as well.

Former Member
0 Kudos

Hello Bastian,

this did the trick. Thank you so much for your help and support. You are totally right about the Query Params. I dont need them but they dont seem to bother me right now (i will still remove them)

Thanks you very much and have a nice day.

Regards Simon

BIG EDIT:

Now that i want to assign the Bin Locations i am getting the following error:

<Payload Role="C" id="atom1" system="0010000119" status="success" b1login="Technical User" method="Synchronous Insert" objectid="15" payload="atom2" keyname="DocEntry" keyvalue="0" DIresult="failure" DImsg="Exception : DI Error: (-10) 1470000838 - Invalid "SerialAndBatchNumbersBaseLine"; specify a valid "SerialAndBatchNumbersBaseLine"" />

What would be the value needed in the "SerialAndBatchNumberBaseLine". I thought it would be the same as the BaseLineNumber/BaseLine and i cant find a node in the structure which fits in my opinion or would make sense:

Thanks for another advice there

ANOTHER EDIT:

The SerialAndBatchNumbersBaseLine in the BinAllocations cannot be empty but the node is not needed in the structure itself. Just to let everyone else know that this works now.

Thank you everyone.

Answers (0)