2007 Feb 28 10:23 AM
Hello,
Is there a way to call dynamically a FM? I can get on run-time the FM name, but what about the export&import parameters? How do you handle that? An example would be very usefull.
Thank you!
2007 Feb 28 10:46 AM
Let's say that I have the FM names and parameters in a configuration table. Depending on a selection screen parameter, I must select the proper FM name and parameters and call the FM. The number of parameter differs from one FM to another. So, how can I call the FM?
Let's say that I have the FM names and parameters in a configuration table. Depending on a selection screen parameter, I must select the proper FM name and parameters and call the FM. The number of parameter differs from one FM to another. So, how can I call the FM?
2007 Feb 28 10:25 AM
HI George,
Even if you get the function module name at the run time, a function module with that name will still be statically defined in se37.
You can see that in the se37 transaction and find the parameters for the same.
then you can simple use those exporting and importing parameters.
call function v_fm_name
exporting
field1 =
importing fiel2 = ..
Regards,
Ravi
2007 Feb 28 10:27 AM
Hi
U can only manage the name of the fm dynamically, but not the interface.
So you can only manage several fms with the same interface:
DATA: FUNCTION_NAME(30) TYPE C.
IF ......
FUNCTION_NAME =
ELSE
FUNCTION_NAME =
ENDIF.
CALL FUNCTION FUNCTION_NAME
EXPORTING
....................
IMPORTING
.....................Max
2007 Feb 28 10:27 AM
Hi George,
You can write Case Statement or condition u can branch to the required FM.
Darshan
2007 Feb 28 10:28 AM
i think it is not possible.
but you can do like this
if fmnae = 'ABC'.
call fn 'ABC'.
elsif fmname = 'DEF'.
call fm 'DEF'.
endif.
like that.
regards
shiba dutta
2007 Feb 28 10:46 AM
Let's say that I have the FM names and parameters in a configuration table. Depending on a selection screen parameter, I must select the proper FM name and parameters and call the FM. The number of parameter differs from one FM to another. So, how can I call the FM?
2007 Feb 28 10:50 AM
Hi!
lv_function = 'function1'.
fill itab_para with parameters for dynamic parameters
CALL FUNCTION lv_function
PARAMETER-TABLE itab_para.
Example from ABAP help:
type-pools ABAP.
data NAME type STRING value `ABAP_DOCU_SHOW`.
data PARA_TAB type ABAP_FUNC_PARMBIND_TAB.
data PARA_LINE like line of PARA_TAB.
data AREA(4) type C.
data OBJECT(30) type C.
AREA = 'ABAP'.
PARA_LINE-NAME = 'AREA'.
PARA_LINE-KIND = ABAP_FUNC_EXPORTING.
get reference of AREA into PARA_LINE-VALUE.
append PARA_LINE to PARA_TAB.
OBJECT = 'CLASS'.
PARA_LINE-NAME = 'NAME'.
PARA_LINE-KIND = ABAP_FUNC_EXPORTING.
get reference of OBJECT into PARA_LINE-VALUE.
append PARA_LINE to PARA_TAB.
call function NAME
parameter-table PARA_TAB.
Regards
Tamá
2007 Feb 28 10:50 AM
Hi George,
I think you can use a recording over the transation se 37 and place the function modules name that you have dynamically retrieved there in the func. module name field and then press the run button , in this next screen place the input parameters and then capture the required output value.
Regards,
Sunmit.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |