Application Development 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: 

bapi tutorial

Former Member
0 Kudos

Hello friends,

plz give me the tutorial for creating a new project in BAPI.

helpful notes will be appreciated.

4 REPLIES 4

Former Member
0 Kudos

BAPI (Business Application Programming Interface) is 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 Sales order:

Check these BAPI

BAPI_SALESORDER_CHANGE

BAPI_SALESORDER_CREATEFROMDAT2

for Purchase Order:

check these combination

1) BAPI_PO_CREATE

2) BAPI_TRANSACTION_COMMIT

BAPI-step by step

http://www.sapgenie.com/abap/bapi/example.htm

Creating BAPI:

http://help.sap.com/saphelp_nw04/helpdata/en/8b/40aeefc95c11d1ad0c080009b0fb56/content.htm

BAPI Convention:

http://www.sap-img.com/abap/bapi-conventions.htm

Coding Example:

http://help.sap.com/saphelp_46c/helpdata/en/dd/5009660aa411d2ad1b080009b0fb56/content.htm

Reward points if useful.

0 Kudos
Hi

Former Member
0 Kudos

Hi,

BAPI-step by step

http://www.sapgenie.com/abap/bapi/example.htm

list of all bapis

http://www.planetsap.com/LIST_ALL_BAPIs.htm

for BAPI's

http://www.sappoint.com/abap/bapiintro.pdf

http://www.sappoint.com/abap/bapiprg.pdf

http://www.sappoint.com/abap/bapiactx.pdf

http://www.sappoint.com/abap/bapilst.pdf

http://www.sappoint.com/abap/bapiexer.pdf

http://service.sap.com/ale

http://service.sap.com/bapi

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://www.planetsap.com/Bapi_main_page.htm

http://www.topxml.com/sap/sap_idoc_xml.asp

http://www.sapdevelopment.co.uk/

http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf

Also refer to the following links..

www.sappoint.com/abap/bapiintro.pdf

www.sap-img.com/bapi.htm

www.sap-img.com/abap/bapi-conventions.htm

www.planetsap.com/Bapi_main_page.htm

www.sapgenie.com/abap/bapi/index.htm

Checkout !!

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

u can check the below the material also

what is BAPI?

BAPI stands for Business API(Application Program Interface).

I have answered this question before..

A BAPI is remotely enabled function module ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..

You can make your function module remotely enabled in attributes of Function module but

A BAPI are standard SAP function modules provided by SAP for remote access. Also they are part of Businees Objest Repository(BOR).

BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA. in this case u only specify the business object and its method from external system in BAPI there is no direct system call. while RFC are direct system call Some BAPIs provide basic functions and can be used for most SAP business object types. These BAPIs should be implemented the same for all business object types. Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs. Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.

The following standardized BAPIs are provided:

Reading instances of SAP business objects

GetList ( ) With the BAPI GetList you can select a range of object key values, for example, company codes and material numbers.

The BAPI GetList() is a class method.

GetDetail() With the BAPI GetDetail() the details of an instance of a business object type are retrieved and returned to the calling program. The instance is identified via its key. The BAPI GetDetail() is an instance method. BAPIs that can create, change or delete instances of a business object type

The following BAPIs of the same object type have to be programmed so that they can be called several times within one transaction. For example, if, after sales order 1 has been created, a second sales order 2 is created in the same transaction, the second BAPI call must not affect the consistency of the sales order 2. After completing the transaction with a COMMIT WORK, both the orders are saved consistently in the database.

Create( ) and CreateFromData! ( )

The BAPIs Create() and CreateFromData() create an instance of an SAP business object type, for example, a purchase order. These BAPIs are class methods.

Change( )

The BAPI Change() changes an existing instance of an SAP business object type, for example, a purchase order. The BAPI Change () is an instance method.

Delete( ) and Undelete( ) The BAPI Delete() deletes an instance of an SAP business object type from the database or sets a deletion flag.

The BAPI Undelete() removes a deletion flag. These BAPIs are instance methods.

Cancel ( ) Unlike the BAPI Delete(), the BAPI Cancel() cancels an instance of a business object type. The instance to be cancelled remains in the database and an additional instance is created and this is the one that is actually canceled. The Cancel() BAPI is an instance method.

Add<subobject> ( ) and Remove<subobject> ( ) The BAPI Add<subobject> adds a subobject to an existing object inst! ance and the BAPI and Remove<subobject> removes a subobject from an object instance. These BAPIs are instance methods.

Regards,

Satish

Former Member
0 Kudos

Hi Lokesh,

*BAPI*

BAPIs are standardized programming interfaces (methods) enabling external applications to access business processes and data in the R/3 System.

BAPIs provide stable and standardized methods to achieve seamless integration between the R/3 System and external applications, legacy systems and add-ons.

BAPIs are defined in the BOR(Business object repository) as methods of SAP business object types that carry out specific business functions.

BAPIs are implemented as RFC-enabled function modules and are created in the Function Builder of the ABAP Workbench.

The BAPI Explorer is the R/3 System working environment for developing BAPIs.

A BAPI interface is defined by:

-Import parameters

-Export parameters

-Import/export (table) parameters

Each function module underlying a BAPI:

· Supports the Remote Function Call (RFC) protocol

· Has been assigned as a method to an SAP Business Object in the BOR

· Is processed without returning any screen dialogs to the calling application

The process of defining and implementing a BAPI consists of the

following steps --

Describing the Scenario the BAPI is Used in

Reviewing the BAPI Concept and BAPI Scenario

Defining a BAPI and Its Interface

Creating Individual Programming Objects

Testing the BAPI

Releasing and Freezing the BAPI .

Some BAPIs and methods provide basic functions and can be used for

most SAP Business Objects.These are called STANDARDIZED

BAPI’s.

Standardized BAPIs

BAPIs for Reading Data

GetList() , GetDetail() , GetStatus() , ExistenceCheck()

BAPIs for Creating or Changing Data

Create() or CreateFromData(),Change(),Delete() and Undelete() ,

Cancel() ,Add

BAPIs for Mass Processing

ChangeMultiple(), CreateMultiple(), DeleteMultiple().

BAPIs for Replicating Business Object Instances

Replicate() and SaveReplica()

Creating a BAPI

Go to transaction sw01 (that is Tools->Business Framework -> BAPI Development ->Business Object builder ) .

Select the business object ( generally of type BUS nnnn ) , according to the functional requirement for which the BAPI is being created.

Open the business object in change mode. Then Select Utilities ->API Methods ->Add method.

Then enter the name of the function module and select Continue.

In the next dialog box, following information needs to be specified :

Method : Suggest an appropriate name for the method,

Texts : Enter description for the BAPI,

Radio buttons : Dialog, Synchronous, Instance-independent . BAPI ‘s are usually implemented synchronously.

Now, select Next step.

To create the method select Yes in the next dialog box.

After the program has been generated and executed, check the program in the method just created.

Thus , a BAPI is created.

Testing the BAPI :-

You can test the BAPI by testing the individual method of the Business Object in the Business Object Builder.

( or one can use the transaction ‘swud’ to test the method ) .

Releasing and freezing the BAPI :-

-To release the BAPI , first release the function module ( using transaction se37 ) .

-Set the status of the method to 'released' in the Business Object Builder .

( using transaction swo1 – Edit-> change status-> released. )

Use of BAPI in Custom programs

Step 1: First step is to identify the application area. Then go to the transaction code BAPI and obtain the corresponding BAPI.

Eg : if your dealing with a sales order , in the BAPI explorer , go to sales and distribution-> sales->sales order.

Step 2: Refer to the documentation of the method to know how to use the BAPI.

Eg : In order to create a sales order, select the BAPI CreateFromDat2. (BAPI_SALESORDER_CREATEFROMDAT1).

Step 3: Simulate the desired output using SE37 transaction. Do sample testing with the function module found. SAP does not specify flag population part to control the update. That you can achieve by some trial run of the function module.

Example :

Call function ‘BAPI_SALESORDER_CREATEFROMDAT1’

EXPORTING

Order_header_in = s_order_header

IMPORTING

Salesdocument = w_sales_docno

Return = s_return

TABLES

Order_items_in = t_order_item

Order_partners = t_order_partner

Order_item_out = t_order_item_out.

FOR STEP BY STEP IMPLEMENTATION OF BAPI-----

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/200dd1cc-589e-2910-98a9-bb2c48b7...

http://www.erpgenie.com/abap/bapi/example.htm

reward if useful

thanks and regards

suma sailaja pvn