BADI and It's Implementation in SAP

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

1

BADI
AND ITS
IMPLEMENTATION
IN SAP

Phone/Whatsapp: +1 (515) 309-7846


Email: [email protected]
Website: www.zarantech.com
1 1

Introduction To

BADIs and BADI Implementation

INDEX

1) BADI (Business Add-Ins) ……………………………………………… Page 3

2) Comparison between BADI and User exits……………………… Page 4

3) What constitutes the BADI definition? …………………………………… Page 5

4) How to implement the BADI Definition? …………………………. Page 8 9)

How BADI Works? ………………………………………………………….. Page 12

Phone/Whatsapp: +1 (515) 309-7846 || [email protected]


1 1

BADI (Business Add-Ins)

Purpose of this Document

This document is intended to give a brief introduction of BADI definitions and


BADI implementation to the user and also includes a step-by-step guide to
create BADI implementation.

Who will benefit?

All technical and functional consultants getting introduced to BADI

Phone/Whatsapp: +1 (515) 309-7846 || [email protected]


1 1

Prerequisites
Basic knowledge of User exits.
Scope of this document:

This BOK is mainly focusing on the BADI definition and how to implement
the BADI definition. The things I am putting here are exclusively based on
my understandings about BADIs.

Introduction

Business Add-Ins or BADI are used to implement customer specific


requirements in SAP software. It functions like user exits but are more
advance to incorporate the user requirements. BADIs were introduced with
the release 4.6.

Concept of BADI
To incorporate the required functionalities in the standard SAP code exit
points are defined in this code (Standard SAP code). This achieves the
intention of the programmer to add his changes in the standard SAP code
without changing the actual code. This is called as “Definition view”.

In the “implementation views” programmer chooses his required method


depending on the import parameters and adds the code in that method.
Single business add-in contains all the interfaces required to implement
specific task.

Comparison between BADI and User exits


BADI is an object oriented version of user exit. Unlike in user exit where
we write our code in function module, in BADI we enter the code in the
methods which are triggered at predefined points by standard SAP program.

What constitutes the BADI definition?


To see the BADI definitions use the transaction SE18.
Or use path choose Tools → ABAP Workbench → Utilities → Business Add-Ins.
Take an example of the BADI definition /SAPAPO/SDP_RELDATA.

Phone/Whatsapp: +1 (515) 309-7846 || [email protected]


1 1

This BADI is used to process the demands from DP to SNP in APO.

4 2

5
3

1) The highlighted text shows the BADI definition. To implement the BADI

its definition must have been created. The BADI definition could of
maximum 20 characters.

2) The implementation drop down menu shows the following items


regarding the implementation of BADI definition.

Phone/Whatsapp: +1 (515) 309-7846 || [email protected]


1 1

a) Create: We can create the new BADI implementation.


Implementation name could be of maximum 20 characters.

b) Change: We can make changes in the already implemented


BADI definition.
c) Display: It shows the names of the implementation crated for
the definition. See the screen shot below:

Currently there are two implementations created for the definition

/SAPAPO/SDP_RELDATA, which are ZSDP_RELDATA and


ZSDP_RELDATA_BACK.

Phone/Whatsapp: +1 (515) 309-7846 || [email protected]


1 1

3) Interfaces tab :

The interface tab shows the names of the various methods that can be
implemented. Each method is having its own functionality.

E.g the method change_reldata when implemented, gives the liberty


to programmer to change the quantity and period data which is getting
transferred from DP (demand Planning) to SNP (Supply network
Planning).
Method CHANGE_DATA_BEFORE_SPLIT comes in to play before
modification of data before product/Location split.
4) Documentation: Use the documentation tab to see the documentation
for the definition.

5) Multiple Use Check Box: If this Check is checked, this ensures that the
BADI definition can be implemented more than once else it can be
implemented only once.

6) Filter-depend and Filter type: This defines the type of data that is valid
as a filter value. We can specify the filter type (7), which must be a
data element of character type with maximum length as 30.

Phone/Whatsapp: +1 (515) 309-7846 || [email protected]


1 1

How to implement the BADI Definition?


To implement BADI definition /SAPAPO/SDP_RELDATA, use
implementation name as ZSDP_RELDATA3.

To implement the BADI definitions use transaction SE19.

Enter the name of implementation and click on the “create” tab.

Pop-up will appear asking for the definition name, enter the name
/SAPAPO/SDP_RELDATA as shown in above screen shot.

Phone/Whatsapp: +1 (515) 309-7846 || [email protected]


1 1

Enter the description for the implementation and activate it. To activate
and deactivate the implementation use the buttons highlighted in the
screen shot.

Now to implement the method go to tab interfaces. It will show the


names of the methods that can be implemented.

Phone/Whatsapp: +1 (515) 309-7846 || [email protected]


1 1

Our required method is change_reldata. To write the code in to the


method double click on it.

The editor will appear in where we can write our code.


To see the import parameters click on the “Signature” tab as highlighted
above.

Here as we can see parameters are starting with IV, IT and CT. The
meaning of this is as follows:

1) Starting with IV: Parameter name starting with IV is a variable which


is being imported in to the method with some value.
2) Starting with IT: Parameter starting with IT is a name of internal table
which is being imported in to the method with lines of records. We can
use these internal tables only for read purpose; we can not make any
changes to the values of it.
3) Starting with CT: Parameter starting with CT is a name of internal
table which is being imported in to the method with lines of record. We
can make the changes to values of the data in these tables.

Again clicking on the “Signature” tab disappears the parameter pane.

Phone/Whatsapp: +1 (515) 309-7846 || [email protected]


1 1

How BADI Works?

As Mentioned earlier functionality of BADIs and User exits is same. Only

difference is BADI uses object oriented approach to achieve the functionality


of the user exit. Both are the exits of the standard SAP program.

When we say BADI is being called, actually methods are being called which
contain our code.
Let me take you through an example:

This example is taken from APO Rollout Project.


Here we used the transaction /SAPAPO/MC90 which transfers the Demand
Planning data in to Supply network Planning.

When this transaction is executed a standard SAP program is called which


subsequently calls the BADI implementation method of the BADI
implementation ZSDP_RELDATA. This is the implementation of definition
/SAPAPO/SDP_RELDATA.

Our aim was to split the data as per the requirement, for that we used the
method CHANGE_RELDATA. The above screen shot shows this method.

Phone/Whatsapp: +1 (515) 309-7846 || [email protected]


1 1

The code was been written in this method to get the desired data split.

Code in the method.

By changing the values in the import parameters we achieved the desired


split.

Phone/Whatsapp: +1 (515) 309-7846 || [email protected]


THANK YOU

SAP Corporate Training Course Catalog


SAP Learner Community
Get any SAP Video Training

Phone/Whatsapp: +1 (515) 309-7846


Email: [email protected]
www.zarantech.com

You might also like