Unable to edit order line and tax amount

Hello

I am trying to edit a existing sales order using BOI,... i am able to make header level changes but when i am trying to change line level data ( ie: item code) a new line is getting created....

And when i am trying to add a new line and over write tax amount i am getting error 

Can Anyone Please Help

Thanks

  • 0
    How are you overwriting the tax amount on a new line? It might help if you posted your script.
  • 0 in reply to BadgerJerry
    Thanks @BadgerJerry for your responce ... i have added the code bellow

    ************************************************************************************************************************************************

    dim tax_amt As Double =1
    salesWrite = oScript.NewObject("SO_SalesOrder_BUS", oSS)

    If Not (CBool(salesWrite.nSetKey(document.OrderNumber ))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool( salesWrite.nSetValue("OrderDate$", document .OrderDate ))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool( salesWrite.nSetValue("ARDivisionNo$",Split(document.CustName ,"-")(0)))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool( salesWrite.nSetValue("CustomerNo$",document.CustID ))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool(salesWrite.nSetValue("ShipToCode$",document.ShipFromAddressss (0).PartnerNumber ))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool(salesWrite.nSetValue("ShipToAddress1$",document .ShipToAddress(0).AddressLine1 ))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool(salesWrite.nSetValue("ShipToAddress2$", document .ShipToAddress(0).AddressLine2 ))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool(salesWrite.nSetValue("ShipToAddress3$",document .ShipToAddress(0).AddressLine3))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool(salesWrite.nSetValue("ShipToCity$", document .ShipToAddress(0).City))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool(salesWrite.nSetValue("ShipToState$", document .ShipToAddress(0).State))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool(salesWrite.nSetValue("ShipToCountryCode$",document .ShipToAddress(0).Country))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool(salesWrite.nSetValue("ShipToZipCode$",document .ShipToAddress(0).ZipCode))) Then MsgBox(salesWrite .sLastErrorMsg)

    If Not (CBool( salesWrite.oLines.nSetKey( document .Line (0).SerialNumber))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool(salesWrite.oLines.nSetValue("ItemCode$",document .Line (0).ItemDetails .ItemName))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool(salesWrite.oLines.nSetValue("QuantityOrdered", document .Line(0).Quantity ))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool(salesWrite.oLines.nSetValue("ItemCodeDesc$",document .Line (0).ItemDetails .ItemDescription ))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool(salesWrite.oLines.nSetValue("ExtensionAmt", document.Line(0).ChargeAmount))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool(salesWrite.oLines.nSetValue("UnitPrice", document.Line(0).ItemDetails.Price ))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool(salesWrite.oLines.nSetValue("TaxRate",tax_amt))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool(salesWrite.oLines.nSetValue("TaxableAmt", "100"))) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool(salesWrite.oLines.nWrite())) Then MsgBox(salesWrite .sLastErrorMsg)
    If Not (CBool(salesWrite.nWrite())) Then MsgBox(salesWrite .sLastErrorMsg)

    ***********************************************************************************************************************************************
  • 0 in reply to seshasai
    Try grabbing a retVal after salesWrite.oLines.nSetKey ... If the retVal = 2 then you're creating a new line. You probably have and issue the key. Also, TaxRate and TaxAmount are informational fields for Credit Card processing - they will not affect the calculated Sales Tax amount. TaxClass is the field in SO Details that drives whether the line is taxable or not.