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: 

hi guru's what is bapi

Former Member
0 Kudos

hi guru's what is bapi how we use bapi

7 REPLIES 7

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 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

Reward points if useful.

Former Member
0 Kudos

Hi Vasu,

BAPI is nothing bue a Remote enabled function module........

it actually is a normal function module which can be called from remote system to post data into SAP system.......

A BAPI actually acts on a Business Object for eg: given an Equipment as a Businedd Object you have BAPI's which act on this Business Object they reside in the Business Object Repository......

you can access this repository using the Tcode: BAPI

Reward points if this helps....

Regards,

Ravi G

Former Member
0 Kudos

HI,

BAPI stands for Business API(Application Program Interface).

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.

BAPI-step by step

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

just refer to the link below

http://www.sapmaterial.com/?gclid=CN322K28t4sCFQ-WbgodSGbK2g

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.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#

Example Code

we use the function module for creating PO

BAP_PO_CTREAT1.

constants : c_x value 'X'.

data: del_date type sy-datum.

data: pohead type bapimepoheader.

data: poheadx type bapimepoheaderx.

data: exp_head type bapimepoheader.

data: return type table of bapiret2 with header line.

data: poitem type table of bapimepoitem with header line.

data: poitemx type table of bapimepoitemx with header line.

data: posched type table of bapimeposchedule with header line.

data: poschedx type table of bapimeposchedulx with header line.

data: ex_po_number type bapimepoheader-po_number.

parameters: p_matnr type ekpo-matnr.

parameters: p_werks type ekpo-werks.

parameters: p_lgort type ekpo-lgort.

parameters: p_menge type ekpo-menge.

parameters: p_lifnr type ekko-lifnr.

parameters: p_ekorg type ekko-ekorg.

parameters: p_ekgrp type ekko-ekgrp.

parameters: p_bukrs type ekko-bukrs.

  • Header Level Data

pohead-comp_code = p_bukrs.

pohead-doc_type = 'NB' .

pohead-creat_date = sy-datum .

pohead-vendor = p_lifnr.

pohead-purch_org = p_ekorg.

pohead-pur_group = p_ekgrp.

pohead-langu = sy-langu .

pohead-doc_date = sy-datum.

poheadx-comp_code = c_x.

poheadx-doc_type = c_x.

poheadx-creat_date = c_x.

poheadx-vendor = c_x.

poheadx-langu = c_x.

poheadx-purch_org = c_x.

poheadx-pur_group = c_x.

poheadx-doc_date = c_x.

  • Item Level Data

poitem-po_item = 1.

poitem-material = p_matnr.

poitem-plant = p_werks.

poitem-stge_loc = p_lgort.

poitem-quantity = p_menge.

append poitem.

poitemx-po_item = 1.

poitemx-po_itemx = c_x.

poitemx-material = c_x.

poitemx-plant = c_x .

poitemx-stge_loc = c_x .

poitemx-quantity = c_x .

poitemx-tax_code = c_x .

poitemx-item_cat = c_x .

poitemx-acctasscat = c_x .

append poitemx.

  • Schedule Line Level Data

posched-po_item = 1.

posched-sched_line = 1.

posched-del_datcat_ext = 'D'.

del_date = sy-datum + 1.

write del_date to posched-delivery_date.

posched-deliv_time = '000001'.

posched-quantity = p_menge.

append posched.

poschedx-po_item = 1.

poschedx-sched_line = 1.

poschedx-po_itemx = c_x.

poschedx-sched_linex = c_x.

poschedx-del_datcat_ext = c_x.

poschedx-delivery_date = c_x.

poschedx-quantity = c_x.

append poschedx.

call function 'BAPI_PO_CREATE1'

exporting

poheader = pohead

poheaderx = poheadx

testrun = ' '

importing

exppurchaseorder = ex_po_number

expheader = exp_head

tables

return = return

poitem = poitem

poitemx = poitemx

poschedule = posched

poschedulex = poschedx.

call function 'BAPI_TRANSACTION_COMMIT'

exporting

wait = 'X'.

if not ex_po_number is initial.

call function 'DEQUEUE_ALL'.

else.

call function 'DEQUEUE_ALL'.

  • message i036.

Check this

http://www.sap-img.com/abap/bapi-step-by-step-guidance.htm

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

<b>Reward is usefull</b>

Former Member
0 Kudos

Hi Vasu,

Bapi are programming interfaces to acess sap db from within in sap or from other independent platforms.

Bapi is middleware component in sap . bapi deals with business object. to create business object SWo1,

Regards,

Sana

reward if helpful....

Former Member
0 Kudos

Hi,

check for this , link...

help.sap.com/saphelp_nw04/helpdata/en/e0/9eb2370f9cbe68e10000009b38f8cf/frameset.htm

help.sap.com/saphelp_46c/helpdata/en/a5/3ec8464ac011d1894e0000e829fbbd/content.htm

https://wiki.sdn.sap.com/wiki/display/Snippets/BAPI+Step-by-Step

articles.techrepublic.com.com/5100-6329-1051160.html

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

Regards,

Sana.

Former Member
0 Kudos

hai sri vasu,

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.