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

Call Multiple BAPI's at dynamically

Former Member
0 Likes
860

Hello All,

i have a requirement where, i will receive a file having a Bapi name, its required import parameters with name and values, its exporting parametres and return table parameters with fname and values.

it can be any BAPI of the system in that file.

I looked and searched very much, and got following way.

Create a BAPI Gateway Function object.

1. Find the Repository Services IFunction object for the function module you wish to call. You

do so by finding the specific IFunction object in the IFunctions collection of the Repository

Services.

2. Use the CreateFromRepository method of the BAPI Gateway Function object to copy the

metadata of the Repository Services IFunction object into the BAPI Gateway Function object.

3. Use the Call method of the BAPI Gateway Function object to call function module.

4. If no error occurred when calling the function module, get the data returned through the

export parameters of the function call.

You can use the AdviseRfcGuiSink method of the BAPI Gateway Function object before calling

the function. This invokes the SAPGUI, if it is installed, running the ABAP Debugger. It then hits a

breakpoint at the next RFC call.

But i am unable to implement/understand these points, so can anybody help me in this or can suggest any other way of doing such..

Regards,

Nitin.

3 REPLIES 3
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
668

do you need to call it in custom program itself ?

The bapi is also a function module. So the same applies for calling the function module dynamically.

For example refer function module, you will find a line like below. Look at the function module PRICING_SUBSCREEN_SET_DATA and check how to populate p_tab & e_tab.


 CALL FUNCTION 'PRICING_SUBSCREEN_PBO' PARAMETER-TABLE p_tab
                                       EXCEPTION-TABLE e_tab.

Now if name is dynamic then


lf_bapi_name = 'BAPI_ROUTING_CREATE'.
CALL FUNCTION lf_bapi_name PARAMETER-TABLE p_tab
                           EXCEPTION-TABLE e_tab.

Read only

0 Likes
668

Hi,

yes i have to create/call it in a custom program.

and i cant see any link.

And i ant to ask you that how to proceed if :

1. A Bapi to be called dynamically has 3 Importing Structures, 2 Importing Tables

3 exporting Structures, 3 exporting Tables

2 returning Structures, 2 returning Tables.

mean how to deal with all under the same PARA_TAB.

Read only

0 Likes
668

Hi,

Apart from my example you can view this link for sample code

[Calling function modules dynamically|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/840ad679-0601-0010-cd8e-9989fd650822#q-29]