Paul P
1st September 2006, 06:56
Hi guys,
I'm trying to make my API for Maintain Receipts (tdpur4120m000) fool-proof. One possible hick up I noticed is that if someone selects a line from the tdpur4131s000 subsession, but doesn't continue on updating the data for that line in the main tdpur4120m000 session (ie leaving all numbers in tdpur4120m000 zero for that line), then all the other people wouldn't be able to select that same line to perform receipt against elsewhere. In short, BaanIV wants one person to finish recording receipt for a particular PO-line before allowing another person to record another receipt for that PO-line.

In trying to catch this, if one PO-line that's to be received using API can't be found in tdpur4131s000 (stpapi.find()<>1), I'd like my API script to un-mark all previously found & marked records before closing tdpur4131s000. I think I should be able to be un-mark using stpapi.recover(), which calls the choice.recover.set. After this, I need to ask API to execute(abort.program) and not execute(end.program), but I don't know how to do this as stpapi.end.session() seems to be calling choice.end.program. FYI, doing execute(end.program) after execute(recover.set) directly on the program (not through AFS) still results in the previously marked records being sent to tdpur4120m000

Anybody ever tried to do the same thing? Or am I going too far in making the API for this fool-proof :) ?

Thx,
Paul

mark_h
1st September 2006, 13:57
Can't you just search for an existing receipt for a PO/Line? Pull that up in tdpur4120m000 and process that receipt. Am I missing something? The first thing I do is check for a open receipt to finish receiving(using a plain old select on tdpur045) - if I do not find one then I create a receipt.

What I do when a user receives a PO is run tdpur4224s000 and create a 0 record in tdpur4120m000 for all lines on that PO. Then I might receive just one line. The next time the user does a receipt on the PO - I look at tdpur045, get the old receipt number and then go update it. I actually only have two routines that I use - create receipt (which runs tdpur4120m000 and then tdpur4224s000) to create the receipt number for all lines on the PO. Then the second routine is modify receipt - to actually do the receipt.

And you can never go to far in making it fool proof. In my case the users do not even get to select which line to receive - I do it for them in need date order. So basically all they give me is PO, part and qty(and maybe lot info).

Paul P
4th September 2006, 05:10
Thanks, Mark. That's a good idea. But I'm probably rather paranoid about making it fool-proof. Since we still leave it open for users to use both BaanIV internal receipt screen and web-based, API-powered receipt screen, I might not implement your idea as is. But, I'll use your idea of making a select from tdpur045 to prevent the web-based screen from making receipt on the same PO-line being received by another user using BaanIV screen. Thanks again, Mark

Rgds,
Paul