Wednesday, April 20, 2016

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.

8 comments:

Anonymous said...

Your Blogs are too good.. Very descriptive and easy to understand..Thumps up!

VIRU B said...

Awesome blog...Kudos.'

Unknown said...

well description. as a learner i understand the blog. :-)

Anonymous said...

SAP Success Factors Real Time Hands on Training in Chennai...

Don't always Depend on Training Institute Alone and so please aware of Best Trainers too..

http://thecreatingexperts.com/sap-successfactors-training-in-chennai/

If You need a Best Trainer over SAP Success Factors Means??? Please ready for an DEMO From the Trainer MR.Karthick
CONTACT:8122241286

Both Classroom/Online Training is Available!!!!!!

Unknown said...

Hi Sandip,

Thanks for the post...

I have a query actually.I also implemented a CMOD enhancement for KS02,KS03 transactions. The problem is that whenever I perform ATC Checks on the same Function Group for the same Exit,the ATC Inspector tells me to change the Importing,Exporting Parameter's namin convention ;whereas the system throws an information message telling I cannot change the function module and grey's out the parameter name. Is it possible to change the same?

R@tK@K@ said...

SAP Training has become one of the most sought after training at the moment. Before learning SAP it's essential to know the various modules and choose the one that fits your needs. There are several institutes which provide SAP training in Bangalore.

Unknown said...

SAP FIORI Training in Chennai from the best and experienced SAP Consultants get trained and become the expert in SAP FIORI training in Chennai

Reach us @ 8122241286 & 9003085882

Anonymous said...

Great information. the information provided is of great

use as i got to learn new things. If you are looking for

real time training by industry experts with live projects

and placement support.kindly contact the creating experts

Reach our Technical Experts @ 8122241286 / 9003085882