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

ABAP Workbench Delta Guide (3.1-4.

6)

%XVLQHVV$GG,QV

As of release 4.6 a new enhancement technique has been established in R/3: Business Add
Ins (BAdIs). The goal of this enhancement technique is to avoid the insufficient parts of the
older techniques, customer exits and SD user exits. This unit is divided into three sections. In
the first section we want to motivate the necessity of a new technique. The second section will
deal with creating Business Add Ins. Then, in the subsequent section we will learn how to
implement Business Add Ins. Finally, a short summary will conclude this unit.

,QWURGXFWLRQ

This section summarizes the insufficient aspects of the older enhancement techniques to
explain the need for Business Add Ins. One thing that has changed is the software delivery
chain.
6RIWZDUH'HOLYHU\&KDLQV<HVWHUGD\$QG7RGD\

l \HVWHUGD\

&XVWRPHU
6$3 &XVWRPHU
([LWV

l WRGD\

6$3
6$3 LQGXVWU\ 3DUWQHU &XVWRPHU
VROXWLRQ
%XVLQHVV
DGGLQ
1HZ$%$3/DQJXDJH
1HZ$%$3/DQJXDJH
$%$32EMHFWV

SAP AG 1999

Originally, the software delivery chain consisted of two components, the customer and SAP
itself. Today, the situation has completely changed. In most cases SAP does not deliver the
software directly to the customer; instead, there are several participants in the delivery chain.
A typical situation is depicted in the graphic: SAP delivers the Standard R/3 system to a SAP
Industry Solution, which is developing industry-specific components. Together, Standard R/3
and the industry-specific components are delivered to a company that produces a
complementary software product (CSP). Finally, the customer gets the complete software
bundle.

SAP AG 29
ABAP Workbench Delta Guide (3.1-4.6)

'LVDGYDQWDJHVRIWKH2OG(QKDQFHPHQW
7HFKQLTXHV

There were several disadvantages to the old enhancement techniques:


Customer exits can be used only by one link in the chain
User exits provide only enhancements of source code; technically, they are modifications
Also, business transaction events only enable you to enhance source code.
There is no administrative layer in either user exits or business transaction events.
Business add-ins have been developed to address these shortcomings.

$GYDQWDJHVRI%XVLQHVV$GG,QV

The main advantage of this concept is the capacity for reuse. Once implemented, a business
add-in can be reimplemented using other links in the software chain. Further advantages are:
Administrative layer to manage business add-ins
Implementation using techniques of ABAP Objects
All enhancement types available (this will be implemented in a future release).
%XVLQHVV$GG,QV$UFKLWHFWXUH

6$3 ,6 3DUWQHU &XVWRPHU

&XVWRPHU
HQKDQFH
PHQW
$GG,QDGDSWHU

&25(
5
$GG,QDGDSWHU

,QGXVWU\ &XVWRPHU
VROXWLRQ HQKDQFH
,QWHUIDFH
,6 PHQW

DQRWKHU
,QWHUIDFH

SAP AG 1999

SAP AG 30
ABAP Workbench Delta Guide (3.1-4.6)

Business add-ins, unlike customer exits, take into account the changes to the software
delivery process. The top part of the graphic illustrates the typical delivery process: It no
longer merely consists of provider and user. Instead, it can now contain a whole chain of
intermediate providers. Below this is a diagram explaining how business add-ins work.
Enhancements are made possible using SAP application programs. This requires at least
one interface and an adapter class that implements it. The interface is implemented by the
user.
The main advantage of this concept is the capacity for reuse. Once implemented, a business
add-in can be reimplemented by other links in the software chain (further to the right in the
graphic). Furthermore, an implementation can also offer its own business add-ins.

&UHDWLQJD%XVLQHVV$GG,Q

Business add-ins use the interface concept of ABAP Objects. There is a new transaction
SE18 to create business add-ins. You can find it in the ABAP Workbench following the path
8WLOLWLHV%XVLQHVV$GG,QV'HILQLWLRQ. Alternatively, you can start with the Object
Navigator. Here, choose :RUNEHQFK2WKHU2EMHFW . In the popup window, select the
%XVLQHVV(QJLQHHULQJ tab. Here you find menu items for defining and implementing business
add-ins.
'HILQLQJ%XVLQHVV$GG,QV,QLWLDO6FUHHQ

%XVLQHVV$GG,QV'HILQLWLRQ0DLQWHQDQFH,QLWLDO6FUHHQ

%XVLQHVVDGGLQ
'HILQLWLRQQDPHBB GHILQLWLRQQDPH
'LVSOD\ &KDQJH &UHDWH
&UHDWH

SAP AG 1999

In the initial screen of Transaction SE18, enter the name of the business add-in definition and
choose &UHDWH. On the next screen, enter a short description for the business add-in
definition.

SAP AG 31
ABAP Workbench Delta Guide (3.1-4.6)

This next screen consists of a tabstrip. The first tab is the $WWULEXWHV tab. Here you can define
whether the Business Add-In can be single use or multiple use. Moreover, you can define a
filter dependence for the business add-in. You can also define a function code for your
business add-in. Using this, you can let the user display an additional menu entry in the
corresponding application. However, the most important component of a business add-in is
the ,QWHUIDFH. Using this, you can define the methods that will contain the additional source
code when a business add-in is implemented.
%XVLQHVV$GG,Q'HILQLWLRQ,QWHUIDFH0HWKRGV

$  )

,QWHUIDFHQDPH )B(;BE !

1DPHRIJHQHUDWHG%$G,FODVV /B(;BE !

&ODVV%XLOGHU&KDQJH,QWHUIDFH,)B(;BEDGL!

$  0 (Y

3DUDPHWHUV ([FHSWLRQV
0HWKRG 7\SH 'HVFULSWLRQ

PHWKRG! %$G,PHWKRG

6WDWLF
,QVWDQFH

SAP AG 1999

Choose the ,QWHUIDFHTab to define these methods. Doubleclick the name of the interface. The
system displays the Class Builder where you can define the methods that should be provided
in that business add-in. To find out how to create the methods, see the Class Builder
documentation.

Class Builder
When you activate the interface, the system generates a class ("Adapter Class") which
processes the implementations of the business add-in.
Advantage of the adapter class:
Multiple use of business add-ins
Adapter class analyses which implementation is passed.
Overall, a business add-in consists of the components depicted in the following graphic:

SAP AG 32
ABAP Workbench Delta Guide (3.1-4.6)

%XVLQHVV$GG,QV&RPSRQHQWV

%XVLQHVV &/$66&/B(;BEDGL!'(),1,7,21

DGGLQ 38%/,&6(&7,21
38%/,&6(&7,21


,17(5)$&( ,17(5)$&(6,)B(;BEDGL!

$GG,QDGDSWHU
,)B(;BEDGL!


'$7$D
(1'&/$66
0(7+2'6P
0(7+2'6P
(;3257,1* &/$66FOBH[BEDGL!,03/(0(17$7,21
HBSDU
HBSDU 0(7+2'LIBH[BEDGLaP
,03257,1*
LBSDU (1'0(7+2'
0(7+2'6P 0(7+2'LIBH[BEDGL!aP

(1',17(5)$&( (1'0(7+2'
(1'&/$66
)XQFWLRQFRGH
QDPHVSDFH[[[

SAP AG 1999

The following constraints apply to the definition of business add-ins:

A business add-in cannot have a function code as one of its components if you define a
filter dependency.

A business add-in cannot be filter-dependent if you define a function code as one of its
components.

A business add-in can have only one active implementation, if you define it filter specific
or if you define a function code as one of its components.

%XVLQHVV$GG,QV1DPLQJ&RQYHQWLRQV

SAP AG 33
ABAP Workbench Delta Guide (3.1-4.6)

%XVLQHVV$GG,Q'HILQLWLRQ1DPLQJ&RQYHQWLRQV

l %XVLQHVV$GG,Q'HILQLWLRQDQ\QDPHDOORZHG
n EDGL!  6$3QDPHUDQJH
n EDGL! 3DUWQHUQDPHVSDFH
n =EDGL! &XVWRPHUQDPHUDQJH
l ,QWHUIDFHDQ\QDPHDOORZHG
n ,)B(;BEDGL! 6$3QDPHUDQJH
n ,)B(;BEDGL! 3DUWQHUQDPHVSDFH
n =,)B(;BEDGL! &XVWRPHUQDPHUDQJH
l 0HWKRGVDQ\QDPHVDOORZHG
l *HQHUDWHG%XVLQHVV$GGLQ&ODVV $GDSWHU&ODVV QRWWREHFKDQJHG
n &/B,0BEDGL! 6$3QDPHUDQJH
n &/B(;BEDGL! 3DUWQHUQDPHVSDFH
n =&/B(;BEDGL! &XVWRPHUQDPHUDQJH

SAP AG 1999

The naming conventions depicted in the slide apply to business add-ins: Thus, for business
add-in definitions, you only have to take into account the corresponding name space or
customer name range.
The name of the interface is derived from the name of the business add-in using the following
rule:
The name space prefix first
IF_EX_ by default
name of the business add-in without name space prefix
The name of the interface can be changed arbitrarily. You only have to take into account the
name-space rules. The methods are not Repository Objects. So their name is arbitrary, too.
The name of the generated class is fixed, and is composed as follows:
The name space prefix
CL_(;_
The name of the business add-in without name space prefix.

SAP AG 34
ABAP Workbench Delta Guide (3.1-4.6)

%$G,,PSOHPHQWDWLRQ1DPLQJ&RQYHQWLRQV

l %XVLQHVVDGGLQLPSOHPHQWDWLRQDQ\QDPHDOORZHG
n LPSO!  6$3QDPHUDQJH
n LPSO! 3DUWQHUQDPHVSDFH
n =LPSO! &XVWRPHUQDPHUDQJH

l ,QWHUIDFHQDPHGHILQHGLQ%XVLQHVVDGGLQGHILQLWLRQ
l 0HWKRGVQDPHGHILQHGLQ%XVLQHVVDGGLQGHILQLWLRQ

l ,PSOHPHQWLQJFODVVDQ\QDPHDOORZHG
n &/B,0BLPSO! 6$3QDPHUDQJH
n &/B,0BLPSO! 3DUWQHUQDPHVSDFH
n =&/B,0BLPSO! &XVWRPHUQDPHUDQJH

SAP AG 1999

The name of the business add-in implementation can be chosen freely within the
corresponding name-space or name range, respectively. The same holds for the name of the
class that is created when you implement a business add in. the system makes the following
proposal for the class:
The name space prefix
CL_,0_
The name of the implementation without name space prefix.

&UHDWLQJD)LOWHU'HSHQGHQW%XVLQHVV$GG,Q

You can create a filter dependent BAdI by marking the corresponding flag in the $WWULEXWHTab.

SAP AG 35
ABAP Workbench Delta Guide (3.1-4.6)

&UHDWLQJD)LOWHU'HSHQGHQW%$G,

$ E )

3URJUDP )XQFWLRQFRGH 'HVFULSWLRQ

$ E

5 E

) S )LOWHUW\SH '  !

SAP AG 1999

The filter type has to be a data element defined in the ABAP Dictionary. Because a data
element refers to a domain which itself refers to a value table or fixed single values, the
values for the filter are predefined.
The methods defined in the BAdI-Interface have an additional fixed parameter: FLT_VAL,
which has the type of the data element. We will see in the implementation part how this filter
value is used to select a specific implementation.

6DPSOH&DOOLQJD%XVLQHVV$GG,Q

This section describes an ABAP Program that provides an enhancement as a business add-in
by discussing the program flow, before providing the code itself.

SAP AG 36
ABAP Workbench Delta Guide (3.1-4.6)

3URJUDPIRU3URYLGLQJ$%XVLQHVV$GG,Q)ORZ

$SSOLFDWLRQSURJUDP

6HUYLFH&ODVV

&/B(;,7+$1'/(5

3URFHVVLQJRIDFWLYH

,PSOHPHQWDWLRQV

$GDSWHU&ODVV
%XVLQHVV$GG,Q
&/B(;BEDGL!
,PSOHPHQWDWLRQ&ODVV
,PSOHPHQWDWLRQ&ODVV

&UHDWH

2EMHFWUHIHUHQFH

SAP AG 1999

The graphics shows the flow of an application program that provides a business add-in
enhancement. First, declare a reference variable that is a reference to the business add-in
interface. The following example shall provide you with the necessary code for calling a
business add-in method. Assume that we have created a business add-in with the name
<%$',7(67already. We let the name of the interface be <,)B(;B%$',7(67. Furthermore,
we have declared a method %$',B0(7+2' within the interface.
PROGRAM badi_provider.
'$7$UHIHUHQFBYDULDEOH7<3(5()72,)B(;B%$',7(67
Now, we have declared the reference variable. In a second step, we have to instantiate an
object of the Adapter class. This is done by calling the method *(7B,167$1&(of the
existing class &/B(;,7+$1'/(5. We advise calling this method as seldom as possible. So
it is a good choice to call it at the ABAP event LOAD-OF-PROGRAM. The code should look as
follows:
LOAD-OF-PROGRAM.
&$//0(7+2'FOBH[LWKDQGOHU !JHWBLQVWDQFH
&+$1*,1*
LQVWDQFH UHIHUHQFHBYDULDEOH
That is all the preparation we need. In the next step we can call the methods of the
enhancement. The provider determines where the enhancement is called:
&$//0(7+2'UHIHUHQFHBYDULDEOH!EDGLBPHWKRG
LQWHUIDFHRIWKHEDGLPHWKRG!
With this statement the method is called in the generated adapter class, as depicted in the
graphic above. The enhancements are called from within that method of the adapter class.
Thus, the adapter class looks for active implementations and executes them.

SAP AG 37
ABAP Workbench Delta Guide (3.1-4.6)

,PSOHPHQWLQJD%XVLQHVV$GG,Q

Transaction SE19 is used to implement business add-ins.


,PSOHPHQWLQJ%XVLQHVV$GG,QV,QLWLDO6FUHHQ

%XVLQHVV$GG,QV,PSOHPHQWDWLRQ0DLQW,QLWLDO6FUHHQ

1DPHRI
,PSHPHQWDWLRQQDPH LPSOPQW!
LPSOHPHQWDWLRQ
'LVSOD\ &KDQJH &UHDWH
&UHDWH

%XVLQHVV$GG,QV&KRRVH'HI

'HILQLWLRQQDPH EDGL!

SAP AG 1999

Enter a name for the implementation. It has to comply with name space conventions. For
example, to create an implementation in the customer name range, named =,03/(0(17
you would enter this name in the corresponding entry field and press the &UHDWHbutton. The
system asks you for the business add-in you want to implement. Enter the name of the
business add-in in the dialog box. The next screen displays some tabs. Here you can specify
more details for the implementation of the interface method.

SAP AG 38
ABAP Workbench Delta Guide (3.1-4.6)

,PSOHPHQWLQJ%XVLQHVV$GG,QV0HWKRGV

$WWUV ,QWHUIDFH )&RGHV

,QWHUIDFHQDPH ,)BLQWHUIDFH!

1DPHRILPSOHPHQWLQJFODVV &/B,0BLPSOPQW!

0HWKRG 'HVFULSWLRQ

PHWKRG! %XVLQHVVDGGLQPHWKRG

&ODVV%XLOGHU(GLW0HWKRG,)LQWHUIDFH!aP!

0(7+2'LIBLQWHUIDFH!aPHWKRG!



(1'0(7+2'

SAP AG 1999

When you double click the name of the interface method, the system navigates to the editor
where you can enter your source code. Technically, the system creates a new class, the
LPSOHPHQWLQJFODVV =&/B,0B,03/(0(17, which implements the interface that has been
defined in the business add-in definition. If you wish, you can change the name of the class.
Within this method you are free to do anything you can do within a class. For instance, you
could call other private methods within the class.

To be performed, the implementation has to be activated!

You can deactivate an active implementation. It will then be no longer carried out.

,PSOHPHQWLQJD)LOWHU'HSHQGHQW%XVLQHVV$GG
,Q

To implement a filter-dependent business add-in, you must specify the filter value for the
business add-in. Therefore, you must insert specific values for the filter in the $WWULEXWHVfield.
In the following graphic, the implementation is only performed when the implementation is
called with filter value "AA" or "LH".

SAP AG 39
ABAP Workbench Delta Guide (3.1-4.6)

)LOWHU'HSHQGHQW,PSOHPHQWDWLRQ

$WWULEXWHV ,QWHUIDFH

5HXVDEOH

)LOWHUVSHFLILF )LOWHUW\SH 6B&$55B,'


9DOXHV
$$
/+

SAP AG 1999

SAP AG 40
ABAP Workbench Delta Guide (3.1-4.6)

0RGLILFDWLRQ$VVLVWDQW
After reviewing the following topics, you will be able to:
Explain the concept of Modification Assistant
Use the Modification Browser
Understand the upgrade procedure
Explain how to do adjustments with Modification Assistant
Explain how to do adjustments without Modification Assistant

2000 SAP AG. All rights reserved.

SAP AG 41

You might also like