cancel
Showing results for 
Search instead for 
Did you mean: 

Updating draft delivery isn't able to delete packages

former_member622512
Participant
0 Kudos
85

Goodmorning,

Currently we face some issues while we are trying to update a draft delivery document inside sbo.

The method of the B1 object call is set to: Synchronous Insert with fallback to update.

For example when we have a draft delivery with the following amount of packages and we want to delete for example package 3 it doesn't work at all.

All relations from the items to the packages are also removed  before we send the xml towards B1if.



<DocumentPackages>

  <row>

  <Number>1</Number>

  <Type>Pallet 120x8</Type>

  <Units>3</Units>

  </row>

  <row>

  <Number>2</Number>

  <Type>Pallet 120x80</Type>

  <Units>3</Units>

  </row>

  <row>

  <Number>3</Number>

  <Type>Pallet 120x80</Type>

  <Units>3</Units>

  </row>

</DocumentPackages>


Once we send the update where only 2 packages exist, this will be the actual result:


<DocumentPackages>

  <row>

  <Number>1</Number>

  <Type>Pallet 120x80 UPDATED</Type>

  <Units>3</Units>

  </row>

  <row>

  <Number>2</Number>

  <Type>Pallet 120x80 UPDATED</Type>

  <Units>3</Units>

  </row>

  <row>

  <Number>3</Number>

  <Type>Pallet 120x80</Type>

  <Units>3</Units>

  </row>

</DocumentPackages>

So all changes are visible however not the actual removal of the third package.

Are we doing something wrong, or is this just not possible at all?

Kind regards,

Marcel Kieboom

View Entire Topic
Former Member
0 Kudos

Hi Marcel

I'm using 'Synchronous Update' in a similar case. I've read on this forum that other developers use updateDocWithSubDeletion.

You can also consider using XPath to select your method dynamically.

Kind regards,

Radek

former_member622512
Participant
0 Kudos

Hi Radek,

Thank you for your reply!

Later this day I will test it and let you know if it works.

Kind regards,

Marcel

former_member622512
Participant
0 Kudos

Hi Radek,

Based on your input I searched several topics regarding this issue for some extra information.

Currently I've tested the scenario with updateDocwithSubDeletion, however for some reason he doesn't find my docentry anymore.

The message I receive is:

Exception : DI Error: (-1) [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot insert the value NULL into column 'DocEntry', table '#databasename#.dbo.ODRF'; column does not allow nulls. INSERT fails

Kind regards,

Marcel

former_member192773
Active Participant
0 Kudos

Hello Marcel,

It seems that this is not the correct function. I assume that you only could delete lines, no packages.

Could you post your Business-Object XML for more info?

See B1i-help:

updateDocWithSubDeletion

Use the DocWithSubDeletion method only for Document objects 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 59, 60, 112, 163, 164, 165, 166, 203,204, and 540000006 only. This method updates an existing object instance in SAP Business One and deletes some line items.

The Payload parameter is mandatory. Define a predecessor transformation that provides the payload the integration framework sends to the SAP Business One DI API. In the Key Value field, enter the primary key for the instance, this is mandatory.

The DI action is updateDocWithSubDeletion.

If the object instance does not exist in SAP Business One, the DI call raises an exception. The integration framework behaves as described for the Stop processing if fails parameter.

Best Regards/Groeten

Teun Aben

former_member622512
Participant
0 Kudos

Hi Teun,

Thank you for your reply.

I also read that explanation in the help.

Currently the atom which needs to update the draft delivery has the following xml:

The DocEntry of the object is given to the B1 Object atom itself.


<xsl:template name="B1if.object.schema.DeliveryNotes">

<Documents xmlns="">

<row>

<DocObjectCode>

<xsl:value-of select="$msg/CreateDraftDocument/Documents/row/DocObjectCode"></xsl:value-of>

</DocObjectCode>

<DocDate>

<xsl:value-of select="$msg/CreateDraftDocument/Documents/row/DocDate"></xsl:value-of>

</DocDate>

<DocDueDate>

<xsl:value-of select="$msg/CreateDraftDocument/Documents/row/DocDueDate"></xsl:value-of>

</DocDueDate>

<CardCode>

<xsl:value-of select="$msg/CreateDraftDocument/Documents/row/CardCode"></xsl:value-of>

</CardCode>

<U_Status>

<xsl:value-of select="$msg/CreateDraftDocument/Documents/row/U_Status"></xsl:value-of>

</U_Status>

</row>

</Documents>

<Document_Lines xmlns="">

<xsl:for-each select="$msg/CreateDraftDocument/Document_Lines/row">

<row>

<LineNum>

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

</LineNum>

<ItemCode>

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

</ItemCode>

<Quantity>

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

</Quantity>

<WarehouseCode>

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

</WarehouseCode>

</row>

</xsl:for-each>

</Document_Lines>

<SerialNumbers xmlns="">

<xsl:for-each select="$msg/CreateDraftDocument/SerialNumbers/row">

<xsl:variable name="last" select="last()"></xsl:variable>

<xsl:if test="$last&gt;1">

<xsl:variable name="pos12" select="concat(&apos;atom12_&apos;,position())"></xsl:variable>

</xsl:if>

<xsl:if test="$last=1">

<xsl:variable name="pos12" select="&apos;atom12&apos;"></xsl:variable>

</xsl:if>

<row>

<SystemSerialNumber>

<xsl:value-of select="/vpf:Msg/vpf:Body/vpf:Payload[./@id=$pos12]/jdbc:ResultSet/jdbc:Row/jdbc:SysNumber"></xsl:value-of>

</SystemSerialNumber>

<BaseLineNumber>

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

</BaseLineNumber>

<InternalSerialNumber>

<xsl:value-of select="./InternalSerialNumber"></xsl:value-of>

</InternalSerialNumber>

<Quantity>

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

</Quantity>

</row>

</xsl:for-each>

</SerialNumbers>

<DocumentLinesBinAllocations xmlns="">

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

<row>

<BinAbsEntry>

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

</BinAbsEntry>

<Quantity>

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

</Quantity>

<SerialAndBatchNumbersBaseLine>

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

</SerialAndBatchNumbersBaseLine>

<BaseLineNumber>

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

</BaseLineNumber>

</row>

</xsl:for-each>

</DocumentLinesBinAllocations>

<DocumentPackages xmlns="">

<xsl:for-each select="$msg/CreateDraftDocument/DocumentPackages/row">

<row>

<Number>

<xsl:value-of select="./Number"></xsl:value-of>

</Number>

<Type>

<xsl:value-of select="./Type"></xsl:value-of>

</Type>

<Units>

<xsl:value-of select="./Units"></xsl:value-of>

</Units>

<U_Pakhoogte>

<xsl:value-of select="./U_Pakhoogte"></xsl:value-of>

</U_Pakhoogte>

<U_PakLengte>

<xsl:value-of select="./U_PakLengte"></xsl:value-of>

</U_PakLengte>

<U_Pakbreedte>

<xsl:value-of select="./U_Pakbreedte"></xsl:value-of>

</U_Pakbreedte>

<U_Pakgewicht>

<xsl:value-of select="./U_Pakgewicht"></xsl:value-of>

</U_Pakgewicht>

</row>

</xsl:for-each>

</DocumentPackages>

<DocumentPackageItems xmlns="">

<xsl:for-each select="$msg/CreateDraftDocument/DocumentPackageItems/row">

<row>

<PackageNumber>

<xsl:value-of select="./PackageNumber"></xsl:value-of>

</PackageNumber>

<ItemCode>

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

</ItemCode>

<Quantity>

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

</Quantity>

<UoMEntry>

<xsl:value-of select="./UoMEntry"></xsl:value-of>

</UoMEntry>

<UnitsOfMeasurement>

<xsl:value-of select="./UnitsOfMeasurement"></xsl:value-of>

</UnitsOfMeasurement>

</row>

</xsl:for-each>

</DocumentPackageItems>

</xsl:template>

Kind regards,

Marcel Kieboom