‎2015 Jul 24 10:29 AM
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
‎2015 Jul 27 2:35 PM
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
‎2015 Jul 28 5:35 AM
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
‎2015 Jul 28 6:31 AM
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