0% found this document useful (0 votes)
3 views23 pages

Function Exit or Customer Exit

The document explains the concept of function exits (customer exits) in SAP, detailing how to implement custom code within a standard function module using the CALL CUSTOMER-FUNCTION statement. It outlines the steps to find and implement a function exit, specifically using the transaction XK02 to generate an information message based on vendor country. Additionally, it highlights the limitation of having only one implementation per function exit, contrasting it with BADI which allows multiple implementations.

Uploaded by

amir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views23 pages

Function Exit or Customer Exit

The document explains the concept of function exits (customer exits) in SAP, detailing how to implement custom code within a standard function module using the CALL CUSTOMER-FUNCTION statement. It outlines the steps to find and implement a function exit, specifically using the transaction XK02 to generate an information message based on vendor country. Additionally, it highlights the limitation of having only one implementation per function exit, contrasting it with BADI which allows multiple implementations.

Uploaded by

amir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Function Exit or Customer Exit

The function exit is actually the customer exit. Here we need to use the statement CALL CUSTOMER-
FUNCTION. Since we are writing our custom code inside a function module it is called function exit.
This function module is a standard one so we can’t change anything in that function module. Inside
this function module we have an include program starting with Z. We have to create this include and
then we can write our own code. After that we need to implement this function module. Hence the
function exit / customer exit is basically a function module which is provided by SAP and implemented
by customer.

The name of the function module contains EXIT_, then the program name and then the three digit
indicator in function exit. We can search the exact function module exit by using the program name
(the program name is called the Enhancement) in transaction SMOD. We implement the function exit
by creating a specific project in CMOD. Now if one function exit is already implemented in one project
then we cannot implement that function exit into a new project. This is the main draw back in function /
customer exit.

We have two standard DB tables like MODSAP & MODACT. Execute MODSAP by entering the
enhancement name and we can get all function exits of this enhancement. Similarly execute
MODACT by entering the project name and we get all the activated enhancement names.

In the following example we are working with the transaction XK02 – change vendor data. We need to
generate an information message if the country of the vendor is not India. To do this we are heading
the following step by step approach.

1. Go to XK02.

2. Mention a valid vendor and check Address.


3. Now we are in the address screen where the country is DE (Germany) for the existing vendor.
4. Now we modify the name by adding ‘Mr.’ and then save it. The vendor details have been saved
successfully. At this stage we want this information pop up message.
5. Stay on that screen where we need to customize and go to System > Status.
6. Double click on the program name.
7. Now we are in that program at SE38.
8. Now find the statement CALL CUSTOMER-FUNCTION.
9. Choose the program name.

10. Now we are in the global search screen where customer functions are visible. One program can
have more than one customer functions for different purpose.
11. Now double click on CALL CUSTOMER-FUNCTION ‘001’ and go to the exact location of the
program.
12. Now double click on the ‘001’ and then we go into the function module (SE37) as follows.
13. Another way to find the function exit is to go to the attribute of the program.
14. Note down the package.
15. Go to SMOD.

16. Enter the program name into the Enhancement input field and display.
17. Click on Components.

18. Now we can see the name of Function modules, Programs, screens etc.
19. Now we have to write our own code into that include program. To do this go to CMOD
transaction.
20. Create a new project at first.

21. Give the description and save it in a package or local.


22. Click on Enhancement Assignment.
23. Now mention the program name into the enhancement and hit enter.
24. Then click on components. Then double click on Exit.

25. The function module screen will come and then double click on the include program.
26. Create the program.
27. Now we can write our custom code as follows. Activate the program.

28. Go back and activate the project. Here we have Activate as well as deactivate option.

29. Finally go to XK02 > mention vendor with address > change something (delete the ‘Mr.’ text in the
name) > save it. We can see the pop up information message comes as required.
it is impossible to have multiple implementation for user exit, it is used for one time and for
a specfic something. The BADI provides this option, you can have multiple implementations and
only one if you use it for

Subscreens and FCode.

look to this BADI,.

Mulitiple Use ( no Subscreens, or FCode)


One Use ( you can use hier subscreen and/or FCode for one time)

You might also like