Create Enhancement Project for SAP User Exit Function using CMOD in ABAP
In this SAP tutorial for ABAP programmers we will create CMOD Enhancement project with a function exit for VA01 Order Creation initial screen. For more than the SAP screen where the enhancement is being created, the tutorial is more focused on the steps of creating CMOD project for ABAP developer; projet creation, assign enhancements and enhancement components, etc.
Launch Project Management of SAP Enhancements screen using CMOD Enhancements transaction code
Enter project name and press Create button.
Project name: MV45A002
On enhancement attributes screen provide descriptive text for the CMOD enhancement project.
Since this enhancement project is created to modify user exit function EXIT_SAPMV45A_002 in enhancement V45A0002 to hook standard ABAP code in VA01 transaction program SAPMV45A, I provided following short text:
VA01 TCode SAPMV45A Program V45A0002 Enhancement
Click on Save button.
At this point the CMOD enhancement project is created without any enhancement assignment in inactive status.
The next step will be assigning enhancements for the project.
Click on the Enhancement assignments button
On SAP Enhancements in Enhancement Project MV45A002, in Enhancement textbox select or enter enhancement V45A0002 which is used to Predefine sold-to party in sales document. Press Enter. Then Save.
After you save the enhancement assignment, the components of the project is also created and saved.
Now ABAP programmer can click on Components button to continue with user exit function and ABAP developments.
As seen in above screenshot, the function exit or the function module name can be seen for the assigned enhancement.
If the ABAP programmer double-clicks on the function exit name, the Function Builder will directly open the function module code where only a single Include command exists
This include is possibly not created in the system if no enhancements are build before using this function exit.
Double click on the include name.
A warning will be displayed: Program names ZX... are reserved for includes of exit function groups
Press enter to continue after the warning message.
The ABAP developer will be prompted to confirm whether he wants to create the include object or not.
Click Yes and create the ZXVVAU04 include
ABAP developer can build a logic here using the input and output parameters of the function exit (in this case function module EXIT_SAPMV45A_002)
Since the returning export parameter is E_KUNNR which is the predefined sold-to party customer in the VA01 screen, it is possible to assign a predefined sold-to party customer using the input parameters.
For example a case statement
Or just for demo purposes, a constant sold-to party code
Activate the include code.
Then go back to components list. You will see red dots as follows
Click on Activate icon button. All marks will change to green.
Now the code added in function exit include and the enhancement project is active.
If you call VA01 and pass initial screen you will see KODYAZ as sold-to party customer on new sales document screen.