Skip to Content
avatar image
Former Member

Help needed for BADI in MIGO

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    May 08, 2006 at 06:33 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 08, 2006 at 07:01 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded