Add New Parameters and Enhance Source Code of Standard Function Module
Add New Parameters and Enhance Source Code of Standard Function Module
Module
Introduction
Many times the existing functionality in standard function module is not sufficient for a developer. In such
cases, to little more functionality, we copy the standard FM and make the Z custom copy of it. Or else
create the custom new FM for extra functionality and call multiple function modules.
In SAPs new enhancement Framework, SAP has provided this new enhancement technique which allow
user to enhance the standard function module. So when there are small changes required we can
enhance the function module itself. Once we made changes in standard FM, new changes would be
available to all objects in environment.
This article will elaborate you the way to enhance the standard function module. Here we are taking
example of Function module LAST_WEEK. We are enhancing the parameters in EXPORT & TABLES
with source code enhancement. We will also be enhancing the global data to declare some new
variables.
First lets see the original function module, its parameters & output.
Import & Export parameters:
Original
Function
module
output:
Lets now enhance this function module. We will add one more parameter in Export which will give no of
holidays in that week. We will also add table which hold details on holidays. Once we enhance this
function module LAST_WEEK it will start giving more appropriate details of last week.
Steps to Enhance Interface
1. Go
to
Export
parameter
screen
select
menu
Function
Module Enhance
interfac
2. A pop-up will come to Create Enhancement Implementation. Give the details to create custom
implementation and click on , give the package and save.
4. We also need to add new table. So we will also add required table under tables tab.
3. First click anywhere on """""""" line and then right click on same line. Go to Enhancement
Implementation create Implementation.
2. Go to last line of function module. Before ENDFUNCTION statement you will see the available implicit
enhancement. Implement custom enhancement by clicking right click and selecting Enhancement
Implementation create Implementation.
3. You will get a pop-up like below. Choose option Code.
Result
Run the Function module.
You will see the newly added parameters in Export & Tables.
Notes
All parameters which you add in IMPORT/EXPORT/TABLE must be optional. This will not affect
existing objects which are using function module.
SAP doesnt support this function level enhancement to all standard function modules. There are
some FM in central repository which never be enhanced like FM POPUP_TO_CONFIRM.