Skip to Content
avatar image
Former Member

Usage of BAPI in Userexit/BADI

Hello All,

Good Day!

Need info reg usage of BAPI, in user exit/BADI.

Can we use, BAPI inside a exit/BADI?

In general, we are not supposed to use commit/rollback in BADI/User exit. But what we have called a BAPI, in a exit/BADI, and we have error message in return parameter, and transaction was successful.

Will there be inconsistency, if yes, what is the turn around?

Thanks a lot in advance.

Regards,

Naga

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Nov 29, 2016 at 07:48 AM

    Hi Naga,

    I'm pretty sure someone did the same question about 2 weeks ago.

    As you pointed out, in BAdI and U.E. we cannot put commit / rollbacks so calling a BAPI in them could lead to incosistency.

    It's one of the first thing i learn working with U.E. ages ago :)


    The most common workaround i found implemented is to raise and event in U.E./BAdI calling a FORM for this ON COMMIT (so it's triggered only when the commit is done) and then create an external report to schedule to intercept the Event.

    In the event you put as parameter the document nr you need and in the report retrieve the data.

    It's ugly, it's not 100% sure, it's not the best solution.

    My suggestion is to study the case and ask yourself you need to call a BAPI in an BAdI and check if you can achieve the same result in other way.

    Add comment
    10|10000 characters needed characters exceeded

    • Yes, BAPI rarely perform internal commit so you have to put it manually.

      @EJ Ermac

      And no, you cannot leave the system to perform the commit itself because it's too risky!

      You have to trigger the BAPI only when a document is correctly saved, but, after triggering it, the commit perform a rollback (or viceversa): can you see the big issue?