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

BAPI Examples

Former Member
10,206

Hi ,

1.Can anyone please explain me what are the most commonly used BAPI across SD,FI,MM Modules

2. Please provide some sample code for the BAPI &explain me how to test BAPI

3.What are other diff between BAPI & FM ???

BAPI has clasess and methods

BAPI is remote enalbled - Any examples ??

Thanks,

Priya

6 REPLIES 6
Read only

Former Member
0 Likes
3,971

Hi,

Check out the transaction 'BAPI' it provides all the BAPI details. Also check the BAPI documentation for detailed description of the BAPI.

Regards,

Navneeth K.

Read only

Former Member
0 Likes
3,971

Hi Priya,

Simple sap BADI example

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.

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.

reward if useful

thanks and regards

suma sailaja pvn

Read only

Former Member
0 Likes
3,971

Hi Priya,

Commonly used Bapi's are----

SALES AND DISTRIBUTION----


Customer Material Info - BAPI_CUSTMATINFO_GETDETAILM

Sales order - BAPI_SALESORDER_GETLIST

Sales order - BAPI_SALESORDER_GETSTATUS

MATERIAL MANAGEMENT----


Purchase Req Item - BAPI_REQUIREMENT_GET_LIST

Purchase order - BAPI_PO_GETITEMS

Purchase order - BAPI_PO_GETITEMSREL

Purchase order - BAPI_PO_GET_LIST

Purchasing info - BAPI_INFORECORD_GETLIST

FINANCE----


AP Account - BAPI_AP_ACC_GETOPENITEMS

Debtor Credit Account - BAPI_CR_ACC_GETDETAIL

AR Account - BAPI_AR_ACC_GETOPENITEMS

AR Account - BAPI_AR_ACC_GETPERIODBALANCE

AR Account - BAPI_AR_ACC_GETSTATEMENT

another sample code for implementing BAPI

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

reward if useful...

thanks and regards

suma sailaja pvn

Read only

Former Member
0 Likes
3,971

hi kamala,

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

this link might help you..

plz reward points if useful..

Read only

Former Member
0 Likes
3,971

Hi,

Please refer to the link below :

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

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
3,971

Check this link for BAPI step by step example.

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

Also check this link..

Check this thread for differece between BAPI and FM.

Regards,

maha