Trying to complete a receipt of goods against a P.O

I'm on MAS 90 4.40.0.6 and cannot get past this... We are trying to complete a receipt of goods against a P.O.. We get the error:

 

"Update not successful: This receipt has no lines and has zero total amounts."

 

Here’s my code:

 

Set mySecur = oScript.NewObject("SY_Security", oSS, 0)

POCustomer = oSS.nLookupTask("PO_ReceiptofGoods_ui")
retVAL = oSS.nSetProgram(POCustomer)
set oCustomer = oScript.NewObject("PO_Receipt_bus",oSS)

retVal = oCustomer.nSetKeyValue("receiptNo$", "001018")
retVal = oCustomer.nSetKeyValue("ReceiptType$", "G")
retVal = oCustomer.nSetKey()
retVal = oCustomer.nSetValue("APDivisionNo$", "02")
retVal = oCustomer.nSetValue("VendorNo$", "SCR")
retVal = oCustomer.nSetValue("TaxSchedule$", TaxSched)

retVal = oCustomer.oLines.nAddLine()

retVal = oCustomer.oLines.nSetValue("ItemCode$", "/668337")
retVal = oCustomer.oLines.nSetValue("LineKey$", "000001")
retVal = oCustomer.oLines.nSetValue("OriginalQtyOrdered$", "5")
retVal = oCustomer.oLines.nSetValue("QuantityReceived$", "5")
retVal = oCustomer.oLines.nSetValue("UnitCost$", "7.76")

' Writes the line. This write value must be used before writing a new line or moving to a new tab or focus.
retVal = oCustomer.oLines.nWrite()
retVal = oCustomer.nWrite()

 

Thanks in Advance!

  • I don't see where you are setting the PO #?   I believe you need to add a PO # or Invoice # before it will let you add any lines.  If you checked the retVal from the nAddLine(), I think it will be zero.

     

    In your example below, if you put the following in:

     

    retVal = oCustomer.nSetValue("PurchaseOrderNo$", poNum) ' where poNum is your purchase order

     

    You would then be able to do the AddLine, however, maybe you would like to copy the purchase order lines over and edit them?  You can dothis using the following method.

     

    retVal = oCustomer.oLines.CopyPurchaseOrderLines(poNum, 1) ' use 1 if you want to default to receive complete, or 0 (zero) if you don't.

     

    Hope this helps,

    Elliott

  • Elliot,

     

    added the line:

     

    retVal = oCustomer.nSetValue("PurchaseOrderNo$", "0010077") 'poNum exists with a single line in PO entry

     

    When i put in:

    retVal = oCustomer.oLines.CopyPurchaseOrderLines("0010077", 1)

     

    i get the error:

     

    Object doesn't support this property or Method: ' oCustomer.oLines.CopyPurchaseOrderLines'

     

    Thanks

     

    Matt

     

  • Sorry Matt,

     

    I always do this, but I neglected to specify the type on the method call.  Try this:

     

    retVal = oCustomer.oLines.nCopyPurchaseOrderLines("0010077", 1)

     

    :smileyhappy: So many languages switching back and forth...

  • Elliot,

     

    That's my fault. I should have caught that myself. it works great when i accept the entire order.

     

    When not accpeting the default lines and items and using a '0' like this:

     

    retVal = oCustomer.oLines.nCopyPurchaseOrderLines("0010077", 0)

     

    i can't seem to edit the lines.

     

    Any ideas?

     

    Thanks

     

    matt

     

     

  • in reply to matthewb

    did you solved the problem with the receipt of good retVal = oCustomer.oLines.nCopyPurchaseOrderLines("0010077", 0)?

  • in reply to matthewb

    did you solved the problem with the receipt of good retVal = oCustomer.oLines.nCopyPurchaseOrderLines("0010077", 0)?