Final docnum and rollback question
SeKo
Hi all,when a user wants to add a new order, we would like to build some checks and some additional objects (extra stock transfers).
The order in which things are checked are (please correct me if I'm wrong):
1. SAP stuff: user has credit, 'you cannot update this document after adding it', ...
2. Coresuite FormDataAdd event: the one we're programming
3. SP_TransactionNotifciation
Now I have 2 questions:
1. How can I know in Coresuite what the definite DocNum is of the order? I cannot take the one from the form, because maybe somebody else inserted an order in between so that docnum is not the final one. Is there a way to know the real docnum (or docentry)?
2. In the Coresuite part I'm adding some stock transfers. But if the SP_TransactionNotif blocks the order (due to some other checks), the stock transfers are already in SAP. So the transaction of SAP is not running over everything which is being processed. I would like to stock transfers to be rolled back. Is this possible? If the stock transfers fail, I can return a false and the order is not saved until the issue with the stock transfers is fixed (as expected)
Thanks!
Sebastiaan
Paolo Manfrin
Hi Sebastian, what about using starttransaction and endtransaction? Would that be an option?Paolo
SeKo
Hi Paolo,not really since the end of the transaction would need to happen after the SP_TransactionNotification since I also want to be sure the order is in the database.
What we probably will do is add the stock transfers to a UD table in SP_TransactionNotification and then run a job which creates these items. First we would do the checks to make sure those objects can be created. It's not perfect, but I think it's close enough.. Also, in SP_TransactionNotification we have the new DocNum, so that should solve that problem also.
0
Please sign in to leave a comment.
Comments
0 comments