Sage 100

 View Only
  • 1.  PO Detail Script Link to Vendor Price Level

    Posted 09-15-2020 08:21
    ​Good morning. I am looking at wanting to script a UDF value that was created for the PO_VendorPriceLevel table to the Purchase Order Lines tab and this table is not available as a ChildHandle, so I am playing with the BUS object instead but am not able to make the connection so far. Here is what I have...should I be using the Header as the main object and then setting oLines instead to pull the UDF I need from the vendor price record, or is this a case where we use a "CO" object link?

    sItemCode = "" : sDivNo = "" : sVendorNo = ""
    retVal = 0 : oVendorPrice = 0
    sOPFlag = ""

    retVal = oBusObj.GetValue("ItemCode$", sItemCode)
    retVal = oHeaderObj.GetValue("APDivisionNo$", sDivNo)
    retVal = oHeaderObj.GetValue("VendorNo$", sVendorNo)

    sMsg = "Vendor: " & sVendorNo & " ItemCode: " & sItemCode
    retMsg = oSession.AsObject(oSession.UI).MessageBox("", sMsg)

    set oVendorPrice = oSession.AsObject(oSession.GetObject("PO_VendorPriceLevel_bus"))
    retVal = oVendorPrice.SetKeyValue("APDivisionNo$", sDivNo)
    retVal = oVendorPrice.SetKeyValue("VendorNo$", sVendorNo)
    retVal = oVendorPrice.SetKeyValue("ItemCode$", sItemCode)
    retVal = oVendorPrice.Find()

    sMsg = "Found? " & retVal
    retMsg = oSession.AsObject(oSession.UI).MessageBox("", sMsg)

    ------------------------------
    Amber Prayfrock, Blytheco
    ------------------------------


  • 2.  RE: PO Detail Script Link to Vendor Price Level

    Posted 09-15-2020 10:22
    In order for the SetKeyValue / Find to work you need to use all the fields in the table's primary key.  You are missing Pricing Type and Product Line.

    You might want to try SetBrowseFilter to the Div-Vendor and add a loop until you find the correct item.


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



  • 3.  RE: PO Detail Script Link to Vendor Price Level

    Posted 09-15-2020 10:52
    Thank you, Kevin! I wasn't sure if I could get away without reading those fields. I will try your angle!

    ------------------------------
    Amber Prayfrock, Blytheco
    ------------------------------