Skip to Content
avatar image
Former Member

Data add event background

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Feb 24, 2017 at 07:09 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 26, 2017 at 11:32 PM

    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).

    Add comment
    10|10000 characters needed 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.

  • Feb 28, 2017 at 09:40 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded