Sage 100

 View Only
  • 1.  Landed Cost posted per line based on HTS code %

    Posted 08-03-2025 21:21

    Has anyone successfully created a script that will write the AllocatedLandedCostAmt in the PO ReceiptDetail?  I have a script that will calculate the line duty based on a rate from a UDT pulling in the HTS code.  I have a UDF that the amount populates but I am unable to change the AllocatedLandedCostAmt with that amount.  I have tried using the PostWrite in PO Receipt Header to pull but that does not seem to change the field so I am taking there is calculating in the back ground that I am missing capturing. Can anyone point me in the correct direction.  I have the scripts attached. I appreciate any thoughts.



    ------------------------------
    Venessa Griffin
    Senior Business Analyst / Team Lead
    Net at Work
    ------------------------------

    Attachment(s)

    txt
    Duty_Pre-Totals.txt   2 KB 1 version


  • 2.  RE: Landed Cost posted per line based on HTS code %

    Posted 08-04-2025 09:34

    What I've done is use a script to set each Landed Cost code & amount so native Sage takes over for the write back values to the Lines. I will calculate the amount in a number of ways per line, like you've done, then use standard Sage UDF logic to total all lines with a value in that UDF to a Header UDF for each type of Landed Cost. I then use a script to populate the Landed Cost code & amount associated with that cost in a Pre-Totals script. 

    This is what I have saved where they actually had 3 of these in play, so depending on what cost code was populated on the Lines would tally up to the Header. Here is one of the three in play. The key part is that last 5 lines; this will write the Landed Cost code for you. Hope this helps.

    sReceiptType = ""
    sReceiptNo = ""
    nFreightCar = 0
    sCostTypeCar = ""

    retVal = oBusObj.GetValue("ReceiptType$",sReceiptType)
    retVal = oBusObj.GetValue("ReceiptNo$",sReceiptNo)
    retVal = oBusObj.GetValue("UDF_FREIGHT_FOR_LC",nFreightCar)
    retVal = oBusObj.GetValue("UDF_LC_FREIGHT_CODE$",sCostTypeCar)

    Set oLCReceipt = oBusObj.AsObject(oBusObj.PO_LandedCostReceiptObj)

    sKeyPadded = sReceiptType & sReceiptNo & sCostTypeCar
    retVal = oLCReceipt.SetKey(sKeyPadded)
    retVal = oLCReceipt.SetValue("LandedCostAmt",nFreightCar)
    retWrite = oLCReceipt.Write()



    ------------------------------
    Dana Young
    Lehman Wesley
    Lansing, MI
    ------------------------------



  • 3.  RE: Landed Cost posted per line based on HTS code %

    Posted 08-06-2025 12:56

    You can't override the line allocations directly.  (I've tried).

    Choose the "Weight" calculation method for landed cost type allocation method, then use a script to override the line weights in the receipt details... so Sage will calculate the landed cost detail allocations the way you want.



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------