SAP ABAB: Using the User Exit
August 4, 2007
Find The User Exit
The Procedure to investigate the user exit used in the transaction:
1. Running the transaction (ex: ME21), fill in the data needed, and determine in which screen the user exit will be needed.
2. While on the screen of the transaction, drill down the “System>Status” and the screen will pop up then we can get the program name used in this screen (ex: SAPMM06E).
3. Then we open the “se38″ transaction and we fill in the program name we got from the procedure No.2, choose “Attributes”, choose “Display”, get the “Dev. Class” of the program (ex: ME).
4. Go to the transaction “CMOD” > “Utilities” > “SAP Enhancement” > fill in the “Dev. Class” (according the procedure 3) > then “Execute”.
5. After procedure 4, the “list of the Exits” will show up (ex: M06E0005)
Example of List of Exits:
Exit name Short text
AMPL0001 User subscreen for additional data on AMPL
MM06E001 User exits for EDI inbound and outbound purchasing documents
MM06E003 Number range and document number
MM06E004 Control import data screens in purchase order
MM06E005 Customer fields in purchasing document
6. Give the “Check” in the checkbox (ex: MM06E005) > “Display”.
7. After the procedure 6, there will be the “lists of the components in SAP Enhancement” of MM06E005.
8. In this case there are: “Function Module Exits”, and “Screen Areas”. Beside those also there are the “Function Codes” and “Includes”.
Example:
Function module ShortTxt
EXIT_SAPMM06E_006 Export Data to Customer Subscreen for Purchasing Document
EXIT_SAPMM06E_007 Export Data to Customer Subscreen for Purchasing Document
EXIT_SAPMM06E_008 Import Data from Customer Subscreen for Purchasing Document
Program Code Short text
“Empty”
Calling screen No. Area Called screen No. ShortTxt
SAPMM06E 0101 CUSTSCR1 SAPLXM06 0101 Subscreen: PO header
SAPMM06E 0111 CUSTSCR1 SAPLXM06 0111 Subscreen: PO item
SAPMM06E 0201 CUSTSCR1 SAPLXM06 0201 Subscreen: agreement
INCLUDEs
CI_EKKODB
9. Things needed for the investigation (in terms to find the correct includes that will be useful for the enhancement) :
- Importing value contained in “Function Module Exits”.
- In the function module, there will be one or more than one include, and we can try by giving the “break-point” to be tested in every “includes” in every ‘Function Module Exits”.
Example:
Break-point.
FUNCTION EXIT_SAPMM06E_012.
*”——————————start———————————–
*”*”Lokale Schnittstelle:
*” IMPORTING
*” VALUE(I_EKKO) LIKE EKKO STRUCTURE EKKO
*” VALUE(I_TRTYP)
*” VALUE(I_BSTYP) LIKE EKKO-BSTYP
*” VALUE(I_NO_SCREEN)
*” VALUE(I_LFA1) LIKE LFA1 STRUCTURE LFA1
*” VALUE(I_LFM1) LIKE LFM1 STRUCTURE LFM1
*” VALUE(I_KEKKO) LIKE EKKO STRUCTURE EKKO
*” VALUE(I_AEKKO) LIKE EKKO STRUCTURE EKKO
*” VALUE(I_REKKO) LIKE EKKO STRUCTURE EKKO
*” VALUE(I_CI_EKKO) LIKE EKKO_CI STRUCTURE EKKO_CI
*” VALUE(I_VORGA) LIKE T160-VORGA
*” TABLES
*” TEKPO STRUCTURE BEKPO OPTIONAL
*” TEKET STRUCTURE BEKET OPTIONAL
*” TEKKN STRUCTURE EKKNU OPTIONAL
*” TKOMV STRUCTURE KOMV OPTIONAL
*” CHANGING
*” VALUE(C_CI_EKKO) LIKE EKKO_CI STRUCTURE EKKO_CI OPTIONAL
*”———————————————————————-
INCLUDE ZXM06U43 .
ENDFUNCTION.
———————————end————————————-
*——————————–start———————————-*
* INCLUDE ZXM06U43 *
*———————————————————————-*
BREAK-POINT.
———————————end————————————-
- After giving the “break-point” if this include is the one of many include that will be called in the transaction (in this case ME21), after clicking something (Save button), then will go to the debugger.
- In this case this include is the correct include.
10. If we want to maintain the global data for the function module, In “Function Module Exits”>”Go To”>”Global Data”> we can maintain the global data here.
Creating the User Exit
1. Create the new ‘Project’. Fill the “Attribute” with the Short text and Development Class
2. Fill the ‘Enhancement Assignment’ based on the procedure Find The User Exit , In this case the example would be LMR1M002.
3. Automatically, the component of the Function Exit of LMR1M002 will be assigned in the “Component” .
4. In each Function Exit consist one or many of includes. In this Includes we can make some modification, make some coding in this Includes. After coding the Includes, we activate the Includes and then activate the Function Exit (p.s. You can trace the use Function Exit by their Importing value and the Exporting Value… in terms the field you will be needed in your project).
Example:
FUNCTION EXIT_SAPLKONT_011.
*”———————————————————————-
*”*”Lokale Schnittstelle:
*” IMPORTING
*” VALUE(I_WRXMOD) LIKE WRXMOD STRUCTURE WRXMOD
*” EXPORTING
*” VALUE(E_KONTO_MODIF) LIKE T030-KOMOK
*”———————————————————————-
INCLUDE ZXM08U18 .
ENDFUNCTION.
p.s. It is necessary to determine which field’s value need to be retrieved, validated and exported to the next process… This can be done by looking the ‘Importing’, ‘Exporting’ and the ‘Changing’ value that used in the ‘Function Module Exit ‘ that we have found.
Importing Value : Just retrieved the value of the declared field.
Exporting Value : Just send the value of the declared field.
Changing Value : The value of the declared field can be changed while in the process.
———————————–oo———————————–
*———————————————————————-*
* INCLUDE ZXM08U18 *
*———————————————————————-*
IF SY-UNAME = ‘JAWGU01′.
BREAK-POINT.
ENDIF.
After activating the Includes and the Function Exit, If we go to the components, there will be the display as below:
Project ZWIDY Test for User Exit
Enhancement Impl Exp LMR1M002 Account grouping for GR/IR account maintenance
Function exit a EXIT_SAPLKONT_011
5. We have to activate the project after we already preparing all the components that we will use for the enhancement project.
Project ZWIDY Test for User Exit
Enhancement Impl Exp LMR1M002 Account grouping for GR/IR account maintenance
Function exit a EXIT_SAPLKONT_011
And all the button will become green and the project, including all the components are ready to use.
6. After this we can test it whether the requirement is already fulfilled or not.
Entry Filed under: TECHNICAL. Tags: ABAP, sap, SAP ABAP, user exit.
7 Comments Add your own
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed
1.
Prabha | May 14, 2008 at 8:06 pm
Hi,this is prabha I have been working for mnc companies but I changing my proffession i.e into ERP I am interested in SAP FUNCTIONAL and I am pasionated with ur site could u guide me how should I start up with this.
I am looking forward for longer term working in the same field. suggest me …………..
2.
husnie | May 24, 2008 at 6:23 am
Hello Prabha, welcome in this blog…
I think you can begin from learning ABAP programing, it’s easy and faster. Your ABAP skill will become entry point to joint in a SAP project and after that you can learn another module. In indonesia there is online ABAP course, it’s very cheap for a package. Unfortunately it’s only for indonesian in Indonesia and teach with indonesian language.
3.
hirdesh bairwa | June 11, 2008 at 11:42 am
which sap enhancement userd when one item is sale two item is free.
4.
husnie | June 23, 2008 at 12:35 pm
My friend has been show me, that your problem is already handle in configuration. So it’s not need enhancement
5.
Trung | July 1, 2008 at 5:47 am
Hi all,
I’m looking for SAP ABAP USER EXIT STEP BY STEP, if you have it, Please send me a document, I’m very thank you.
My email : trunglovething@yahoo.com
Thanks,
Trung Tran
6.
husnie | July 5, 2008 at 2:58 am
Hi Trung,
The simple step show like below:
1. Finding the user exit
There is many way to find user exit, from developmen class like i show in this article, from configuration menu t- code “SPRO”.
2. Give some code to the exit
After finding user exit then use t-code se37 to edit the code.
3. Activate user exit using t-code “SMOD” and click test button (F8).
Rgds
Husnie
7.
viji | July 13, 2008 at 12:22 pm
Dear Team,
Kindly send me the SAP – Information Technology Book for Doing SAP Courses.
Regards,
Viji