Implementing Function Module Exit
- Function module exit allows us to add code to our SAP Programs with the help of Function Modules.
- We can enhance our SAP programs using Function modules.
Syntax :-
- For every Customer Exit we have a dedicated Syntax.
- CALL CUSTOMER-FUNCTION ‘three digit number’.
- the three digit number in the above syntax varies from 000 to 999.
- Example :- CALL CUSTOMER-FUNCTION ‘001’.
let’s take a requirement first
Requirement :-
-
Go to VA01 ( Create Sales Document ) transaction code.
-
Suppose, I have given this order type as OR and as soon as I press enter.
- I want my Sold to Party should be auto populated.
-
Note :-
- For any function module exit, we need to check, is there any function module exit available which will fill our requirement.
Finding Function Module Exit Using debugging :-
-
Step 1 :- Go to VA01 transaction code.
-
Step 2 :- Write /h and press enter → It will turn the debugging mode.
-
Step 3 :- Now, again press enter and you will enter to debugging mode.
-
Step 4 :- Now, we need to put breakpoints on the keywords .
- So, click on breakpoints → breakpoint at → breakpoint at Statement.
-
Step 5 :- Here, in ABAP statements we need to write syntax.
- Click on OK button.
-
Step 6 :- Press F8, It will automatically stop at the Function module exit.
- Also don’t forget to check whether, this function module exit fulfill your requirement or not.
- If it is not, then we will have to continue checking whether this will work for us or not.
- Now if I go inside this function module,
- We can see in this function, that we can use this function module exit for pre assignment of Sold to Party.
- We can use this function module for writing our code.
Solution :-
-
Step 1 :- Go to SE37 transaction code and give the name for the above function module.
- In the Export tab we can see we have a parameter which we can use for Sold to Party.
-
Step 2 :- Go to source code.
-
Step 3 :- Double click on the include and open it in change mode and then write the below logic.
- I have given this if condition so that it could not affect the other users.
Execution :-
-
Step 1 :- Go to VA01 transaction code and give the order type as OR.
- Press enter.
- We can see that sold to party is automatically getting populated.
Note :-
- Always remove the code after practicing it.
Comments
Post a Comment