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

Former Member
0 Likes
5,108

Hi Experts,

Where can I find the Bapi Function Modules.

Can u provide me the coding part of how to use BAPI in our program .

Will be rewarded if helpful.

Regards.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,038

hi,

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.

http://help.sap.com/saphelp_46c/helpdata/en/9b/417f07ee2211d1ad14080009b0fb56/frameset.htm

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

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

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

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

Kishore

6 REPLIES 6
Read only

Former Member
0 Likes
3,038

Go to the transaction BAPI.

The bapis are classified according to application area.

Once you know the bapi name, you can go to se37 transaction to find the code for that bapi.

Regards,

Ravi

Message was edited by:

Ravi Kanth Talagana

Read only

Former Member
0 Likes
3,038

hi,

Check these threads..

Hope this Helps !!

Cheers

Alfred

Read only

Former Member
0 Likes
3,038

Hi,

Check the transaction code BAPI.

in which you can find the BAPIs according to application area(Ex : MM, SD ,PP etc.,)

If you get the required bapi name, you can go to se37 transaction code to find the code for that bapi and use in your program accordingly.

To know more about the BAPI function module, you can go to its code and click on the 'Function module documentation' button.

Regards.

Read only

Former Member
0 Likes
3,038

Hi Raj,

Foremost of all before you can search for a BAPI you should know the BAPI you are going to use depending on your need. Generally when you are in a project the Functional Consultant gives you the BAPI which you need to use unless you are developing your own BAPI.

By going to the Transaction BAPI, you can search for the BAPI you need. This transaction takes you to the BAPI Explorer where all the BAPI’s are listed in two ways,

• Alphabetical Order

• Hierarchical Order

When the BAPI you need is found you can get all the details regarding all the parameters that are used in the BAPI and also as to how they are declared. DOCUMENTATION is provided for all the BAPI parameters describing them. In the DOCUMENTATION for the BAPI you fill find how a particular BAPI can be used to perform different operations. For ex: the BAPI called BAPI_PROJECT_MAINTAIN can be used perform UPDATE or RELEASE operations.

Some useful tips when using a Standard BAPI,

• Go through all the data declarations of the BAPI parameters and check if any Conversion Rules are used. This is helpful as you will need to declare variables for every parameter in BAPI that you would be used by you. And all these variables should be declared of the same data type as the BAPI parameters.

• Check to see if there any mandatory fields that need to be passed. Look for all the BAPI parameters that you would need and declare variables for them and map them correctly.

• Though RETURN (generally a table) is may not be mandatory it’s useful to use it as any messages regarding success or error while processing the BAPI are populated in it. In some cases the RETURN may be a structure and in such a case there would another table where messages are populated. These are useful to be used in the program.

• After processing BAPI, if successful then the Function Module BAPI_TRANSACTION_COMMIT is performed to save the changes. But if it’s not successful then the Function Module BAPI_TRANSACTION_ROLLBACK is performed to rollback any changes that would have occurred.

Sample Program,

Note: 1. Here the BAPI called BAPI_PROJECT_MAINTAIN is used. This BAPI is used to

“Edit project including networks”. It can be used perform operations like UPDATE

or RELEASE and others. Here it’s used to perform UPDATE operation (Here

ROFIT_CENTER is updated).

2. Here a Function Module called “CONVERSION_EXIT_ALPHA_INPUT” is used

to convert the profit center from the External Format(Format as in the program) to

Internal Format (Format in the BAPI).

(You can use this program to check out.)

DATA: wk_i_project_definition TYPE bapi_project_definition,

wa_i_method_project TYPE bapi_method_project,

wa_i_wbs_element_table TYPE bapi_wbs_element,

it_i_method_project TYPE STANDARD TABLE OF bapi_method_project,

it_i_wbs_element_table TYPE STANDARD TABLE OF bapi_wbs_element.

DATA: wk_i_project_definition_upd TYPE bapi_project_definition_up,

wk_return TYPE bapireturn1,

wa_i_wbs_element_table_update TYPE bapi_wbs_element_update,

wa_e_message_table TYPE bapi_meth_message,

it_i_wbs_element_table_update TYPE STANDARD TABLE OF bapi_wbs_element_update,

it_e_message_table TYPE STANDARD TABLE OF bapi_meth_message.

CONSTANTS: _index(6) TYPE c VALUE '000001',

_wbselement(11) TYPE c VALUE 'WBS-ELEMENT',

_update(6) TYPE c VALUE 'UPDATE',

_save(4) TYPE c VALUE 'SAVE'.

wk_i_project_definition-project_definition = 'M-1000000000'.

wk_i_project_definition_upd-project_definition = 'X'.

wa_i_method_project-refnumber = _index.

wa_i_method_project-objecttype = _wbselement.

wa_i_method_project-method = _update.

wa_i_method_project-objectkey = 'M-1000000000:00001-003'.

APPEND wa_i_method_project TO it_i_method_project.

CLEAR wa_i_method_project.

wa_i_method_project-method = _save.

APPEND wa_i_method_project TO it_i_method_project.

wa_i_wbs_element_table-wbs_element = 'M-1000000000:00001-003'.

wa_i_wbs_element_table-profit_ctr = '65576'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = wa_i_wbs_element_table-profit_ctr

IMPORTING

output = wa_i_wbs_element_table-profit_ctr.

APPEND wa_i_wbs_element_table TO it_i_wbs_element_table.

wa_i_wbs_element_table_update-profit_ctr = 'X'.

APPEND wa_i_wbs_element_table_update TO it_i_wbs_element_table_update.

CALL FUNCTION 'BAPI_PROJECT_MAINTAIN'

EXPORTING

i_project_definition = wk_i_project_definition

i_project_definition_upd = wk_i_project_definition_upd

IMPORTING

return = wk_return

TABLES

i_method_project = it_i_method_project

i_wbs_element_table_update = it_i_wbs_element_table_update

i_wbs_element_table = it_i_wbs_element_table

  • I_WBS_MILESTONE_TABLE =

  • I_WBS_MILESTONE_TABLE_UPDATE =

  • I_WBS_HIERARCHIE_TABLE =

  • I_NETWORK =

  • I_NETWORK_UPDATE =

  • I_ACTIVITY =

  • I_ACTIVITY_UPDATE =

  • I_RELATION =

  • I_RELATION_UPDATE =

e_message_table = it_e_message_table

  • I_ACTIVITY_ELEMENT =

  • I_ACTIVITY_ELEMENT_UPDATE =

  • I_ACTIVITY_MILESTONE =

  • I_ACTIVITY_MILESTONE_UPDATE =

.

IF wk_return IS INITIAL.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN =

.

LOOP AT it_e_message_table INTO wa_e_message_table.

WRITE:/ wa_e_message_table-message_id, wa_e_message_table-message_number,

wa_e_message_table-message_type, wa_e_message_table-message_text.

ENDLOOP.

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'

  • IMPORTING

  • RETURN =

.

LOOP AT it_e_message_table INTO wa_e_message_table.

WRITE:/ wa_e_message_table-message_id, wa_e_message_table-message_number,

wa_e_message_table-message_type, wa_e_message_table-message_text.

ENDLOOP.

ENDIF.

Regards,

Raga Suman.

Read only

Former Member
0 Likes
3,039

hi,

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.

http://help.sap.com/saphelp_46c/helpdata/en/9b/417f07ee2211d1ad14080009b0fb56/frameset.htm

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

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

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

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

Kishore

Read only

0 Likes
3,038

Hi ,

Thanks for the links provided and also for the info given.

Can u provide me the code also for the same .

It will be very helpful. Will be surely rewarded for that also.

Regards