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

problem in using function module parameters in abap program

Former Member
0 Likes
413

i want to use the coding present in on one of the function module 'AS_API_INFOSTRUC_FIND' i got the problem using the function module parameters in my abap program.

these are the parameters inside fm

""Lokale Schnittstelle:

*" IMPORTING

*" VALUE(I_FIELDCAT) TYPE AIND_FCAT

*" VALUE(I_FIELDS) TYPE TABLE OPTIONAL

*" VALUE(I_OBLIGATORY_FIELDS) TYPE TABLE OPTIONAL

*" EXPORTING

*" VALUE(E_INFOSTRUC) TYPE AIND_DESC

*" REFERENCE(E_ALL_FIELDS) TYPE TABLE

*" REFERENCE(E_MATCHING_FIELDS) TYPE TABLE

*" EXCEPTIONS

*" NO_INFOSTRUC_FOUND

i want to declare E_ALL_FIELDS parameter in my abap program,

i have declared as

data: E_ALL_FIELDS TYPE TABLE.

but the system throws error that

'type of field 'TABLE' is generic .no table line has been specified'.

i want to use it in my abap program how can i declare in my abap program .

1 ACCEPTED SOLUTION
Read only

former_member209703
Active Contributor
0 Likes
349

You have to declare the table using any specific type.

The type table in the FM is generic so you can pass any type you need.

For instance:



TYPES: BEGIN OF ty_fields,
         fieldname LIKE dfies-fieldname,
       END OF ty_fields,



TYPES: TY_T_GLU1              LIKE GLU1                     OCCURS 0,
       ty_t_fields            type ty_fields                occurs 0.



  DATA: lt_info_struct_fields TYPE ty_t_fields WITH HEADER LINE,
        lt_matching_fields    TYPE ty_t_fields WITH HEADER LINE.


    CALL FUNCTION 'AS_API_INFOSTRUC_FIND'
         EXPORTING
              i_fieldcat         = ft_fieldcat-fieldcat
              i_fields           = ft_fields_filled[]
         IMPORTING
              e_infostruc        = lv_info_struct_name
              e_all_fields       = lt_info_struct_fields[]
              e_matching_fields  = lt_matching_fields[]
         EXCEPTIONS
              no_infostruc_found = 1.




1 REPLY 1
Read only

former_member209703
Active Contributor
0 Likes
350

You have to declare the table using any specific type.

The type table in the FM is generic so you can pass any type you need.

For instance:



TYPES: BEGIN OF ty_fields,
         fieldname LIKE dfies-fieldname,
       END OF ty_fields,



TYPES: TY_T_GLU1              LIKE GLU1                     OCCURS 0,
       ty_t_fields            type ty_fields                occurs 0.



  DATA: lt_info_struct_fields TYPE ty_t_fields WITH HEADER LINE,
        lt_matching_fields    TYPE ty_t_fields WITH HEADER LINE.


    CALL FUNCTION 'AS_API_INFOSTRUC_FIND'
         EXPORTING
              i_fieldcat         = ft_fieldcat-fieldcat
              i_fields           = ft_fields_filled[]
         IMPORTING
              e_infostruc        = lv_info_struct_name
              e_all_fields       = lt_info_struct_fields[]
              e_matching_fields  = lt_matching_fields[]
         EXCEPTIONS
              no_infostruc_found = 1.