Académique Documents
Professionnel Documents
Culture Documents
Introduction:
Enhancement Framework is the new paradigm to bring all enhancement techniques under one roof. It
can also be switched using Switch Framework. The following are different enhancement technologies
available under this framework.
Source Code Enhancement
Function Group Enhancement
Class Enhancement
Kernel-BADI Enhancement
Source Code enhancement
Whenever enhancement needs to be incorporated directly into the ABAP source code, this technology
shall be provided. Implementing this technology is also called as Source Code Plug-In. There are two
types of Source Code enhancements possible.
Implicit enhancement option
Explicit enhancement option
Explicit enhancement option
As implicit enhancements are predefined enhancements provided by SAP in the source code, the explicit
enhancements can be implemented by the customers or partners.
There are two types of Explicit Enhancement options available. For this, we now have two new ABAP
statements, viz.
1.
Enhancement
point
(Syntax
2. Enhancement section (Syntax - ENHANCEMENT-SECTION)
ENHANCEMENT-POINT)
Enhancement section is used to replace a set of code or statements with the customer (custom code). In
this technique the original source code does not get executed but, the customer implementation (custom
code) gets executed.
Note - Explicit enhancements though can be placed anywhere in the source code but, not just anywhere
except some areas where SAP would allow (program allows).
STEP 1: Create a package in transaction SE80 (Object navigator) Name YDEV
And save it into created package. Observe the enhancement spot created under the 'Enhancement
Spots' folder.
STEP 3: 'Right Click' the spot created and 'Implement' it (Create an Implementation).
STEP 4: Now, we need to 'Activate' the enhancement spot. In addition with the Enhancement spot the
'Enhancement Implementation' will get activated.
STEP 5: Here we are applying enhancements to a CUSTOM program not a standard program to
demonstrate the functionality. So we create a simple program 'YDEV_CODE' (say) it is retrieving records
from the database table 'VBAK' (Sales Document Header) and displaying a few records.
Now, if the customer wants to replace the set of logic with his own logic (say) like retrieving records from
database table 'VBAP' (Sales Document Item) and then display a few records, he/she will create an
enhancement section which goes like,
Create a program YDEV_CODE.
OUTPUT
STEP 6: Right click the area which is appropriate to apply the enhancement
Note - Explicit enhancements though can be placed anywhere in the source code but, not just anywhere
except some areas where SAP would allow (program allows).
Now, in the 'Create Enhancement Option' fill in the details, here fill the name under 'Enhancementsection' only. Then fill in the Enhancement Spot Implementation Name which we created earlier.
Note- Make sure that the code which has to be replaced is within the 'ENHANCEMENT-SECTION...' and
'END-ENHANCEMENT-SECTION'.
Click here to continue..
STEP 7: Now to include the custom code in the program which will replace the original code, enable the
'Enhancement Mode' by clicking on the 'Spiral' button.
Place the cursor on the 'Enhancement-section' and navigate to 'Edit' 'Enhancement Operations'
'Create Implementation'.
Fill in the details for the 'Create Enhancement Implementation' dialog. Click on 'Create' button for the
'Select or Create Enhancement Implementation' dialog.
STEP 8: Now, write the code within the 'ENHANCEMENT' and 'ENDENHANCEMENT' statements as the
replacement code.
STEP 9: Don't forget to 'Activate' the enhancement Switch the 'Enhancement' mode OFF and
'Activate' the entire program.
After Enhancement:
Summary:
1. Here we deals with the enhancement of a 'Z' program it is possible to 'CREATE' an
'ENHANCEMENT-SECTION'. But, in case of a 'STANDARD SAP' program there are certain
places (provided by SAP) like 'ENHANCEMENT-POINT...' and 'ENHANCEMENT-SECTION...'
where we can create implementations based on customers business functionality.
2. There can be only one and only one 'ACTIVE' implementation for an 'ENHANCEMENT-SECTION'.
Source Code:
1.
Here we deals with the enhancement of a 'Z' program it is possible to 'CREATE' an 'ENHANCEMENTSECTION'. But, in case of a 'STANDARD SAP' program there are certain places (provided by SAP) like
'ENHANCEMENT-POINT...' and 'ENHANCEMENT-SECTION...' where we can create implementations based
on customers business functionality.
2.
There can be only one and only one 'ACTIVE' implementation for an 'ENHANCEMENT-SECTION'.
Source Code:
*&---------------------------------------------------------------------*
*& Report YDEV_CODE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT YDEV_CODE.
TABLES : VBAK, VBAP.
DATA : IT_VBAK TYPE STANDARD TABLE OF VBAK INITIAL SIZE 0,
WA_VBAK TYPE VBAK,
IT_VBAP TYPE STANDARD TABLE OF VBAP INITIAL SIZE 0,
WA_VBAP TYPE VBAP.
INITIALIZATION.
REFRESH : IT_VBAK,
IT_VBAP.
CLEAR : WA_VBAK,
WA_VBAP.
START-OF-SELECTION.
"active version
FROM VBAP
INTO TABLE IT_VBAP[]
UP TO 10 ROWS.
*********************************************************************************************************************
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.
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.
***********************************************************************************************************************
Go to VF02 transaction
Step by step how can we add custom tab to the billing header detail;
In order to fulfill the requirement we need a custom subscreen with some custom fields in that screen.
Steps for creating the custom fields and adding them to the custom sub screen.
1. Creating the Custom fields
a) Create the Z fields to the table VBRK, by appending the structure.
b) Give a name to the structure for example ZZVBRK_APPEND. Enter the fields name which will you
need.
Note: the added fields should follow the naming convention that they should start with ZZxxxxx or
YYxxxxx.
c) Save and activate.
2. Creating the z* program and its screen and adding the Z fields on layout.
a) Create a z*program using transaction SE38
give a name for example ZZBILLHEADER .
b) Create a screen using the transaction SE51.
OUTPUT Adding custom tab to the transaction VF01/VF02/VF03 Header detail screen
...Previous
Go to screen layout and get the fields from dictionary on vbrk table
The screen in VF03 before which is in changeable mode. If you write screen pbo module below code it
will be read only.
Go to transaction vf02,
SAP provides 2 screens for customer addional datas; screen 6001 is for header and screen 6002 is for
detail screen.
In the cust_head_activate subroutine we have to activate TABSTRIP_TAB06 for customer header tab
screen.
You will see the arrows . Right click on the arrow line and click Enhancement implemantation >Create
tab
z*
name
program
Activate the enhancement and check in the VF01/ VF02/ VF03 you can find the custom tab with the
custom fields. The Data automatically populates to the database table when the data is entered into the Z
fields.
******************************************************************************************************************************
Go to VF02 transaction:
SAP
has provided a custom tab in the tab strip (Program name SAPMV60A) screen 6002
which is having the function code PFCU.
In order to fulfill the requirement we need a custom subscreen with some custom fields
in that screen.
Steps for creating the custom fields and adding them to the custom sub screen.
1. Creating the Custom fields
a) Create the Z fields to the table VBRP, by appending the structure.
b) Give a name to the structure for example zzcustom_fields. Enter the field name.
Note: the added fields should follow the naming convention that they should start with
ZZxxxxx.
c) Save and activate.
2.
Creating the screen and adding the Z fields
a) Create a screen using the transaction SE51.
b) Get the
field from the dictionary which needs to be added to the screen.
3. Go to SE80 and give the program name (SAPMV60A) of the VF01 transaction. Go to
screen -> 6002.
In order to activate the custom tab for this requirement which is having the function code
PFCU, the module CUST_ITEM_ACTIVATE needs to be implemented.
To make use of this logic use enhancement frame work. We have enhancement spots
at the begin/end of the subroutine.
4. Steps to write the code in the enhancement spots.
a. First to find the enhancement spots click on the spiral icon in the menu bar, and next
click on the edit enhancement operations - show implicit enhancement options.
Insert
your code as below.
Activate the enhancement and check in the vf01/vf02/vf03 you can find the custom tab
with
the
custom
fields.
The Data automatically populates to the database table when the data is entered into
the Z fields. But where as in display mode it is changeable for it to be made disable, a
simple code is to be added.
The
screen
in
VF03
before
which
is
in
changeable
mode.
After
adding the code the screen is as follows in VF03 transaction.