SDK problem with SalesDocument.Convert

Overview

With the flow control "Set the quantity shipped value to zero when converting the sales order to sales invoice" set to True (Documents > Misc > Others > Others1), when trying to convert a sales order to an invoice via the API the non-inventoried items (mainly 'SH' for shipping) are set to zero.

Including the additional argument sLineSequenceXML with ConvertLineItems XML, has no effect on this issue. There appears to be no way via the API to set the quantities of the non-inventoried items on an invoice.

Solution

There is a limitation from SDK: while "Set the quantity shipped value to zero when converting the sales order to sales invoice" is set to True, you can't submit non-inventory items with shipped quantity.

Option 1: All invoicing is handled through the API

If all invoicing is handled through the API, you can update the "Set the quantity shipped value to zero when converting the sales order to sales invoice" flag false from the database while converting SO to SI from SDK and set back to true after completing the transaction, while passing the sequence to be converted through the sLineSequenceXML parameter.

  • Set the flow control flag to False:

    UPDATE "<Company_Database>".."DIVISION" 
    SET "INVDEFQTYZ"='F'
    WHERE "DIV_CODE"='<Div_Code>' AND "INVDEFQTYZ"='T'
  • Pass the sequence

    Example

    <ConvertLineItems>
    <Sequence>2</Sequence>
    <Sequence>4</Sequence>
    </ConvertLineItems>

    This will convert only the second and fourth line item.

  • Set the flow control flag to True:

    UPDATE "<Company_Database>".."DIVISION" 
    SET "INVDEFQTYZ"='T'
    WHERE "DIV_CODE"='<Div_Code>' AND "INVDEFQTYZ"='F'

Option 2: Users are performing manual invoicing in addition to automated processes

If you have users performing manual invoicing, then the flow control switch affects their actions too. If the quantities are automatically set, then when the user presses F4 to invoice the order, the committed quantities are used for items that are committed, but items that are not committed are automatically set to the ordered quantity even though the committed quantity is zero. This causes problems because the user ends up invoicing the wrong quantities.

In this situation, you can create an inventory item (without maintaining price) instead of using a non-inventory item. That way you can convert the sale order to an invoice from the SDK with quantity.

Comments

0 comments

Please sign in to leave a comment.