PO Receipt of Goods EditKey EditLine

SUGGESTED

I have a working Receipt of Goods Visual Studio VB console app.  It's an integration project.  I have a textfile that has the receiving data.  It's easy enough to MoveFirst and MoveNext and match the text data to the PO Line using LineKey (or I could use Item or both).

I was hoping to make a more elegant solution.  Since I have the LineKey (000001, 000002, etc), I thought I could use EditKey and EditLine and skip the MoveFirst and MoveNext but GetEditKey is giving me null.

Here's the code (not testing return values unless I have to for now while I'm messing around):

r = oBUS.nGetNextReceiptNo(RNo)
r = oBUS.nSetKeyValue("ReceiptNo$", RNo)
r = oBUS.nSetKey()
r = oBUS.nSetValue("PurchaseOrderNo$", PONo)

r = oBUS.nCopyPurchaseOrderLines(0)     '0 do not set qtys, 1=receive complete

Do Until txtline = ""

EditKey = oBUS.oLines.sGetEditKey(LineKey) 'I have the line key from txtline (example 000001 or 000002)
MsgBox("editkey " & EditKey)

r = oBUS.oLines.nEditLine(EditKey)

r = oBUS.oLines.nGetValue("ItemCode$", LItem)
r = oBUS.oLines.nGetValue("LineKey$", LLineKey)

I'm baffled as to why this is not working.  There is obviously something I am not understanding.

EditKey is DIM as string and I set it to "" in the very beginning:

Dim EditKey As String

EditKey = ""

  • 0

    - Unfortunately, GetEditKey() only works with existing or documents (receipts).  (Ones that have been previously saved).  The lines copied from a purchase order "should" be in the same order as the purchase order lines display order.    Not sure how you have the LineKey in your text file, unless that's either the Linekey from the Purchase Order or just an incremental sequence #.   

    PO Line Key = 1   does not necessarily equal PO Receipt Line Key = 1, because in Purchase Order you can re-order lines, insert lines, delete lines, etc.  The LineSeqNo is the order that the lines are displayed in and in this case copied into PO Receipts.

    I'm not sure the best way to refine what you are doing (still missing some info), but if you are using the Linekey from the purchase order, it may be best to look for that when populating the receipt.

    Hope this helps.

    Elliott

  • 0

    That does explain why EditKey is null.  I needed to make sure it was not a mistake in execution.  Seems a shame that there is no way to directly access a PO Receipt Line.  It is what it is.  Thanks for the confirm that I can't do it that way.  The other way, MoveFirst and MoveNext, will have to suffice.  Thanks again.

  • 0 in reply to Fangfish
    SUGGESTED

    If your LineKey value in the file is for the PO LineKey, you should be matching  that with the Receipt line's OrderLineKey value, which is the technical link to the PO lines.  The Receipt's LineKey is not related to the PO's LineKey.

  • 0 in reply to Kevin M
    SUGGESTED

    Instead of looping through with MoveFirst and MoveNext.  You can use the GetResultSets method from the lines object and have it return the receipt detail's LineKey and use a filter on the OrderLineKey as Kevin mentioned.  Refer to the FLOR for more info on GetResultSets and you can also find some details and examples on using it on this forum. Just search for GetResultSets.

    help-sage100.na.sage.com/.../index.htm

    Technically, the method is still reading through the lines but saves you the trouble of moving to each line, getting the value in OrderLineKey and comparing it to the line key in your source file.