oShipLines.nCopyLinesFromSalesOrder(soOrder) is copying an extra line

SOLVED

Hi Forum,

I am using .nCopyLinesFromSalesOrder(soOrder) to bring in all lines from the Sales Order into Shipping Invoice data entry and every order I import is duplicating the lines.

Any advice on this will be greatly appreciated.

Regards,

Manuel

Top Replies

Parents
  • +1
    verified answer

    , I believe when you do the .nSetValue("SalesOrderNo$", soOrder) to the invoice header object, it uses that CopyLinesFromSalesOrder() method to copy the lines within the validation of the Sales Order number.  So if you do it manually after, you'll get the duplicate lines, so try leaving out your call and let the validation of the sales order do that.

    Hope that helps

    Elliott

  • 0 in reply to jepritch

    Elliott,

    Do you know of an easy way to pull in the missing lines from the SO (not in the invoice source file used by VI), so those un-invoiced lines are back-ordered properly?  I experimented a bit with a similar CopyLinesFromSalesOrder strategy (using VI PerformLogic) and had the same problem with duplicate lines.

    I could probably write a PreTotals script, but that would require looping through the invoice lines multiple times (for each SO line), which would slow down the import for large orders / invoices.

  • 0 in reply to Kevin M

    Hey Kevin,

    Not sure how your import works, but you would need the sales order line key when adding the invoice line so that the 2 are married up.  If you have that, you could maybe keep track of the SO Line Keys in a storage var, then on the pre-write of the invoice itself, you could go through the sales order and add in the lines that do not have their line key in your string of lines stored in the storage var (use oSession storage btw).  This would alleviate having to make multiple loops through the invoice lines.

    Not sure if I fully grasp everything.  The only issue with my method would be the lines will be in a different order than the sales order.

    I haven't tried this obviously, but sounds like it might work.  If you want to email me more details maybe we can work it out.  Should be possible without having to loop too many times on the lines.

    E

Reply
  • 0 in reply to Kevin M

    Hey Kevin,

    Not sure how your import works, but you would need the sales order line key when adding the invoice line so that the 2 are married up.  If you have that, you could maybe keep track of the SO Line Keys in a storage var, then on the pre-write of the invoice itself, you could go through the sales order and add in the lines that do not have their line key in your string of lines stored in the storage var (use oSession storage btw).  This would alleviate having to make multiple loops through the invoice lines.

    Not sure if I fully grasp everything.  The only issue with my method would be the lines will be in a different order than the sales order.

    I haven't tried this obviously, but sounds like it might work.  If you want to email me more details maybe we can work it out.  Should be possible without having to loop too many times on the lines.

    E

Children
No Data