rduncan10
6th June 2013, 21:23
I am writing an AFS session for Maintain Receipt (tdpur4120m000).
Everything is working fine thanks to help from other posts on this site, but I am having one problem.
Sometimes the source data (a text file sent by another application) only has receipts for a few lines on a PO. I need to deliver zero and backorder the remaining lines so that they can immediately be available for another receipt.
I tried to use the following code to do this. My idea was to backorder all lines first, then use stpapi.find to find the lines in the source data and receive them:
loop = stpapi.browse.set("tdpur4120m000", "first.set", err)
while loop
stpapi.get.field("tdpur4120m000", "tdpur045.pono", value)
stpapi.put.field("tdpur4120m000", "tdpur045.date", str$(date.num()))
stpapi.put.field("tdpur4120m000", "tdpur045.diqu", str$(0))
stpapi.put.field("tdpur4120m000", "tdpur045.dqua", str$(0))
stpapi.update("tdpur4120m000", 1, err)
loop = stpapi.browse.set("tdpur4120m000", "next.set", err)
endwhile
The code does loop through all lines. The stpapi.get.field does return the value of every line number. But the stpapi.update stops working after 12-15 lines. There is no error: the lines just don't get updated.
The updates stop about half way down the second page, that is just after I would have to hit page down if I were receiving this manually. I'm not sure if that has something to do with it.
Any help is appreciated.
Everything is working fine thanks to help from other posts on this site, but I am having one problem.
Sometimes the source data (a text file sent by another application) only has receipts for a few lines on a PO. I need to deliver zero and backorder the remaining lines so that they can immediately be available for another receipt.
I tried to use the following code to do this. My idea was to backorder all lines first, then use stpapi.find to find the lines in the source data and receive them:
loop = stpapi.browse.set("tdpur4120m000", "first.set", err)
while loop
stpapi.get.field("tdpur4120m000", "tdpur045.pono", value)
stpapi.put.field("tdpur4120m000", "tdpur045.date", str$(date.num()))
stpapi.put.field("tdpur4120m000", "tdpur045.diqu", str$(0))
stpapi.put.field("tdpur4120m000", "tdpur045.dqua", str$(0))
stpapi.update("tdpur4120m000", 1, err)
loop = stpapi.browse.set("tdpur4120m000", "next.set", err)
endwhile
The code does loop through all lines. The stpapi.get.field does return the value of every line number. But the stpapi.update stops working after 12-15 lines. There is no error: the lines just don't get updated.
The updates stop about half way down the second page, that is just after I would have to hit page down if I were receiving this manually. I'm not sure if that has something to do with it.
Any help is appreciated.