BADI MB_DOCUMENT_BADI

Hi All,
I have created one implementation to the BADI MB_DOCUMENT_BADI. This badi will hit while creation of material document.I have write the code in method MB_DOCUMENT_BEFORE_UPDATE such  that it will act only for certain movement types specially for t-codeMb1a and MB31.
What problem I am facing i have used a error message "MB_DOCUMENT_BEFORE_UPDATE" in this method.If we got the erroe message then we dont need to post the material dcoument,but here problem is that if the material document could not posted then it corrupt the material and when we performing 261/101 we got error message like " Inconsistency between MM and ML for material and plant"
Can anybody elebrate the problem why its happining and what will be the solution to the issue.
Thanks ,
sandeep.

Hi,
  This needs to be handled in the program based on the user action, you can either 'exit' the program or 'continue' processing, refer the sample code below,
CALL FUNCTION 'POPUP_TO_CONFIRM'
        EXPORTING
         TITLEBAR                    = 'Confirm'
        TEXT_QUESTION               = 'Do you want to continue or exit'
         TEXT_BUTTON_1               = 'Continue'
         TEXT_BUTTON_2               = 'Exit'
         DISPLAY_CANCEL_BUTTON       = ' '
       IMPORTING
         ANSWER                      = LV_ANSWER.
      IF LV_ANSWER = 1.
            Handle the error,
      endif.
Hope this helps,
Rgds,

Similar Messages

  • Use of enque and deque function in BADI MB_DOCUMENT_BADI

    Hi All,
    I have implemented one implementation to the BADI MB_DOCUMENT_BADI.I have to use update command in this implementation to update on ZTABLE,In order to update I need to use enqueue and dequeue function before updating the table.
    My concern is that in the documentation to the BADI it specifies that Unlocking the data( DEQUEUE_ALL) will be not used in this implementation.
    Please let me know Can  I use enqueue and deques function for this table to this BADI.
    Thanks,.
    Sandeep.

    Hi,
      I think field GOODSMVT_CODE is not table type, you mension it type table of 'BAPI2017_GM_CODE'.
    Thanks,
    Anmol.

  • BADI MB_DOCUMENT_BADI and method only working in debug mode

    Hi SAP Experts,
    I have a problem with badi MB_DOCUMENT_BADI. I implemented method MB_DOCUMENT_UPDATE, which  is called from update
    task.
    My implementation calls a BAPI to update a standard sap table and I also update a custom table. When I put a breakpoint and the debugger gets to it, it runs wells. Everything gets updated properly.
    With no breakpoints it doesnu2019t update anything. Iu2019m not sure what is causing this. Any help would be greatly appreciated.
    << Moderator message - Everyone's problem is important. But the answers in the forum are provided by volunteers. Please do not ask for help quickly. >>
    Miguel
    Edited by: Rob Burbank on Oct 28, 2011 2:18 PM

    Hi,
    Please see below:
    CALL FUNCTION 'BAPI_EQUI_CHANGE'
                      EXPORTING
                         EQUIPMENT               =  <FS_UPD>-EQUNR  "->equnr of looped table
                         DATA_GENERAL            =  K_DATA_GENERAL
                         DATA_GENERALX           =  K_DATA_GENERALX
                         DATA_SPECIFIC           =  K_SPECIFIC_DATA
                         DATA_SPECIFICX          =  K_SPECIFIC_DATAX
                      IMPORTING
                         DATA_GENERAL_EXP        =  K_DATA_GENERAL_EXP
                         RETURN                  = I_MESSAGE.
    ***This is called inside a loop, after the loop...
      UPDATE "Z_MY_TABLE" FROM TABLE I_UPD_FM.
    Inside the loop the data gets prepared for the custom and standard table.
    Thanks all!
    Miguel

  • Any Enhancement Point/Spot that serves like BADI(MB_DOCUMENT_BADI) on MSEG?

    Hi Experts,
    I need to populate around 10 standard SAP fields and 8 custom fields on MSEG(material document item table) record, WHILE the material document is creating or CONFIRMING the delivery or SHIPEMENT confirmation. In this process I found an a BADI (MB_DOCUMENT_BADI), well, this BADI does not having CHANGING parameters of MSEG.....pls. let me know any other user-exit ot BADI which serves my requirement?
    Actually, I tried to do it by suing field-symbols (below code) in this BADI, but still my values are not reflecting!
    FIELD-SYMBOLS: <SGTXT> TYPE any,
    <SGTXT_1> TYPE any.
    ASSIGN '(SAPMM07M)MSEG-SGTXT' TO <SGTXT>.
    CHECK SY-SUBRC = 0.
    assign (<SGTXT>) to <SGTXT_1>.
    CHECK SY-SUBRC = 0.
    <SGTXT_1> = 'MY_TEST'.
    assign (<SGTXT_1>) to <SGTXT>.
    endmethod.
    Thank you

    I found that this BADI itself is migrating.
    Thank you

  • Problem with badi MB_DOCUMENT_BADI

    Hi experts
    i have a problem with the badi, MB_DOCUMENT_BADI this is i am using for MIGO transaction
    my requirement is i need to call MR22 transaction in this badi but as this badi is calling in up date task i cann't use the call transaction statement and there is no BAPI available for MR22 transaction so could you please tell me is there any any way to process the session automatically after creating the session for MR22 transaction.
    it would be great help for me
    thanks in advance

    Lets the FM created is Z_Call_transaction_data. ( Make this FM as RFC enabled by selecting radiobutton Remote- Enabled Module in Attributes of the FM)
    Call this FM in ur BADiI Method as :
    Call function 'Z_Call_transaction_data.' starting new task 'TASK1'.
    Import ...
    Export...
    You can ginve any name to this task.
    If you want to debug it , execute ur code and when control reaches to FM , press F5 a new session will be opened .
    Starting new task starts the code in new LUW.

  • BADI MB_DOCUMENT_BADI dump error

    Hi all,
    am using BADI : MB_DOCUMENT_BADI,method MB_DOCUMENT_BEFORE_UPDATE,to have checks in MB1A(Goods Issue transaction).I have written a code to check some values,after checking and raising an error message if I press enter the following dump error is coming:
    Error analysis
        Short text of error message:
        Internal error: Multiple call of update function module
        Long text of error message:
         Diagnosis
             In the FORM routine Buchen_Ausfuehren (program SAPMM07M), an error
             message was issued by a Business Add-In (BAdI) or function module.
             This is not permitted, because it could lead to data
             inconsistencies. For this reason, the update of the material
             document was also terminated with a termination message (dump).
             Note that this message (M7 372) is not the responsible error
             message.
         System Response
         Procedure
             Contact your system administrator.
         Procedure for System Administration
             If there is an active implementation of the Business Add-In
             MB_DOCUMENT_BADI, check that no error message is issued in the
             MB_DOCUMENT_BEFORE_UPDATE method.
        Technical information about the message:
        Message class....... "M7"
        Number.............. 372
        Variable 1.......... " "
        Variable 2.......... " "
        Variable 3.......... " "
        Variable 4.......... " "
    Hope am clear in my questian,
    Thanks & Regards,
    Rock.

    Hi,
    This BADI is called in update task.
    So as a result when you call your error message, SAP is retuning it as message type 'X" and an update termination occurs.
    I was facing a similar problem becuase i was trying to update measurment doc via this badi.
    Incase the measuring document was locked by some user my FM used to throw an error message and that would lead to a message type 'X' in this badi.
    So if you want to do some validations only; please use the following BADI.
    MB_MIGO_ITEM_BADI in the method ITEM_MODIFY.
    Regards,
    Ankur Parab

  • Help to use BAPI_GOODSMVT_CREATE in BAdI MB_DOCUMENT_BADI

    Hi frnds ,
      I want use BAPI_GOODSMVT_CREATE in BAdI MB_DOCUMENT_BADI,
    can any one have any code related this ?
    i have also writeen my code but it is giving error that itab is not an inatertable occurs n misiing , but when i  m creting internal table with occurs staement it is not suppoertd by OO concept.
    Dont worry about points.
    Mahesh.

    Hello
    Use the syntax
    data : itab type table of <xmseg> with header line.
    regards

  • Z implementation not getting picked for BADI  - MB_DOCUMENT_BADI

    Hi,
    I have a done a z implemenatation for standard badi MB_DOCUMENT_BADI in ECC6.In Tcode MIIGO after giving  2 line items when i save it that Zimplemen is not getting picked.
    In 4.6c the same Z implementation is getting picked.
    can you please help me out in this.

    Hi Rajeev,
    I am not sure about the definition of Badi and hence am assuming that the filter is set....and the value for the z implementation does not match the value passed from the call point. Can you please check this and confirm
    Regards,
    Jemin

  • Cannot update batch header during MIGO GR using BADI MB_DOCUMENT_BADI

    I am trying to update next inspection date via MIGO when Goods Receipting a production order which is held in the batch header and in a classification we have set up. I have used function modules to try and perform the update.
    I have used both 'VB_UPDATE_BATCH' and QEVA_BATCH_UPDATE both by themselves and in an update task to update field QNDAT. (1st one updating MCHA and MCH1 the second one to update MCHA).
    I had the code before in POST_DOCUMENT of BADI MB_MIGO_BADI and this made no difference either. Sometimes it updates if I cancel the material document and redo the goods receipt with the same production number but this is very inconsistent. I need this to be done when I am posting the goods receipt.
    Does anyone have any ideas as I am at the end of my tether with this one?
    Many thanks
    Regards
    Larissa Maryniuk

    used BAPI_CHANGE_BATCH in method CHECK_ITEM of  MB_MIGO_BADI

  • Call BAPI in BADI 'MB_DOCUMENT_BADI'

    Hi all,
    How can i call a BAPI in MB_DOCUMENT_BADI~MB_DOCUMENT_BEFORE_UPDATE ? I wrote code below but got  "GOODSMVT_CODE" is the correct type, its length is incorrect." error.
      DATA:
            goodsmvt_header       TYPE TABLE OF  bapi2017_gm_head_01,
            goodsmvt_code         TYPE TABLE OF  bapi2017_gm_code,
            goodsmvt_headret      TYPE TABLE OF  bapi2017_gm_head_ret,
            matdocumentyear       TYPE  bapi2017_gm_head_ret-doc_year,
            goodsmvt_item         TYPE TABLE OF  bapi2017_gm_item_create, " OCCURS 0 WITH HEADER LINE,
            goodsmvt_serialnumber TYPE TABLE OF  bapi2017_gm_serialnumber. " OCCURS 0.
        CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
          EXPORTING
            goodsmvt_header  = goodsmvt_header
            goodsmvt_code    = goodsmvt_code
            testrun          = ''
          IMPORTING
            goodsmvt_headret = goodsmvt_headret
            materialdocument = materialdocument
            matdocumentyear  = matdocumentyear
          TABLES
            goodsmvt_item    = goodsmvt_item
            return           = messages.
    Best regards,
    Munur

    Hi,
      I think field GOODSMVT_CODE is not table type, you mension it type table of 'BAPI2017_GM_CODE'.
    Thanks,
    Anmol.

  • MB_DOCUMENT_BADI badi is not poping up the error message

    hi friend,
    i m using the badi MB_DOCUMENT_BADI for MIGO transaction code to check batch condition for that i m using the method MB_DOCUMENT_BEFORE_UPDATE. in this method i have given the condition like
       if wa_XMSEG-charg <> wa_mseg-charg.
        message 'Batch is different' type 'I'.
            LEAVE PROGRAM.
       endif.
    now my problem is when this condition is true its going to "message 'Batch is different'  type 'I'" this statment but it is not poping up
    the message, after this it is directly going to the "LEAVE PROGRAM" and comming out of transaction. i want to pop up this message first and then it shoul come out of the transaction.
    pl suggest me some thing to get out of this problem.
    regards,
    vicky.

    HI ,
    Use the following piece of code for message...
    if wa_XMSEG-charg wa_mseg-charg.
    message I368(00) with 'Batch is different'.
    LEAVE PROGRAM.
    endif.
    Hope this helps.
    Regards,
    Rohan.

  • BADI / USER EXIT for MB01 - after posting GR.

    Hi,
    We have some requirement, where we need to create the Goods Issue using bdc after posting the GR in MB01. can anybody give the user exit / BADI for this.
    i have used BADI - MB_DOCUMENT_BADI : It is triggering while click on the Save button in the MB01, but it is calling before post the GR. the customization part should trigger after the GR post.
    Regards,
    Sree

    Hi Sree,
    Do it the other manner. Store the GR in a Z-table and do the BDC or use the BAPI as suggest Keshav in a periodic job, or call it with a job (OPEN_JOB, CLOSE_JOB,...) in a function module, always with the option IN UPDATE TASK. Think that you have the number of document in this BADI and you must wait some time (1, 2 or 5 seconds) until the database save all data.
    Be careful with this badi (MB_DOCUMENT_BADI), see Note 92550 - Stock inconsistency due to customer enhancement (exit, BAdI) to understand the reasons.
    Regards,
    Eduardo
    Edited by: E_Hinojosa on Feb 2, 2011 2:20 PM

  • MB1B / Change profit center in Exit, Badi or Enhancement

    Hi guys,
    we're doing transfer postings in MB1B with reference to existing returns. In the return item a profit center different from the material master is entered. MB1B is creating the material document with the profit center from the materal master.
    The requirement is to get the profit center from the return into the material document.
    I have tried various ways to meet the requirement:
    - Badi MB_DOCUMENT_BADI
    - Badi MB_MIGO_ITEM_BADI
    - Exit EXIT_SAPLIE01_007
    - Enhancement ENHANCEMENT-POINT SEGMENTDATEN_MAT_SETZEN_03
    - Enhancement ENHANCEMENT-POINT MM07MFM0_M_SEGMENTE_GENERIE_04
    In MB_DOCUMENT_BADI and EXIT_SAPLIE01_007 the profit center can't be changed, MB_MIGO_ITEM is not run through.
    In the 2 enhancements the value can be changed, but the profit center in the material document and the follow up documents is still taken from the material master.
    Does anybody know where I can change the profit center in this case? (Badi / Exit / Enhancement).
    It's a requirement that MB1B has to be used, so using MIGO for this is not a solution.
    Thank you very much!
    Best regards, Andreas

    Hi,
    Enhancement - MB_CF001            Customer Function Exit in the Case of Updating a Mat. Doc.  is called in the update task.
    This could be useful.
    Thanks
    Sujay

  • BADI or USER EXIT for MIGO when changing order number

    Hi experts, I'm looking for a BADI or USER EXIT in Tx. MIGO that is triggered after pushing ENTER when you change the order number. What I need to do is to propose the movement type depending on the order data. Thanks.

    Not sure but you can try in BADi MB_DOCUMENT_BADI menthod:
    MB_DOCUMENT_UPDATE

  • Help in BAdi for 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 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...how to go about it?
    regards
    kiran
    pls ...help is urgent...every effort is appreciated
    Message was edited by: kiran k

    Hi
    If you call a popup I don't think you can use the method 'MB_DOCUMENT_UPDATE', as here you can update your Z-TABLE without the COMMIT. So I suppose this method works in background and in this step any popup can be shown.
    So you should use 'MB_DOCUMENT_BEFORE_UPDATE', but I don't know I you can stop the saving, try to use an error message.
    Max

Maybe you are looking for

  • Customizing Alerts in PI 7.31/PO

    Hi , We have a requirement of customizing alerts in our  SAP PI 7.31 server . I just started working on it by having a glance at below blog ,but struck at getting jar files mentioned by Amit .I posted same query in blog but no response. Customize Ale

  • Change the default noscript message in ADF faces

    Hi, I'm developing an application using ADF faces, and i've noticed that all my pages have a <noscript>This page uses JavaScript and requires a JavaScript enabled browser.Your browser is not JavaScript enabled.</noscript> Is there a way to change thi

  • How to migrate user from IDM 5.5 to 6

    Our current users in IDM 5.5 have many attributes, admin roles and defer tasks. Does anyone know what is the best way to migrate the users withought missing user information from 5.5 database to 6?

  • Need help setting up a "Caching Nameserver"

    Hi, I am running (non server) mac osx on several machines at home hidden behind a router using IP's 192.168.1.xxx. I am connected to the internet by a cable modem with roadrunner being the ISP de jour. All of my machines use a fixed IP. I recently bo

  • How search works with joins?

    Hello, I have a query like this: Select A.Name, A.description From design A, field B Where A.fieldID = B.fieldID And B.unitID = 0 And contains(A.description, 'some text', 1) > 0 I'd like to get some suggestions about usign Oracle Text in join-queries