Skip to Content
0
Former Member
May 27, 2008 at 02:41 PM

How to populate field catalogue fields in ALV using dynamic internal table

175 Views

Hi All,

Please let me know how to populate field catalogue fields in ALV using dynamic internal table.

I have created <dyn_table> using code below.

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

  • it_fieldcatalog = g_t_ifc

it_fieldcatalog = g_t_fieldcat

IMPORTING

ep_table = dy_table.

ASSIGN dy_table->* TO <dyn_table>.

  • Create dynamic work area and assign to FS

CREATE DATA dy_line LIKE LINE OF <dyn_table>.

ASSIGN dy_line->* TO <dyn_wa>.

Now this <dyn_table> has fields like idoc no.,creation date ,

segment field 1, segment field 2 etc..Now idoc no.,creation date are static fields from table EDIDC. And segment field 1, segment field 2 etc are dynamic fields from table EDSAPPL.

In my ALV report I am getting the final layout properly but I am unable to move values to corresponding fields in the final layout shown.Please let me know how to populate these fields from different tables.

I tried this way but its not working.

SORT g_t_edid4 BY docnum.

LOOP AT g_t_edidc INTO g_r_edidc.

READ TABLE g_t_edid4 into g_r_edid4

WITH KEY docnum = g_r_edidc-docnum

BINARY SEARCH.

IF sy-subrc = 0.

<dyn_wa> = g_r_edid4-sdata.

MOVE-CORRESPONDING g_r_edid4 to <dyn_wa>.

  • CLEAR g_r_edid4.

ENDIF.

MOVE-CORRESPONDING g_r_edidc to <dyn_wa>.

APPEND <dyn_wa> TO <dyn_table>.