Example1 on
Function Module Exit using call customer function.
Business Requirement: When ever we create a customer. We need to check weather the customer
belongs to Country : GERMANY and if Region is
equal to space .
Then, Raise an Error message.
Technical requirements:
Þ
Tcode is : XD01/
XD02/ XD03.
Þ
Country Field is
: LAND1 .
Þ
Region Field is :
REGIO.
Þ
Table name is :
KNA1 .
Þ
The above tables
and fileds are given by functionasl consultants.
STEPS:
Step1 : Find the FM exit for the requirement.
Step 2: Implement the Exit using CMOD
Transaction .
Step 3: Test It .
Step1 : Find the FM exit for the
requirement:
Þ
Goto XD02
Þ
Give any customer
no, Ex : 3471
Þ
Press enter
Þ
Customer Details
will be displayed.
Þ
Click System from
Menu bar -> Status ->
Þ
Double click on
Program (Screen)
Þ
Þ
Type Call
customer in the Find field, then click
the In Main program radio button and hit
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 my
requirement, I need KNA1 Table details, SO I have selected the below Customer
Function Module which has an exporting parameter I_KNA1.
Þ
Now, double click
on the above Function Module and Put a
break-point .
Þ
Now execute the
Transaction.
Þ
Goto XD02
Þ
Give any customer number, Ex : 3471
Þ
Press Enter
Þ
Customer screen
will be displayed.
Þ
Click on Save.
Our break-point
will be triggered. Please check the
below screen shot ..
Þ
Stop the
Debugging and now implement the Functional Module Exit.
Þ
As this exit is
triggered, this is the suitable Functional Module Exit for our requirement.
Step 2: Implement the Exit using CMOD
Transaction .
Þ
Goto CMOD
Transaction.
Þ
Give a name
for the Project
Þ
Click on create
Þ
Give Short Text
as “Implementing Enhancement for XD01”.
Þ
Click on
Enhancement Assignments Button.
Þ
Give Enhancement
Name and press enter.
Þ
Now we don’t know the Enhancement name .
Þ
So, to find the
Enhancement name Follow the below steps.
STEPS TO find the Enhancement name
Goto Table MODACT
which will display SAP Enhancement names.
Þ
Goto SE11->Give table Name as
MODACT->display->Click on contents
Þ
Give MEMBER
as “EXIT_SAPMF02D_001”
Click on execute .
It will display the
Enhancement name .
Þ
So the
Enhancement name is SAPMF02D .
Þ
Give Enhancement
Name and press enter.
The below Screen will be
displayed with RED colors.
Þ
Double click
on “EXIT_SAPMF02D_001”.
Þ
Function Module
will be opened .
Þ
Below you will
find an Include .
Þ
Double click on
Include .
Þ
A warning message
will appear.
Þ
Just press Enter.
Þ
Create the
Include
Þ
Include will be opened.
Þ
Write the below
code.
Þ
Save activate the
Include.
Þ
Click on BACK
Þ
Activate the
Function Module.
Þ
Click on BACK
Þ
Click on
Activate.
Þ
The RED lights
will turn to GREEN Color.
Þ
Activate the
Exit.
Þ
Now, Run the
transaction and test .
Þ
Þ
Goto XD02.
Þ
Give customer no
Þ
Press neter
Þ
Customer Screen
is displayed.
Þ
Remove the
region and save it.
Check below
Þ
Now save it . Our
Exit will be triggered and
Þ
The error message
will be displayed as below .
0 comments:
Post a Comment