Enhancement Framework in ABAP 1725388528

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Enhancement in SAP

public
1. What is Enhancement?

In Sap systems, techniques that allow adding new features to the system or extending existing
functions without changing the current functionalities of any object are used. SAP offers various
enhancement methods to provide flexibility according to the specific needs of customers.

1.1 Advantages of using Enhancement

Some of the advantage of using Enhancements are as follows:

• Flexibility and Customizability: Enhancements provide the flexibility to tailor SAP systems
according to the specific requirements of businesses. It allows customization of the customer's
business processes.
• Compatibility with System Updates: Since additions are made without changing SAP's standard
objects, compatibility issues are avoided during system updates and upgrades.
• Ease of Maintenance: Enhancements make it easier to track and manage changes made in the
system. This improves the effectiveness of maintenance and support processes.

1.2 Disadvantage of using Enhancement

If don't pay attention some of the disadvantages of using Enhancements are as follows:

• Complexity: Using multiple enhancements can make the code complex.


• Performance Impact: A lot of enhancements may negatively impact system performance.
• Difficulty Debugging: Enhancements can be little difficult to track, making debugging difficult.
• Risk of Misuse: Misuse or excessive use may cause the system to operate unexpectedly.

Enhancement in SAP
Date
www.nttdata-solutions.com
Page 2 of 14
2. Implicit Enhancements
Implicit enhancements are points that SAP usually creates at the beginning or end of an object
(function module, subroutine or program). These points allow developers to add their own code during
certain standard SAP operations. To create an Implicit Enhancement, first go to the source code of the
object to be enhanced.

In this example, enhancement will be added to the ‘DEMO_DATA_PROCESS_FIELDS’ program.

To switch to Enhance mode, the Enhance


button must be pressed.

Enhancement in SAP
Date
www.nttdata-solutions.com
Page 3 of 14
After entering Enhance mode, options such as
Create/Change/Replace/Undo will appear as
on the left. To show Implicy Enhancement
Option; Edit > Enhancement Operations >
Show Implicit Enhancement Options must be
pressed.

After clicking the Show Implicit Enhancement option, an arrow sign will appear in the editor, as in lines 71, 73
and 79 above, and SAP will tell you that enhancements can be made to these sections.

Right-click on the dotted line to the right of the arrow, select enhancement operations, and select create
implementation from the menu that appears.

Enhancement in SAP
Date
www.nttdata-solutions.com
Page 4 of 14
After selecting Create Implementation, the
enhancement mode must be selected. There are two
options here: declaration and code.

• Declaration: Implementation is created statically. This means that it can always be used in all
clients.
• Code: Implementation is created dynamically.

In general, 'Decleration' is based on an unconditional call system, while 'Code' is based on a conditional call
system. An unconditional call, 'Decleration', is a static call that is called independently of the client. The
definition of subroutines, methods and local classes can only be applied in unconditional calls. The
conditional call, 'Code', is called dynamically in this case depending on the current settings of the switches.
For more information, click on the "Info" button.

After clicking the Declaration button, a pop-up will appear as above. From the fields here;

• Enhancement Implementation: Used to determine the name of the Enhancement Implementation.


The name usually starts with the letter “Z” or “Y” and is given a meaningful name according to project
standards.

• Short Text: Contains a short description of the Enhancement Implementation. This description
should summarize the purpose of the implementation or what it is used for.

• Composite Enhancement Implementation: Indicates whether the Enhancement Implementation is


a composite enhancement implementation. A composite enhancement implementation can include
more than one enhancement point.

Enhancement in SAP
Date
www.nttdata-solutions.com
Page 5 of 14
After filling in the required fields and clicking the Next button, SAP
asks which package the relevant enhancement will be saved in. In
projects, such enhancements are usually saved in General Module
Packages (ZMM000, ZPP000 etc.).

After selecting the package, the enhancement is now created. Enhancement codes can be written between
the open lines. Now the additional enhancement made to a standard object can be tested. When you double-
click on the Enhancement, you can view its information in more detail.

On this screen;

• Enhanced Development Object: This field shows which enhancement object the enhancement
implementation affects.
• Enhancement Spot / Program: This column shows the name of the enhancement point or program.
In this example, it is specified as "DEMO_DATA_PROCESS_FIELDS".
• Overview: This column provides a general summary of the enhancement point. In this example, it is
specified as "Static Enhancement Point/Section".
• Enhancement Implementation Type: This column shows the type of enhancement implementation.
In this example, it is specified as "Static Enhancement Point/Section".
• Enhancement Implementation Point/Section: This column shows the full path of the enhancement
point or section.

Enhancement in SAP
Date
www.nttdata-solutions.com
Page 6 of 14
In other tabs;
• Properties: Contains general and metadata properties of the Enhancement Implementation.
• History: Shows the change history of the Enhancement Implementation.
• Technical Details: Contains technical details of the Enhancement Implementation.

3. Switch / Enhancement Framework


The main purpose of Switch Framework is to simplify one or more customer process solutions in a
standard system in an ABAP-based system environment. Switch Framework allows you to externally control
the visibility of repository objects or components via switches. The developments made can thus change the
status actively or passively.

First, enter the SFW1 transaction code to create a


Switch. If there is no previously created switch, type
the object name and click the create button.

After clicking the Create button, a short description of


the switch to be created is entered. The "Conflict
Switch" option is used to determine whether a switch
conflicts with another switch. If this box is checked,
certain other switches can be disabled or certain
functions can be prevented from working when this
switch is active. It provides control of functions that
may affect each other when activated at the same time.

Enhancement in SAP
Date
www.nttdata-solutions.com
Page 7 of 14
After the switch is created, the package selection in the Packages tab is important because when the
enhancement and the switch are in the same package, the enhancement automatically inherits the features
of that switch.

After the switch is activated, a pop-up will appear stating that


the job has started. Then, a Business Function must be
created with the SFW2 transaction code.

Enter the SFW2 transaction code. If there is no previously


created business function, type the object name and click
the create button. After clicking the create button, enter the
necessary information and select G (Enterprise Business
Function) so that it can be easily followed on the SFW5
screen.

In the Switch tab, enter the name of the switch object


created in the previous step and select its type as Activation
or Standby. Here, Activation will allow both dynamic and
static enhancements to work. If Standby is selected,
dynamic enhancements will not work.

Enhancement in SAP
Date
www.nttdata-solutions.com
Page 8 of 14
If you want to delete or deactivate this Business Function
from the SFW5 screen in the future, the Reversible feature
in the Properties tab must be activated. Otherwise, no
changes can be made after it is activated.

After entering the SFW5 screen, go to the bottom of the


ENTERPRISE_BUSINESS_FUNCTIONS group and find
the Business function created with Z. To activate, check
the planned status checkbox and click the Activate
Changes button. After this stage, our Switch is now active
for the objects in the relevant package.

When you go to the Enhancement properties, you can see


that the switch and switch position properties are updated.
If the switch is put into standby state, the dynamic
enhancement development created with the code option
will not work. Enhancements created with the Declaration
property will not be affected by this switch state because
they are called unconditionally.

Enhancement in SAP
Date
www.nttdata-solutions.com
Page 9 of 14
4. Explicit Enhancement
Explicit enhancements are enhancements made through specific enhancement points. SAP specifies
these points on any line and developers can add their own code at these points. In this example, we will
work on transaction code LMGMMI05, where the enhancement point affects the material number control in
transaction code MM01.

After pressing the Enhance button and switching to the enhance mode, right-click on the enhancement point
line as above;

Enhancement Implementations can be created using the Enhancement Operations > Create
Implementations or Edit > Enhancement Operations > Create Implementations option.

Enhancement in SAP
Date
www.nttdata-solutions.com
Page 10 of 14
The code to be developed to the opened
enhancement point. Then the enhancement is
activated. As above, if the SAP system user is not
'DDURAK' and the relevant material number is not
'0123456789', the code of a process that will give
a message is written and an error message is
received as on the left.

Enhancement Point and Enhancement Section


can be grouped under Enhancement Spots. As
seen on the left, all sections and points in the
relevant program are grouped under spots.

Enhancement in SAP
Date
www.nttdata-solutions.com
Page 11 of 14
In addition to Enhancement Point, Enhancement Section can
also be used in enhancements. Enhancement Section has
"default" standard codes in the section between
ENHANCEMENT-SECTION and END-ENHANCEMENT-
SECTION. If a new enhancement is implemented in
Enhancement Section, these standard codes will also come to
the new implementation and will be overwritten. In other words,
the implemented codes will work instead of the codes between
ENHANCEMENT-SECTION / END-ENHANCEMENT-SECTION.
If the enhancement section on the left is implemented and
commented completely, it is observed that SAP will no longer
automatically give a material number.

As can be seen, as the ZMM000_ENH_GET_NUMBER


Enhancement Implementation was created, the default codes in
the Enhancement section came automatically. In this process,
after the material number is created, if the system user name is
'DDURAK', the code was edited to give a message such as the
material number was created.

Enhancement in SAP
Date
www.nttdata-solutions.com
Page 12 of 14
The Create Enhancement Option feature allows you to create a new
enhancement point in the SAP ABAP Enhancement Framework. With this
option, additional functionality can be added to a specific point in an
existing program or function. Right-click on any line where empty code can
be written and select Enhancement Operations > Create Option.

On the Create Enhancement Option screen, in the Type and Name


section, it is necessary to select whether an enhancement section or
an enhancement point will be created and to give a name with a Z.
In the Source Text Link section, it is determined whether the
enhancement to be created will be dynamic or static.
(Unconditional = Static = Declaration,
Conditional = Dynamic = Code)
In the Enhancement Point column, the Enhancement Spot name,
description and the package information to be assigned are entered.
Here, the Enhancement Spot name must start with a Z or Y.

Enhancement in SAP
Date
www.nttdata-solutions.com
Page 13 of 14
After the Enhancement Point is created, it is activated
and the normal editing mode in the program is exited.
Enhancement mode is entered. The Enhancement
Implementation point is created by right-clicking on the
relevant Enhancement Point point. Here, the pop-up with
Declaration or Code options does not appear. The reason
for this is that the Enhancement Point is given the
dynamic or static feature. The enhancement point on the
left is static.

On the left, an Enhancement Section was created for the


ZOPERATION spot using the Create Option option.
Implementation can be done by switching to Enhance
mode.

As the Enhancement Implementation was done, the same default codes in


the enhancement section came to implementation. Overwrite operation can
be done here. Extra additions to the codes or complete editing can be done.
As can be seen, the result of the division operation was not given twice, only
the operations within the implemented enhancement were done.

Enhancement in SAP
Date
www.nttdata-solutions.com
Page 14 of 14

You might also like