Академический Документы
Профессиональный Документы
Культура Документы
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 2
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 3
Introduction
EXIT s are nothing but the R/3 Enhancements which allows you to add your own functionality to SAPs standard business applications without having to modify the original applications. Purpose Use Challenges
Introduction
Purpose
To introduce the techniques of enhancement in standard SAP system. SAP creates customer exits for specific programs, screens, and menus within standard R/3 applications. These exits do not contain any functionality. Instead, the customer exits act as hooks. You can hang your own add-on functionality onto these hooks.
Introduction
Use
They do not affect standard SAP source code. When you add new functionality to your SAP System using SAPs exits, you do not alter the source code of standard SAP programs in any way. The code and screens you create are encapsulated as separate objects. These customer objects are linked to standard applications, but exist separately from SAPs standard software package. They do not affect software updates. When you add new functionality to your SAP System using SAPs exits, your objects (called customer objects) must adhere to strict naming conventions. When it comes time to upgrade a to a new software release, customer objects names ensure that they will not be affected by any changes or new additions to the standard software package.
India SAP CoE, Slide 6
Introduction
Challenges
Customer exits are not available for all programs and screens found in the SAP System.
Any change made to an SAP object in a customer system is called a modification. Customers usually modify their systems for one of two reasons. Either they make changes to the SAP standard in order to adjust the R/3 System to their specific business needs (actual modifications), or they alter individual SAP objects in order to correct an error (as recommended in an SAP error note). You should only modify the SAP standard if the modifications you want to make are absolutely necessary for optimizing work flow in your company. Be aware that good background knowledge of application structure and flow are important prerequisites for deciding what kind of modifications to make and how these modifications should be designed.
2 3 4
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 11
ABAP DICTIONARY Table Enhancements: There are two ways that you can add additional fields to tables without modifying your system. o Append Structures: Append structures allow you to enhance tables by adding fields to them that are not part of the standard. With append structures, customers can add their own fields to any table or structure they want. Append structures are created for use with a specific table. However, a table can have multiple append structures assigned to it. Customizing Includes: If customers know in advance that one of the tables or structures delivered to them by SAP needs to have customer-specific fields added to it, an SAP application developer can include these fields in the table using a Customizing include statement. The same Customizing include can be used in multiple tables or structures. This provides for consistency in these tables and structures whenever the itself include is altered.
India SAP CoE, Slide 12
ABAP DICTIONARY Field Exits: Field exits take you from a screen field with a data element reference to a function module. Field exits can be either global or local. Field exit function modules adhere to the following naming convention: o prefix: FIELD_EXIT_ o name: <data element name>_ o suffix (optional): 0 to 9, A to Z
Possible text enhancements include customer keywords and customer documentation of data elements.
Text enhancements differ from other application enhancements in that they take effect globally in all related SAP applications after activation (global enhancements).
Customer Exits
Function Module Exits Menu Exits Screen Exits
Editing Components
Enhancement Framework
The new enhancement concept of the ABAP Workbench enables the integration of different concepts for modifying and enhancing development objects. The enhancement concept is supported by the Enhancement Builder tool and ABAP language elements. The objective of the Enhancement Framework is to provide a technology to create modification-free enhancements and to unify all possible ways of modifying or enhancing Repository objects.
India SAP CoE, Slide 23
Multilayer Support
Enhancement Spots
Enhancement Spots can only be of type source code Enhancement or BAdI. Enhancement Spots manage explicit Enhancement Options
While implicit enhancement options always exist and do not require any special management, explicit enhancement options created in an initial system must be made known to developers in target systems via Enhancement Spots.
Enhancement Implementations
Enhancement implementations manage their enhancements. Enhancements made by developers in follow-on systems are managed as Enhancement Implementations. This applies to all enhancement options, both explicit and implicit.
The first tab displays which (Simple) Enhancement Implementations are contained. The second tab displays which other Composite Enhancement Implementations are contained.
India SAP CoE, Slide 29
Enhancement Relations
To mark a position in an ABAP program as an explicit enhancement option, the following ABAP statement is used:
ENHANCEMENT-POINT enh_id SPOTS spot1 spot2 ...
To mark a section in an ABAP program as an explicit enhancement option, the following ABAP statement is used:
ENHANCEMENT-SECTION enh_id SPOTS spot1 spot2 ... END-ENHANCEMENT-SECTION.
Enhancement Type
ENHANCEMENT-POINT <name> SPOTS <spot1> [<spot2>] ..[STATIC]
Static: Additional data declaration Dynamic: Additional source code
Data declarations are always static, even if they are inside an implementation of a dynamic enhancement point. Form routines, methods and local classes cant be part of dynamic enhancement points/sections. Therefore it is necessary to place them into static enhancement points/sections. Static enhancement points/sections are marked with the addition STATIC in source code. Dynamic enhancement points/sections do not contain an addition.
Class/Interface Enhancement
Class/Interface Enhancements allow addition of:
Optional parameters to existing methods Methods Events and event handlers References to interfaces Exits to existing methods
Pre-Exit Called at the beginning of a method Post-Exit Called at the End of a method Overwrite-Exit Replaces the original method
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 39
User Exits
Demonstration
Demonstration
Field Exits It is triggered at field level. It is attached at data element Specific to one screen only or to all the screen where field appears. Field exit is not allowed in SAP version 4.7 and above . Example with screen shots for consultants working in SAP V 4.6 below version.
In the above context, Enhancement Implementation can be done only if option (hook) is provided by the Option-provider. In simple words there are no implicit BAdIs.
Note: In the following slides, Definitions are created so as to understand the method of BAdI definition & for example purpose. As stated above this is the role of Enhancement Option-Provider. Classic BAdIs already exist since SAP Release 4.6 BAdIs have been Re-implemented in ECC7.0 under the new Enhancement Framework & Switch Framework
India SAP CoE, Slide 50
Classic BAdIs
To understand what a powerful pattern a BAdI is, we will now define & then implement a BAdI
Screen Enhancements
Classic BAdIs
Double Click on the Interface Name to define methods, parameters, exceptions for that interface
Classic BAdIs
Classic BAdIs
Add any Exception. For Class-based exceptions check the Exception Classes option
Classic BAdIs
BADI Implementation
BAdI Implementation (SE19)
SE19: BAdI Implementation
Double Click on the Method to modify the Method code (Class Builder)
BADI Implementation
BAdI Implementation
BAdI Implementation
Enter mandatory data and click on Save.
Check the Exit Name BADI_MATERIAL_CHECK. This is the BAdI we are going to implement.
We will be using the CHECK_DATA method. Double Click to see the Method Parameters.
Implementing BADI
Go to SE19. Specify a name for the BAdI Implementation. Enter the Definition Name.
Implementing BADI
Enter code inside the MethodEnd Method We are only showing an message in this case; if division in Basic Data tab of Material Creation is not entered. The structure CMARA is defined as Exporting Parameter. Data can be modified using this.
India SAP CoE, Slide 64
BAdI Implementation
Two new ABAP commands for the new BAdI: GET BADI <handle> : returns a handle to all active instances of the implementations of the respective BAdI CALL BADI <handle> <method> : all active implementations are selected and the method of BAdI is called (amounts to a loop with different method calls in it)
India SAP CoE, Slide 68
New BAdIs
BAdI definition
Enter name for the Interface and click on Change
BAdI definition
Click on this to create an Enhancement Implementation
BAdI Implementation
Expand the Node for Implementing Class Specify the Implementing Class and click on Change
Report program to call BADI: DATA: handle type ref to <BAdI_Name> <other data declarations> GET BADI handle CALL BADI handle <method_name> EXPORTING IMPORTING
India SAP CoE, Slide 74
Filter-dependent BAdI
What is a Filter-Dependent BAdI? GET BADI <handle> FILTER <filter_name> = <filter_value>. Implementations meeting the filter conditions are chosen Example: GET_VAT (Country-Code Specific). Create 2 implementations for GB & US. It does not make sense to call both of them, hence the Definition is marked as Single-Use (only single active implementation can exist). We define a filter (remember this is the role of BAdI provider) say COUNTRY Add a filter value corresponding to the BADI Implementation, i.e. Implementation for GB has Filter Value = GB & that for US has Filter value = US
Filter-dependent BAdI
Create a new Implementation for the same BADI definition we created earlier.
Multiple-use BAdI
What are Multiple-use BAdI? Multiple-use BAdIs can have more than one implementations Option is provided by the Enhancement Option-provider (in the BAdI definition) Example: BAdI that converts data for different output devices. Hence, call of a method of a multiple-use BAdI is akin to sending a message. It does not matter how many services react to the message. It is similar to Publish & Subscribe mechanism.
Active implementations are evaluated at compile time and included in the load of BAdI handle only implementations that are switched on by the Switch Framework in at least one client are considered
Enhancement Framework
On double clicking on any of the enhancement-point, system will display the code behind each of them
To insert new implementation for enhancement point, click on the spiral button.
In order to create an implementation for an enhancement point, right click on enhancement point and then select create option from context menu.
Enter the name of the enhancement implementation and short text, and then choose this option
India SAP CoE, Slide 91
Select the newly created enhancement implementation and then select this option
You can enhance the parameter interface of a function module with new, optional formal parameters. You cannot include an exceptions.
India SAP CoE, Slide 94
After Activation
Class/Interface Enhancement
Class/Interface Enhancement
Optional
Additional parameters are always optional. Hint: The flag optional is not checked for exporting parameters, because they are always optional, even if they are not in an enhancement.
India SAP CoE, Slide 97
Class/Interface Enhancement
Post Exit
A post-method is called after the last statement of the existing method before ENDMETHOD (only if the method is exited using ENDMETHOD).
Access to attributes
The pre and the post method do only have access to the public attributes/methods of the class.
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 100
Exercises
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 102
HelpMe
Include program LXaaaTOP also contains the FUNCTION-POOL statement, which may not be changed. Therefore, you must always include the message class in parentheses when outputting messages. SAP application programmers can supply customers with default subroutines in include LXaaaF00.
Subroutines, modules, and interactive events (AT) are created as include programs and included enhancements using include program ZXaaaZZZ.
for subroutines, for PBO modules, for PAI modules, for events.
Put a breakpoint at the following code and execute the transaction (e.g. MM01) We want to implement a BAdI on Saving Material Data.