Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BADI

Former Member
0 Likes
616

hi,

I want step by step procedure for creating badis, iam using ecc

6.0.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
546

Hi,

Have a look at the link below:

http://www.saptechnical.com/Tutorials/ExitsBADIs/VL02/page1.htm

Thanks,

Sriram Ponna.

hi,

I want step by step procedure for creating badis, iam using ecc

6.0.

2 REPLIES 2
Read only

Former Member
0 Likes
547

Hi,

Have a look at the link below:

http://www.saptechnical.com/Tutorials/ExitsBADIs/VL02/page1.htm

Thanks,

Sriram Ponna.

Read only

geetha_k
Active Participant
0 Likes
546

Hi,

Implementing Business Add-Ins (BADI)

The use of object orientated code within SAP has lead to new method of enhancing standard SAP code called

Business Add-Ins or BADI's for short. Although the implementation concept is based on classes, methods and

inheritance you do not really have to understand this fully to implement a BADI. Simply think of methods

as a function module with the same import and export parameters and follow the simple instructions below.

Steps:

1. Execute Business Add-In(BADI) transaction SE18

2. Enter BADI name i.e. HRPBSGB_HESA_NISR and press the display

button

3. Select menu option Implementation->Create

4. Give implementation a name such as Z_HRPBSGB_HESA_NISR

5. You can now make any changes you require to the BADI within this

implementation, for example choose the Interface tab

6. Double click on the method you want to change, you can now enter

any code you require.

7. Please note to find out what import and export parameters a

method has got return the original BADI definition

(i.e. HRPBSGB_HESA_NISR) and double click on the method name

for example within HRPBSGB_HESA_NISR contract is a method

8. When changes have been made activate the implementation

[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d0456c54-0901-0010-f0b3-cd765fb99702]

Business Add-Ins

•Business Add-Ins are a new SAP enhancement technique based on ABAP Objects. They can be inserted into the SAP System to accommodate user requirements too specific to be included in the standard delivery.

•Business Add-Ins are somewhat like User Exit, but it is based on the Object Oriented Technology. It has Interfaces and methods for that interface.

•Business Add-Ins have two parts: One is the Definition and the other is its Implementation. The definition can either be SAP provided or user may also create it.

•In the definition view, an application programmer predefines exit points in a source that allow specific industry sectors, partners, and customers to attach additional software to standard SAP source code without having to modify the original object.

•In the implementation view, the users of Business Add-Ins can customize the logic they need or use a standard logic if one is available.

•In contrast to customer exits, Business Add-Ins no longer assume a two-system infrastructure (SAP and customers), but instead allow for multiple levels of software development (by SAP, partners, and customers, and as country versions, industry solutions, and the like). Definitions and implementations of Business Add-Ins can be created at each level within such a system infrastructure.

•SAP guarantees the upward compatibility of all Business Add-In interfaces. Release upgrades do not affect enhancement calls from within the standard software. You do not have to register Business Add-Ins in SSCR.

•The Business Add-In enhancement technique differentiates between enhancements that can only be implemented once and enhancements that can be used actively by any number of customers at the same time.

•In order to enhance a program, a Business Add-In must first be defined. Application developers create an interface for the add-in. Enhancement management takes this interface and generates an adapter class for implementing it, thus opening a path for implementations created by partners or customers.

•Developers then create an instance of the adapter class in the application program and calls the corresponding method at the appropriate time.

•Customers can find the enhancements present in their system in the IMG and in the component hierarchy. Whenever they want to use a Business Add In, they must create their own implementation of the add-in. Customers must first implement methods and user interface enhancements, and then activate their implementations of the enhancement. The enhancement's active components are then called at runtime.

•Starting with the next release, Business Add-Ins will also include enhancements for screens and tables.

Defining Business Add-Ins

In order for application developers to include Business Add-Ins in their programs, they must define an interface for the enhancement in the SAP menu under Tools-> ABAP Workbench -> Utilities -> Business Add-Ins (transaction SE18) and call this interface at the appropriate point in their application program. Customers can then select the add-in and implement it according to their needs.

Example:

You want to be able to convert strings in your application program. You also want users to determine how their strings are converted themselves. As the application developer, you define an enhancement consisting of an interface with a method. A changing parameter is used to transfer strings.

In order to create an add-in like this, proceed as follows:

1.Choose Tools ->ABAP Workbench -> Utilities -> Business Add-Ins (transaction SE18) from the SAP menu.

2.Enter a name for your Business Add-In containing a maximum of 20 characters. (Give a name beginning with Z for testing)

3.Choose Create.

4.Enter a short description for your Business Add-In on the following screen.

If this enhancement is going to be used multiple times or if you want its implementation to depend on a specific filter value, first choose Management and then select the appropriate checkbox in the category Type.

This example only deals with basic enhancements, therefore neither of these checkboxes should be selected.

5.Choose the Interface tab.

The name of the interface is generated automatically and now appears along with the name of its corresponding class. At this time, you can change the name of the interface if you so desire.

You can use the Fcodes tab to create menu enhancements.

6.Double-click on the interface's name field to assign a method to the interface.

7.The system branches to the Class Builder. A dialog box appears, asking you if you want to save the entries you have made. Save your entries. Assign your add-in to a development class.

8.Use the Class Builder to assign a method to the interface.

9.Now define a parameter with the following attributes:

10.Save and activate your changes. Use the pushbutton Back to navigate back to Business Add-In definition.

If you do not activate your attributes in the Class Builder, the system will not allow you to proceed with Business Add-In definition.

A table control now appears on the definition screen containing the method you have assigned to the interface.

Whenever you assign a method to an interface, the corresponding executing class is generated. The code generated cannot be altered in the initial expansion phase.

11.Save your entries and use the Documentation pushbutton to create a description for your new Business Add-In. Be aware that this documentation is of great importance in helping end users understand the purpose of your add-in.

Changes made to the interface and changes made to the Business-Add-In definition are always incompatible.

If implementations already exist for a Business-Add-In definition, they are invalidated if you make changes to the interface. This means that their syntax is no longer correct. No statements can be given on the runtime behavior. Try to absolutely avoid making changes to the interface or the Business-Add-In definition after the transport has taken place.

If changes to the interface are inevitable, navigate to the Class Builder (transaction SE19, tab Interface, field Name of implementing class) for all implementing classes, that is, all classes for which Business-Add-In implementations are used, and clean up the method includes of these classes (Utilities -> Clean up -> Method includes).

Implementing Business Add-Ins

A list of the Business Add-Ins present in your system can be found either in the IMG or in the component hierarchy. The enhancements' names and corresponding documentation should help you decide which add-in you want to create an implementation for. During implementation creation, a class for implementing the enhancement's interface is also created. In order to create an implementation for the string conversion example, the add-in (in this case, the interface's method) needs to be filled with logic that converts the string. This logic will be run through every time the add-in is called from the application program.

To create an implementation, proceed as follows:

1.Choose ABAP Workbench ->Utilities -> Business Add-Ins (transaction SE19) from the SAP menu or double-click on the corresponding activity in the Implementation Guide.

2.Enter a name for the implementation and choose Create.

3.Enter the name of the add-in you want to create an implementation for in the dialog box that appears.

4.Enter a short text describing your implementation on the following screen.

5.Choose the Interface tab.

6.In order to implement a method for your add-in, double-click on the method to branch to the Class Builder. You must first enter a development class before the Class Builder is displayed.

7.Insert the desired source code for the implementation between the method if_ex_businessaddin~method. and endmethod. statements automatically provided to you by the system.

Enter the statement translate parameter to upper case. for the string conversion example.

8.Save your entries and return to the Change Implementation screen.

9.Choose Activate. You may now use this implementation when the application program is executed.

Some more points to regard

•There can be more than one implementations of the same BADI definition, and in that case only the active implementations will be executed. You can activate or de-activate any of the implementations after creation.

•Business Add-In Definition can be Created, Changed or Displayed through the transaction SE18.

•Business Add-In Implementation can be Created, Changed or Displayed through the transaction SE19.

•The code should be written inside the Methods and for the particular BADI (if it is SAP provided) there is documentation for the time of execution of each method. Depending on the requirement of the time of execution of your code, you can write code in any of those methods.

•A number of syntax does not work inside the BADI, like TABLES: (I don't remember the whole list). In such case, I have found two good solutions: 1: To call an executable program with the SUBMIT ABC AND RETURN. command. And, if you need to pass parameters from the BADI to be executed in the program, you can either export to memory and import them inside the program or you can use a function module and call that function module from the BADI and pass required parameters.

•If there are some import parameters and internal tables inside the BADI which has the values of the fields that have been saved through a transaction, you may have to use those tables and import parameters inside the BADI. You can know about the import parameters by double clicking the Interface name and then going to the Parameters tab