Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
Contributor
matthewb
Posts: 36
Registered: 08-24-2010
0

PO Receipt of goods

Hello all....

 

I'm on MAS90 v4.40 SU6.

 

I had an earlier post that jeritch helped solve with receiving against the entire order of a P.O.. Works like a charm. The issue I’m having is trying to receive an order without accepting the entire order.. I've read both gator Here and PVX_Girl Here other posts for guidance and i am stumped. Here’s my code. You notice that SOME items are being picked up in the msgbox and others are not. i did this to see if i was at least referencing the right lines.

 

Here's my code.

 

Dim poNum
poNum = ""
Dim linekey
linekey = ""
Dim LineSeqNo
LineSeqNo = ""
Dim QtyRec
QtyRec = ""

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$", "001026")
retVal = oCustomer.nSetKeyValue("ReceiptType$", "G")
retVal = oCustomer.nSetKey()
retVal = oCustomer.nSetValue("PurchaseOrderNo$", "1234570")
retVal = oCustomer.oLines.nAddLine()
retVal = oCustomer.oLines.nCopyPurchaseOrderLines("1234570", 0)
retVal = oCustomer.oLines.nMoveFirst() retVal = oCustomer.oLines.nGetValue("PurchaseOrderNo$", PoNum) retVal = oCustomer.oLines.nGetValue("LineKey$", linekey) retVal = oCustomer.oLines.nGetValue("LineSeqNo$", lineSeqNo) retVal = oCustomer.oLines.nGetValue("QuantityBackordered$", QtyRec) msgbox(PoNum) 'this return an empty value msgBox(lineSeqNo) 'this returns a "0000010000000" msgbox(linekey) 'this returns a "000001" msgbox(qtyrec) 'this returns an empty value retVal = oCustomer.oLines.nEditline(PoNum & linekey & lineSeqNo) retVal = oCustomer.oLines.nSetValue("QuantityReceived$", 1) retVal = oCustomer.oLines.nWrite() retVal = oCustomer.nWrite()

 

Thanks!

 

Matt

Sage Employee
jepritch
Posts: 233
Registered: 08-25-2009
0

Re: PO Receipt of goods

Hi Matt,

 

A couple of things I noticed, in your code below.

 

1. the AddLine() does not really do anything for you since you are copying the PO Lines so this can be removed.

2. the QtyRec should be defined as a numeric and not a string.  So up front QtyRec = 0 and then it will return a 0 which I believe is what you want.

3. you are retreiving quantity backordered, but aren't using it

4. this will only modify the first line, this probably should be in some sort of looping structure

 

Dim poNum
poNum = ""
Dim linekey
linekey = ""
Dim LineSeqNo
LineSeqNo = ""
Dim QtyRec
QtyRec = 0 ' should be numeric

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$", "001026")
retVal = oCustomer.nSetKeyValue("ReceiptType$", "G")
retVal = oCustomer.nSetKey()
retVal = oCustomer.nSetValue("PurchaseOrderNo$", "1234570")
retVal = oCustomer.oLines.nAddLine()
retVal = oCustomer.oLines.nCopyPurchaseOrderLines("1234570"​, 0) ' this copies the line and sets the receipt qty to 0
retVal = oCustomer.oLines.nMoveFirst()


retVal = oCustomer.oLines.nGetValue("PurchaseOrderNo$", PoNum) 
retVal = oCustomer.oLines.nGetValue("LineKey$", linekey)
retVal = oCustomer.oLines.nGetValue("LineSeqNo$", lineSeqNo)
retVal = oCustomer.oLines.nGetValue("QuantityBackordered$", QtyRec) ' remove the $ as this is numeric
msgbox(PoNum) 'this return an empty value
msgBox(lineSeqNo) 'this returns a "0000010000000"
msgbox(linekey) 'this returns a "000001"
msgbox(qtyrec) 'this returns an empty value


retVal = oCustomer.oLines.nEditline(PoNum & linekey & lineSeqNo)
retVal = oCustomer.oLines.nSetValue("QuantityReceived$", 1)  ' remove the $ as this is numeric

retVal = oCustomer.oLines.nWrite()
retVal = oCustomer.nWrite()

 

 

 

 

 

Contributor
matthewb
Posts: 36
Registered: 08-24-2010
0

Re: PO Receipt of goods

Elliott,

 

Thanks for all of your help.... i still am not able to populate the "QuantityReceived".

 

Removing the "$" solved the problem of returning a value. I was merely using this to verify I was connecting to the right line. I also noticed that the “PoNum” return is blank. Does this mean that I’m not passing the right information?

 

all of the lines of the P.O. are populated and have a "0" for recieved. Beyond that i cannot get the QuantityReceived to populate.

 

Any other code recommendations?

Contributor
matthewb
Posts: 36
Registered: 08-24-2010
0

Re: PO Receipt of goods

Elliot....

 

Got it! i removed:

 

retVal = oCustomer.oLines.nEditline(PoNum & linekey & lineSeqNo)

 

And works like a charm. Without your earlier post i would still be fumbling.

 

Thanks!

 

Matt

Sage Employee
jepritch
Posts: 233
Registered: 08-25-2009
0

Re: PO Receipt of goods

Hey Matt,

 

On second reading of your code, just wanted to point out something else. 

 

The MoveFirst() will actually do what the EditLine() is doing so you can remove the editline.   But, the first thing to do is start checking your return values, particularly on Read operations and Write operations.

 

For Example:

 

retVal = oCustomer.oLines.nMoveFirst()

 

' Check the value of retVal, if it comes up with 1 then you have the first line, otherwise there are no lines or something else happened.  If there are no lines you can check the property oCustomer.oLines.EOF

 

Note: When using EditLine() the key values you need to edit are PoNum & LineSeqNo & LineKey

 

Hope this helps

 

Elliott