Vous êtes sur la page 1sur 62

Presentation on SAP Enhancement Techniques

New Enhancement Framework


Why it came in Picture?
The main problem with user exits was that only a single implementation is possible. The new enhancement concept of the ABAP Workbench (Enhancement Framework) 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. To over come this issue SAP has came with BAdI and Enhancement Spot. There are four types of enhancement technique: ABAP Source Code Enhancement by using the source code plug-in Function Module Enhancement refer to various type of enhancement Global Class Enhancement refer to enhancement made to global classes and interfaces. Business Add-Ins What is an Enhancement Options? Enhancement Options are positions in repository objects where enhancement can be made. These options can be either Explicit or Implicit. Types of Enhancement with the Enhancement Framework: Explicit Enhancement Points Implicit Enhancement Points

Explicit Enhancement Points : These are basically hooks already coded into the
program by SAP various points of the code. Implicit Enhancement Points: These are basically points within ABAP code

where an enhancement point is implied, and in which case can be created.


In Explicit Enhancements there are more two ways of enhancing, 1. Enhancement point (Syntax - ENHANCEMENT-POINT) 2. Enhancement section (Syntax - ENHANCEMENT-SECTION) Enhancement section is used to replace a set of code or statements with the customer (custom code). In this technique the original source code does not get executed but, the customer implementation (custom code) gets executed. Enhancement Spots: Enhancement Spots are points in a SAP system where enhancement options are created.

BadI
What is BAdI?
Is an enhancement technique which adds extra business functionality with the existing standard code. Advantage of BAdI Uses Object oriented approach Two parts - Definition and its Implementation - definition can either be SAP provided or user may also create it No longer assumes a two-system infrastructure (SAP and customers) Allows multiple levels of software development (by SAP, partners, and customers, and as country versions, industry solutions, and the like) Can have multiple representations - specific one will be executed based on some criteria (filter) Release upgrades do not affect enhancement calls from within the standard software nor do they affect the validity of call interfaces No SSCR (SAP Software Change Registration) required

BAdI vs. User Exit


User exit is what we call the customer exit. These are points in SAP application program planned by SAP Developers, where you can insert your own code. The main disadvantage with this method is that it can be used only once in the system, i.e. there is no feature of reusability. BAdI is customer exit plus Business transaction event. Then as it is developed on ABAP objects, it caters the need of reusability. These are planned by SAP; customers can develop on their own. There are many stages in SAP software reaching customer, which have increased duly and hence a need for reusable object.

Defining and Implementing Business Add-ins (BADI) (Step-by-step with screenshots)


Defining a Business Add-in 1. From SAP menu, choose Tools -> ABAP Workbench -> Utilities -> Business Add-ins or transaction code SE18. 2. Enter the BADI name and choose create

3.

Enter the short text.

Give the short description

Implementation of BADI

Now save and activate then execute.

Now how to call BAdI in your report program

Filter dependent Badi Business Add-in definition level (for example a country, industry sector) we can have filter dependent option. If an enhancement for country specific versions then it is likely that different partners can implement this enhancement. The individual countries can create and activate their own implementation. In the enhancement definition, all the methods created in the enhancements interface need to have filter value as their importing parameter. The application program provides the filter values for the implementation method. Filter dependent BAdi is called using one filter value only, it is possible to check active implementation for the filter value using the function module SXC_EXIT_CHECK_ACTIVE.

Multiple use Badi 1. There are multiple use and single use Business Add-ins. This option can be choose at Business Add-in definition. 2. The distinction is base on the procedure or event character of an enhancement. In the first case the program waits for the enhancement to return a return code. Typical example is benefit calculation in HR depending on the implementation, alternative calculations can be executed. In case of multiple use add-ins, an event that may be interest to other components in program flow. Any number of components could use this event as a hook to hang their own additional actions on to. 3. There is no sequence control for multiple-use implementations of BAdis. Sequence control is technically impossible, at the time of the definition the interface does not know which implementations parameters will be change the implementations. 4. The concept of multiple use of the Business Add-in is that has been implemented once already can be implemented again by right of the software chain.

How many ways we can find the BadIs? There are 3 ways we can BAdI the BadI. 1. Method to find the BAdIs First: Run the transaction SE24. Under object type put the class name CL_EXITHANDLER. Click on display button.

Under this class CL_EXITHANDLER select the method GET_INSTANCE and double click.

Under the method GET_INSTANCE put break point on a function module called CALL METHOD CL_EXITHANDLER=>GET_CLASS_NAME_BY_INTERFACE

Step 2: Then according to the requirement run the transaction. In this example transaction code is VL02. Run the transaction VL02. As in 1st step we have putted a break point, that function module will give all BADI used by the transaction in each screen and activity on the application (VL02).

Under the parameter EXIT_NAME this debugger screen will give all BAdI name for each

screen

Each time press F8, you will get all BAdI used for the screen. After that system will go for next screen. BADI NAME: EHS_DG_001 LE_SHP_DELIVERY_PROC LE_SHP_PRICING BADI_LAYER CU_CONFIG_DELEGATION 1st screen of transaction VL02.

2. Method to find the BadIs Run the transaction SE18. Under BAdI Name press F4 button.

After pressing the F4 button below screen will appear than click on Information System

Here you need to give the package name

After giving the package name press enter it will give the badi name

3. Method to find the BAdIs. Run the transaction SE84.

BTE's - Business Transaction Events


BTE's or Business Transaction Events are a special type of extension for the FI Module.Like SD's Customer Exits, BTE's allow customer to adapt the system to their needs. BTE's are based in the following principles: The developer defines its interface in a FM In the generated code, an assignment table is read Based on this result, customer functions are called dynamically Business Transaction Events and Business Add Ins rely on the same concept. Nevertheless, there are some differences between them: Only code enhancements may be created with BTE's. With BADI's, you may also extend structures and Dynpros BTE's have a three layer architecture (SAP, SAP Partners, Customer). On the other hand, BADI's are multi layer. BTE's are based on Function Modules, in contrast to BADI's, which implement object methods

BTE's Types of Interfaces Two types of interfaces exist: Publish and Subscribe Interface Process Interface Publish and Subscribe Interfaces These interfaces inform about particular events (such as a document created), and the resulting data of these events are made available to external software; this software can not return data to the SAP System. Examples of this type of interface include: A document was created, modified or deleted Master Data was created, modified or blocked This type of interface does not change the standard processing. Process Interfaces These kind of interfaces are generally used to send business processes to a customer created control; that is, process interfaces replace the standard process. With Process Interfaces you can modify the standard behavior of the SAP System. If for some reason the standard procedure does not match the client needs, a Process Interface may be implemented and it will replace the standard process flow.

How we create BTEs Spro->SAP Reference IMG -> Financial Accounting -> Financial Accounting Global Settings -> Business Transaction Events

Click on SAP reference IMG

In next screen you will in the SE37 tcode. It will show the function module related to the that BTE .We have to copy that function module into Z or Y function module module to add the code.

click on copy button. Specify the "Z" or "Y" function module name in the To Function Module field

Specify a Function Group. If you need to create a "Z" or "Y" function group, go to transaction code SE37 and follow menu path: Go to Function Groups Create Group. A function group is a logical grouping of function modules, and the ABAP code is generated for function groups. You will be prompted for a development class and transport when creating the function group. In Function Builder (transaction SE37), enter the new "Z" or "Y" function module. Click on the Change button. The system will default into the source code screen where you may enter your ABAP code.

Enter the source code as per the requirement.

Save and activate the function module

To assign Function module to the Event, first create a product say "ZTEST".

Go to IMG Menu Path: Financial Accounting ->Financial Accounting Global SettingsBusiness Transaction Events-> Settings->Products->-- of a customer.
Click on the "New Entries" button.

Enter the Product name and make sure you select the "Active" check box, otherwise the BTE will not trigger.
Now assign the function module "Z_SAMPLE_PROCESS_00001120" to the Event.

Go to IMG Menu Path: Financial Accounting ->Financial Accounting Global Settings>Business Transaction Events-> Settings->Process function modules->-- of a customer.
Test the BTE by creating posting document.

Thanx