Commit statement in user exit

Hi All,
We found that while doing PGI , it takes some time to COMMIT the table VBUK. Due to which we are getting old values of VBUK-KOSTK field while executing select query at later point of time in the flow.
My question --
Can I use COMMIT WORK statement in user exit MV50AFZ1 --> FORM USEREXIT_SAVE_DOCUMENT so that all the related tables
get committed immediately.
Thanks
Saurabh

Hi Saurabh ,
Normally , you shoud not specify COMMIT stmt in any user exit , badi etc..
SAP has its own COMMIT statement while execuiting the standard transactions .
Addition of a COMMIT might lead to problems elsewhere .
Thanks
Supriya

Similar Messages

  • Can it be used commit statement in user-exits?

    Can it be used commit statement in user-exits?
    How to badi is different from other enhancement?
    What are the two default components systems automatically creates when we create a new badi?
    What is the business object for purchase order?

    Hi,
       1) commit statement in userexit:
    You should not do that.
    After the user exits code is triggered, the transaction's own commits statements will commit the database anyway
    2)You could say: BAdI = enhancement using interfaces
    It is just the most up-to-date version of SAP's enhancement concept.
    go thru this.
    http://www.esnips.com/web/BAdI
    http://www.allsaplinks.com/badi.html
    New to Badi
    Regards
    Kiran Sure

  • Export statement in user-exit??

    I have used the following export statement in a user-exit:"EXPORT xaccit TO MEMORY ID 'ZCACHEPPA'."-I have doubt that - will this statement export the contents of the table XACCIT to memory and those contents in the memory will be imported by the IMPORT statement in other user-exit.....??
    If no,then which EXPORT/IMPORT statement should be used....is there any other keyword that can be used to export the contents to the memory?

    Hi
    See the doc related to SAP Memory and ABAP memory
    SAP memory is a memory area to which all main sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters can be set either for a particular user or for a particular program using the SET PARAMETER statement. Other ABAP programs can then retrieve the set parameters using the GET PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill input fields on screens
    SAP global memory retains field value through out session.
    set parameter id 'MAT' field v_matnr.
    get parameter id 'MAT' field v_matnr.
    They are stored in table TPARA.
    ABAP memory is a memory area that all ABAP programs within the same internal session can access using the EXPORT and IMPORT statements. Data within this area remains intact during a whole sequence of program calls. To pass data
    to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is then returned to the program which made the initial call, the same process operates in reverse.
    ABAP memory is temporary and values are retained in same LUW.
    export itab to memory id 'TEST'.
    import itab from memory Id 'TEST'.
    Here itab should be declared of same type and length.
    http://www.sap-img.com/abap/difference-between-sap-and-abap-memory.htm
    ABAP Memmory & SAP Memmory
    http://www.sap-img.com/abap/difference-between-sap-and-abap-memory.htm
    http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
    Reward points if useful
    Regards
    Anji

  • EXIT statement in custome exit

    Hi All,
    I have written EXIT statement in routine XXX of Sales order custom include MV45AFZZ.
    does this EXIT statement inside user exit do any internal commits or incorrect commits. Please explain.
    i heard that output of messages (except message type u201CAu201D) inside user exits triggers an incorrect commit work, the result
    *could be a loss of transactional integrity and possible data inconsistencies,
    Is this above statement is true. Please provide the links that could talk about commits in user exits.
    Thanks,
    Shaik

    hi
    jus have a look at this documentation
    http://help.sap.com/saphelp_nw04/helpdata/en/f1/0a56f5e09411d2acb90000e829fbfe/content.htm
    hope this helps
    regards
    Aakash Banga

  • Commit in user exit

    hi experts
    during an idoc process i am trying to do commit after inserting data to a database table in include MV45AFZZ in a user exit. the commit statement causes the idoc process to fail.
    how can i do commit in a way that won't fail the idoc process
    tahnks
    amit
    Edited by: amit walden on Jun 18, 2008 8:38 AM

    Hi,
      commit statement in userexit,You should not do that.
    After the user exits code is triggered, the transaction's own commits statements will commit the database anyway.
    Regards
    Kiran Sure

  • User Exit / Badi after (inbound idoc) database commit

    Hello Folks,
    I want to know the User Exit/Badi that can be used after inbound idoc gets posted, as i want to use perform on commit statement.
    Thanks & Regards,
    Nishanth Kumar

    Hi Sengupta,
    Usually there are no user-exits after COMMIT.
    What you need to do is register a call which will be executed after COMMIT, from one of the available user-exits.
    To do this, SAP provides 2 methods:
    1. PERFORM xxx ON COMMIT
    2. Function Module with attribute "Update Module"
    Check ABAP keyword help for more information for PERFORM xxx ON COMMIT.
    <a href="http://help.sap.com/saphelp_46c/helpdata/en/34/8e72cc6df74873e10000009b38f9b8/frameset.htm">http://help.sap.com/saphelp_46c/helpdata/en/34/8e72cc6df74873e10000009b38f9b8/frameset.htm</a>
    Hope this helps.
    Regards,
    Sumant.
    PS: Reward points if this is helpful.

  • COMMIT WORK within an user exit

    Hi every one,
         I got a lill question here, can i use COMMIT WORK (AND WAIT ) within a user
    exit FM, if yes is do i need any thing extra. Please help.
    Thanks in advance
    Jahan.

    Hi Jahan,
    although your question has been answered, just a few words on COMMIT WORK.
    During a LUW (logical unit of work, i.e. transaction) all changes of database records are done within a so-called rollback segment of the database. That means they are visible within the current LUW but invisible to other users.
    This makes it easy to do all necessary changes to all tables step by step. And if any step fails, all changes can be thrown away. Thats what we call a rollback - A rollback will just dump the rollback segment.
    The reason you should not COMMIT WORK in a user exit is simply you have no idea what other database changes have already been done and what other database changes may follow after the user exit. If in one of the following steps a severe error is detected, all prior changes cannot be rolled back. COMMIT WORK means that all changes still in the rollback segment of the database will be applied and finalized to the database. The rollback segment will also be dumped that there is no chance to find out details about the changes.
    An Error message (Type E or A) will automatically finish the LUW without commiting the data in the rollback segment -  implicit rollback.
    The end of a report not caused by any error will commit the rollback segment to the database -  implicit commit.
    All function modules called IN UPDATE TASK will be executed in their own update process after COMMIT or DUMPED after rollback.
    All form routines called as PERFORM ... ON COMMIT or PERFORM ... ON ROLLBACK will be executed only after explicit COMMIT WORK or ROLLBACK WORK.
    The addition 'AND WAIT' just means that the next program statement is not executed before all update processes started with COMMIT WORK have finished.
    The general rule derived from this can be:
    Never do a commit or rollback in a process which is called by another process. The only place for COMMIT or ROLLBACK is at the end of reports and transactions using CALL ... IN UPDATE TASK or PERFORM ... ON COMMIT - if you call any functions you should be aware that function modules may initiate update calls and/or form calls ...ON COMMIT/ROLLBACK. An explicit COMMIT WORK at the end of a process (or ROLLBACK WORK in case of error) will be OK.
    Regards,
    Clemens

  • Statement not accessible in include called in a user-exit

    I am working on an upgrade project, and we receive an error 'Statement not accessible.
    In the following user exit:
    FUNCTION EXIT_SAPLZLWB_002.
    INCLUDE ZZLWBU02 .
    ENDFUNCTION.
    If I go to the include, I get an the error 'statement not accessible'.
    I tried to put all the code in the include between a form...endform statement,
    but then I get an incorrect nesting error because the form...endform is between a function...endfunction.
    How can I solve this?
    Thx!
    Edited by: christophe latinne on Jan 9, 2009 4:31 PM

    this seems to be a clone of a standard SAP function group, and thats why you can;t access the exits here.
    EXIT_SAPLZLWB_002
    you can create the exits starting with Z* in order to access those at runtime.

  • User Exit/BADI after database commit in VA01/VA02

    Hi All,
    Can you tell me an user exit/BADI in VA01/VA02 which I can utilize AFTER the database commit but still utilize the tables/structures like xvbap, xvbkd etc? Thanks.
    Best Regards,
    Avimanyu

    Hi Sengupta,
    Usually there are no user-exits after COMMIT.
    What you need to do is register a call which will be executed after COMMIT, from one of the available user-exits.
    To do this, SAP provides 2 methods:
    1. PERFORM xxx ON COMMIT
    2. Function Module with attribute "Update Module"
    Check ABAP keyword help for more information for PERFORM xxx ON COMMIT.
    <a href="http://help.sap.com/saphelp_46c/helpdata/en/34/8e72cc6df74873e10000009b38f9b8/frameset.htm">http://help.sap.com/saphelp_46c/helpdata/en/34/8e72cc6df74873e10000009b38f9b8/frameset.htm</a>
    Hope this helps.
    Regards,
    Sumant.
    PS: Reward points if this is helpful.

  • User Exit after the credit release  by VKM1/VKM3 (database commit)

    Hi All,
    We have a requirement where once the credit manager releases the order from block through transaction VKM1 or VKM3, an e-mail should be triggered stating that the order has been released.
    I tried putting the code in EXIT_SAPFV45K_001(include ZXVVAU03 ) which checks the status in vbuk-cmgst for value 'D' and send the mail.But there are 2 problems with this appproach.
    1) The database table VBUK is not getting updated at this stage.So the CMGST value doesnt change. Even the last change value in VBAK( VBAK-CMFRE) is not getting updated.
    I tried Implementing this solution as well.
    "Perform f0001_download_data on commit"
    but even then the tables are not getting updated at this point.
    2) This user exit is called in transaction VA02 as well.so the mail is getting triggered whenever someone saves anything in VA02. Chances are thetre might be other transacyions using this exit like va01.
    Can anyone help me with this scenario? Is there any other user exit which can be used or any other way this can be done ??
    Thanks
    Shwet
    Edited by: Shwet Priy Anand on Jun 29, 2010 7:16 PM

    Output determination requires both config and development and it's the standard method for triggering document-related communications (printing, faxing, emailing, etc.).  When you block or release a sales order for credit check, you are changing that order and thus you can use output determination to trigger any type of communication related to the change.  There is a standard output type and standard requirements for credit holds; you can create your own for credit releases.  You can find thousands of posts on this site related to output determination and emailing and there is an abundance of documentation in the IMG (SD -> Basic functions -> Output control) and in the help files.
    Don't put emails in user exits unless it's a last resort - there's no error handling and logging available.

  • User Exit to Change 'Assignment Field' while uploading Bank statement using FF_5

    Hi Experts,
    We are uploading  bank statement using tcode FF_5. It creates BDC of FB01. then we process it via SM35. Its a country specific bank statement (Hungary). Now while processing BDC we found that document header text (BKTXT) and Assignment (ZUONR) field is filled with the combination of two keys of table FEBEP.
    Screen shot of BDC
    Screen having document header text:
    Next Screen having Assignment
    These both fields are the combination of FEBEP-KUKEY -Short key (surrogate) and FEBEP-ESNUM -Memo record number (line item number in bank statement).
    Both fields are getting filled inside the standard program RFEBBU00 (This program creates BDC)
    Now user wants 'posting date' in the Assignment field. Functional has changed the configuration so while doing manually via FB01 , posting date gets populated in Assignment field but While uploading via FF_5 this standard report gets called and it populates the key combination.
    I am working on SAP 4.7 .
    Is these any user exit or sap note for this info.
    Please help me. if anyone has any idea that would be helpful.
    Regards,
    Ashish

    Ashish, Try to find some BTE for your requirement. Use FM BTE_FUNCTION_FIND .
    OPEN_FI_PERFORM_00001120_P
    OPEN_FI_PERFORM_00001120_E

  • MIGO BAdI or User-Exit - After Database Commit

    Hello,
    I'm looking for a BAdI or user-exit after database commit for MIGO posting. I want to create a FI document after MIGO posting.
    I already tried MB_MIGO_BADI BAdI but system gives a short dump. So I have to find a exit or BAdI after database commit.
    Thanks for helping in advance.
    Regards,
    Burak

    Hello,
    This issue solved.
    I used MB_DOCUMENT_BADI / MB_DOCUMENT_UPDATE and it solved my problem.
    FYI.
    Regards,
    Burak

  • User exit to find sy-comm when user select a tab at item level data in VA02

    Hi Gurus,
    is there any user exit in VA02 in which we can find the command button pressed in the sale order line item data where we find sales A sales B .....and condition tab in the screen.
    rewards for sure.
    thanks

    Dear Mandy,
    How to find user exits:
    Display the program where you are searching for and exit and search for CALL CUSTOMER-EXIT
    If you know the Exit name, go to transaction CMOD.
    Choose menu Utillities->SAP Enhancements. Enter the exit name and press enter.
    You will now come to a screen that shows the function module exits for the exit.
    3. Using Project management of SAP Enhancements, we want to create a project to enahance trasnaction VA01 .
    - Go to transaction CMOD
    - Create a project called ZVA01
    - Choose the Enhancement assign radio button and press the Change button
    In the first column enter V45A0002 Predefine sold-to party in sales document. 
    Note that an enhancement can only be used in 1 project. If the enhancement is already in use, and error message will be displayed
    Press Save
    Press Components. You can now see that enhancement uses user exit EXIT_SAPMV45A_002. Double click on the exit.
    Now the function module is displayed. Double click on include ZXVVAU04 in the function module
    Insert the following code into the include: E_KUNNR = '2155'.
    Activate the include program. Go back to CMOD and activate the project. 
    Goto transaction VA01 and craete a salesorder. 
    Finding the user-exits of a SAP transaction code
    * Finding the user-exits of a SAP transaction code
    * Enter the transaction code in which you are looking for the user-exit
    * and it will list you the list of user-exits in the transaction code.
    * Also a drill down is possible which will help you to branch to SMOD.
    report zuserexit no standard page heading.
    tables : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.
             tables : tstct.
    data : jtab like tadir occurs 0 with header line.
    data : field1(30).
    data : v_devclass like tadir-devclass.
    parameters : p_tcode like tstc-tcode obligatory.
    select single * from tstc where tcode eq p_tcode.
    if sy-subrc eq 0.
       select single * from tadir where pgmid = 'R3TR'
                        and object = 'PROG'
                        and obj_name = tstc-pgmna.
       move : tadir-devclass to v_devclass.
          if sy-subrc ne 0.
             select single * from trdir where name = tstc-pgmna.
             if trdir-subc eq 'F'.
                select single * from tfdir where pname = tstc-pgmna.
                select single * from enlfdir where funcname =
                tfdir-funcname.
                select single * from tadir where pgmid = 'R3TR'
                                   and object = 'FUGR'
                                   and obj_name eq enlfdir-area.
                move : tadir-devclass to v_devclass.
              endif.
           endif.
           select * from tadir into table jtab
                         where pgmid = 'R3TR'
                           and object = 'SMOD'
                           and devclass = v_devclass.
            select single * from tstct where sprsl eq sy-langu and
                                             tcode eq p_tcode.
            format color col_positive intensified off.
            write:/(19) 'Transaction Code - ',
                 20(20) p_tcode,
                 45(50) tstct-ttext.
                        skip.
            if not jtab[] is initial.
               write:/(95) sy-uline.
               format color col_heading intensified on.
               write:/1 sy-vline,
                      2 'Exit Name',
                     21 sy-vline ,
                     22 'Description',
                     95 sy-vline.
               write:/(95) sy-uline.
               loop at jtab.
                  select single * from modsapt
                         where sprsl = sy-langu and
                                name = jtab-obj_name.
                       format color col_normal intensified off.
                       write:/1 sy-vline,
                              2 jtab-obj_name hotspot on,
                             21 sy-vline ,
                             22 modsapt-modtext,
                             95 sy-vline.
               endloop.
               write:/(95) sy-uline.
               describe table jtab.
               skip.
               format color col_total intensified on.
               write:/ 'No of Exits:' , sy-tfill.
            else.
               format color col_negative intensified on.
               write:/(95) 'No User Exit exists'.
            endif.
          else.
              format color col_negative intensified on.
              write:/(95) 'Transaction Code Does Not Exist'.
          endif.
    at line-selection.
       get cursor field field1.
       check field1(4) eq 'JTAB'.
       set parameter id 'MON' field sy-lisel+1(10).
       call transaction 'SMOD' and skip first   screen.
    *---End of Program
    Best Regards,
    Rajesh
    <b>Please award points if found helpful.</b>

  • User exit/BADI AFTER the database commit in va01 va02

    Hi All
    I need an user exit/BADI <b>AFTER the database tables are updated</b> when save button is pressed on VA01/VA02, both these user exits are fired before that.
    Regards
    Badari

    Check out all these exits
                                                                                    SDTRM001            Reschedule schedule lines without a new ATP check            
    V45A0001            Determine alternative materials for product selection        
    V45A0002            Predefine sold-to party in sales document                    
    V45A0003            Collector for customer function modulpool MV45A              
    V45A0004            Copy packing proposal                                        
    V45E0001            Update the purchase order from the sales order               
    V45E0002            Data transfer in procurement elements (PRreq., assembly)     
    V45L0001            SD component supplier processing (customer enhancements)     
    V45P0001            SD customer function for cross-company code sales            
    V45S0001            Update sales document from configuration                     
    V45S0003            MRP-relevance for incomplete configuration                   
    V45S0004            Effectivity type in sales order                              
    V45W0001            SD Service Management: Forward Contract Data to Item         
    V46H0001            SD Customer functions for resource-related billing           
    V60F0001            SD Billing plan (customer enhancement) diff. to billing plan 
    SDAPO001            Activating Sourcing Subitem Quantity Propagation

  • Ztable not updating in sales order user exit

    Hi Genius Abapers.
    We want to take text ID data of sales order into Ztable. For taking the data we have used user exit in sales order. Now the problem is if we go through debug mode then the Ztable is updating but if we remove the break point Ztable is not getting updated.
    Please give solution for this problem
    Regards
    Narayana

    Hi Gurus,
            I am basically from SD and we used commit statements in the programme and this is the code we used
    Include name --- MV45AF0B_BELEG_INITIALISIEREN
    **********************************Code Addd by paresh 8.10.2007 starts *******************************
      DATA : BEGIN OF itab_so OCCURS 0,
             vbeln LIKE vbap-vbeln,
             posnr LIKE vbap-posnr,
             spras LIKE t002t-spras,
             END OF itab_so.
      DATA : BEGIN OF itab_so1 OCCURS 0,
             vbeln LIKE vbap-vbeln,
             posnr LIKE vbap-posnr,
             spras LIKE t002t-spras,
             END OF itab_so1.
      DATA : BEGIN OF it_tabid OCCURS 0,
             tdid LIKE stxh-tdid,
             tdspras like stxh-tdspras,
             END OF it_tabid.
      DATA : is_stxh TYPE stxh.
      DATA g_header TYPE string .
      DATA wa_plain_text TYPE zplain_text.
      DATA t_lines LIKE tline OCCURS 0 WITH HEADER LINE.
      DATA g_item(16)." type i.
      data :it_ztable type table of  ZPLAIN_TEXT .
      data wa_ztable type zplain_text.
      data flag.
    *****************************Read Header text***************************************
    *loop at vbak.
       itab_so1-vbeln = vbak-vbeln.
       itab_so1-posnr = vbak-posnr.
       itab_so1-spras = vbak-wklnd.
       APPEND itab_so1.
       CLEAR itab_so1.
    ENDLOOP.
    refresh it_tabid.
    clear it_tabid.
    refresh it_ztable.
    clear it_ztable.
      LOOP AT xvbap.
        itab_so-vbeln = vbak-vbeln.
        itab_so-posnr = xvbap-posnr.
        itab_so-spras = xvbap-wklnd.
        APPEND itab_so.
        CLEAR itab_so.
      ENDLOOP.
    LOOP AT itab_so.
        SELECT tdid tdspras FROM stxh INTO TABLE it_tabid WHERE tdobject = 'VBBK' AND tdname = vbak-vbeln  .
    ENDLOOP.
    *loop at it_ztable into wa_ztable.
      LOOP AT itab_so.
        LOOP AT it_tabid.
          is_stxh-tdobject = 'VBBK'.
          is_stxh-tdname   = vbak-vbeln.
          is_stxh-tdid     = it_tabid-tdid.
          is_stxh-tdspras  = it_tabid-tdspras.
          CALL FUNCTION 'READ_TEXT'
            EXPORTING
              id                      = is_stxh-tdid
              language                = is_stxh-tdspras
              name                    = is_stxh-tdname
              object                  = is_stxh-tdobject
            TABLES
              lines                   = t_lines
            EXCEPTIONS
              id                      = 1
              language                = 2
              name                    = 3
              not_found               = 4
              object                  = 5
              reference_check         = 6
              wrong_access_to_archive = 7
              OTHERS                  = 8.
          IF sy-subrc = 0.
            LOOP AT t_lines.
              CONCATENATE g_header t_lines-tdline INTO g_header SEPARATED BY space.
            ENDLOOP.
            wa_plain_text-application = 'SO'.
          wa_plain_text-key1 = itab_so-vbeln.
            wa_plain_text-key1 = vbak-vbeln.
            wa_plain_text-key2 = 'HDR'.
            wa_plain_text-sub_application = it_tabid-tdid.
            wa_plain_text-text = g_header.
            wa_plain_text-last_date = sy-datum.
            MODIFY zplain_text FROM wa_plain_text .
       wait up  to  60 seconds.
             commit work.
            CLEAR: wa_plain_text.
            CLEAR : g_header,t_lines.
            refresh t_lines.
          ENDIF.
      if sy-subrc <> 0.
       delete from zplain_text where key1  = vbak-vbeln    and
                                  key2  = itab_so-posnr    and
                                  SUB_APPLICATION = it_tabid-tdid.
                                   commit work.
       endif.
        ENDLOOP.
      ENDLOOP.
    *endloop.
    Please do me the needfull
    Regards
    Manam.Narayana

Maybe you are looking for

  • Populating a PDF File from ColdFusion

    I wanted to populate a pfd file from coldfusion and I found this online: http://www.school-for-champions.com/coldfusion/cftopdf.htm When I submit the form.. I then show a link [view pdf].. only when I click on that lick I get a message saying Adobe a

  • Exporting Images

    Hello everyone..... I'm using an old version of Flash: Flash MX (when Macromedia was still selling it). I'm trying to export Images, but can't figure out how to get the exact image as I'm seeing on my screen in Flash. I've tried Export Image, but it

  • Built in isight - how to activate in chat rooms

    Hi. I'm a new MacbookPro user and am pretty new to using isight. It works in Yahoo ok. Mac version of MSN does not seem to have provision for webcam and I can't activate the camera in chat rooms with webcam facility. Any ideas?

  • Checking for Ctrl key after DropTargetDragEvent

    Hi, I need help with a program which contains a table and a tree. A DropTargetDragEvent is fired whenever selected line(s) from the table are dragged to the tree. Upon dragEnter() I do some action. How can I detect if the Ctrl key is pressed at that

  • 2 javascript image galleries to communicate

    http://www.canchair.com/new_web_product_detail.asp?ProductID=450&ProductFamily=1&ProductFa milySub=9# The above page features an image gallery containing thumbnails and a "large image" whose javascript ID is "largeimage" Additionally, clicking on the