Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

MB_DOCUMENT_BADI (MB_DOCUMENT_BEFORE_UPDATE)

Former Member
0 Likes
1,802

Hi,

I implemented the BADI MB_DOCUMENT_BADI - Method MB_DOCUMENT_BEFORE_UPDATE. Inside the method I called a custom Function Module which calls a BAPI (BAPI_BATCH_CHANGE). However, it was reported that users sometimes encounter an update termination when using MIGO.When I opened an OSS message, they told me that the BADI implementation caused it.

My question is, should the FM (which contains the call to the BAPI) be called in BACKGROUND TASK AS SEPARATE UNIT ? If it is going to be called in this mode, do I need to also add an explicit BAPI_COMMIT after the BAPI_BATCH_CHANGE is called ? In the current version of the method, the FM is called as a normal function module.

Thanks.

1 ACCEPTED SOLUTION
Read only

mvoros
Active Contributor
0 Likes
1,378

Hi,

this BADI is really weird. You have to be really careful what you put in it. There is even OSS note related to this problem - Note 1284654. I briefly checked BAPI BAPI_BATCH_CHANGE and I found the following code


* End of transaction - IDOC-creation or directly COMMIT WORK
  IF sy-subrc IS INITIAL.
    CALL FUNCTION 'TRANSACTION_END'
         EXPORTING
              transaction_id = f_transaction_id
         EXCEPTIONS
              OTHERS         = 1.

So it calls COMMIT WORK automatically. Therefore you don't have to call BAPI_COMMIT.

Cheers

Hi,

I implemented the BADI MB_DOCUMENT_BADI - Method MB_DOCUMENT_BEFORE_UPDATE. Inside the method I called a custom Function Module which calls a BAPI (BAPI_BATCH_CHANGE). However, it was reported that users sometimes encounter an update termination when using MIGO.When I opened an OSS message, they told me that the BADI implementation caused it.

My question is, should the FM (which contains the call to the BAPI) be called in BACKGROUND TASK AS SEPARATE UNIT ? If it is going to be called in this mode, do I need to also add an explicit BAPI_COMMIT after the BAPI_BATCH_CHANGE is called ? In the current version of the method, the FM is called as a normal function module.

Thanks.

1 REPLY 1
Read only

mvoros
Active Contributor
0 Likes
1,379

Hi,

this BADI is really weird. You have to be really careful what you put in it. There is even OSS note related to this problem - Note 1284654. I briefly checked BAPI BAPI_BATCH_CHANGE and I found the following code


* End of transaction - IDOC-creation or directly COMMIT WORK
  IF sy-subrc IS INITIAL.
    CALL FUNCTION 'TRANSACTION_END'
         EXPORTING
              transaction_id = f_transaction_id
         EXCEPTIONS
              OTHERS         = 1.

So it calls COMMIT WORK automatically. Therefore you don't have to call BAPI_COMMIT.

Cheers