2008 Mar 10 2:32 PM
2008 Mar 10 2:44 PM
BAPI - Business Application - commonly a function module that is normally RFC enabled as well and acts as a method of a business object. For example, Sales Order as the business object with a method of create - the BAPI is BAPI_SALESORDER_CREATEFROMDAT2.
A BADI is a Business Add-in - one of SAP's methods of implementing a user-exit or change to standard SAP code. BADI's are ABAP object based changes instead of the more common subroutines/function modules.
2008 Mar 10 2:48 PM
Hi,
BAPI (Business Application Programming Interface) :
BAPIis an API method of a business object which intern is a RFC enabled Function Module.
Business Objects are the Objects which has business sence associated to it. Ex. Sales Orders, Purchase Orders etc.
The Properties of BAPI are:
Every BAPI name should start with letters 'BAPI'.
It is an API method of a Business Object.
it does not contain a internal COMMIT statement in the Function Module.
It does not contain "CALL TRANSACTION" statements.
BAPI do not raise 'EXCEPTIONS'.
a RETURN structure is defined as an interface parameter of a BAPI which is used to log all the errors, warnings and the successful processes tha are triggered in the course of execution of a BAPI.
A successful execution of a BAPI requires the data to be commited and this process of performing a COMMIT is achieved by calling the BAPI_TRANSACTION_COMMIT' explicitly if there are no errors logged in the RETURN structure.
There are two types of BAPI's: Instance Dependent & Instance Independent.
BAPI provides an access to the SAP system for external applications to have the business data processed in the form of web services. When BAPI's are used to post the data in SAP system these are used as Function Modules.
for further information check following:
Go to the below link for BAPI.
http://help.sap.com/saphelp_nw04/helpdata/en/e0/9eb2370f9cbe68e10000009b38f8cf/frameset.htm
BAPI
http://help.sap.com/saphelp_nw2004s/helpdata/en/7e/5e114a4a1611d1894c0000e829fbbd/frameset.htm
http://www.sapgenie.com/abap/bapi/example.htm
http://help.sap.com/saphelp_46c/helpdata/en/9b/417f07ee2211d1ad14080009b0fb56/frameset.htm
http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
http://techrepublic.com.com/5100-6329-1051160.html#
http://www.sap-img.com/bapi.htm
http://www.sap-img.com/abap/bapi-conventions.htm
http://www.sappoint.com/abap/bapiintro.pdf
http://www.sapgenie.com/abap/bapi/example.htm
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
BAPI Programming guide: -
http://help.sap.com/saphelp_nw04/helpdata/en/e0/9eb2370f9cbe68e10000009b38f8cf/frameset.htm
BAPI user guide: -
http://help.sap.com/saphelp_46c/helpdata/en/7e/5e115e4a1611d1894c0000e829fbbd/frameset.htm
BAPI STEP BY STEP PROCEDURE: -
http://www.sap-img.com/abap/bapi-step-by-step-guidance.htm
Example:-
http://www.erpgenie.com/abap/bapi/example.htm
PDF download: -
BADI
Business Add-Ins are a new SAP enhancement technique based on ABAP Objects.
Badis allow for a multi-level system landscape (SAP, partner, and customer solutions, as well as country versions, industry solutions, and the like).
Business Add-Ins can be created at each level within such a system infrastructure
Some BADI can have multiple independent implementations which is much better for software deployment as several developers can implement the same BADI independently.
1} Identify the User Exit suitable for the requirement and that is available in the system:
Code SE18 is used to Identify the BADI available.
Look for the string 'CL_EXITHANDLER' in the standard program. This is a class which has a method 'GET_INSTANCE' which is used to trigger BADI's from the Standard Program. The interface parameter for this static method 'EXIT_NAME' is used to pass the BADI to the method.
Open Standard Program and do a global search 'CL_EXITHANDLER'.
SE18 > give the BADI name found through above search.
CUSTOMER_ADD_DATA > which has a method SAVE_DATA.
2} Implement the User Exit identified through above process.
T.Code SE19 is used to Implement BADI.
SE19 > give the implementation name > Give the Definition name as CUSTOMER_ADD_DATA and the Short Text.
Check these blogs 2 find a BADI:
How To Define a New BAdI Within the Enhancement Framework (Some Basics About the BAdI,BAdI Commands in ABAP,
When to Use a BAdI?)
/people/thomas.weiss/blog/2006/04/03/how-to-define-a-new-badi-within-the-enhancement-framework--part-3-of-the-series
How to implement a BAdI And How to Use a Filter
/people/thomas.weiss/blog/2006/04/18/how-to-implement-a-badi-and-how-to-use-a-filter--part-4-of-the-series-on-the-new-enhancement-framework
Introducing Business Add-Ins
How to implement BAdi in Enhancement Framework
Business Add-Ins
http://help.sap.com/saphelp_47x200/helpdata/en/ee/a1d548892b11d295d60000e82de14a/frameset.htm
BAdI: Customer-Defined Functions in the Formula Builder
http://help.sap.com/saphelp_nw04/helpdata/en/04/f3683c05ea4464e10000000a114084/content.htm
Difference Between BADI and User Exits
http://www.sap-img.com/abap/difference-between-badi-and-user-exits.htm
To Use BADI - Business Add In you need to Understand ABAP OO Interface Concept
http://www.sap-img.com/abap/business-add-in-you-need-to-understand-abap-oo-interface-concept.htm
Reward points if helpful.
Sudheer
2008 Mar 11 4:39 AM
Hi
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. Since specific industries often require special functions, SAP allows you to predefine these points in your software.
As with customer exits (SMOD/CMOD [Page 40]), two different views are available:
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 nor do they affect the validity of call interfaces. 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 addition, Business Add-Ins can be defined according to filter values. This allows you to control add-in implementation and make it dependent on specific criteria (on a specific Country value, for example). All ABAP sources, screens, GUIs, and table interfaces created using this enhancement technique are defined in a manner that allows customers to include their own enhancements in the standard.
A single Business Add-In contains all of the interfaces necessary to implement a specific task. In Release 4.6A, program and menu enhancements can be made with Business Add-Ins. The actual program code is enhanced using ABAP Objects. In order to better understand the programming techniques behind the Business Add-In enhancement concept, SAP recommends reading the section on ABAP Objects
DEFINING THE BADI
1) execute Tcode SE18.
2) Specify a definition Name : ZBADI_SPFLI
3) Press create
4) Choose the attribute tab. Specify short desc for badi.. and specify the type :
multiple use.
5) Choose the interface tab
6) Specify interface name: ZIF_EX_BADI_SPFLI and save.
7) Dbl clk on interface name to start class builder . specify a method name (name,
level, desc).
Method level desc
Linese;ection instance methos some desc
😎 place the cursor on the method name desc its parameters to define the interface.
Parameter type refe field desc
I_carrid import spfli-carrid some
I_connid import spefi-connid some
9) save , check and activate adapter class proposed by system is
ZCL_IM_IM_LINESEL is genereated.
IMPLEMENTATION OF BADI DEFINITION
1) EXECUTE tcode se18.choose menuitem create from the implementation menubar.
2) Specify aname for implementation ZIM_LINESEL
3) Specify short desc.
4) Choose interface tab. System proposes a name fo the implementation class.
ZCL_IM_IMLINESEL which is already generarted.
5) Specify short desc for method
6) Dbl clk on method to insert code..(check the code in AAA).
7) Save , check and activate the code.
Some useful URL
http://www.esnips.com/doc/e06e4171-29df-462f-b857-54fac19a9d8e/ppt-on-badis.ppt
http://www.esnips.com/doc/10016c34-55a7-4b13-8f5f-bf720422d265/BADIs.pdf
http://www.esnips.com/doc/43a58f51-5d92-4213-913a-de05e9faac0d/Business-Addin.doc
http://www.esnips.com/doc/1e10392e-64d8-4181-b2a5-5f04d8f87839/badi.doc
www.sapgenie.com/publications/saptips/022006%20-%20Zaidi%20BADI.pdf
http://www.sapdevelopment.co.uk/enhance/enhance_badi.htm
http://help.sap.com/saphelp_nw04/helpdata/en/04/f3683c05ea4464e10000000a114084/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/e6/d54d3c596f0b26e10000000a11402f/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/c2/eab541c5b63031e10000000a155106/frameset.htm
Now write a sample program to use this badi method..
Look for BBB sample program.
AAA
data : wa_flights type sflight,
it_flights type table of sflight.
format color col_heading.
write:/ 'Flight info of:', i_carrid, i_connid.
format color col_normal.
select * from sflight
into corresponding fields of table it_flights
where carrid = i_carrid
and connid = i_connid.
loop at it_flights into wa_flights.
write:/ wa_flights-fldate,
wa_flights-planetype,
wa_flights-price currency wa_flights-currency,
wa_flights-seatsmax,
wa_flights-seatsocc.
endloop.
BBB
&----
*& Report ZBADI_TEST *
*& *
&----
REPORT ZBADI_TEST .
tables: spfli.
data: wa_spfli type spfli,
it_spfli type table of spfli with key carrid connid.
*Initialise the object of the interface.
data: exit_ref type ref to ZCL_IM_IM_LINESEL,
exit_ref1 type ref to ZIF_EX_BADISPFLI1.
selection-screen begin of block b1.
select-options: s_carr for spfli-carrid.
selection-screen end of block b1.
start-of-selection.
select * from spfli into corresponding fields of table it_spfli
where carrid in s_carr.
end-of-selection.
loop at it_spfli into wa_spfli.
write:/ wa_spfli-carrid,
wa_spfli-connid,
wa_spfli-cityfrom,
wa_spfli-deptime,
wa_spfli-arrtime.
hide: wa_spfli-carrid, wa_spfli-connid.
endloop.
at line-selection.
check not wa_spfli-carrid is initial.
create object exit_ref.
exit_ref1 = exit_ref.
call method exit_ref1->lineselection
EXPORTING
i_carrid = wa_spfli-carrid
i_connid = wa_spfli-connid.
clear wa_spfli.
A Business Application Programming Interface is a precisely defined interface providing access process and data in Business Applications Systems Such as SAP R/3
BAPICan be used in diverse languages / Development Environments(ABAP, Visual Basic, Java, C++, etc.)Can be called from diverse platforms (COM, CORBA, Unix)Reduced development costReduced maintenance costBest-of-both-worlds approachRich functionality of the R/3 systemUser-specific front-ends
BAPI Return StructureType Message typeblank or "S"=Success"E"=Error"W"=Warning"I"=Information"A"=AbortMessage Message text Log_No Application Log NumberLog_Msg_No Application Log Message Serial NumberMessage_V1 -V4 Message variables.
award if helpful.
Thanks & Regards,
Sravani.
2008 Mar 11 4:45 AM
Hi Zuber,
Please check the below link:
Regards,
Esha Raj