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

Fill | Map Function input parameters dynamically from XML file

Former Member
0 Likes
795

Hi,

I am working on a requirement of executing a BAPI/RFC by passing input parameter through XML file / table .  Here BAPI name is dynamic and hence parameters.

I am able to parse the XML however challenge is to map them to input parameters.  The parameters can be deep structure as well.


Can anybody help ?


Thanks in advance.

Regards.

Prashant

3 REPLIES 3
Read only

DominikKraemer
Active Participant
0 Likes
642

Hello Prashant,

take a look at the addition PARAMETER-TABLE of CALL-FUNCTION (http://help.sap.com/abapdocu_70/de/ABAPCALL_FUNCTION_DYNAMIC.htm).

Regards,

Dominik

Read only

0 Likes
642

Hi Dominik,

Yes we will be using this parameter for calling the FM dynamically but the challenge is to fill the parameters from XML file.  The XML payload needs to be mapped to FM parameter which can be field, structure, table , nested structure. 

Regards.

Prashant

Read only

0 Likes
642

Hi, Prashant.

You need to dynamically create table using structure from xml and fill ABAP_FUNC_PARMBIND_TAB-VALUE field. If you have only flat xml with no structures like your FM parameters you will not be able to do it.

I.e. something like this ( Example - create a dynamic internal table - Code Gallery - SCN Wiki 😞

DATA: p_table type ref to data.

create data p_table type handle <your_created_dynamic_type>

field-symbols <table> type standard table.

assign p_table->* to <table>.

Add data to the table <table> using assign component and add p_table to FM param table:

data param_table type abap_func_parmbind_tab.

append initial line to param_table assigning field-symbol(<fs>).

<fs>-name = <param_name>

<fs>-kind = ABAP_FUNC_TABLES

<fs>-value = p_table