Professional Documents
Culture Documents
Vvi Document Badi Interview
Vvi Document Badi Interview
Framework
for Nordic User group
Contributing Speakers
Michael Acker
Development Architect, NW AS ABAP Workbench, SAP AG
Dr. Roland Krmer
Senior Developer, NW AS ABAP Workbench, SAP AG
This document is a preliminary version and not subject to your license agreement or any other agreement
with SAP. This document contains only intended strategies, developments, and functionalities of the SAP
product and is not intended to be binding upon SAP to any particular course of business, product strategy,
and/or development. Please note that this document is subject to change and may be changed by SAP at any
time without notice. SAP assumes no responsibility for errors or omissions in this document.
Learning Objectives
As a result of this workshop, you will be able to
Understand the fundamental idea of the Enhancement Framework
and Switch Framework
Reduce TCO by using enhancement technologies instead of
modifications
Enhance SAP standard objects
Create your own Enhancement Spots for your own source code
Work with enhancements during an upgrade or import of a support
package
Ways of adaptation:
Customizing
Enhancement
Modification
Motivation
Reducing TCO
Enhancing objects instead of modifying them reduces the effort
for adjustment during SP import or upgrade.
Disadvantages of modifications
No support for multiple users or projects
No grouping
No support for parallel developments
Will appear much more often in adjustment tools
Higher adjustment effort
Multilayer Support
Core Development
Original Object
Application Development
Enhancement 1
Enhancement 2
Add On Development
Enhancement 11
Enhancement 12
Enhancement 01
Customer Development
Enhancement 121
Enhancement 201
Enhancement 001
Enhancements Relations
n
1
n
1
Can contain
Other Composite Enhancement
Spots
[Simple] Enhancement Spots
Enhancement Elements:
Such as a
[Simple]
Enhancement Spot
BAdI-Definition
[Simple] Enhancement
Implementation
Can contain Enhancement
Implementation Elements
Enhancement
Implementation Elements
Implementations
Composite Enhancement
Implementation
[Simple] Enhancement
Implementation
Enhancement Implementation
Elements:
[Simple] Enhancement Spot
Such as a
BAdI-Implementation
Tab 3
dependent on enhancement technology:
e.g. BAdI-Implementation or Source Code Enhancements
SAP AG 2006, Enhancement Framework/ 14
Contained
Composite
Enhancement
Implementations
contains [Simple]
Enhancement
Implementations
Terminology by Example
Composite Enhancement Spot
ERP
IS_OIL
SD
Upstream
Invoice
Composite Enhancement Spot
OIL_PRICING
Pricing
Enhancement Implementation
Functiongroup Enhancement
FUGR V60A
Enhancement Spot
Source Code Enhancement
Enhancement Implementation
Source Code Plugin
FUGR V60A
FUGR V60A
Enhancement Spot
BAdI Definition
Enhancement Implementation
BAdI Implementation
PRICING_BADI1
OIL_PRICING_IMPL1
Enhancement Browser
Search for
Enhancements possibilities
Existing Enhancement Implementations
Enhancement Implementations to be adjusted after upgrade
SE03 / SE06
New option:
Enhanceable
ENHANCEMENT 1.
WRITE Hello
Paris.
ENDENHANCEMENT.
ENHANCEMENT 2.
WRITE Hello
London.
ENDENHANCEMENT.
..
..
..
ENHANCEMENT-SECTION ep2
SPOTS s1.
WRITE Original.
END-ENHANCEMENT-SECTION.
ENHANCEMENT 3.
WRITE Enhanced.
ENDENHANCEMENT.
Beginning/End of Include
Beginning/End of Method/Function Module/Form Routine
End of a structure
End of Private/Protected/Public Section of a local class
...
Point A
Spot
Hugo
Point C
SpotA B
Section
Spot
Flights
Point D
Point F
Point E
Spot
Hugo
E2
E2
E3
Point C
SpotA B
Section
Spot
Flights
Point D
Point F
Point E
Spot
Hugo
E2
E2
E3
Point C
SpotA B
Section
Spot
Flights
Point D
Point F
Point E
E1
E2
E2
[Simple] Enhancement
Implementation 2
Physical Part of Compilation Unit
SAP AG 2006, Enhancement Framework/ 28
Spot
Hugo
E2
E2
E3
Point C
[Simple] Enhancement
Implementation 3
SpotA B
Section
Spot
Flights
E1
Point D
Point F
Point E
E1
E2
E2
E2
[Simple] Enhancement
Implementation 2
Physical Part of Compilation Unit
SAP AG 2006, Enhancement Framework/ 29
Overlay Enhancement
Existing Enhancements must not be modified. Enhance the
Enhancement instead!
Program
Enhancement e.g.
Industry Solution
Enhancement e.g.
Customer
Example:
An SAP Program is enhanced by an Industry
Solution.
The source code of the Industry Solution
enhancement is exchanged by a customer
enhancement.
to switch to
to leave Enhancement
Additional Parameters
Add optional parameters to existing function modules
Class/Interface Enhancements
Class/Interface Enhancements allow addition of:
optional parameters to existing methods
methods
events and event handlers
references to interfaces
types*
exits to existing methods
Additional Methods
Add new methods
Pre/Post Exits
Method Hugo.
source code.
source code.
source code.
Endmethod.
Method Pre.
.
Endmethod.
Method Post.
.
.
Endmethod.
g
lan
lan
g
ua
gua
ge
e=
XY
= D
E
METHOD if_mybadi~add_tax.
result = value +
myfunc(value).
ENDMETHOD.
METHOD if_mybadi~add_tax.
result = value * 1.16.
ENDMETHOD.
METHOD
if_mybadi~value_changed.
insert value ..
ENDMETHOD.
METHOD
if_mybadi~value_changed.
write value ..
ENDMETHOD.
ABC
DEF
XYZ
MER
FGH
METHOD
if_mybadi~get_result.
do
ENDMETHOD.
..
METHOD
if_mybadi~get_result.
do ..
ENDMETHOD.
bd
Inst1
Cl_imp1
SAP AG 2006, Enhancement Framework/ 51
Inst2
Cl_imp2
BAdI-Handle is No Proxy
CALL BADI bd->m exporting ... importing ...
Inst1
Inst2
Inst2
bd
Inst1
SAP AG 2006, Enhancement Framework/ 52
Inst2
Inst2
Implementation
BAdI Implementation 1
BAdI Implementation 2
BAdI Definition A
BAdI Implementation 2
BAdI Definition B
BAdI Implementation 2
BAdI Definition C
BAdI Implementation 3
Implementation
BAdI Implementation 1
BAdI Implementation 2
BAdI Definition A
BAdI Implementation 2
BAdI Definition B
BAdI Implementation 2
BAdI Definition C
BAdI Implementation 3
Implementation
BAdI Implementation 1
BAdI Implementation 2
Enhancement Implementation E2
BAdI Definition A
BAdI Implementation 2
BAdI Definition B
BAdI Implementation 2
BAdI Definition C
BAdI Implementation 3
Enhancement Implementation E1
Definition
Simple Enhancement Spot
Spot_1
Implementation
BAdI Implementation 1
Simple Enhancement Implementation SEI1
Package A
BAdI Implementation 2
BAdI BADI_A
BAdI BADI_B
BAdI Implementation 3
BAdI BADI_C
BAdI Implementation 4
Simple Enhancement Implementation SEI2
BAdI Implementation 5
Package B
Implementation
BAdI Implementation 1
Simple Enhancement Implementation SEI1
Package A
BAdI Implementation 2
BAdI BADI_A
BAdI BADI_B
BAdI Implementation 3
BAdI BADI_C
BAdI Implementation 4
Simple Enhancement Implementation SEI2
BAdI Implementation 5
Switch_2
SAP AG 2006, Enhancement Framework/ 57
Package B
Implementation
BAdI Implementation 1
Simple Enhancement Implementation SEI1
BAdI BADI_A
BAdI Implementation 2
BAdI BADI_B
BAdI Implementation 3
BAdI BADI_C
BAdI Implementation 4
Simple Enhancement Spot
Spot_2
BAdI Implementation 5
BAdI BADI_E
BAdI Implementation 6
Default Implementations
Types of Implementations
A BAdI-Definition may have an associated fallback class
A BAdI-Implementation is either default or non-default
Implementation Inheritance
Together with the BAdI, abstract or normal implementation
classes may be supplied
cl_imp1 has to implement all interface methods
cl_imp2, ... implement methods not supplied by cl_abstract_imp or
override some methods
It is also allowed to inherit from the default class or example
class, if they are not defined as final
bd1:badi_name1
imp:cl_imp
bd2:badi_name1
Types of Instantiations
ctx_a
ctx_b
ctx_c
DATA
badi_name
bd1
Inst1
Inst2
Cl_imp1
SAP AG 2006, Enhancement Framework/ 63
Cl_imp2
bd2
bd1
Inst1
Inst2
Cl_imp1
SAP AG 2006, Enhancement Framework/ 64
Inst3
Cl_imp2
Inst4
badi_name
bd1
Inst1
Cl_imp1
SAP AG 2006, Enhancement Framework/ 65
Inst2
Cl_imp2
bd2
bd1
Inst1
Cl_imp1
SAP AG 2006, Enhancement Framework/ 66
Inst2
Cl_imp2
Implementation Class 1
Implementation Class 2
Implementation Class n
bd1
bd2
bd3
dif_ctx
same_ctx
Inst2
Inst1
Cl_imp1
SAP AG 2006, Enhancement Framework/ 69
Impl1
badi_1
Interface B
method M2
Class a
*some code
GET BADI bd1 ref to badi_1 CONTEXT me
CALL BADI bd1->met
*some code
GET BADI bd2 ref to badi_2 CONTEXT me
CALL BADI bd2->met
Interface A
method M1
Cl_1
Impl2
badi_2
Interface B
method M2
BAdI Migration
Automatic migration
by selecting
utilities
migration
from BAdI
Automatic
migration
by selecting
utilities
migration
from
BAdI
Builder (SE18)
Builder
(se18)
Specify Enhancement Spot for BAdI Defintion
Specify
Enhancement
Implementation
BAdI
Implementation
Specify
Enhancement
Spot forfor
BAdI
Definition
special
Specify
Enhancement
Implementation for BAdI
no
knowledge
necessary
Implementation
can be automated.
BAdI Migration
Automatic migration by selecting utilities
migration from BAdI Builder (SE18)
CL_EXITHANDLER=>
GET_INSTANCE
CALL METHOD
if_ex_badi->m
Proxy Class
CL_EX_<BAdI>
BAdI
BAdI Migration
Complete migration:
Delete the classic BAdI.
Change Context Settings if you need no context.
Find all calls of the classic BAdI by GET_INSTANCE and
reprogram the BAdI call using the new commands GET
BADI and CALL BADI.
For BAdIs that are called more than once in one program the
context settings may be changed to improve the
performance.
Expert knowledge of the application necessary
Performance Comparison
Classic BAdI
Migrated BAdI
2-27
x faster than classic BAdI
New BAdI
40-600
x faster than classic BAdI
Migration of Implementations
Normally BAdI definition and implementations are defined
in different systems.
SAP System
BAdI A
Customer System
Implementation Z1
of BAdI A
Customer
PROGRAM
PROGRAM
Code Changes
enhancements?
*Enhancement Section
*Enhancement Section
Code Changes
Code Changes
?
*Section Implementation
Code Adjustments ???
PROGRAM
*Original source code
Code Changes
*Enhancement Section
Customer
PROGRAM
*Original source code
*Enhancement Section
Code Changes
Code Changes
*Section Implementation
Code Adjustments ???
Objects to be Adjusted
ABAP Source code with enhancements
The standard source code between ENHANCEMENT-SECTION
and END-ENHANCEMENT-SECTION has changed.
BAdIs
BAdI interface was changed or a filter was deleted
Editor
SPAU_ENH
Adjust Enhancements I
SPAU_ENH
3. Go to tab Adjustment
4. Double-Click on list entry to adjust it
Adjust Enhancements II
SPAU_ENH
Adjustment States
Semantic Changes
Automatic Adjustment
Tool-Aided Adjustment
Manual Adjustment
Enhancement is adjusted
Enhanced Object was deleted
Implementation is empty
Exclusiv Activation
Multiple Activation
SAP ECC Enterprise Extension Defense Forces & Public Security 6.0
SAP ECC Enterprise Extension Financials 6.0
SAP ECC Industry Extension Discrete Industries & Mill Products 6.0
Single Activation
Multiple Usage
Benefits
Switches control the visibility of repository objects at
runtime
Benefits:
Industry Solutions are available with every release and SP
without delay (i.e. timely provision of legal requirements),
CRTs are no longer necessary for add-on systems
Industry Solutions can be enriched by generic functions from
other industries
Synchronization of release cycles and planning
Switchable Objects I
Switchable Objects
by package assignment
Appends, SI-, CI-includes for dictionary structures
Fixed value appends to domains
Secondary Indexes
Append Search Helps
Enhancement Implementations
Switch Business Configuration Sets (Switch BC-Sets)
Switchable Objects II
Switchable Objects
by direct assignment
Screen elements & Flow logic
Menu entries & functions
IMG nodes
Customizing
Menu Painter
Switch dependent menu entries
View Cluster
The visibility of a view within a view cluster can be
controlled by switches.
Customizing
Switch dependent import of table content via BC-Sets
BC-Sets improvements:
Performance improvements
Support of deletion of customizing entries
Tool improvements like automatic recording, switch dependent
definition and browsing
Business Function
Business Function
Represents a piece of
business functionality
Contains switches
Switch
Transaction SFW2
Switch
Calculated states:
ON, OFF, STANDBY
Transaction SFW1
Industry Solution Y
P2
P1
Area Menue
P3
Appends
Appends
Redefinitions
Redefinitions
BadI-Implem.
Function Group
Transactions
Transactions
BC set 2
P4
P5
Reports
BadI-Implem.
Redefinitions
Transactions
BC set 3
Appends
BC set 1
BC set 4
Screen 1
IMG-Node 1
Element 1
IMG-Node 2
Screen 2
IMG-Node 3
Element 3
P7
P6
Function Group
BC set 5
Screen 3
IMG-Node 6
Element 4
IMG-Node 7
Element 5
Industry Solution Y
P2
P1
Appends
Redefinitions
Redefinitions
BadI-Implem.
Function Group
Transactions
Transactions
Reports
Reports
BC set 1
Screen 1
IMG-Node 1
Element 1
IMG-Node 2
Screen 2
IMG-Node 3
Element 3
Area Menue
P3
Appends
BC set 2
P7
P6
Function Group
P4
P5
Reports
BadI-Implem.
Redefinitions
Transactions
BC set 3
Appends
BC set 4
BC set 5
Screen 3
IMG-Node 6
Element 4
IMG-Node 7
Element 5
Industry Solution Y
P2
P1
Appends
Redefinitions
Redefinitions
BadI-Implem.
Function Group
Transactions
Transactions
Reports
Reports
BC set 1
Screen 1
IMG-Node 1
Element 1
IMG-Node 2
Screen 2
IMG-Node 3
Element 3
Area Menu
P3
Appends
BC set 2
P7
P6
Function Group
P4
P5
Reports
BadI-Implem.
Redefinitions
Transactions
BC set 3
Appends
BC set 5
BC set 4
Screen 3
IMG-Node 6
Element 4
IMG-Node 7
Element 5
Activate a BFS
Log on to the Development System with authorization SAP_ALL
Disable all batch jobs
Close the system for all other users
Transaction SFW5
Choose the BFS in the drop down box
Select the required Business Functions that belong to the chosen
BFS
Click on the button activate
SFW5
I. Select the BFS
SFW5
Activating a BFS II
The Batch Job for DDIC and BC-Set activation starts immediately.
This job takes about 30-120 min
The background activities are comparable to installing an Add On
manually
Reschedule batch jobs in the development system and unlock
users
Caution:
Only one Business
Function Set can be
activated
Caution:
There is no possibility,
to deactivate a BFS
Summary
The new BAdIs are more flexible and faster than the
classic ones.
The Enhancements offered by Enhancement Framework
and several other object types can be switched by the
Switch Framework.
Further Information
Public Web
http://help.sap.com
Documentation
SAP Netweaver
Application
Platform
ABAP technology
ABAP Workbench
Enhancement
Framework
Weblogs by author Thomas Weiss
http://sdn.sap.com
SUGGESTIONS
DISCUSSION
The information in this document is proprietary to SAP. No part of this document may be reproduced, copied, or transmitted in any form or for any purpose
without the express prior written permission of SAP AG.
This document is a preliminary version and not subject to your license agreement or any other agreement with SAP. This document contains only intended
strategies, developments, and functionalities of the SAP product and is not intended to be binding upon SAP to any particular course of business, product
strategy, and/or development. Please note that this document is subject to change and may be changed by SAP at any time without notice.
SAP assumes no responsibility for errors or omissions in this document. SAP does not warrant the accuracy or completeness of the information, text, graphics,
links, or other items contained within this material. This document is provided without a warranty of any kind, either express or implied, including but not limited
to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement.
SAP shall have no liability for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use
of these materials. This limitation shall not apply in cases of intent or gross negligence.
The statutory liability for personal injury and defective products is not affected. SAP has no control over the information that you may access through the use
of hot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party
Web pages.