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 create program for bapi?

Former Member
0 Kudos

hi all,

how to create program for bapi?

reply me soon now.....

can anybody help me.....

thanks,

S.Suresh.

Title was edited by:

Alvaro Tejada Galindo

5 REPLIES 5

Former Member
0 Kudos

give me your email id

Former Member
0 Kudos

Former Member
0 Kudos

Hi ...Here is the step by step procedure for creating BAPIs.

There are 5 different steps in BAPI.

- Create BAPI Structure

- Create BAPI Function Module or API Method.

- Create BAPI object

- Release BAPI Function Module.

- Release BAPI object.

Step1. Creating BAPI Structure:

- Go to <SE11>.

- Select Data Type & Enter a name.

- Click on Create.

- Note: Always BAPI should be in a development class with request number (Not Local Object).

- Select Structure & hit ENTER.

- Enter the fields from your database. Make sure that the first field is the Primary Key Field.

- Then SAVE & ACTIVATE.

Step 2. Creating BAPI module:

- Enter TR.CODE <SE37>.

- Before entering any thing, from the present screen that you are in, select the menu

Goto -> Function Groups -> Create Group.

Enter a name (Note: This name Must start with ZBAPI)

Let this screen be as it is and open another window and there, enter TR.CODE <SE80).

Click on the Third ICON that says Inactive Objects.

Select the group that you just created and click on Activate.

Notice that the group you created will disappear from the list of inactive objects.

- Go back to ><SE37> screen and enter a name and hit <ENTER>. Then enter the group name that you just created and activated.

NOTE: When you release a function module the respective group will be attached to that particular application. It cannot be used for any other application. NEVER include an already existing group that is attached to another module.

Now click on the first Tab that says [ATTRIBUTES] and select the radio button that says remote-enabled module since we will be accessing this from any external system.

Then click on the second tab that says [IMPORT].

Enter a PARAMETER NAME, TYPE and the structure you created in the first step. Also select the check box ‘Pa’. All remotely enabled functional modules MUST be Pa enabled, where Pa means ‘Passed by Value’ and if you don’t select ‘Pa’, then that means it will be passed by reference..

Then click on tab that says [EXPORT].

Enter the following as is in the first three fields

RETURN TYPE BAPIRETURN (These 3 field values are always same)

Here also select ‘Pa’ meaning Pass by value.

Note: BAPIRETURN contains structure with message fields.

Then SAVE and ACTIVATE.

Step 3. Creating BAPI object:

- Enter Tr.Code <SWO1> (Note. It is letter ‘O’ and not Zero).

- Enter a name and then click on create. Enter details.

NOTE: Make sure that that Object Type and Program name are SAME.

- Enter Application ‘M’, if you are using standard table Mara. If you are using your own database then select ‘Z’ at the bottom.

- Then hit <ENTER>.

- Now we have to add ‘Methods’. High light METHODS and then select the following from the menu:

Goto Utilities -> API Methods -> Add Methods.

- Enter function Module name and hit <ENTER>.

- Select the second FORWARD ARROW button (>)to go to next step.

- Check if every thing looks ok and again click on FORWARD ARROW button (>).

- Then select ‘YES’ and click on <SAVE>.

- Now on a different screen goto TR.CODE <SE37>. Enter Function Module name and select from the top menu Function Module -> Release -> Release.

- Goback to TR.CODE <SWO1>.

Here select the menu combination shown below in the same order.

- Edit -> Change Release Status -> Object Type Component -> To Implemented.

- Edit -> Change Release Status -> Object Type Component -> To Released.

- Edit -> Change Release Status -> Object Type -> To Implemented.

- Edit -> Change Release Status -> Object Type -> To Released.

- Then click on <SAVE>.

- Then click on Generate Button (4th button from left hand side looks like spinning wheel).

- Then Click on the button that says ‘PROGRAM’ to see the source code.

To check if this is present in work flow goto TR.CODE <BAPI>.

Here it shows business object repository.

- First click on the middle button and then select “ALL” and hit ENTER.

- Goto tab [ALPHABETICAL] and look for the object that you created. This shows that the BAPI object has been created successfully

Overall Info :

http://help.sap.com/saphelp_47x200/helpdata/EN/00/32a43697bc11d1acf9080009b0fb56/frameset.htm

BAPI Creation Info :

http://help.sap.com/saphelp_47x200/helpdata/EN/e0/9eb2370f9cbe68e10000009b38f8cf/frameset.htm

Reference :

http://help.sap.com/saphelp_47x200/helpdata/EN/00/32a43697bc11d1acf9080009b0fb56/frameset.htm

http://help.sap.com/saphelp_47x200/helpdata/EN/00/32a43697bc11d1acf9080009b0fb56/frameset.htm

http://help.sap.com/saphelp_47x200/helpdata/EN/e0/9eb2370f9cbe68e10000009b38f8cf/frameset.htm

harimanjesh_an
Active Participant
0 Kudos

hi suresh,

Just select ut BAPI according to requirement or create ur own bapi.....

And in SE38, call this BAPI similar to function module..

Example, if i want to implement <b>'BAPI_SALESORDER_GETLIST'</b> bapi in my program then check this code....

PARAMETER : p_kunnr TYPE bapi1007-customer, "similarly declared in BAPI

p_vkorg TYPE bapiorders-sales_org.

DATA : t_order TYPE TABLE OF bapiorders," WITH HEADER LINE,

wa_order TYPE bapiorders.

START-OF-SELECTION.

CALL FUNCTION 'BAPI_SALESORDER_GETLIST'

EXPORTING

customer_number = p_kunnr

sales_organization = p_vkorg

  • MATERIAL =

  • DOCUMENT_DATE =

  • DOCUMENT_DATE_TO =

  • PURCHASE_ORDER =

  • TRANSACTION_GROUP = 0

  • PURCHASE_ORDER_NUMBER =

  • IMPORTING

  • RETURN =

TABLES

sales_orders = t_order

.

IF t_order[] IS NOT INITIAL.

LOOP AT t_order INTO wa_order.

WRITE : / wa_order-sd_doc,

wa_order-itm_number,

wa_order-material,

wa_order-short_text,

wa_order-doc_type.

ENDLOOP.

ELSE.

WRITE : / 'No Data'.

ENDIF.

<b><REMOVED BY MODERATOR></b>

Harimanjesh AN

Message was edited by:

Alvaro Tejada Galindo

Former Member
0 Kudos

<b><REMOVED BY MODERATOR></b>

Message was edited by:

Alvaro Tejada Galindo