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: 

how to work with BAPI's

Former Member
0 Kudos

Hi,

Can u explain me how to work with Bapi's , If possible can u send me some sample programs regarding Bapi's

Thanks

5 REPLIES 5

Former Member
0 Kudos

hii,

Following are the Documents

Bapi to create customer master

-


BAPI_CUSTOMER_CREATEFROMDATA

BAPI_CUSTOMER_CREATEFROMDATA1

Or you can use FM SD_CUSTOMER_MAINTAIN_ALL

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.

Check these Links out

http://searchsap.techtarget.com/ateQuestionNResponse/0,289625,sid21_cid558752_tax293481,00.html

http://www.sap-img.com/abap/interview-question-on-bapi-rfc-abap-objects-tables.htm

http://www.sap-img.com/fu033.htm

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

Please check out this thread..

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

Java Connector(JCO) can call not only BAPI's but also the function modules which are remotely enabled..

BAPI's as i said earlier are remotely enabled function modules..

Hence, JCO can call also BAPI's(n not only BAPI's as u mentioned).

follow these links

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

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

http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html

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

http://www.allsaplinks.com/bapi_example.html

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

For More Info check this thread.

https://forums.sdn.sap.com/click.jspa?searchID=2721366&messageID=1761503

/thread/415825 [original link is broken]

Edited by: sharad narayan on Apr 29, 2008 12:12 PM

Former Member
0 Kudos

hi,

Follow this link for step by step tutorial with screen shots.

http://www.saptechnical.com/Tutorials/BAPI/BAPIMainPage.htm

Hope this helps, Do reward

Former Member
0 Kudos

Programming a BAPI consists of some tasks like:

• Defining BAPI Data structures ( using SE11 )

• Creating BAPI Function Modules (For each method)

• Defining BAPI Methods in the BOR

• Generate and release

1. Defining BAPI Data structures: This is the basic step followed while creating BAPIs. All the relevant structures that are required for BAPI have to be created using T-Code SE11. The structures can be created for Import/Tables parameters.

2. Creating BAPI Function Modules: We must create new function group for each BAPI. If the BAPIs are related then the same can be grouped under the same FUNCTION GROUP to enable the sharing of global data amongst the related BAPIs.

3. Defining BAPI Methods in the BOR: When creating a new object type in BOR (Business Object Repository), there can be two possibilities. Either it is created as a subtype of an existing business object or it is created as a new business object from scratch. Create a business object using the T-Code SWO1. The business object gets created with the standard interface that contains an Interface IFSAP, an Attribute ObjectType, and two methods namely ExistenceCheck and Display. All these cannot be changed. You can add a method to the business object. For this, we will choose from the menu path, Utillities -> API methods -> Add method. To use the business object Object type status has to be set to Implemented.

4. Generate and Release: Go to SE37 and release the API enabled Function module. In the Object created in the BOR, set the status of Object Type Component to Released.

You can then display the BAPI in the BAPI Explorer. Invoke the same using the T-code BAPI.

Also have a look at below links.

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

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/saphelp_nw04/helpdata/en/a5/3ec9f74ac011d1894e0000e829fbbd/frameset.htm

http://www.allsaplinks.com/bapi.html

http://www.allsaplinks.com/bapi_example.html

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

http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html

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

I hope it helps.

Best Regards,

Vibha

Please mark all the helpful answers

Former Member
0 Kudos

hai

this is a return code information

1.) bapireturn

2.) bapireturn1

3.) bapiret1

4.) bapiret2

sap transactions

1.)se11

2.)se37

3.)sw01 ( business object builder) , sw02( business object browser)

4.)bapi business object browser

here the step you follow to configure the bapi

step 1.) define the structure for the bapi

step 2) write functional module

step 3) create the api method using the bapi wizard

step 4) final steps

use t-code se11 then data type ->structure

define the structure name zbap_struct1.

note that all structure , function , object , program are start with zbapi

1.) in se11

enter the structure name in data type field

2.)click create

3)choose the structure

4.)continue button

5)what are the components u want just add

say ex.

name,

rollno,

mark1,

mark2,

mark3

etc

6.)activate the structure

7.) in se37

8.) create the functional module say zbapi_funct1 in the function group ygroup1.

9.) click attribute tab and choose the remote enable module,

10.) import the parameter

such as rollno, they are called by value

11.)export the parameter say bapireturn

12.)click the table say itab

13.)click the source code

and write the coding

select name rollno mark1 mark2 mark3 from ysustab1 into corresponding fields of table itab where rollno = rollno.

save and activate the functional module.

14.)release the fm

by choosing functional module-> release->release

or

ctrl+F10.

15.)

in tcode sw01

create the object type,object name, name ,desc, program, application

say

zbapi_obj1,zbap_obj1,zbapi_obj1, student details, zbapi_obj1 ,* it represents the cross applications

16.) expand the methods

there are two objects defaulty created

17)put the cursor on the methods

and go utilities-> api methods -> add method.

18) give the fm name that already u created by se37

19) click the play button shown below

20.)tick yes

21) there should be a one api method appended below the already created two default objects.

22.)select the bapi object type shown above

23) and go edit ->change release status->object type->to implemented

24)edit ->change release status->object type->to released

25)select the api method

26)

edit ->change release status->object type component->to implemented

27)edit ->change release status->object type component-> to released

28)click on generate button

29) give the rollno

30) it should depicted the entries corresponding to the rollno

regards

surender.s

Former Member
0 Kudos

Hi,

Please refer the link below:

http://www.saptechnical.com/Tutorials/BAPI/BAPIMainPage.htm

Thanks,

Sriram Ponna.