SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software SAP ABAP Programming and HANA Database Tutorials
Development resources, articles, tutorials, code samples and tools and downloads for ASP.Net, SQL Server, R Script, Windows, Windows Phone, AWS, SAP HANA and ABAP, like SAP UI5, Screen Personas, etc.




Install SAP Free


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

create CMOD SAP Enhancement project

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

SAP CMOD Enhancement project description

Click on Save button.

At this point the CMOD enhancement project is created without any enhancement assignment in inactive status.

CMOD project enhancement assignments

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.

SAP Enhancements for CMOD project

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.

CMOD project enhancement components and function module user exit

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

INCLUDE ZXVVAU04 .

This include is possibly not created in the system if no enhancements are build before using this function exit.

ABAP function exit for SAP CMOD Enhancement project

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.

create include for function exit for SAP VA01 tcode

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)

*" IMPORTING
*" VALUE(I_TVAK) LIKE TVAK STRUCTURE TVAK
*" VALUE(I_TVTA) LIKE TVTA STRUCTURE TVTA
*" VALUE(I_VKGRP) LIKE VBAK-VKGRP
*" VALUE(I_VKBUR) LIKE VBAK-VKBUR
*" EXPORTING
*" VALUE(E_KUNNR) LIKE KNA1-KUNNR

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

CASE i_tvak-AUART.
WHEN ''.
 E_KUNNR = ''.
WHEN ''.
 E_KUNNR = ''.
WHEN OTHERS.
ENDCASE.

Or just for demo purposes, a constant sold-to party code

e_kunnr = 'KODYAZ'.

Activate the include code.
Then go back to components list. You will see red dots as follows

activate CMOD SAP Enhancement project

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.

SAP VA01 Create Sales Order screen with predefined Sold-to Party customer






SAP Tutorials

SAP Tutorial

SAP Forums

SAP Tools

SAP Transaction Codes Table


Meetup Sunumu 1 meetup






Copyright © 2004 - 2019 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems