Function - dynamic export parameter
I have several similar ODSs objects, i would like to read their content (export paramater = structure of the ODS), but i don't want to create the function for every ODS. Is it possible set up export parameter as dynamic or do you have another solution ?
Thanks for advice in advance
Durairaj Athavan Raja replied
declare the import parameter as type ref to DATA
in the program calling the FM first fill this itab with data .
data: itab type <ODSNAMETABLENAME> .
data: odstab type ref to data .
*fill data to itab
get reference of itab into odstab .
now pass this odstab to the FM import parameter (which of type ref to data)
in this approach only the program which is calling the FM whould know the odstable name in design time. this can also be avoided by dynamically creating the itab.
within the FM code you can have the following code to convert the type ref to DATA vairalbe to a itab.
field-symbols: <outtab> type any table .
assign var->* to <outtab> . (where var is the import parameter name which is of type ref to DATA)
Hope this is clear.
Sorry, didnt read the question carefully and missed that you want it as export parameter. you can use similar approach for export param as well
Message was edited by:
Durairaj Athavan Raja