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

Returning dynamic internal table as output from function module

Former Member
0 Likes
2,149

Hi,

I need to return a dynamic internal table from a normal function module. Like I will create one dynamic internal table <t_dyntable> in function module. Now i need to return this <t_dyntable> to the calling programme as output from function module.

Please let me know how it is possible.

Regards,

Vimal

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,122

See function module HR_READ_INFOTYPE. In this FM internal table INFTY_TAB is returned as output. This function module returns the INFTY_TAB whose structure will depend upon the input to FM-- infotype. From the programme where u call this function module define the internal table of structure which this FM is expected to return and use it to get the data. For this see include

BEN47F01 where this FM HR_READ_INFOTYPE has been used.

5 REPLIES 5
Read only

Former Member
0 Likes
1,122

You need to use Field Symbol to achieve the same.

Thanks

Sudharshan

Read only

0 Likes
1,122

Dear Sudharshan,

I have created the dynamic internal table using field symbols. I want to know how to define this dynamic internal table as parameter in Tables tab(SE37) and how to return this dynamic internal table as output.

Regards,

Vimal

Read only

0 Likes
1,122

Define ur table as type any table...For details see the table declaration

in FM REUSE_ALV_LIST_DISPLAY.

Regards,

Joy.

Read only

Former Member
0 Likes
1,123

See function module HR_READ_INFOTYPE. In this FM internal table INFTY_TAB is returned as output. This function module returns the INFTY_TAB whose structure will depend upon the input to FM-- infotype. From the programme where u call this function module define the internal table of structure which this FM is expected to return and use it to get the data. For this see include

BEN47F01 where this FM HR_READ_INFOTYPE has been used.

Read only

uwe_schieferstein
Active Contributor
0 Likes
1,122

Hello Vimal

If you fm is not RFC-enabled then you can export a data reference of your dynamic itab, e.g.:


DATA:
  ldo_itab           TYPE REF TO data.

FIELD-SYMBOLS:
  <lt_itab>          TYPE TABLE.

  CALL FUNCTION 'Z_...'
    IMPORTING
      edo_reference = lde_itab.

  ASSIGN ldo_itab->* TO <lt_itab>.

Regards

Uwe