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

Function modul

Former Member
0 Likes
1,476

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,388

>

> 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?

12 REPLIES 12
Read only

Former Member
0 Likes
1,388

Could be littile more specific and clear.

put fm name in one variable v_fmname.

if not initial

call function v_fmname.

Read only

Former Member
0 Likes
1,389

>

> 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?

Read only

0 Likes
1,388

Both, I want to rad the funtion module to ge the parameters and if possible execute the function module dynamically.

Kindly

Barbara

Read only

0 Likes
1,388

where you want to read the FM from ?

Renu

Read only

0 Likes
1,388

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.

Read only

0 Likes
1,388

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

Read only

0 Likes
1,388

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.

Read only

0 Likes
1,388

copy pasta

Read only

0 Likes
1,388

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.

Read only

kostas_tsioubris
Contributor
0 Likes
1,388

Hi,

you can read the FM parameters from table FUPARAREF.

Kostas

Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,388

Check FM : RFC_GET_FUNCTION_INTERFACE pass RFC as NONE for the current system.

Read only

Former Member
0 Likes
1,388

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