Skip to Content
0

Data add event background

Feb 24, 2017 at 08:42 AM

77

avatar image

In SAP B1 9.1 PL07 I have to capture invoice data add event created internally, not by form (like stored procedure SBO_TransactionNotification but via sdk, not by sql). I have to get object invoice (using SAPbobsCOM.Documents) before transaction commit, change some values in document and then let continue standard creation (because of invoice are not modifiable after creation and in my case i can't use draft). Also, i can't use form_data_add event because i have to modify massive background creations.

Thanks.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Lan Zhang Feb 24, 2017 at 07:09 PM
0

Hi Antonio,

Alternatively you can try this approach, call a .net DLL from that SBO_TransactionNotification store procedure. But there is one thing I don't understand that you said you can't use form_data_add event because you have a massive data operation in the background. But actually both using SBO_TransactionNotification and addon with form_data_add event has same effect, anyway the massive data creations will slow down the user operation.I don't see the difference here. Maybe you can separate your job into two steps, first step is to modify the invoice document itself that you can use either addon(via form_data_add event) or the SBO_TransactionNotification store procedure. I guess this is pretty fast. Once this is done successfully then do second step which is do the massive data creation but in another process like a background process.

Lan

Share
10 |10000 characters needed characters left characters exceeded
Antonio Molino Feb 26, 2017 at 11:32 PM
0

Thanks but using .net DLL from that SBO_TransactionNotification can i get sdk object before commit (so i can modify some fields)?

Somethings like:

oDoc = (SAPbobsCOM.Documents)B1Connections.diCompany.GetBusinessObject(BoObjectTypes.oInvoices);

oDoc.GetByKey(docEntry_beforeCommit_fromSBOTransaction);

oDoc.Comments = "..."; /*or other fields*/

... let continue commit from SAP so invoice has comments = "..."

This event should fire during invoice creation not by form but by background creations (without any forms).

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Intercepting in SBO_TransactionNotification, you can only commit or rollback the operation by specifying an error.
You can not modify any values of the invoice as it is already in the database.

1
DIEGO LOTHER Feb 28, 2017 at 09:40 PM
0

Hi Antonio,

I believe that there is no resource to listen the add event outside UI API. In this case if you can modify the values after the invoice creation, create some service that check after some interval if new invoices are created in the database and then update the invoices that you found.

Kind Regards,

Diego Lother.

Share
10 |10000 characters needed characters left characters exceeded