Multiple call of update function module

Hi Everybody,
I have made implementation to the definition MB_DOCUMENT_BADI( material Document creation).
While executing this BADI I am getting short dum with this error  Multiple call of update function module.
Here is the short dump--
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.                                                         
Please any body suggest the way forward.
Regards,
Sandeep.

Hi Kiran,
Thanks for the reply.
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"
I have used following things like-
1-while updating the customized table using " Commit Work".
2-Call function vb_change_batch for updating the batch and not in update task.
3. Dequeue the table after updating the table.
Will thos things can create any inconsistency to  the MM and ML.
Please suggest me uor thoughts.
Thanks
sandeep.
Thanks ,
sandeep.

Similar Messages

  • Multiple calls of same function module do NOT initialize variables ?

    Hi all,
    ..so its my fist post here, this is a bit strange problem for me and maybe someone knows whats happening.
    So I have in SAP Solution Manager a function module 'Z', which calls a standard SAP class CL_SPROJECT_SOLAR_BASE_REPORT, which in turn calls the standard function module 'SPROJECT_GET_ADMIMP_SCREEN_BP'.
    During development, things worked fine, but now I run my Z-Program for more than one instance and even I do all FREE for the Class, apperently the function module SPROJECT_GET_ADMIMP_SCREEN_BP, which is called by the class CL_SPROJECT_SOLAR_BASE_REPORT, does not get it's variables from the global data of the function pool re-initialized, when it is called for the second, 3rd, ... time.
    This is a bit strane behavior for me, I would have expected that variables in a function module (or even in the global data of that function pool) get re-initialized each time that function module is called ?
    Actually, this is the only function in that function pool.
    Well, if not, does anyone has an idea how I can get the variables of this module pool re-initialized between the calls ? More concrete, the global data of function pool SAPLSPROJECT_SOLAR_ADMEVAL_BP define:
    DATA: g_v_with_var TYPE char1.
    In the function module line 36 (no reference to g_v_with_var, no module call, no changes to g_v_with_var before the IF-statement at all) it is querying:
      IF g_v_with_var IS INITIAL.
    So this is my problem, the second time I am calling the class  (which is 'free'ed and re-created between the calls) which calls this function module the 'g_v_with_var' is not initial and there seems to be no way to have it set to initial again ?
    So even thought this is in SolMan, I think the question & problem is a ABAP technical one ?
    Any thoughts, help or support would be very much appreciated,
    thank so much,
    Frank

    Hi Mae,
    ..thanks a lot for your fast reply, unfortunately there is only one function and no functions or forms at all for initializing. The variable I am fighting with is g_v_with_var and that is referenced only 4 times in the whole function pool:
    Global Data:   101 DATA: g_v_with_var TYPE char1.
    Function Module SPROJECT_GET_ADMIMP_SCREEN_BP (which is the only function module):
        36   IF g_v_with_var IS INITIAL.
       127       g_v_with_var = airep_true.
       193         CLEAR g_v_with_var.
    If in line 36 g_v_with_var is 'X', which it is always after the first call, the function will exit with an exception, so line 193 to clear it will actually never be executed...and it is not cleared  the next time the function module is called, so you never get back to have the function run...
    All the best,
    Frank

  • Checking the contents of update function module log table

    Dear experts,
    I created several CALL FUNCTION ... IN UPDATE TASK lines and is curious about the contents of the update function module log table. How can I see its contents?
    Thanks in advance.
    Regards,
    Haris

    Hi Hari,
    Use transaction SM13. This gives all the details
    To view the details in SM13 switch on Update debugging before you call your update function module.
    In debugger Settings --> Display / change Debugger settings --> Use the check box "Update Debugging" --> Press save button
    So after COMMIT WORK statement, debugging will start with the update function module
    During this time check the entries in SM13
    Once the update is complete the entries will be removed from SM13 (Unless there is a failure)
    I am not sure if there is option to view records in SM13 for which update is complete (No authorization to change settings in SM13). So i cannot check this
    Regards
    Rajvansh
    Edited by: Rajvansh Ravi on Jul 24, 2011 3:52 PM

  • WHAT ARE THE UPDATED FUNCTION MODULES

    Hi Friends,
    Can anybody explain me about UPDATED FUNCTION MODULES (types of function modules)

    Hi
    Update Function Module
    Unlike transactions and executable programs, dialog modules do not start a new SAP LUW. Calls to update-task function modules from a dialog module use the same update key as the ones in the calling program. The result is that calls to update function modules from a dialog module are executed only if a COMMIT WORK statement occurs in the calling program.
    If you place a COMMIT WORK in a dialog module, it does commit changes to the database (for example, with UPDATE).However, it does not start the update task. The function modules are not actually executed until a COMMIT WORK statement occurs in the calling program.
    If you use dialog modules, try to avoid including calls to update function modules in subroutines called with PERFORM ON COMMIT. In general, any occurrence of PERFORM ON COMMIT(with or without update-task function calls) in a dialog module can be problematic.
    This is because dialog modules have their own roll area, which disappears when the module finishes. Consequently, all local data (including data used for parameter values when calling an update function module) disappears as soon as the commit in the main program is reached.
    If you must use this method in a dialog module (i.e. include the call to an update-task function in a subroutine), you must ensure that the values of the actual parameters still exist when the update-task function actually runs. To do this, you can store the required values with EXPORT TO MEMORY and then import them back into the main program (IMPORT FROM MEMORY) before the COMMIT WORK statement
    Creating Update Function Modules
    To create a function module, you first need to start the Function Builder. Choose Tools ® ABAP Workbench, Function Builder. For more information about creating function modules, refer to the ABAP Workbench Tools documentation.
    To be able to call a function module in an update work process, you must flag it in the Function Builder. When you create the function module, set the Process Type attribute to one of the following values:
    Update with immediate start
    Set this option for high priority ("V1") functions that run in a shared (SAP LUW). These functions can be restarted by the update task in case of errors.
    Update w. imm. start, no restart
    Set this option for high priority ("V1") functions that run in a shared (SAP LUW). These functions may not be restarted by the update task.
    Update with delayed start
    Set this option for low priority ("V2") functions that run in their own update transactions. These functions can be restarted by the update task in case of errors.
    To display the attributes screen in the Function Builder, choose Goto ® Administration.
    Defining the Interface
    Function modules that run in the update task have a limited interface:
    Result parameters or exceptions are not allowed since update-task function modules cannot report on their results.
    You must specify input parameters and tables with reference fields or reference structures defined in the ABAP Dictionary.
    http://help.sap.com/saphelp_nw70/helpdata/en/41/7af4daa79e11d1950f0000e82de14a/frameset.htm
    Regards,
    Harish

  • CALL TRANSACTION in Update Function module

    Hi all
    AFIK, it is not possible to trigger a CALL TRANSACTION for BDC update in an update function module. Yet, i jus wanna to confirm it with the xperts. what are other options for posting a BDC data in an update function module?
    thkx
    Prabhu

    Hi,
    Try this..
    Create a new RFC function module and in the function module do all the coding for the BDC and CALL TRANSACTION..
    Inside the update module call the RFC function module IN BACKGROUND TASK.
    I believe this should work..
    Thanks
    Naren

  • Doubt in update function module

    dear friends..
    i have created an UPDATE function module with Processing type- Update Module, Start Immediate. i have handled the exceptions using Raise statement in the function module..
    the call function looks as..
      CALL FUNCTION 'ZFI_LCTXN_TABLES_UPDATE'
        in update task
        EXPORTING
          ZLCTMB1  = p_lctmb1
          NU_ENTRY = p_global-ins_zlctmb1
        TABLES
          UPD_PO   = UPD_PO
          UPD_SH   = UPD_SH
        EXCEPTIONS
          ERROR    = 1
          OTHERS   = 2.
      p_subrc = sy-subrc.
      commit work.
    but if the update fails, and even though the RAISE ERROR works, and update termination message is registered in SM13, i dont get the value for sy-subrc as 1 .
    is it the right way..if yes please tell me how to generate an error message within the transaction..so that the user knows the update has failed..
    thank you for your time
    Nivin

    Hi,
    Maybe it's usefull  for you.
    <b>
      IF sy-subrc EQ 4.
        MESSAGE e001 RAISING not_found.
      ELSEIF sy-subrc EQ 8.
        MESSAGE e002 RAISING not_found.
      ELSE.
      ENDIF.</b>
    Using this to create a message and raise in the same time !
    Regards.
    Marcelo Ramos

  • Questions regarding update function module

    Hello experts,
    I am on customer site to help them investigate one issue: they have a background job which runs periodically.
    In the report database table A is changed firstly ( new entries are inserted ), then a update function module is called via keyword CALL FUNCTION ... IN UPDATE TASK.
    Inside the function module database table B is updated. ( existing entries are updated )
    Customer issue:
    sometimes they find A is updated as expected, however B remains unchanged at the same time.
    customer could not find exact steps to reproduce the issue. However the issue does exist there and occur from time to time.
    the issue could only be reproduced in their production system, but works perfectly well in dev & Q system. It is difficult to debug in their production system for trouble shooting.
    After analyzing related code, I have one doubt: according to ABAP help on CALL FUNCTION aaa IN UPDATE TASK, I know the function module aaa is called in a new update work process. I wonder whether there is any possibility there this issue might be caused because the update function module fails to get called at all? ( perhaps due to heavy system load so no free update function module could serve the table B update ? )
    If update function module fails to execute, is there any system utility to record this? That is to say, will it be recorded in such as SM13 or SM21?
    Looking forward to your expertise on this topic!
    Best regards,
    Jerry

    Hello friends,
    Thanks a lot for your interests on this issue. I update all my findings:
    1. issue background: this issue occurs in SAP CRM Channel manageement Solution, software component CRM-CHM-POS.
    2. due to some limitations, the table CMSD_CI_HISTORY and history table are not updated in the same LUW. Instead the first one is updated in normal work process while the other is done in update work process. Since I am not the original developer I didn't know the whole complex scenario ( I did see this is done delibrately in note 1764006 - CMS:Sell In Release creating PB with zero available quantity ).
    So for the moment we have to accept this design.
    3. during our testing ,we ensure COMMIT WORK is always called.
    4. So why sometimes the first table update fails, however there is no hint at all for this failure in the system like ST22 and SM21 ?? ( forget SM13, since it is updated in normal work process ).
    The root cause is the flaw of SAP code below.
    The code has planned to raise exception if insertion failed due to duplicate records to be inserted.
    Unfortunately, the fact is if we use "INSERT db FROM TABLE xxx" to insert records into database and some record already exists with the same key, it will result in a termination but SY-SUBRC is STILL 0; Just compare it with single insertion using "INSERT db FROM <work area>", in the same error situation, processing does not terminate, and SY-SUBRC is set to 4.
    As a result in this case even the insertion fails, line 29 will never be executed as sy-subrc is always 0. Since the insertion fails and the exception is caught without any notification, so customer sufferred because they do not know what has happened.
    Best regards,
    Jerry

  • Regarding update function module

    Hi all,
    This is regrding update function module
    How to handle errors in update function module
    Can exception be used in Update function modules
    while calling in update Task
    if we can use please let me know how to do so while calling in Update task.
    Regards,
    siva chalasani.

    Hi Vinod,
    Just wanted to say...
    your answer solved my problem.
    I needed to pass my error records into a internal table and from there to notepad using GUI_DOWNLOAD.
    The following is my function module....
    RHPP_Q_PROFILE_WRITE
    It has under  TABLES-- 'err_profile' to capture error records.
    So, I passed a internal table in " err_profile" to capture the errors.
    And then passed this internal table in GUI_DOWNLOAD.
    Regards,
    Hari Kiran
    Edited by: HARI KIRAN REDDY on Aug 12, 2008 12:20 PM

  • Invalid COMMIT WORK in an update function module. in VKM1 Tcode

    Hi All,
    I am getting the short dump with message "Invalid COMMIT WORK in an update function module. "
    Calling a COMMIT WORK in an update process is not allowed
    because the function modules triggered in a Logical Unit
    of Work cannot then be processed correctly.
    in FM : SO_DOCUMENT_SEND_API1
    Prev. it was giving error in one of my driver program where I had written the commi Work after calling FM for sending fax :
    "CONVERT_OTF_AND_FAX" .
    call function 'CONVERT_OTF_AND_FAX'
        exporting
          FAXOPTIONS = W_ITCPP
          USER       = NAST-USNAM
        importing
          MSGID      = W_MSGID
          MSGNO      = W_MSGNO
          MSGV1      = W_MSGV1
          MSGV2      = W_MSGV2
          MSGV3      = W_MSGV3
          MSGV4      = W_MSGV4
        tables
          OTF        = IT_OTF.
    if sy-subrc eq 0.
      commit work.
      submit RSCONN01 with MODE = 'FAX' and return.
    endif.
    Please explain me where and how I can change my code so that this error should not come?
    Rgds.
    MAdhuri

    Hello, Suhas!
    I am getting the short dump with message "Invalid COMMIT WORK in a COMMIT WORK or ROLLBACK WORK."
    Short text
        Invalid COMMIT WORK in a COMMIT WORK or ROLLBACK WORK.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "CL_FDT_CC_SERVICES============CP" had to be
         terminated because it has
        come across a statement that unfortunately cannot be executed.
    Error analysis
        The call of a COMMIT WORK in a FORM, that will not be executed until
        the commit or rollback point of the caller using the variant
        PERFORM ... ON COMMIT or PERFORM ... ON ROLLBACK is not permitted.
    etc.
    Could you help me to solve the issue?
    Regards,
    Kseniya Tsyganchuk

  • How two create UPDATE FUNCTION MODULE

    Hi,
    I have 2 tables to update one after the other...
    I have geard it is advisable to use update function module for this..
    can any1 tell me how to create and work with update function modules...
    Answers will be rewarded....

    Abhay,
    How an update function module works is, the execution of the FM is delayed to until when a COMMIT WORK statement is executed.
    Hence if you have the data available for updating the two DB tables at the time of calling the FM, you can pass the tables to the same FM and program the DB update for both in the same FM.
    However the COMMIT WORK should be outside the FM further down in the calling program.
    This link is very good and easy to follow
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/41/7af4daa79e11d1950f0000e82de14a/frameset.htm
    Hope it helps
    Aditya[url=http://help.sap.com/saphelp_erp2005vp/helpdata/en/41/7af4daa79e11d1950f0000e82de14a/frameset.htm]
    Message was edited by:
            Aditya

  • Update Function module - How to provide detailed messages in case of errors

    Hello everyone,
    I am using update function modules. When there is a error, the Message i provide goes to inbox and i get a express message.
    I am looking for ways to provide detailed messages (multiple lines) and i also need to add the error message returned by the BAPI
    Providing a long text for the MESSAGE also does not work.
    How can i achieve this ?
    Thanks

    Hi,
    The express message is because the update functions executes in background.
    You can view the detail messages of updates [Error Information from Update Management|http://help.sap.com/saphelp_nw04/helpdata/en/e5/de874735cd11d3acb00000e83539c3/content.htm]
    For your requirement have alook at [Application Log and Application-Specific Error Tables|http://help.sap.com/saphelp_nw04/helpdata/en/a5/3ec9f74ac011d1894e0000e829fbbd/content.htm]
    There are some functions avaibale for this and is mentioned in the document.
    Keshav

  • Add entries to database tables using update function module

    Hi All,
    I have a small requirement, in which I need to update Z-tables usimg update function module in update task. In the calling program, I have gathered the data in a field symbol value of type any. I need to pass the same to that function module to update the data which is in the field symbol.
    Please guide me how to achieve this technically.
    Thanks in advance,
    Pradipta .

    Hi,
    I believe you already have evrything with you.....Start Coding the same and come back with any Coding issue.
    I believe you will not be able to pass the Field Symbol in FM Interface.....You need to pass the Variable which Field Symbol is referring....

  • Short dump for update function module

    Hi Folks,
       If I try to raise exception in Update Task function module which is in turn called in Custom BAPI function module. When I test the BAPI stand-alone using explicit COMMIT WORK (For testing)I can see the error in SM13 and it processes further in BAPI. Now when I am using this BAPI for ALE Inbound processing function module to SAP, when I test using testing tool WE19 it crashes when it passes the update FM inside BAPI, and encounteres BAPI_TRANSACTION_COMMIT, the update Function module is executed as encountered and gives me dump at the raised exception and does not show error in SM13. Please suggest how I could overcome this dump.
    Regards,
    Tim

    Hi there,
    Yes. I know that I can details from ST22 Analysis. And I did go through that.
    Here's the Section that explains:
    How to correct the error
        Try to find out why the number of decimal places of the field should be
        2.
        There are various possible options:
        1. The number of decimal places of the imported field has changed in the
           Data Dictionary. Make sure that the number of decimal places of the
           imported field matches the number of decimal places of the field in
           the Data Dictionary.
           If the data cannot be restored from another source, the data of the
           'old' structure must be read by the 'old' structure, converted und
           again eported with the new structure, so that future IMPORTs will
           always function with the new structure.
        2. A new program version is active, which no longer fits the dataset.
           Try to solve the error generating the program
         "ZFI_FM_GET_STD_COSTS==========FT" again. This
           works as follows: Select transaction SE38 in the SAP system. Enter
           the program name "Z_GET_COSTS==========FT". Then activate the
         function 'Generate'.
    1. I made sure that the decimal places matches.
    2. I did re-generate the program.
    But still got the same dump. Interestingly, the program where I am using this FM is working absolutely fine.
    Thanks.

  • Problem while calling an RFC Function Module in Background

    Hello,
    I have created a RFC function module for reading data from an external DB system. The FM calls an external RFC program (coded in C++ using RFC SDK), which delivers the required data. This external program is maintainged as an TCP RFC Connection in SM59.
    Further I have created a report, that calls the RFC function module to get the data from the external RFC programm.
    My problem is, when I call the report in foreground, everything works OK, the RFC connection works and data can be read from the external program.
    However, when I schedule the report to run in background as a job, the report is stating in the protocoll that there was a problem calling the defined RFC connection (although the connection is working properly at that time).
    More funny is, this particular problem with running in background occurs only in the productive system, in test and development system the report works correctly also while running as a job in background.
    Can you suggest the solution to this problem? Could it be something with authorisations or server settings?
    I will be on holiday for the next 6 weeks, so take your time to answer .
    Regards,
    Dusan.
    Edited by: Julius Bussche on Jan 22, 2009 7:19 PM
    Please read the forum rules about u r g e n t ...

    This is an external RFC server program, not a remote enabled ABAP RFC function module as the others seem to be assuming, right?
    Is it possible that your DEV and QAS systems only have one application server, but the PROD has many and dedicated one(s) for processing low priority background jobs?
    It might be that the target server of your TCP connection is not this BTC instance, and your RFC server is returning the data "locally" - so, into nirvana...
    Just guessing, but might be worth checking.
    Cheers,
    Julius

  • Calling a RFC Function Module

    Hello Guys,
    I have a question regarding calling a RFC function module.
    In BW - BI 7.0 I call a RFC function module:
    (The ABAP program in BW-BI 7.0 is below)
      CALL FUNCTION ''ZTESTFUNCTIONMODULE'  " Function module in ECC
         DESTINATION 'DECCLNT110'  " ECC system
        TABLES
          it_gl_item   = it_gl
          it_errlog_gl = it_errlog_gl.
    The 'ZTESTFUNCTIONMODULE'   is RFC enabled in the ECC system.
    The purpose is we retarct the data from BW to ECC.
    When I run the function module it always asks for the user id and password.
    The SAP logon screen appears and it asks for the user id and password.
    The destination is maintained in the SM59 transaction and also the user is maintained there. I think it should login automatically into remote system and return the tables. is it correct. How to skip the logon screen.
    Do I have to pass the user id and password in the function module. I think it should take the user id from the SM59 destination. Is it correct.
    Please advise. As always thanks for your help guys.

    Hi Senthil,
    I think you answered your query in your question itself
    The user ID and password need to be maintained in RFC destination in SM59.
    Go to SM59 and then click on test connection..if it does not ask for ID and passwoed that means correct ID and password is maintained in SM59 otherwise maintain it.
    Regards,
    Atish

Maybe you are looking for

  • Photoshop Elements 6.0 startet nicht

    Hallo, wir brauchen Hilfe zu Photoshop Elements 6.0. Das Programm liess sich plötzlich nicht mehr oeffnen, wurde de- und wieder re-installiert. Problm nicht behoben, laesst sich noch immer nicht oeffnen.- Das BS ist WIN XP PRO, das Programm wurde unt

  • Ive just learned that i can use loadjava to load jsp pages into the database.

    Ive just learned that i can use loadjava to load jsp pages into the database. How is that possible. How can someone go to my lets say, index.jsp page and actually see it if its inside the database? What authenticates it? Where would you set the param

  • Capturing HD to FCP Pro

    If I want to capture HD DV fig. to FCP is the only thing I have to do is change the capture setting to 1080i (50 or 60)? Jeff Dual G4 1 GIG, G4 1.25 Laptop Macbook Pro 2.0   Mac OS X (10.4.7)  

  • Detected virus

    whats the best way to get rid of pop-ups and a virus?

  • Currency Coversion and Exchange Rate Issue

    Hi, I have a scenario in query which is related to currency conversion and exchange rates. Company Code     Matter Code      Invoice          Invoice date     Amount                          Number          (DD/MM/YYYY) 1001          1111          IN