Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Pass parameters of user defined type to function module

Hi,

Is it possible to pass a table parameter of user defined type, from the calling program, to a user defined function module? If yes then how to do it? If no then is there a work around for this?

Thanks in advance!!!!

Regards,

Sriram.

Former Member
replied

A type defined in your program is only visible within your program. It is unknown to your function module. Function module parameters must either have a generic definition (Blank = ANY, STANDARD TABLE, C, CLIKE etc.) a basic type (T, I etc.) or be defined in the data dictionary.

One possible workaround - depending on what you're trying to achieve - is to define the type in the function module and the calling program, then pass the reference from the program to the FM.

e.g.

Calling program

TYPES my_table_type ...

DATA: my_table TYPE my_table_type,
     r_data TYPE REF TO DATA.
...
* populate my_table

GET REFERENCE OF my_table INTO r_data.
CALL FUNCTION MODULE 'Z_MYFM' EXPORTING ir_data = r_data. 

FM

TYPES my_table_type ...

FIELD-SYMBOLS: <my_table> TYPE my_table_type.
ASSIGN ir_data->* TO <my_table>.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question