Application Development 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: 

Help needed for BADI in MIGO

Former Member
0 Kudos

hi friends,

i have a requirement in which, when i post goods in migo, a pop up should come where i have to enter a form(form-31) details and this should get reflected in an ztable along with the vendor details. i have found that a BAdi(MB_DOCUMENT_BADI- i am using SAP R/3 5.0 ) exists with two methods

1.'MB_DOCUMENT_BEFORE_UPDATE'

2.'MB_DOCUMENT_UPDATE'.

which one should i use? becos in the documentation it says that 'MB_DOCUMENT_BEFORE_UPDATE' is called before any accounting documents are generated and if i write any database commit in this method then if some error occurs after the business add-ins are processed we cannot carry out a complete ROLL BACK,as the data up to the COMMIT has already been written in the database(ztable),it will lead to data inconsistency.

again in 'MB_DOCUMENT_UPDATE' it says is processed after the FI document numbers are called and for For performance reasons, you should not re-read the tables or write to any tables or carry out any time-consuming routines in this method..

pls advice if there is any other BAdi or any work around...waiting for your replies...and pls be very descriptive...

also if the user cancels or exits the popup then processing should not proceed..it should come back to the migo initial screen without posting the goods...

regards

kiran

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Create an update function module in which you can write the database update statment for the ztable. Call this function module within the method 'MB_DOCUMENT_BEFORE_UPDATE' so that this function module is called when sap does a commmit, that is when Document is created without any errors.

Let me know if u want some more details about update function modules.

2 REPLIES 2

Former Member
0 Kudos

Hi,

Create an update function module in which you can write the database update statment for the ztable. Call this function module within the method 'MB_DOCUMENT_BEFORE_UPDATE' so that this function module is called when sap does a commmit, that is when Document is created without any errors.

Let me know if u want some more details about update function modules.

Former Member
0 Kudos

Hello Kiran,

As the 'MB_DOCUMENT_BEFORE_UPDATE' is called the update has happened, I would suggest u create a FM which will update ur Z tables and call it in update task. So when COmmit work for the MIGO is called this will be also commited and if the transx fails everything will be rolled back. The FM should be with update module and start immediate in attribute of the FM.