Why the code in a user exit is executed twice?

Hi all,
I've got a development in a user exit EXIT_SAPMP56T_001.
This user exit allows us to control the travel expenses.
When you go to the TX: PR05 you can see a list with travels to add expenses. Here you can select one item on the list and press the edit button to add new expenses.
We want to control this and we use this user exit for that purpose.
When the user selects a row and presses the edit button, the user exit is triggered. We can check the values of the table and see which row is selected. But this exit is executed twice. The first time the table doesn't have any changes on it, the second time it has marked the selected row.
Why is this happening? Why is this exit executed twice? And how can I control that the table is properlly updated?
Thank you.

Hi,
I think this user exist in getting triggered both in the PAI and PBO of that screen.
For avoiding this use the flag.
If flag is initial then only your code needs to trigger.
if flag is initial.
flag = 'X'.
then your code.
endif.
So when it again comes into the PBO it will check the flag and the same code will not be triggered for the second time.
With Regards,
Sumodh.P

Similar Messages

  • Problem in triggering the code for CO02 User Exit

    Hi,
    I am using the code for the Tcode CO02 (User Exit) and i am facing a problem that when i am using the code as a normal program it is executing fine and displaying the pop up window and showing the data in it.
    But when i am using that code in the USER EXIT code it is not trigerring that pop up window.
    I am using the enhancement:-
    *PPCO0007 * - Exit when saving production order
    And the include in which i am writing the code is :-
    INCLUDE ZXCO1U06
    plzz provide me guidelines for solving this problem.

    hi ,
    i am using the following: -
    Enhancement No.  ->  PPCO0007 (Exit when saving production order)
    When i click on the enhancement the following is displayed:-
    Function exit  ->   *EXIT_SAPLCOZV_001 *
    When i double click the function exit  the code i had written in the following include:-
    INCLUDE ZXCO1U06
    plzz tell me whether i am doing it right or worng?

  • How to access the global data in user exit.

    Hi All,
    How to access the global data in user exit.
    the question is that when we were writing a code in the FM. i need to read data from the standard program like newly created documen and this document number need to be accessed in my program.
    this document number is not imported to the FM i needed to access for frther proceed.
    Thanks in advance.

    Hi,
    See the below PDF file by Jeff Goldstein. There you can find all the details about accessing data outside of the exit.
    [SAP User Exits and the People Who Love Them|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/208811b0-00b2-2910-c5ac-dd2c7c50c8e8]
    This will help you to solve your problem.
    Regards
    Karthik D
    Edited by: Karthik D on Dec 2, 2008 4:18 PM

  • HOW TO FIND TRANSACTION CODE BASED ON uSER eXIT.

    HI FRIENDS,
    I WOULD LIKE TO KNOW HOW WE CAN FIND OUT A TRANSACTION CODE OF AN USER EXIT.
    MY USER EXIT IS : EXIT_SAPLV60B_002 .
    PLEASE LET ME KNOW .
    THANS IN ADVANCE,
    REGARDS,
    ROBERTS.K

    FUNCTION EXIT_SAPLV60B_002.
    ""Lokale Schnittstelle:
    *"  IMPORTING
    *"     VALUE(XACCIT) LIKE  ACCIT STRUCTURE  ACCIT
    *"     VALUE(VBRK) LIKE  VBRK STRUCTURE  VBRK
    *"     REFERENCE(DOC_NUMBER) LIKE  VBRK-VBELN OPTIONAL
    *"  EXPORTING
    *"     VALUE(XACCIT) LIKE  ACCIT STRUCTURE  ACCIT
    *"  TABLES
    *"      CVBRP STRUCTURE  VBRPVB OPTIONAL
    *"      CKOMV STRUCTURE  KOMV
      INCLUDE ZXVVFU02.
    ENDFUNCTION.
    Above is the interface of the function module stated by you, create the include zxvvfu02 by double clicking on it,
    put a break point in it and activate and in the debugging mode you can see that the structure XACCIT has EBELN i.e.
    purchase order no. assign it to the reqd field.

  • Whats the exact differnrce between User-Exit and BADI ?

    Hi All,
    Can any one tell me whats the exact difference between User-Exit and BADI ?
    Even in User Exit also we write our code and the same in BADI also. Can any one plse elaborate wats the exact difference between these ...
    Thanks & Regards,
    Anil Kumar.

    BADI is the Object oriented concept of USER-EXIT
    chk this
    http://www.sap-img.com/abap/difference-between-badi-and-user-exits.htm
    Message was edited by:
            Chandrasekhar Jagarlamudi

  • What is the Difference 'VOFM' and 'User-Exit' ?

    What is the Difference 'VOFM' and 'User-Exit' ?

    If you need to implement any of these User exits, you first create a project for the user exit, then assign the user exit(s) to your project. Then you write the coding for the user exit, and finally activate the project.
    For general information about user exits, in the R/3 Library, go to Basis components and look at the Enhancements section. In addition there is detailed information about each user exit that you can access when you assign it to your project (see below).
    Activities
    Start by creating your project.
    1. Enter a name for your project.
    2. Select Modification -> Create.
    3. Enter a short text for your project and select save.
    Next assign the user exit to your project.
    4. Select Components.
    5. Enter the name(s) of the user exits you want to implement.
    6. Select SAP documentation, if you want detailed information on this user exit.
    7. Select save.
    8. Select back.
    Next make your coding modifications.
    9. Select enhancement components.
    10. Select change.
    11. Select the user exit you want to write code for.
    12. Select the include zxpbco01.
    The system will then prompt you to create this include, and you can continue to write your coding in it.
    Next activate your project.
    13. Return to the initial screen and select activate project.
    Routines
    Routines are short sub-programs that carry out various checks during document processing. In the SD module, you can create and process routines for copying requirements, data transfer, requirements and formulas using transaction VOFM. Besides the routines delivered to you with the system, you can create your own individual routines.
    Transaction VOFM allows you to follow a standardized procedure for creating routines. The name ranges are predefined for routines delivered to you with the system and for routines created by the customer. This name convention guarantees that your own routines are not overwritten during a Release upgrade.
    Copying requirements and data transfer
    The routines for coying requirements and data transfer are defined for the document types sales orders, deliveries, billing documents, sales activities, as well as for texts. You specify copying requirements and the data transfers when defining the document flow for each document type. You enter the routines for texts in the access sequences for texts.
    o Copying requirements determine which data is copied during the copying of documents. A copying requirement could define, for example, that the same customer must appear in the document header when you copy an inquiry to a quotation.
    o Routines for data transfer make a detailed control of the copying of fields possible. A data transfer could define, for example, that particular item fields can only be copied in combination with other particular fields and can only be copied into contracts or credit and debit memos.
    Requirements and formulas
    Routines for requirements and formulas are used for functions using the condition technique. You enter these routines in the pricing procedure or the condition types. Requirements are also used for statistics.
    o A requirement in pricing can determine that an access is dependent on a particular precondition. It can carry out a check of the document currency, for example, and, depending on whether it is a foreign or the local currency, allow or deny the access.
    o Formulas are used in pricing to define various factors for pricing. Formulas are defined for scale base value, condition base value, condition amount, group key, and rounding rules. The formula for a rounding rule could define, for example, that all calculated amounts are rounded to two places behind the decimal point during a price change of the condition record. The formula for a condition base value could define, that the header discount is distributed among the order items according to volume an not value of the item, as is the case in the standard SAP R/3 System.
    Creating routines
    There are two methods to create a routine
    1. Creating by overwriting
    When using this method, a note appears as a commentary in the routine to be newly created.
    2. Creating
    When creating a new routine, an ABAP with internal number assignment is created.
    You always have to activate a new routine before using it. Each routine for requirements and formulas, copying requirements and data transfers is stored in a separate program. For each new routine an entry is added in table TFRM and TFRMT. For each routine, a long text can be stored as a text module.
    Most routines must be changed in client 000. Transaction VOFM can be transported as XPRAs, which means that after the import all routines can be activated.
    Name ranges for routines
    The standard routines are to be within the number range 001-599 (for 2 digit formula numbers, 01-49)
    The user routines are to be within the number range 600-999 (for 2 digit formula numbers, 50-99).

  • How to find the list of all user exits modified by the users

    How to find the list of all user exits using by in R3

    Hi Mohamed
    You use Solution Manager to do the comparison for you.  There are some nice features that will highlight all your customised coding.  Have a look at the SolMan resources on the Support Portal e.g. using SolMan for upgrade comparisons.
    Rgards
    Carl.

  • Coming back to the Transaction from a User Exit

    Hi,
    I perform some checks in a User-Exit before saving a transaction & throw an error message if something is not proper. But, the transaction terminates after that. I need to give the user an option to make changes in the transaction. eg, if user exit checks if a certain field should not be empty, the user should have an option to enter the field after the user exit throws the message. How can i go back to the same screen from the exit to achieve the same.
    Thanks in advance.
    Bikash
    This was for a general scenario wherein after an error message triggered by an Exit is displayed, the transaction just terminates.
    Message was edited by: Bikash  Agarwal

    Hi,
    If you give error message, it will leave the current transaction.
    Instead try using some POPUP function module, which will have options 'OK' and 'CANCEL'.
    If user presses 'OK', then allow user to do modifications and if he presses 'CANCEL', then write LEAVE PROGRAM to come out of transaction.
    Hope it helps.
    Regards,
    Shashank

  • Why the code in the UR disappear

    Hi all,
    Why the code in the UR disappear, i wrote a rutine in the UR to fill an Infoobject, but the rutine find from 0EMPLOYEE the comp code, but i need the value with Valid to 31.12.9999, when i write this in the rutine and press save, this disapear , its amazing but i dont know? help

    make sure you are in change mode. Try activating the code after writing.

  • What is the name of the table for finding user exit !

    What is the table name to find the user exit !

    Hi,
    Goto to the table tstc and enter the transaction code for
    which u want to find out the User-Exits. Check out the
    program name from the result. Goto SE38 and dee that
    program in display mode. Then search for the string Call
    Cutomer-Funtion. All the result of search are the user
    exits defined there for that transaction.
    SAP user exits (enhancement names that we see in SMOD transaction) are all stored in the table MODSAP. The field NAME contains the enhancement name and the field MEMBER contains the name of the function module that will be called if the customer enhancement exists and is active. The customer enhancement projects are stored in the table MODACT. There, the NAME field is the name of the project and MEMBER is the name of SAP enhancement (that from the MODSAP).
    So, if you are in some include, you can use where-used-list to get to the function module name. Then you find the SAP enhancement name from the MODSAP by supplying the function module. And finally, you find the customer enhancement projects by querying the MODACT with the SAP enhancement in the field MEMBER.
    cheers,
    vasavi.
    kindly reward if helpful.

  • Is there a way to get the list of ALL user exits in ECC 5.0 or 6.0

    Is this list published somewhere by SAP or can we get it from the system somehow? I m not talking about Enhancement or BADI's just user exits.
    Thanks for reading

    Hi ,
        Just check this program to get the list
    Hi,
    Copy the problem in SE38 and Execute it
    Enter the Tcode u want
    this will the list of Userexits and badis
    TABLES: TSTC,
    TADIR,
    MODSAPT,
    MODACT,
    TRDIR,
    TFDIR,
    ENLFDIR,
    SXS_ATTRT ,
    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,
    P_PGMNA LIKE TSTC-PGMNA .
    DATA: WA_TADIR TYPE TADIR.
    START-OF-SELECTION.
    IF NOT P_TCODE IS INITIAL.
    SELECT SINGLE * FROM TSTC WHERE TCODE EQ P_TCODE.
    ELSEIF NOT P_PGMNA IS INITIAL.
    TSTC-PGMNA = P_PGMNA.
    ENDIF.
    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 in ('SMOD', 'SXSD')
    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:/(105) SY-ULINE.
    FORMAT COLOR COL_HEADING INTENSIFIED ON.
    Sorting the internal Table
    sort jtab by OBJECT.
    data : wf_txt(60) type c,
    wf_smod type i ,
    wf_badi type i ,
    wf_object2(30) type C.
    clear : wf_smod, wf_badi , wf_object2.
    Get the total SMOD.
    LOOP AT JTAB into wa_tadir.
    at first.
    FORMAT COLOR COL_HEADING INTENSIFIED ON.
    WRITE:/1 SY-VLINE,
    2 'Enhancement/ Business Add-in',
    41 SY-VLINE ,
    42 'Description',
    105 SY-VLINE.
    WRITE:/(105) SY-ULINE.
    endat.
    clear wf_txt.
    at new object.
    if wa_tadir-object = 'SMOD'.
    wf_object2 = 'Enhancement' .
    elseif wa_tadir-object = 'SXSD'.
    wf_object2 = ' Business Add-in'.
    endif.
    FORMAT COLOR COL_GROUP INTENSIFIED ON.
    WRITE:/1 SY-VLINE,
    2 wf_object2,
    105 SY-VLINE.
    endat.
    case wa_tadir-object.
    when 'SMOD'.
    wf_smod = wf_smod + 1.
    SELECT SINGLE MODTEXT into wf_txt
    FROM MODSAPT
    WHERE SPRSL = SY-LANGU
    AND NAME = wa_tadir-OBJ_NAME.
    FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
    when 'SXSD'.
    For BADis
    wf_badi = wf_badi + 1 .
    select single TEXT into wf_txt
    from SXS_ATTRT
    where sprsl = sy-langu
    and EXIT_NAME = wa_tadir-OBJ_NAME.
    FORMAT COLOR COL_NORMAL INTENSIFIED ON.
    endcase.
    WRITE:/1 SY-VLINE,
    2 wa_tadir-OBJ_NAME hotspot on,
    41 SY-VLINE ,
    42 wf_txt,
    105 SY-VLINE.
    AT END OF object.
    write : /(105) sy-ULINE.
    ENDAT.
    ENDLOOP.
    WRITE:/(105) SY-ULINE.
    SKIP.
    FORMAT COLOR COL_TOTAL INTENSIFIED ON.
    WRITE:/ 'No.of Exits:' , wf_smod.
    WRITE:/ 'No.of BADis:' , wf_badi.
    ELSE.
    FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
    WRITE:/(105) 'No userexits or BADis exist'.
    ENDIF.
    ELSE.
    FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
    WRITE:/(105) 'Transaction does not exist'.
    ENDIF.
    AT LINE-SELECTION.
    data : wf_object type tadir-object.
    clear wf_object.
    GET CURSOR FIELD FIELD1.
    CHECK FIELD1(8) EQ 'WA_TADIR'.
    read table jtab with key obj_name = sy-lisel+1(20).
    move jtab-object to wf_object.
    case wf_object.
    when 'SMOD'.
    SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).
    CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
    when 'SXSD'.
    SET PARAMETER ID 'EXN' FIELD SY-LISEL+1(20).
    CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.
    ENDCASE.
    Thnks
    Abhishek

  • Problem in transporting the text elements for user exit EXIT_SAPLV09A_002

    Hi  All,
    I am facing a problem in transporting the text element (text symbol) for the exit EXIT_SAPLV09A_002. It is implemented and transported but the text elements are not transported and even if I try to delete them and then create them again, on activation it doesn't prompts for TO and it version its shows it as local object. I have tried to manually assign the TO by using limu as id of program and rept as type and SAPLXV09 as the name of the object but still it doesn't allows as an error message comes prompting local object cannot be assigned to TO. Kindly suggest solution this problem.
    Regards,
    Sachin
    Edited by: Sachin Dangayach on Nov 15, 2010 4:21 PM

    Hello ,
               In the Quality after you run the report check in the layout option>display text elements> variables and check what value is displayed for the use exit variable , if it is correct then problem may be in the selection you gave when you run the report if the user exit variable value is wrong , then set a break point in the code and run the report from rsrt and check where the error is.
    hope it is clear
    assign points if useful

  • Populating cost center automatically by Ts code WVFB - Which user exit ?

    Hi experts,
    I want to populate cost center and to do 'k' assignment automatically using WVFB for Sotre Order creation.
    Which user-exit should be activate? thanks a lot in advance.
    ( the purpose is when user create a  store order by transaction code WVFB ,  the fields of  'k' assingment and cost  center don't need to be filled out, an user exit should make 'k' assignment &  fill out cost center KOSTL. I just need to know this user exit).
    EXIT_SAPLWVFB_002  will be good for my problem? please advice. thanks.

    Yes. I solved my problem.
    EXIT_SAPLWVFB_002 was used to do it.

  • Checking code for SAP USER EXIT

    we have enhanced SAP given data-source 2LIS_XX_XXXXX, there are hard coded user exits for this extractor. How to debug the code for enhancements?
    I know we enhance data-source in CMOD....SAPLRSAP001 (transactional data)....SAPLRSAP002(attributes)

    Hi Monica,
    There are many ways to debug the code if you wish to enhance the DataSource. In RSA3 you can do that by clicking Debug mode option. This is already been suggested by Srini.
    I would like to give you another way to do so.
    If you want to enhance the Transcational data then you need to choose EXIT_SAPLRSAP_001 component of RSAP001 enhancement. It has 4 component for master data( Text, hierarchy...etc).
    This is a function module enhancement. If you goto the source code of the function module, you will find an include program i.e. ZXRSAU01. double click on this program which will take you to the body of the program. This is the place where you need to write code.
    here you need to write the code as follows.
    case i_datasource.
    when '2LIS_XX_XXXXX'.
    Now here you can set a break point. This can be soft or hardcoded break point if you need to debug.
    Better Hardcode it. Write
    BREAK-POINT or BREAK username.
    Now when you execute the DS through RSA3, The program will stop here. The data extracted from DS will be available in an internal table C_T_DATA. Now you can enhance this by writing code. Again you can debug by pressing F5 or F6. This is as usual the way you debug an ABAP program.
    Hope this helps. If you need any further help contact at [email protected]
    Give reward point if you're satisfied.
    Happy debugging....
    cheers,
    Message was edited by: tapan tripathy

  • Code Review of User Exits with Code Inspector

    Hi,
        We are using Code Inspector(Tcode - SCI) for checking the quality of ABAP Codes. It is working fine for all custom programs. But when we are checking the code of User Exits i: e MV50AFZ1 or ZXM06U22 then it checks the std SAP program (SAPMV50A) or (SAPLXM06) for these exits in place of checking that particular Exit only . How the customer/User Exits can be checked using Code Inspector. Pls advice.

    Hi there!
    Today, I stumbled over the same problem: Defining an Include for user exits leads to a check of the surrounding function group from SAP which I don't want to correct at all.
    Is there a nice an elegant way of filtering out the SAP modules from checking? If not, the only way to get around this seems to be building an own implementation of the Code Inspector integration into CTS.
    Thanks, Markus

Maybe you are looking for

  • Getting error while applying psu patch on 11.2.0.2.0

    Hi All, I am getting one error while applying psu july patch on top of 11.2.0.2.0 If anybody has the solution please answer: Below is the code sample: [oracle@host01 16619893]$ opatch prereq CheckConflictAgainstOHWithDetail -phBase                   

  • Can't get back to 300Mbps with my wrt300n v1 router?

    Hello All, My wrt300n, v1 router has always worked great, straight out of the box.  I use various adapter cards and have never had a problem?  All of the cards have connected at their individual full speeds?  Except 1 Airlink 300n that connects at 27

  • IPhoto fix that worked for me (Coregraphics & Adobe Color Profiles issues)

    Ok, I posted a few days back in reference to getting help with my iPhoto. I do apologize on the fact this is quite the long post but maybe it will be easy to understand for those who are like me and not all that computer literate. I searched all the

  • Problems (?) with install CU4 on SCCM 2012 R2

    Hi, Today I have installed CU4 on my test SCCM enviroment (before I will install it on production). My test lab is: 1. One Primary Site server 2. One Secondary Site server 3. One server with Distribution Point role installed  First I have installed C

  • Method Limits? a stressed newbie

    pls can anyone tell me if i can have the following in a method? (WHOLE CLASS) class SuperMethod      public static double aTaxRate (double currentSalary)           if (currentSalary < 6000)                currentSalary = currentSalary * 0.15;