‎2010 Oct 05 11:56 AM
Hi,
I want to read a Function module and its parameter dynamically in ABAP Coding not with SE37. Is there a function module or other utility in SAP to do this?
Kindly
Barbara
‎2010 Oct 05 12:36 PM
>
> Hi,
> I want to read a Function module and its parameter dynamically in ABAP Coding not with SE37. Is there a function module or other utility in SAP to do this?
>
> Kindly
>
> Barbara
Ok, i remember this one. Do you want to EXECUTE the function dynamically or READ the content of the function?
‎2010 Oct 05 12:30 PM
Could be littile more specific and clear.
put fm name in one variable v_fmname.
if not initial
call function v_fmname.
‎2010 Oct 05 12:36 PM
>
> Hi,
> I want to read a Function module and its parameter dynamically in ABAP Coding not with SE37. Is there a function module or other utility in SAP to do this?
>
> Kindly
>
> Barbara
Ok, i remember this one. Do you want to EXECUTE the function dynamically or READ the content of the function?
‎2010 Oct 05 12:57 PM
Both, I want to rad the funtion module to ge the parameters and if possible execute the function module dynamically.
Kindly
Barbara
‎2010 Oct 05 1:03 PM
‎2010 Oct 05 1:08 PM
I have yet to find an example in SAP where a function call was programmed dynamically including its interface.
What you normally will find is a dynamic call to a function but with a static interface.
Example:
CALL FUNCTION gv_some_function
IMPORTING
.... etc.The only thing that is dynamically is the function name in variable gv_some_function.
Does it mean it isn't possible? I really wouldn't know as i never have seen it before.
‎2010 Oct 05 1:12 PM
Having said my previous post, i had a look at the F1 on CALL FUNCTION.
It seems to be possible to have a fully dynamic call to a function.
Read the help on:
CALL FUNCTION - parameter_tables
‎2010 Oct 05 1:16 PM
Hi,
For getting the paramets you can use the table FUPARAREF , which has been already mentioned.
you can also call the function moudle dynamically with its parameters..
for that you need to populate one internal table and pass that table insted of import, export ..etc ..
sample program ..
TYPE-POOLS abap.
DATA: line TYPE c LENGTH 80,
text_tab LIKE STANDARD TABLE OF line,
filename TYPE string,
filetype TYPE c LENGTH 80,
fleng TYPE i.
DATA: func TYPE string,
ptab TYPE abap_func_parmbind_tab,
ptab_line TYPE abap_func_parmbind,
etab TYPE abap_func_excpbind_tab,
etab_line TYPE abap_func_excpbind.
func = 'GUI_DOWNLOAD'.
filename = 'c:\temp\text.txt'.
filetype = 'ASC'.
ptab_line-name = 'FILENAME'.
ptab_line-kind = abap_func_exporting.
GET REFERENCE OF filename INTO ptab_line-value.
INSERT ptab_line INTO TABLE ptab.
ptab_line-name = 'FILETYPE'.
ptab_line-kind = abap_func_exporting.
GET REFERENCE OF filetype INTO ptab_line-value.
INSERT ptab_line INTO TABLE ptab.
ptab_line-name = 'DATA_TAB'.
ptab_line-kind = abap_func_tables.
GET REFERENCE OF text_tab INTO ptab_line-value.
INSERT ptab_line INTO TABLE ptab.
ptab_line-name = 'FILELENGTH'.
ptab_line-kind = abap_func_importing.
GET REFERENCE OF fleng INTO ptab_line-value.
INSERT ptab_line INTO TABLE ptab.
...
etab_line-name = 'OTHERS'.
etab_line-value = 10.
INSERT etab_line INTO TABLE etab.
CALL FUNCTION func
PARAMETER-TABLE
ptab
EXCEPTION-TABLE
etab.
CASE sy-subrc.
WHEN 1.
...
...
ENDCASE.
‎2010 Oct 05 1:20 PM
‎2010 Oct 06 7:58 AM
Jayakumar Thooyavan, thanks for your answer.
I'm sorry, but I mixed the answers and so I marked the wrong answer as "Solved problem".
It's your answer, which solved my problem.
‎2010 Oct 05 12:44 PM
Hi,
you can read the FM parameters from table FUPARAREF.
Kostas
‎2010 Oct 05 12:46 PM
Check FM : RFC_GET_FUNCTION_INTERFACE pass RFC as NONE for the current system.
‎2010 Oct 06 7:48 AM
Sorry, I mixed up the answers and but it isn't possible to correct my marks.
Edited by: Barbara Mader on Oct 6, 2010 8:57 AM