Monday, April 27, 2020

Customer Exit with Example

Customer Exits:

Customer exits are "hooks" provided by SAP within many standard programs, screens and menus on which customers may use custom functionality to meet business requirements. 

Business Requirement: Whenever we create a customer. We need to check whether the customer belongs to Country : Tanzania and if Region is blank.Then, system should raise an error message.

For this requirement we need to implement Function Module exit.

Technical requirements:

  • Tcode is : BP
  • Country Field is : LAND1 .
  • Region Field is : REGIO.
  • Table name is : KNA1 .

Reference Document: Customer Exit Document From SAP

 To implement the Customer exit for this we need to follow the below steps.

Step 1: Find the function exit.
Step 2: Verify the customer exit.
Step 3: Create project for customer exit.
Step 4: Implement the Customer exit.

Find the function exit

Go to SE93 (maintain Transaction) T-code, provide BP, display.


















Double click on Program name SAPLBUPA_DIALOG_JOEL.Click on Find icon, main program, find CALL CUSTOMER, enter.



















A list of call customer functions will be displayed.
Based on requirement, Check Import/Export Parameters for each Function Module And roughly select some Customer Function Modules .




















As per this requirement, we need KNA1 Table details, So we can use the below Customer Function Module which has an exporting parameter I_KNA1.


Verify the Customer Exit 

Create Project in CMOD to implement customer exit.

Go to T-code CMOD (Project Management), provide a project name, create.


create a project (ZPROJ1) and click on create . Click on enhancement assignment and enter the enhancement. Click on components ,  click edit option and activate the components.


























To implement we need to provide enhancement name but we don`t have enhancement name, we just have customer exit name, now we need to find enhancement name. Follow the below steps to find enhancement for a customer exit.
All the enhancements for customer exits will be stored in MODSAP table, we can get enhancement name by using our customer exit.
Get Function module name from customer exit, double click on CALL CUSTOMER FUNCTION '001'. 

You will find Function module name, double click on function exit. 






















Add the below code, activate the function module and test the object.






No comments:

Post a Comment