bc427 - enhancement framework

93
BC427 Enhancement Framework SAP NetWeaver Date Training Center Instructors Education Website Participant Handbook Course Version: 2006/Q2 Course Duration: 2 Days Material Number: 50085380 An SAP course - use it to learn, reference it for work

Upload: kensai-kenshin-ryokuda

Post on 03-Dec-2014

592 views

Category:

Documents


8 download

TRANSCRIPT

Page 1: BC427 - Enhancement Framework

BC427Enhancement Framework

SAP NetWeaver

Date

Training Center

Instructors

Education Website

Participant HandbookCourse Version: 2006/Q2Course Duration: 2 DaysMaterial Number: 50085380

An SAP course - use it to learn, reference it for work

Page 2: BC427 - Enhancement Framework

Copyright

Copyright © 2007 SAP AG. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or for any purposewithout the express permission of SAP AG. The information contained herein may be changedwithout prior notice.

Some software products marketed by SAP AG and its distributors contain proprietary softwarecomponents of other software vendors.

Trademarks

� Microsoft®, WINDOWS®, NT®, EXCEL®, Word®, PowerPoint® and SQL Server® areregistered trademarks of Microsoft Corporation.

� IBM®, DB2®, OS/2®, DB2/6000®, Parallel Sysplex®, MVS/ESA®, RS/6000®, AIX®,S/390®, AS/400®, OS/390®, and OS/400® are registered trademarks of IBM Corporation.

� ORACLE® is a registered trademark of ORACLE Corporation.� INFORMIX®-OnLine for SAP and INFORMIX® Dynamic ServerTM are registered

trademarks of Informix Software Incorporated.� UNIX®, X/Open®, OSF/1®, and Motif® are registered trademarks of the Open Group.� Citrix®, the Citrix logo, ICA®, Program Neighborhood®, MetaFrame®, WinFrame®,

VideoFrame®, MultiWin® and other Citrix product names referenced herein are trademarksof Citrix Systems, Inc.

� HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C®, WorldWide Web Consortium, Massachusetts Institute of Technology.

� JAVA® is a registered trademark of Sun Microsystems, Inc.� JAVASCRIPT® is a registered trademark of Sun Microsystems, Inc., used under license for

technology invented and implemented by Netscape.� SAP, SAP Logo, R/2, RIVA, R/3, SAP ArchiveLink, SAP Business Workflow, WebFlow, SAP

EarlyWatch, BAPI, SAPPHIRE, Management Cockpit, mySAP.com Logo and mySAP.comare trademarks or registered trademarks of SAP AG in Germany and in several other countriesall over the world. All other products mentioned are trademarks or registered trademarks oftheir respective companies.

Disclaimer

THESE MATERIALS ARE PROVIDED BY SAP ON AN "AS IS" BASIS, AND SAP EXPRESSLYDISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR APPLIED, INCLUDINGWITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY AND FITNESS FOR APARTICULAR PURPOSE, WITH RESPECT TO THESE MATERIALS AND THE SERVICE,INFORMATION, TEXT, GRAPHICS, LINKS, OR ANY OTHER MATERIALS AND PRODUCTSCONTAINED HEREIN. IN NO EVENT SHALL SAP BE LIABLE FOR ANY DIRECT,INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES OF ANYKIND WHATSOEVER, INCLUDING WITHOUT LIMITATION LOST REVENUES OR LOSTPROFITS, WHICH MAY RESULT FROM THE USE OF THESE MATERIALS OR INCLUDEDSOFTWARE COMPONENTS.

g20079124527

Page 3: BC427 - Enhancement Framework

About This HandbookThis handbook is intended to complement the instructor-led presentation of thiscourse, and serve as a source of reference. It is not suitable for self-study.

Typographic ConventionsAmerican English is the standard used in this handbook. The followingtypographic conventions are also used.

Type Style Description

Example text Words or characters that appear on the screen. Theseinclude field names, screen titles, pushbuttons as wellas menu names, paths, and options.

Also used for cross-references to other documentationboth internal (in this documentation) and external (inother locations, such as SAPNet).

Example text Emphasized words or phrases in body text, titles ofgraphics, and tables

EXAMPLE TEXT Names of elements in the system. These includereport names, program names, transaction codes, tablenames, and individual key words of a programminglanguage, when surrounded by body text, for exampleSELECT and INCLUDE.

Example text Screen output. This includes file and directory namesand their paths, messages, names of variables andparameters, and passages of the source text of aprogram.

Example text Exact user entry. These are words and characters thatyou enter in the system exactly as they appear in thedocumentation.

<Example text> Variable user entry. Pointed brackets indicate that youreplace these words and characters with appropriateentries.

2007/Q3 © 2007 SAP AG. All rights reserved. iii

Page 4: BC427 - Enhancement Framework

About This Handbook BC427

Icons in Body TextThe following icons are used in this handbook.

Icon Meaning

For more information, tips, or background

Note or further explanation of previous point

Exception or caution

Procedures

Indicates that the item is displayed in the instructor'spresentation.

iv © 2007 SAP AG. All rights reserved. 2007/Q3

Page 5: BC427 - Enhancement Framework

ContentsCourse Overview ..... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii

Course Goals .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .viiCourse Objectives ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .vii

Unit 1: Overview..... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1Basic Concepts and an Overview of the EnhancementTechnology ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2

Unit 2: Enhancements in ABAP Dictionary ..... . . . . . . . . . . . . . . . . . . . 13Enhancements in ABAP Dictionary... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

Unit 3: Enhancement points/options and enhancementsections ... .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

Enhancement Points/Options and Enhancement Sections ... . . 24

Unit 4: Business Add-Ins (BAdIs) .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43Business Add Ins (BAdIs). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

Unit 5: Switch Framework ..... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69Switch Framework ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

Index ..... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

2007/Q3 © 2007 SAP AG. All rights reserved. v

Page 6: BC427 - Enhancement Framework

Contents BC427

vi © 2007 SAP AG. All rights reserved. 2007/Q3

Page 7: BC427 - Enhancement Framework

Course OverviewThis course provides information about using enhancement options in theEnhancement Framework, which is delivered in SAP NetWeaver 7.0.

Target AudienceThis course is intended for the following audiences:

� Customers and consultants who want to use the enhancement options in theEnhancement Framework

Course PrerequisitesRequired Knowledge

� Knowledge of ABAP Objects (Object-oriented programming in ABAP)

Recommended Knowledge

� knowledge of enhancement technology previously used (prior to SAPNetWeaver 7.0).

Course GoalsThis course will prepare you to:

� use enhancement options in the Enhancement Framework delivered forSAP NetWeaver 7.0.

Course ObjectivesAfter completing this course, you will be able to:

� provide an overview of the classic enhancement technology and the newenhancement concept (Enhancement Framework)

� use the new options for SAP NetWeaver 7.0 to enhance the ABAP Dictionary� use enhancement points/options and enhancement sections effectively to

enhance SAP software� find and use enhancements that are determined using BAdI technology� use the Switch Framework to activate and deactivate enhancement

implementations

2007/Q3 © 2007 SAP AG. All rights reserved. vii

Page 8: BC427 - Enhancement Framework

Course Overview BC427

viii © 2007 SAP AG. All rights reserved. 2007/Q3

Page 9: BC427 - Enhancement Framework

Unit 1Overview

Unit OverviewThis unit should present the basic concepts in the enhancement area. It shouldalso provide an overview of the classic and the new (using the EnhancementFramework) enhancement technology and options.

Unit ObjectivesAfter completing this unit, you will be able to:

� explain the basic concepts in the enhancement area� list the technology used by SAP to implement enhancements prior to SAP

NetWeaver 7.0� list the new technology for implementing enhancements for SAP NetWeaver

7.0� explain what enhancement points/options and enhancement sections are

Unit ContentsLesson: Basic Concepts and an Overview of the EnhancementTechnology.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2

2007/Q3 © 2007 SAP AG. All rights reserved. 1

Page 10: BC427 - Enhancement Framework

Unit 1: Overview BC427

Lesson: Basic Concepts and an Overview of theEnhancement Technology

Lesson OverviewThis lesson describes basic enhancement concepts and it also provides anoverview of classic enhancement options and the new enhancement options intheEnhancement Framework.

Lesson ObjectivesAfter completing this lesson, you will be able to:

� explain the basic concepts in the enhancement area� list the technology used by SAP to implement enhancements prior to SAP

NetWeaver 7.0� list the new technology for implementing enhancements for SAP NetWeaver

7.0� explain what enhancement points/options and enhancement sections are

Business ExampleYou want to obtain an overview of the basic enhancement concepts used by SAPto date, and also of the new enhancements technology for SAP NetWeaver 7.0.

Basic Concepts and Classic Enhancement TechnologyThis section introduces the basic concepts of enhancements. It also introducesclassic enhancement technology used by SAP for implementing enhancementsprior to SAP NetWeaver 7.0.

There are three different enhancement types and they are described in thefollowing section.

Figure 1: Enhancement types

2 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 11: BC427 - Enhancement Framework

BC427 Lesson: Basic Concepts and an Overview of the Enhancement Technology

Figure 2: Program exit

A program exit is a jump/link from an SAP program to a customer source code.These exits are used by customers to implement additional or alternative functionsfor the SAP program without making modifications.

SAP can use various enhancement technology to implement program exits.

Figure 3: Implementation techniques for program exits

At the end of this section, we will see why SAP has used so many differenttechniques.

2007/Q3 © 2007 SAP AG. All rights reserved. 3

Page 12: BC427 - Enhancement Framework

Unit 1: Overview BC427

Figure 4: Menu exit

A menu exit is the option to include an additional menu entry with customerfunctions in an SAP screen without making modifications.

Menu exits can be implemented only using theCustomer Exit and BAdI technologyand they can be used just once.

Figure 5: Implementation techniques for menu exits

A screen exit is the option to include additional fields in an SAP screen withoutmaking modifications. SAP fields and customer append fields can be used for this.

4 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 13: BC427 - Enhancement Framework

BC427 Lesson: Basic Concepts and an Overview of the Enhancement Technology

Figure 6: Screen exit

Screen exits can also be implemented only using the Customer Exit and BAdItechnology. Like menu exits, they can be used just once.

Figure 7: Implementation techniques for screen exits

2007/Q3 © 2007 SAP AG. All rights reserved. 5

Page 14: BC427 - Enhancement Framework

Unit 1: Overview BC427

The following figure shows why SAP �created� the various enhancementtechnology and used them to implement enhancements.

Figure 8: Origin of the implementation techniques

Although menu and screen exits can never be used more than once, program exitsthat are implemented using the Business Transaction Event and BAdI technologycan be defined for multiple use. In this case, a program exit may have severalactive implementations that are processed in succession at runtime.

The following graphic shows the runtime architecture of multiple-use programexits.

6 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 15: BC427 - Enhancement Framework

BC427 Lesson: Basic Concepts and an Overview of the Enhancement Technology

Figure 9: Multiple use of a program exit

Enhancement Technology in the EnhancementFrameworkThis section provides an overview of the new enhancement options implementedin the Enhancement Framework (as of SAP NetWeaver 7.0).

Figure 10: Overview: Enhancements in the Enhancement Framework

In addition to the new enhancement options (enhancement points/optionsand enhancement sections), the BAdIs are also managed in theEnhancementFramework.

2007/Q3 © 2007 SAP AG. All rights reserved. 7

Page 16: BC427 - Enhancement Framework

Unit 1: Overview BC427

For SAP NetWeaver 7.0, SAP revised the BAdI technology in order to improveperformance. In future, enhancements will be implemented using the BAdItechnology. However, the system contains a wide range of BAdI exits that wereimplemented using the classic BAdI technology. Therefore, this course alsoprovides an overview of the use of classic BAdIs.

Figure 11: Overview: Enhancement points

Enhancement points are points in SAP programs, in which customers can addadditional functions in the form of source code without making modifications.

Implicit enhancement points are at certain points in the SAP program and they arenot explicitly provided by SAP Development. Explicit enhancement points areenhancement points provided by SAP Development.

8 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 17: BC427 - Enhancement Framework

BC427 Lesson: Basic Concepts and an Overview of the Enhancement Technology

Figure 12: Overview: Enhancement options

Enhancement options are always implicitly available. Customers can use themto enhance SAP class definitions and interfaces of SAP function modules andmethods.

Hint: Implicit enhancement points and options also exist in SAP objectsthat were developed before SAP NetWeaver 7.0.

Figure 13: Overview: Enhancement section :

An enhancement section is an option provided explicitly by SAP to replace ablock of SAP source code with customer source code.

2007/Q3 © 2007 SAP AG. All rights reserved. 9

Page 18: BC427 - Enhancement Framework

Unit 1: Overview BC427

Lesson Summary

You should now be able to:� explain the basic concepts in the enhancement area� list the technology used by SAP to implement enhancements prior to SAP

NetWeaver 7.0� list the new technology for implementing enhancements for SAP NetWeaver

7.0� explain what enhancement points/options and enhancement sections are

10 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 19: BC427 - Enhancement Framework

BC427 Unit Summary

Unit SummaryYou should now be able to:� explain the basic concepts in the enhancement area� list the technology used by SAP to implement enhancements prior to SAP

NetWeaver 7.0� list the new technology for implementing enhancements for SAP NetWeaver

7.0� explain what enhancement points/options and enhancement sections are

2007/Q3 © 2007 SAP AG. All rights reserved. 11

Page 20: BC427 - Enhancement Framework

Unit Summary BC427

12 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 21: BC427 - Enhancement Framework

Unit 2Enhancements in ABAP Dictionary

Unit OverviewThis unit should provide developments in the area for dictionary enhancements.

Unit ObjectivesAfter completing this unit, you will be able to:

� create secondary indexes for SAP tables without making modifications� add additional fixed values to SAP domains without making modifications

Unit ContentsLesson: Enhancements in ABAP Dictionary ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

Exercise 1: Fixed Value Append .. .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

2007/Q3 © 2007 SAP AG. All rights reserved. 13

Page 22: BC427 - Enhancement Framework

Unit 2: Enhancements in ABAP Dictionary BC427

Lesson: Enhancements in ABAP Dictionary

Lesson OverviewThis lesson deals with the new ABAP Dictionary enhancement options for SAPNetWeaver 7.0. This includes Extension Index and Fixed Value Append.

Lesson ObjectivesAfter completing this lesson, you will be able to:

� create secondary indexes for SAP tables without making modifications� add additional fixed values to SAP domains without making modifications

Business ExampleYou want to use the new ABAP Dictionary enhancement options for SAPNetWeaver 7.0 correctly.

Extension Index for SAP TablesCreating a secondary index for an SAP table is a modification even though thecustomer name space is retained. In SAP NetWeaver 7.0, you have the option ofcreating secondary indexes without making modifications. This type of indexis called an Extension Index.

The following figure shows how to create an extension for an SAP table.

14 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 23: BC427 - Enhancement Framework

BC427 Lesson: Enhancements in ABAP Dictionary

Figure 14: Extension index

Fixed Value Append for SAP DomainsPreviously, you had to use modifications to add additional fixed values to SAPdomains In SAP NetWeaver 7.0, you can use fixed value appends to add additionalfixed values and you do not have to use modifications.

The following two figures illustrate how to create a fixed value append for anSAP domain.

2007/Q3 © 2007 SAP AG. All rights reserved. 15

Page 24: BC427 - Enhancement Framework

Unit 2: Enhancements in ABAP Dictionary BC427

Figure 15: Creating a fixed value append

Figure 16: Maintaining additional fixed values

The append must be activated at the end of the maintenance.

16 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 25: BC427 - Enhancement Framework

BC427 Lesson: Enhancements in ABAP Dictionary

Figure 17: A domain with an activated fixed value append

In all input fields that are defined using the enhanced domain, the user can selectthe appended fixed values in addition to the original fixed values when theychoose F4.

2007/Q3 © 2007 SAP AG. All rights reserved. 17

Page 26: BC427 - Enhancement Framework

Unit 2: Enhancements in ABAP Dictionary BC427

18 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 27: BC427 - Enhancement Framework

BC427 Lesson: Enhancements in ABAP Dictionary

Exercise 1: Fixed Value Append

Exercise ObjectivesAfter completing this exercise, you will be able to:� use the fixed value append technology to enhance the fixed values specified

in the SAP domain without making modifications

Business ExampleFor an SAP domain, you want to enhance the specified fixed values withoutmaking modifications.

Task:Enhance the fixed values in SAP domains

1. Create package ZBC427_## (## = group number) and assign all yourexercise objects for this training course to that package.

2. Call program BC427_##_EPS (## = group number). On the selectionscreen, determine with which domain the parameterWEEKDAY is definedand which fixed values are specified there.

3. Add the values '6' (Saturday) and '7' (Sunday) to the specified fixed values.

Name your fixed value append ZA_WEEKDAY_## .

4. Call the program again to check the enhanced input help (F4) on the selectionscreen. What is the program output when you enter '6' or '7' ?

2007/Q3 © 2007 SAP AG. All rights reserved. 19

Page 28: BC427 - Enhancement Framework

Unit 2: Enhancements in ABAP Dictionary BC427

Solution 1: Fixed Value AppendTask:Enhance the fixed values in SAP domains

1. Create package ZBC427_## (## = group number) and assign all yourexercise objects for this training course to that package.

a)

2. Call program BC427_##_EPS (## = group number). On the selectionscreen, determine with which domain the parameterWEEKDAY is definedand which fixed values are specified there.

a) You can use the F1 help in the input field to determine the data elementused for the definition and, therefore, also the domain.

The domain used is called S_WEEKDAY_##.

It has the fixed values '1', '2', '3', '4', '5'.

3. Add the values '6' (Saturday) and '7' (Sunday) to the specified fixed values.

Name your fixed value append ZA_WEEKDAY_## .

a) Use the menu Goto→ Fixed Value Append in the domain display.

4. Call the program again to check the enhanced input help (F4) on the selectionscreen. What is the program output when you enter '6' or '7' ?

a) When you enter '6' and '7', the system issues an information messagesaying 'Invalid weekday input'.

20 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 29: BC427 - Enhancement Framework

BC427 Lesson: Enhancements in ABAP Dictionary

Lesson Summary

You should now be able to:� create secondary indexes for SAP tables without making modifications� add additional fixed values to SAP domains without making modifications

2007/Q3 © 2007 SAP AG. All rights reserved. 21

Page 30: BC427 - Enhancement Framework

Unit Summary BC427

Unit SummaryYou should now be able to:� create secondary indexes for SAP tables without making modifications� add additional fixed values to SAP domains without making modifications

22 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 31: BC427 - Enhancement Framework

Unit 3Enhancement points/options and

enhancement sections

Unit OverviewThis unit provides information about using the enhancement points/options andthe enhancement sections.

Unit ObjectivesAfter completing this unit, you will be able to:

� describe which enhancement options are available in the EnhancementFramework

� list the points in SAP objects where implicit enhancement points and optionsare available and use them to enhance the SAP functions without makingmodifications

� find implemented explicit enhancement points and sections in SAP objectsand use them to enhance or replace SAP functions

Unit ContentsLesson: Enhancement Points/Options and Enhancement Sections .. . . . . 24

Exercise 2: Explicit Enhancement Points and Sections ... . . . . . . . . . . . . . 35Exercise 3: Implicit Enhancement Points and Options in SAP FunctionModules ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37Exercise 4: Implicit Enhancement Points in SAP Structure Definitionsand Subroutines .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

2007/Q3 © 2007 SAP AG. All rights reserved. 23

Page 32: BC427 - Enhancement Framework

Unit 3: Enhancement points/options and enhancement sections BC427

Lesson: Enhancement Points/Options and EnhancementSections

Lesson OverviewThis lesson describes the new enhancement options for SAP NetWeaver 7.0. Thisincludes the implicit enhancement points and options and the explicit points andsections.

Lesson ObjectivesAfter completing this lesson, you will be able to:

� describe which enhancement options are available in the EnhancementFramework

� list the points in SAP objects where implicit enhancement points and optionsare available and use them to enhance the SAP functions without makingmodifications

� find implemented explicit enhancement points and sections in SAP objectsand use them to enhance or replace SAP functions

Business ExampleYou want to use the new enhancement options in the Enhancement Framework toenhance your SAP functions without making modifications.

Overview of the Enhancement FrameworkThis section provides an overview of the enhancement options included in theEnhancement Framework.

24 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 33: BC427 - Enhancement Framework

BC427 Lesson: Enhancement Points/Options and Enhancement Sections

Figure 18: Detailed overview of enhancements in the EnhancementFramework

In the Enhancement Framework, there are some new enhancement options forSAP NetWeaver 7.0: Enhancement points / options and enhancement sections.It is particularly interesting that, unlike enhancements implemented using previousenhancement technology, enhancements implemented using implicit enhancementpoints require no preparation from SAP.

SAP implemented the new BAdI technology for performance reasons, and otherreasons described in the next unit.

The graphic above illustrates how enhancement points and sections, and BAdIsthat have been created using the new technology, are grouped together andmanaged using enhancement spots.

Collected enhancement spots comprise both simple enhancement spotsand/or other collected enhancement spots. They serve to semantically bundleenhancement spots.

Previous BAdIs (classical BAdIs) exist in the system as before. However, SAPwill use only the new technology to implement future BAdI enhancements.

Explicit Enhancement Points and SectionsThis section shows how to search for and use explicit enhancement points andenhancement sections in SAP programs.

2007/Q3 © 2007 SAP AG. All rights reserved. 25

Page 34: BC427 - Enhancement Framework

Unit 3: Enhancement points/options and enhancement sections BC427

Figure 19: Explicit enhancement points and sections

An explicit enhancement point is an option provided by SAP to allow you toenhance the SAP source code without making modifications. It is implementedusing the syntax �ENHANCEMENT-POINT ... �.

An explicit enhancement point is an option provided by SAP to allow you toreplace the SAP source code section without making modifications. The replacedSAP source code is enclosed by the statements �ENHANCEMENT-SECTION ... �and �END-ENHANCEMENT-SECTION ... �.

Explicit enhancement points and sections are always embedded in enhancementspots.

Explicit enhancement points and sections that allow you to enhance or replacesource codes are called dynamic.

Explicit enhancement points and sections that allow you to enhance or replacedeclarations are called static.

26 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 35: BC427 - Enhancement Framework

BC427 Lesson: Enhancement Points/Options and Enhancement Sections

To use explicit enhancement points and sections, implement an enhancementimplementation (an implementation of the higher-level enhancement spot). Thefollowing steps describe how to use explicit enhancement points and enhancementsections:

1. Display the SAP object (program, function module, method)2. Search for the required enhancement point/section3. In the GUI status, choose the enhancement button4. Create the enhancement implementation using the context menu of the

enhancement point/section5. Specify the name of the enhancement implementation (comply with customer

namespace Y* / Z*)6. Enter the source code7. In the GUI status, choose "Activate Enhancements".

Implicit Enhancement Points and OptionsThis section shows which implicit enhancement points and enhancement optionsare available in SAP programs, subroutines, function modules and methods, andhow you can use them to enhance the corresponding SAP objects without makingmodifications.

Figure 20: Overview of implicit enhancement points

2007/Q3 © 2007 SAP AG. All rights reserved. 27

Page 36: BC427 - Enhancement Framework

Unit 3: Enhancement points/options and enhancement sections BC427

To implement additional functions, customers can use the EnhancementFramework (as of SAP NetWeaver 7.0) to insert additional source code in certain,generally specified points without making modifications. The corresponding SAPobject may be derived from earlier releases and it may not require any preparationby SAP application programmers (implicit enhancement point).

Figure 21: Overview of implicit enhancement options

The Enhancement Framework also allows you to enhance interfaces for SAPfunction modules and methods without making modifications, and to enhanceattributes and methods in SAP classes (implicit enhancement option).

To use implicit enhancement points and options, implement an enhancementimplementation. This procedure is described in more detail later in this section.

The following figure shows which implicit enhancement points and options areavailable in SAP function modules.

28 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 37: BC427 - Enhancement Framework

BC427 Lesson: Enhancement Points/Options and Enhancement Sections

Figure 22: Implicit enhancement points and options in SAP function modules

Enhancing interfaces for SAP function modules:

1. Display the function module in the Function Builder2. Choose the menu options Function Module→ Enhance Interface and

specify an enhancement implementation to add a new interface parameterwith type assignment.

3. In the GUI status, choose �Activate Enhancements�.

These newly added interface parameters are generally optional and they can beactivated in the source code enhancements of the corresponding function modules.

Enhancing source code for SAP function modules:

1. Display the source code of the function module2. In the GUI status, choose the enhancement button3. Choose the menu options Edit→ Enhancement Operations→ Show Implicit

Enhancement Options to show the implicit enhancement options.4. In the editor, use the context menu of one of the implicit enhancement points

displayed to create an enhancement implementation.5. Insert the source code6. In the GUI status, choose "Activate Enhancements".

2007/Q3 © 2007 SAP AG. All rights reserved. 29

Page 38: BC427 - Enhancement Framework

Unit 3: Enhancement points/options and enhancement sections BC427

The following figure shows which implicit enhancement points and options areavailable in SAP classes.

Figure 23: Implicit enhancement points and options in SAP classes

Enhancing interfaces for global SAP methods and

defining additional attributes/methods for global SAP classes:

1. Display the class in the Class Builder2. Choose the menu options Class→ Enhance and specify an enhancement

implementation to add new attributes, methods and interface parametersto existing methods.

3. In the GUI status, choose �Activate Enhancements�.

Double-click an additional method to branch to the method editor for theimplementation.

These newly added interface parameters are generally optional and they can beactivated in the source code enhancements of the corresponding methods.

New additional attributes and methods can be activated in the source codeenhancements of methods of the same global class.

30 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 39: BC427 - Enhancement Framework

BC427 Lesson: Enhancement Points/Options and Enhancement Sections

Defining a pre/post/overwrite method for the method of a global SAP class:

1. Display the class in the Class Builder2. Choose the menu options Class→ Enhance to specify/create an enhancement

implementation3. Use the cursor to mark the required SAP method.4. Choose the menu options Edit→ Enhancement Operations then choose

one of the menu entries: Insert Pre-Method, Insert Post-Method or AddOverwrite Method

5. Choose the new button in the column �Pre-/Post-/Overwrite-Exit� toimplement the corresponding method.

6. Save the method7. In the GUI status, choose �Activate Enhancements�

For each SAP method, you can define a pre method and/or a post method. As analternative, you can create an overwrite method, which replaces the SAP method.

These methods are automatically called before, after or instead of the SAPmethod. They are instance methods of an automatically generated, local class andare available via an instance attribute named CORE_OBJECT. This attribute is areference to the corresponding current instance in the application program thatthis SAP class is being used.

Enhancing source code in methods of global SAP classes:

1. Display the source code of the method2. In the GUI status, choose the enhancement button3. Choose the menu options Edit→ Enhancement Operations→ Show Implicit

Enhancement Options to show the implicit enhancement options.4. In the editor, use the context menu of one of the implicit enhancement points

displayed to create an enhancement implementation.5. Insert the source code6. In the GUI status, choose "Activate Enhancements".

The following figure shows which implicit enhancement points and options areavailable in local SAP classes.

2007/Q3 © 2007 SAP AG. All rights reserved. 31

Page 40: BC427 - Enhancement Framework

Unit 3: Enhancement points/options and enhancement sections BC427

Figure 24: Implicit enhancement points and options in local SAP classes

To use implicit enhancement points and options in local SAP classes, implementan enhancement implementation. To do so, proceed as follows:

Enhancing local SAP classes :

1. Display the source code of the local class2. In the GUI status, choose the enhancement button3. Choose the menu options Edit→ Enhancement Operations→ Show Implicit

Enhancement Options to show the implicit enhancement options.4. In the editor, use the context menu of one of the implicit enhancement

options/points displayed to create an enhancement implementation.5. Insert the source code6. In the GUI status, choose "Activate Enhancements".

For the enhancement of a method interface, the introductory additionsIMPORTING, EXPORTING and CHANGING are not to be specified, even ifthey are missing from the original method declaration.

32 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 41: BC427 - Enhancement Framework

BC427 Lesson: Enhancement Points/Options and Enhancement Sections

The following figure shows which other implicit enhancement points are availablein SAP objects.

Figure 25: Other implicit enhancement points

Using the other implicit enhancement points:

1. Display the source code of the corresponding SAP object2. In the GUI status, choose the enhancement button3. Choose the menu options Edit→ Enhancement Operations→ Show Implicit

Enhancement Options to show the implicit enhancement options.4. In the editor, use the context menu of one of the implicit enhancement points

displayed to create an enhancement implementation.5. Insert the source code6. In the GUI status, choose "Activate Enhancements".

Important: When you enhance a structure (type) declaration (before �END OF...�) you must use the syntax

DATA: <Additional field1> TYPE <Type1>, <Additional field2> TYPE<Type2>, ... .

because otherwise the program would be syntactically incorrect.

2007/Q3 © 2007 SAP AG. All rights reserved. 33

Page 42: BC427 - Enhancement Framework

Unit 3: Enhancement points/options and enhancement sections BC427

Hint: Note that implicit enhancement points and sections are not possiblefor elements of the central SAP Basis.

34 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 43: BC427 - Enhancement Framework

BC427 Lesson: Enhancement Points/Options and Enhancement Sections

Exercise 2: Explicit Enhancement Pointsand Sections

Exercise ObjectivesAfter completing this exercise, you will be able to:� use explicit enhancement points and enhancement sections to enhance or

replace SAP source code

Business ExampleYou want to use explicit enhancement points and enhancement sections to enhanceor replace SAP source code without making modifications.

Task:Enhancing and replacing SAP source code

1. Analyze the source code of the program BC427_##_EPS (## = groupnumber).

2. Use the explicit enhancement point BC427_##_EP1 to react to the inputvalues '6' and '7' the same way as the SAP program does.

Name the enhancement implementation to be created ZBC427_##_EPS.

3. Use the explicit enhancement section BC427_##_ES1 to output thecorresponding text in the list (instead of the user message).

2007/Q3 © 2007 SAP AG. All rights reserved. 35

Page 44: BC427 - Enhancement Framework

Unit 3: Enhancement points/options and enhancement sections BC427

Solution 2: Explicit Enhancement Pointsand SectionsTask:Enhancing and replacing SAP source code

1. Analyze the source code of the program BC427_##_EPS (## = groupnumber).

a) -

2. Use the explicit enhancement point BC427_##_EP1 to react to the inputvalues '6' and '7' the same way as the SAP program does.

Name the enhancement implementation to be created ZBC427_##_EPS.

a) When you enter '6' and '7', the system should output 'Saturday' and'Sunday'.

Proceed as described in this lesson.

3. Use the explicit enhancement section BC427_##_ES1 to output thecorresponding text in the list (instead of the user message).

a) Proceed as described in this lesson.

36 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 45: BC427 - Enhancement Framework

BC427 Lesson: Enhancement Points/Options and Enhancement Sections

Exercise 3: Implicit Enhancement Pointsand Options in SAP Function Modules

Exercise ObjectivesAfter completing this exercise, you will be able to:� use implicit enhancement options and enhancement points to enhance SAP

function modules.

Business ExampleYou want to use implicit enhancement options and enhancement points to enhanceSAP function modules without making modifications.

Task:Enhancing SAP function modules

1. Familiarize yourself with the function of SAP function moduleBC427_##_CALC_PRICE .

The function module calculates the gross price for the imported net price andreturns it as the EXPORT parameter.

2. Without making modifications, define an additional (optional) IMPORTparameter named im_discount (type I) that can be used to transfer a discount(in %) to the function module. Name your enhancement implementationZBC427_##_CALC_PRICE_INTERFACE (## = group number).

Define an EXPORT parameter named ex_discprice (type BC427_PRICE)that the function module can use to return the discounted gross price.

Save your enhancements.

3. Enhance the source code of the function module to ensure that thediscounted price can be calculated into ex_discprice using the IMPORTparameter im_discprice. Name your enhancement implementationZBC427_##_CALC_PRICE_SOURCE (## = group number).

4. Activate your two enhancement implementations.

5. Copy the program BC427_IEP_FM_TEMPLATE (name of the targetprogram: ZBC427_##_IEP_FM (## = group number) ).

In your copied program, call your enhanced function module to ensure thatit also returns the discounted gross price in addition to the standard grossprice. (The user input option for discount has already been implementedusing the parameter discount.)

The system should then output the two gross prices.

2007/Q3 © 2007 SAP AG. All rights reserved. 37

Page 46: BC427 - Enhancement Framework

Unit 3: Enhancement points/options and enhancement sections BC427

Solution 3: Implicit Enhancement Pointsand Options in SAP Function ModulesTask:Enhancing SAP function modules

1. Familiarize yourself with the function of SAP function moduleBC427_##_CALC_PRICE .

The function module calculates the gross price for the imported net price andreturns it as the EXPORT parameter.

a) -

2. Without making modifications, define an additional (optional) IMPORTparameter named im_discount (type I) that can be used to transfer a discount(in %) to the function module. Name your enhancement implementationZBC427_##_CALC_PRICE_INTERFACE (## = group number).

Define an EXPORT parameter named ex_discprice (type BC427_PRICE)that the function module can use to return the discounted gross price.

Save your enhancements.

a) Proceed as described in this lesson.

3. Enhance the source code of the function module to ensure that thediscounted price can be calculated into ex_discprice using the IMPORTparameter im_discprice. Name your enhancement implementationZBC427_##_CALC_PRICE_SOURCE (## = group number).

a) Proceed as described in this lesson.

4. Activate your two enhancement implementations.

a) For example, you can use the activation button in the function moduleeditor to do this.

5. Copy the program BC427_IEP_FM_TEMPLATE (name of the targetprogram: ZBC427_##_IEP_FM (## = group number) ).

In your copied program, call your enhanced function module to ensure thatit also returns the discounted gross price in addition to the standard grossprice. (The user input option for discount has already been implementedusing the parameter discount.)

The system should then output the two gross prices.

a) -

38 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 47: BC427 - Enhancement Framework

BC427 Lesson: Enhancement Points/Options and Enhancement Sections

Exercise 4: Implicit EnhancementPoints in SAP Structure Definitions andSubroutines

Exercise ObjectivesAfter completing this exercise, you will be able to:� use implicit enhancement points for enhancing SAP structure definitions

and subroutines.

Business ExampleYou want to use implicit enhancement points for enhancing SAP structuredefinitions and subroutines.

Task:Enhancing SAP structure definitions and subroutines

1. Analyze the source code of the program BC427_##_IEP_STRFORM (## =group number).

2. Use the corresponding implicit enhancement point to add the fields distanceand distid to the structure definition wa_conn (flight distance/unit, typeassignment using the SPFLI fields of the same name).

Name your enhancement implementation ZBC427_##_IEP_STRFORM(## = group number).

3. In the subroutine display_conn , the formal parameter f_conn now containsthe two additional fields distance and distid due to its type assignment viawa_conn. Use the corresponding implicit enhancement point to outputthese fields.

2007/Q3 © 2007 SAP AG. All rights reserved. 39

Page 48: BC427 - Enhancement Framework

Unit 3: Enhancement points/options and enhancement sections BC427

Solution 4: Implicit Enhancement Points inSAP Structure Definitions and SubroutinesTask:Enhancing SAP structure definitions and subroutines

1. Analyze the source code of the program BC427_##_IEP_STRFORM (## =group number).

a) -

2. Use the corresponding implicit enhancement point to add the fields distanceand distid to the structure definition wa_conn (flight distance/unit, typeassignment using the SPFLI fields of the same name).

Name your enhancement implementation ZBC427_##_IEP_STRFORM(## = group number).

a) The implicit enhancement point to be used is at the end of the structuredefinition (before �END OF ...�).

Proceed as described in this lesson.

3. In the subroutine display_conn , the formal parameter f_conn now containsthe two additional fields distance and distid due to its type assignment viawa_conn. Use the corresponding implicit enhancement point to outputthese fields.

a) The implicit enhancement point to be used is at the end of thesubroutine.

Proceed as described in this lesson.

40 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 49: BC427 - Enhancement Framework

BC427 Lesson: Enhancement Points/Options and Enhancement Sections

Lesson Summary

You should now be able to:� describe which enhancement options are available in the Enhancement

Framework� list the points in SAP objects where implicit enhancement points and options

are available and use them to enhance the SAP functions without makingmodifications

� find implemented explicit enhancement points and sections in SAP objectsand use them to enhance or replace SAP functions

2007/Q3 © 2007 SAP AG. All rights reserved. 41

Page 50: BC427 - Enhancement Framework

Unit Summary BC427

Unit SummaryYou should now be able to:� describe which enhancement options are available in the Enhancement

Framework� list the points in SAP objects where implicit enhancement points and options

are available and use them to enhance the SAP functions without makingmodifications

� find implemented explicit enhancement points and sections in SAP objectsand use them to enhance or replace SAP functions

42 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 51: BC427 - Enhancement Framework

Unit 4Business Add-Ins (BAdIs)

Unit OverviewThis unit provides information about the runtime architecture and the call syntax.It also provides information about searching for and using classic and new BAdIs.

Unit ObjectivesAfter completing this unit, you will be able to:

� describe the integration of BAdIs into the Enhancement Framework� describe the idea and the architecture of classic and new BAdIs� explain the implementation of the new BAdI technology by SAP� find classic and new BAdIs in SAP programs and use them for the

enhancement

Unit ContentsLesson: Business Add Ins (BAdIs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

Exercise 5: Classic BAdI Program Exits.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59Exercise 6: New BAdI Program Exits .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61Exercise 7: New BAdI Menu Exits .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63Exercise 8: New BAdI Screen Exits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

2007/Q3 © 2007 SAP AG. All rights reserved. 43

Page 52: BC427 - Enhancement Framework

Unit 4: Business Add-Ins (BAdIs) BC427

Lesson: Business Add Ins (BAdIs)

Lesson OverviewThis lesson provides information about how to search for and use classic andnew BAdIs.

Lesson ObjectivesAfter completing this lesson, you will be able to:

� describe the integration of BAdIs into the Enhancement Framework� describe the idea and the architecture of classic and new BAdIs� explain the implementation of the new BAdI technology by SAP� find classic and new BAdIs in SAP programs and use them for the

enhancement

Business ExampleYou want to use Business Add Ins (BAdIs) to enhance your SAP software withoutmaking modifications.

OverviewThis section describes why SAP implemented the new BAdI technology for SAPNetWeaver 7.0 and it provides an overview of how the classic and new BAdIs areintegrated into the Enhancement Framework.

The Business-Add-In technology (BAdI technology) has existed since Release4.6 and it represents a modern enhancement technology for SAP developers whowant to provide the option to branch to customer functions in their programs.Enhancements implemented by SAP using the BAdI technology are called BAdIs.

For SAP NetWeaver 7.0, SAP implemented the new BAdI technology and intendsto use it for future enhancements. The following figure shows the reasons forimplementing the new BAdI technology.

44 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 53: BC427 - Enhancement Framework

BC427 Lesson: Business Add Ins (BAdIs)

Figure 26: Reasons for the new BAdI technology

In the Enhancement Framework available for SAP NetWeaver 7.0, the classic andnew BAdIs are managed together with the enhancement options/points/sections.

Figure 27: Overview: BAdIs in the Enhancement Framework

Classic BAdIs are not fixed, but new BAdIs always belong to enhancement spotsand they are managed by these spots.

2007/Q3 © 2007 SAP AG. All rights reserved. 45

Page 54: BC427 - Enhancement Framework

Unit 4: Business Add-Ins (BAdIs) BC427

Since there are still so many enhancements that are implemented using classicBAdI technology, these classic BAdIs are still very important. Therefore, we wantto describe this technology in more detail in the following section to ensure thatyou can search for and use these enhancements in SAP programs.

Classic BAdIsThe following figure shows how a program exit that is implemented using theclassic BAdI technology works.

Figure 28: Classic BAdI program exit: Architecture

A BAdI definition is called and a BAdI interface is specified in transaction SE18.This automatically generates a BAdI adapter class and the corresponding bridgingmethod, which the SAP application calls to branch to the relevant program. Theonly task of this bridging method is to call existing active implementation methodsof industry solutions, partners and customers one after the other. The sequence inwhich they are called is not specified.

The following figure shows the syntax that is used to prepare and call the bridgingmethod in the SAP program.

46 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 55: BC427 - Enhancement Framework

BC427 Lesson: Business Add Ins (BAdIs)

Figure 29: Classic BAdI program exit: Call syntax in the SAP program

In the SAP program, after you define the BAdI and generate the adapter classincluding the bridging method, a type is assigned to a reference variable usingthe BAdI interface.

When the static method GET_INSTANCE of the standard classCL_EXITHANDLER is called, an instance of the adapter class (BAdI instance) iscreated.

The bridging method in the BAdI instance is then called and it branches to therelevant program.

The following two figures show how to find the classic BAdI in SAP programsand how to use them for enhancements.

2007/Q3 © 2007 SAP AG. All rights reserved. 47

Page 56: BC427 - Enhancement Framework

Unit 4: Business Add-Ins (BAdIs) BC427

Figure 30: Searching for classic BAdI program exits

Figure 31: Using classic BAdI program exits

New BAdIsThe new BAdI technology works in the same way as the classic technology.However, adapter classes are no longer created, which means the SAP applicationprogram does not have to instantiate them. Instead, at the runtime of theapplication program, the system generates a BAdI handle in the kernel, whichperforms the same function as the adapter class, but which calls the availableimplementation methods much more efficiently.

The following figure shows the architecture of a program exit that is implementedusing the new BAdI technology.

48 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 57: BC427 - Enhancement Framework

BC427 Lesson: Business Add Ins (BAdIs)

Figure 32: New BAdI program exit: Architecture

The following figure shows the relevant syntax of the SAP program calling theBAdI.

Figure 33: New BAdI program exit: Call syntax in the SAP program

2007/Q3 © 2007 SAP AG. All rights reserved. 49

Page 58: BC427 - Enhancement Framework

Unit 4: Business Add-Ins (BAdIs) BC427

In contrast to the classic BAdI technology, a type is assigned to the referencevariable in the SAP program using the BAdI instead of the BAdI interface.

The BAdI handle is generated using the statement GET BADI specifying thereference variables. If no active implementation of the BAdI is found, theexception cx_badi_not_implemented is triggered.

The system branches to the relevant program when the bridging method in theBAdI handle is called (CALL BADI). If an initial handle reference is usedfor this (for example, because GET BADI was not successful), the exceptioncx_badi_initial_reference is triggered.

Knowing the syntax required in the SAP program allows you to perform theprogram-related search for new BAdIs. The following two figures show you howto search for and use the new BAdIs with program exits.

Figure 34: Searching for new BAdI program exits

To use a BAdI that you have found, you must implement an enhancementimplementation (an implementation of the higher-level enhancement spot). Thisimplements a BAdI implementation for each BAdI in the enhancement spot.

50 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 59: BC427 - Enhancement Framework

BC427 Lesson: Business Add Ins (BAdIs)

Figure 35: Using new BAdI program exits

Figure 36: Filter-dependent BAdIs

2007/Q3 © 2007 SAP AG. All rights reserved. 51

Page 60: BC427 - Enhancement Framework

Unit 4: Business Add-Ins (BAdIs) BC427

The figure above illustrates the concept of filter-dependent BAdIs, whichcorresponds to the classic BAdI concept. However, the functions have beenenhanced. Numeric filters can now also be used. For implementations, you cannow specify not only single filter values, but also filter conditions by using theoperators <>, >, <, >=, <=, CP, NP. You can also define multiple filters for a BAdI.

The following figure shows the principle of a menu exit that is implemented usingthe new BAdI technology. Exits of this type can be used only once.

Figure 37: BAdI menu exits: Principle

Menu exits provide customers with the option of implementing additionalmenu entries including customer functions in SAP screens without makingmodifications. In the corresponding GUI status, the developer of the SAP screenprepared a menu entry, which is not yet visible, with a specified function code(always begins with +) that can already be caught in the PAI of the screen usinga BAdI program exit.

When a customer implements a BAdI of this type, in addition to specifying the textfor the additional menu entry, they must also specify the corresponding customerfunction in the form of a program exit. This activates the additional entry in themenu of the SAP screen and makes it visible. If the user chooses an entry, thecustomer function is then processed.

The following graphic provides details about the situation described above.

52 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 61: BC427 - Enhancement Framework

BC427 Lesson: Business Add Ins (BAdIs)

Figure 38: BAdI menu exits: Architecture and details

Figure 39: BAdI menu exits: Call syntax in the SAP program

2007/Q3 © 2007 SAP AG. All rights reserved. 53

Page 62: BC427 - Enhancement Framework

Unit 4: Business Add-Ins (BAdIs) BC427

The figure above shows the call syntax required in the corresponding SAPprogram. It is identical to the call syntax described above for program exitsbecause a program exit plays the deciding role here.

Searching for and using BAdI menu exits in an SAP screen works as follows :

1. In the GUI status of the screen, search for the function code that begins with +.

2. In the PAI modules of the screen, search for the corresponding function code.

3. In the CALL-BADI command implemented there, double-click the specifiedreference variable to navigate to its definition.

4. Double-click the BAdI used for the type assignment to navigate to the displayof the corresponding enhancement spot including the BAdI.

5. Read the BAdI document and, if necessary, create the spot and BAdIimplementation as described above.

6. Implement the program exit available in the BAdI as described above.

7. Double-click the menu exit available in the BAdI to implement it -> specifytext for additional menu entries (see the figure below).

8. Activate all objects.

Figure 40: BAdI menu exits: Implementation

54 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 63: BC427 - Enhancement Framework

BC427 Lesson: Business Add Ins (BAdIs)

The following figure shows the principle of a screen exit that is implementedusing the new BAdI technology. Similar to menu exits, exits of this type canbe used only once.

Figure 41: BAdI screen exits: Principle

Screen exits provide customers with the option to also display additional fields forthe displayed data record in the SAP screen without making modifications. Usingthe screen exits for the additional display of the customer append fields for thecorresponding data record is a particularly interesting use.

The developer of the SAP screen reserved a subscreen area to store a customersubscreen screen. The customer subscreen screen must be defined in a customerfunction group and it should contain the additional fields to be displayed. Inthe corresponding customer implementation of the BAdI, the reference to thesubscreen screen is specified and this subscreen screen is stored in the PBO of theSAP screen in the subscreen area provided.

The following figure shows further details.

2007/Q3 © 2007 SAP AG. All rights reserved. 55

Page 64: BC427 - Enhancement Framework

Unit 4: Business Add-Ins (BAdIs) BC427

Figure 42: BAdI screen exits: Architecture and call syntax

To ensure that the customer subscreen screen displays corresponding data, thedata is transferred from the PBO of the SAP screen (by calling the correspondingbridging method) to the customer putter method. The customer must implementthis in the BAdI implementation in such a way that the corresponding customerfunction module of the customer function group is called when the data istransferred, to ensure that this transfers the data to the global data of the functiongroup to provide the subscreen fields. This means that in the customer functiongroup, in addition to the subscreen screen, a corresponding TABLES structure (inthe TOP include) for the data exchange, and a corresponding function module tobe called by the customer puffer method must be implemented to provide theTABLES structure.

If the ready for input status of the subscreen fields is provided, a predefined getmethod must also be implement in the customer's BAdI implementation in sucha way that it calls the corresponding customer function module of the customerfunction group in order to obtain the data transferred from the subscreen screen tothe TABLES structure (user entries), and to export it to the individual caller. TheSAP program then calls this customer get method in the PAI of its screen (usingthe bridging method) to load and manage the subscreen user entry.

Searching for and using BAdI screen exits works as follows:

1. On the screen, search for a subscreen area (optional pre-search).

56 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 65: BC427 - Enhancement Framework

BC427 Lesson: Business Add Ins (BAdIs)

2. In the program, search for the GET-BADI command.

3. Double-click the reference variable specified there to navigate to its definition.

4. Double-click the BAdI used for the type assignment to navigate to the displayof the corresponding enhancement spot including the BAdI.

5. Read the BAdI document and, if necessary, perform the subsequent steps forthe BAdI implementation.

6. Create the function group including the subscreen screen, the TABLES structure(in the TOP include) and the corresponding function modules (see the graphic andthe description above).

7. Create the spot implementation and the BAdI implementation as describedabove.

8. In the BAdI, implement the available program exits (the put and get methods)as described above.

9. In the BAdI, double-click the available screen exit to implement it -> specifythe subscreen screen and the main program of the function group (see the figurebelow). The name of the main program is the name of the function group withthe prefix �SAPL�.

10. Activate all objects.

Figure 43: BAdI screen exits: Implementation

2007/Q3 © 2007 SAP AG. All rights reserved. 57

Page 66: BC427 - Enhancement Framework

Unit 4: Business Add-Ins (BAdIs) BC427

58 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 67: BC427 - Enhancement Framework

BC427 Lesson: Business Add Ins (BAdIs)

Exercise 5: Classic BAdI Program Exits

Exercise ObjectivesAfter completing this exercise, you will be able to:� find program exits in SAP programs that were implemented using the classic

BAdI technology and use them for enhancements.

Business ExampleYou want to find classic BAdI program exits in SAP programs and use themfor enhancements.

Task:Finding and using classic BAdI program exits

1. You want to add additional columns to the list output of the SAP programBC427_##_CBD_PX (## = group number) without making modifications.

Find out if the SAP program contains a classic BAdI program exit for thispurpose.

2. If applicable, use the BAdI program exit that you found, in order to add anyadditional columns of your choice to the program output.

Name you implementation ZBC427_##_CBD_PX.

2007/Q3 © 2007 SAP AG. All rights reserved. 59

Page 68: BC427 - Enhancement Framework

Unit 4: Business Add-Ins (BAdIs) BC427

Solution 5: Classic BAdI Program ExitsTask:Finding and using classic BAdI program exits

1. You want to add additional columns to the list output of the SAP programBC427_##_CBD_PX (## = group number) without making modifications.

Find out if the SAP program contains a classic BAdI program exit for thispurpose.

a) See the description in the lesson.

2. If applicable, use the BAdI program exit that you found, in order to add anyadditional columns of your choice to the program output.

Name you implementation ZBC427_##_CBD_PX.

a) See the description in the lesson.

60 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 69: BC427 - Enhancement Framework

BC427 Lesson: Business Add Ins (BAdIs)

Exercise 6: New BAdI Program Exits

Exercise ObjectivesAfter completing this exercise, you will be able to:� find program exits in SAP programs that were implemented using the new

BAdI technology and use them for enhancements.

Business ExampleYou want to find new BAdI program exits in SAP programs and use them forenhancements.

Task:Finding and using new BAdI program exits

1. You want to add additional columns to the list output of the SAP programBC427_##_NBD_PX (## = group number) without making modifications.

Find out if the SAP program contains a new BAdI program exit for thispurpose.

2. If applicable, use the BAdI program exit that you found, in order to add anyadditional columns of your choice to the program output.

Name your

- enhancement implementation (spot implementation)ZBC427_##_PXBADI_SPOT

- BAdI implementation ZBC427_##_NBD_PX

- implementation class ZCL_BC427_##_NBD_PX .

2007/Q3 © 2007 SAP AG. All rights reserved. 61

Page 70: BC427 - Enhancement Framework

Unit 4: Business Add-Ins (BAdIs) BC427

Solution 6: New BAdI Program ExitsTask:Finding and using new BAdI program exits

1. You want to add additional columns to the list output of the SAP programBC427_##_NBD_PX (## = group number) without making modifications.

Find out if the SAP program contains a new BAdI program exit for thispurpose.

a) See the description in the lesson.

2. If applicable, use the BAdI program exit that you found, in order to add anyadditional columns of your choice to the program output.

Name your

- enhancement implementation (spot implementation)ZBC427_##_PXBADI_SPOT

- BAdI implementation ZBC427_##_NBD_PX

- implementation class ZCL_BC427_##_NBD_PX .

a) See the description in the lesson.

62 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 71: BC427 - Enhancement Framework

BC427 Lesson: Business Add Ins (BAdIs)

Exercise 7: New BAdI Menu Exits

Exercise ObjectivesAfter completing this exercise, you will be able to:� find menu exits in SAP programs that were implemented using the new

BAdI technology and use them for enhancements.

Business ExampleYou want to find new BAdI menu exits in SAP programs and use them forenhancements.

Task:Finding and using new BAdI menu exits

1. The SAP program BC427_##_NBD_MX (## = group number) shows therequired customer master record on a screen after you enter a customer ID.From the customer display, you want to use an additional menu entry to listthe flight bookings of the customer displayed.

Find out if a BAdI menu exit exists for this.

2. If applicable, use the menu exit that you found to call the programBC427_CUSTOMER_BOOKINGS to display the relevant flight bookingsof the displayed customer. (On a selection screen, this program providesthe parameter CUSTOMID to enter a customer ID and list the respectivebookings.)

Name your

- enhancement implementation (spot implementation)ZBC427_##_MXBADI_SPOT

- BAdI implementation ZBC427_##_NBD_MX

- implementation class ZCL_BC427_##_NBD_MX .

2007/Q3 © 2007 SAP AG. All rights reserved. 63

Page 72: BC427 - Enhancement Framework

Unit 4: Business Add-Ins (BAdIs) BC427

Solution 7: New BAdI Menu ExitsTask:Finding and using new BAdI menu exits

1. The SAP program BC427_##_NBD_MX (## = group number) shows therequired customer master record on a screen after you enter a customer ID.From the customer display, you want to use an additional menu entry to listthe flight bookings of the customer displayed.

Find out if a BAdI menu exit exists for this.

a) See the description in the lesson.

2. If applicable, use the menu exit that you found to call the programBC427_CUSTOMER_BOOKINGS to display the relevant flight bookingsof the displayed customer. (On a selection screen, this program providesthe parameter CUSTOMID to enter a customer ID and list the respectivebookings.)

Name your

- enhancement implementation (spot implementation)ZBC427_##_MXBADI_SPOT

- BAdI implementation ZBC427_##_NBD_MX

- implementation class ZCL_BC427_##_NBD_MX .

a) The syntax for calling the program to display the bookings is as follows:

SUBMIT bc427_customer_bookings

WITH customid = im_customid

AND RETURN.

64 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 73: BC427 - Enhancement Framework

BC427 Lesson: Business Add Ins (BAdIs)

Exercise 8: New BAdI Screen Exits

Exercise ObjectivesAfter completing this exercise, you will be able to:� find screen exits in SAP programs that were implemented using the new

BAdI technology and use them for enhancements.

Business ExampleYou want to find new BAdI screen exits in SAP programs and use them forenhancements.

Task:Finding and using new BAdI screen exits

1. The SAP program BC427_##_NBD_SX (## = group number) shows detailsof the specified airline on a screen after you enter an airline. You also wantto display the local currency of the airline there.

Find out if a BAdI screen exit exists for this.

2. If applicable, use the screen exit that you found to also display the fieldSCARR-CURRCODE (local currency of airline).

Name your

- enhancement implementation (spot implementation)ZBC427_##_SXBADI_SPOT

- BAdI implementation ZBC427_##_NBD_SX

- implementation class ZCL_BC427_##_NBD_SX .

2007/Q3 © 2007 SAP AG. All rights reserved. 65

Page 74: BC427 - Enhancement Framework

Unit 4: Business Add-Ins (BAdIs) BC427

Solution 8: New BAdI Screen ExitsTask:Finding and using new BAdI screen exits

1. The SAP program BC427_##_NBD_SX (## = group number) shows detailsof the specified airline on a screen after you enter an airline. You also wantto display the local currency of the airline there.

Find out if a BAdI screen exit exists for this.

a) See the description in the lesson.

2. If applicable, use the screen exit that you found to also display the fieldSCARR-CURRCODE (local currency of airline).

Name your

- enhancement implementation (spot implementation)ZBC427_##_SXBADI_SPOT

- BAdI implementation ZBC427_##_NBD_SX

- implementation class ZCL_BC427_##_NBD_SX .

a) See the description in the lesson.

66 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 75: BC427 - Enhancement Framework

BC427 Lesson: Business Add Ins (BAdIs)

Lesson Summary

You should now be able to:� describe the integration of BAdIs into the Enhancement Framework� describe the idea and the architecture of classic and new BAdIs� explain the implementation of the new BAdI technology by SAP� find classic and new BAdIs in SAP programs and use them for the

enhancement

2007/Q3 © 2007 SAP AG. All rights reserved. 67

Page 76: BC427 - Enhancement Framework

Unit Summary BC427

Unit SummaryYou should now be able to:� describe the integration of BAdIs into the Enhancement Framework� describe the idea and the architecture of classic and new BAdIs� explain the implementation of the new BAdI technology by SAP� find classic and new BAdIs in SAP programs and use them for the

enhancement

68 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 77: BC427 - Enhancement Framework

Unit 5Switch Framework

Unit OverviewThis unit discusses the general concept and how to use the Switch Framework foractivating and deactivating enhancement implementations.

Unit ObjectivesAfter completing this unit, you will be able to:

� describe what the Switch Framework is and for what it is used� use the Switch Framework to activate and deactivate your enhancement

implementations

Unit ContentsLesson: Switch Framework.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

Exercise 9: Switch Framework .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

2007/Q3 © 2007 SAP AG. All rights reserved. 69

Page 78: BC427 - Enhancement Framework

Unit 5: Switch Framework BC427

Lesson: Switch Framework

Lesson OverviewThis lesson provides information about how to use the Switch Framework toactivate and deactivate your enhancement implementations.

Lesson ObjectivesAfter completing this lesson, you will be able to:

� describe what the Switch Framework is and for what it is used� use the Switch Framework to activate and deactivate your enhancement

implementations

Business ExampleYou want to learn more about the general concept of the Switch Framework,and in particular, you want to be able to use this tool to activate and deactivateyour enhancement implementations.

Switch FrameworkThis lesson provides information about the idea and general concept of the SwitchFramework. It also provides information about how to use this tool to activateand deactivate your enhancement implementations.

The idea of the Switch Framework is that customers receive all industry solutionsas a complete package and they can activate those they want to use. All the othersolutions are available but they cannot be used. SAP has also decided to useenhancement packages to deliver future developments. Customers can then decidewhich new functions they want to activate.

The following graphic illustrates the concept of the Switch Framework.

70 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 79: BC427 - Enhancement Framework

BC427 Lesson: Switch Framework

Figure 44: Overview and concept of the Switch Framework

You can use the Switch Framework to create switches and to assign packages,screen elements and menu entries to them. You can use a business function togroup these switches.

One industry solution from SAP is a collection of business functions called abusiness function set. You can use transaction SFW5 to activate only one businessfunction set, and/or to activate and deactivate business functions.

Customers can also use the Switch Framework to activate and deactivateenhancement implementations. The following figure illustrates this:

Figure 45: Using the Switch Framework for enhancement implementations

2007/Q3 © 2007 SAP AG. All rights reserved. 71

Page 80: BC427 - Enhancement Framework

Unit 5: Switch Framework BC427

The customer defines a switch, to which he assigns the package with theimplementations to be activated. The customer also defines a business function, towhich the switch is assigned.

The business function can be activated and deactivated using transaction SFW5.When it is deactivated, all package objects that can be activated (this includesenhancements) become ineffective although they are still available in the systemFor the activation, it is prerequisite that the business function is defined asreversible and that the package does not contain any dictionary objects.

The following figures show the procedures for the actions describe above.

Figure 46: Defining a switch

72 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 81: BC427 - Enhancement Framework

BC427 Lesson: Switch Framework

Figure 47: Assigning packages to a switch

Figure 48: Defining a business function

2007/Q3 © 2007 SAP AG. All rights reserved. 73

Page 82: BC427 - Enhancement Framework

Unit 5: Switch Framework BC427

Figure 49: Assigning switches to a business function

When you assign a switch to a business function, you must specify the assignmenttype. Activation and Enabling/Standby are possible options.

The option Activation assigns all switch/package objects to the business function,but the option Enabling/Standby assigns only the dictionary objects. Therefore,you should choose Activation.

74 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 83: BC427 - Enhancement Framework

BC427 Lesson: Switch Framework

Figure 50: Activating/deactivating business functions

2007/Q3 © 2007 SAP AG. All rights reserved. 75

Page 84: BC427 - Enhancement Framework

Unit 5: Switch Framework BC427

76 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 85: BC427 - Enhancement Framework

BC427 Lesson: Switch Framework

Exercise 9: Switch Framework

Exercise ObjectivesAfter completing this exercise, you will be able to:� use the Switch Framework to activate/deactivate your enhancement

implementations

Business ExampleYou want to be able to activate and deactivate your enhancement implementationsat any time.

Task:Activating and deactivating enhancement implementations

1. Create a switch named ZSWITCH_## (## = group number).

2. Assign your package ZBC427_## to your switch.

3. Activate your switch.

4. Create a business function named ZBF_## .

5. Assign your switch to your business function.

6. Activate your business function.

7. Check whether or not the enhancement implementations stored in yourpackage are still effective.

8. Turn on your business function and activate your settings.

9. Check again whether or not your enhancement implementations are effective.

2007/Q3 © 2007 SAP AG. All rights reserved. 77

Page 86: BC427 - Enhancement Framework

Unit 5: Switch Framework BC427

Solution 9: Switch FrameworkTask:Activating and deactivating enhancement implementations

1. Create a switch named ZSWITCH_## (## = group number).

a) See the information for SFW1

2. Assign your package ZBC427_## to your switch.

a) See the information for SFW1

3. Activate your switch.

a) See the information for SFW1

4. Create a business function named ZBF_## .

a) See the information for SFW2

5. Assign your switch to your business function.

a) See the information for SFW2

6. Activate your business function.

a) See the information for SFW2

7. Check whether or not the enhancement implementations stored in yourpackage are still effective.

a) -

8. Turn on your business function and activate your settings.

a) See the information for SFW5

9. Check again whether or not your enhancement implementations are effective.

a) -

78 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 87: BC427 - Enhancement Framework

BC427 Lesson: Switch Framework

Lesson Summary

You should now be able to:� describe what the Switch Framework is and for what it is used� use the Switch Framework to activate and deactivate your enhancement

implementations

2007/Q3 © 2007 SAP AG. All rights reserved. 79

Page 88: BC427 - Enhancement Framework

Unit Summary BC427

Unit SummaryYou should now be able to:� describe what the Switch Framework is and for what it is used� use the Switch Framework to activate and deactivate your enhancement

implementations

80 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 89: BC427 - Enhancement Framework

BC427 Course Summary

Course SummaryYou should now be able to:

� provide an overview of the classic enhancement technology and the newenhancement concept (Enhancement Framework)

� use the new options for SAP NetWeaver 7.0 to enhance the ABAP Dictionary� use enhancement points/options and enhancement sections effectively to

enhance SAP software� find and use enhancements that are determined using BAdI technology� use the Switch Framework to activate and deactivate enhancement

implementations

2007/Q3 © 2007 SAP AG. All rights reserved. 81

Page 90: BC427 - Enhancement Framework

Course Summary BC427

82 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 91: BC427 - Enhancement Framework

IndexAActivate and deactivateenhancementimplementations, 71

BBAdI, 44BAdI interface, 46Business Add In, 44Business function, 71Business function set, 71CClassic BAdIs, 46EEnhancement Framework, 7,25

Enhancementimplementation, 27�28

Enhancement options, 9, 25Enhancement package, 70Enhancement points, 8, 25Enhancement section :, 9Enhancement spot, 25Enhancement types, 2Explicit enhancement point,25

Explicit enhancement section,25

Extension index, 14

FFilter-dependent BAdIs, 52Fixed value append, 15IImplicit enhancement option,27

Implicit enhancement point :,27

Industry solution, 70MMenu exit, 4, 52NNew BAdIs, 48OOverwrite method, 31PPost method, 31Pre method, 31Program exit, 3, 46, 48Rreversible, 72SScreen exit, 4, 55Switch Framework, 70Switches, 71

2007/Q3 © 2007 SAP AG. All rights reserved. 83

Page 92: BC427 - Enhancement Framework

Index BC427

84 © 2007 SAP AG. All rights reserved. 2007/Q3

Page 93: BC427 - Enhancement Framework

FeedbackSAP AG has made every effort in the preparation of this course to ensure theaccuracy and completeness of the materials. If you have any corrections orsuggestions for improvement, please record them in the appropriate place in thecourse evaluation.

2007/Q3 © 2007 SAP AG. All rights reserved. 85