cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Table - Dir Full

michael_fallenbchel
Active Participant
0 Kudos

Hi experts,

I create a dynamic table - could be very often in the program (depends on the chosen year, calender week...).

IO know there's a limitation of 36 when I create it with cl_alv_table_create=>create_dynamic_table

This is my code:

   gs_fieldcat-datatype = 'CHAR'.
  gs_fieldcat-scrtext_l = 'TAG'.
  gs_fieldcat-fieldname = 'TAG'.
  APPEND gs_fieldcat TO gt_fieldcat.

  DO g_max TIMES.

    l_div = sy-index MOD 5.
    IF l_div = 0.
      l_div = sy-index * 20.
      gs_fieldcat-scrtext_l = l_div.
      CONDENSE gs_fieldcat-scrtext_l.
    ELSE.
      CLEAR gs_fieldcat-scrtext_l.
    ENDIF.

    l_header = sy-index.
    CONCATENATE 'ZEIT' l_header INTO l_header.
    gs_fieldcat-datatype = 'CHAR'.
    gs_fieldcat-intlen = 40.
    gs_fieldcat-outputlen = 1.
    gs_fieldcat-no_zero = 'X'.

    gs_fieldcat-fieldname = l_header.
    APPEND gs_fieldcat TO gt_fieldcat.
  ENDDO.

  CLEAR gs_fieldcat.
  gs_fieldcat-datatype = 'CHAR'.
  gs_fieldcat-intlen = 40.
  gs_fieldcat-scrtext_l = 'Bemerkung'.
  gs_fieldcat-fieldname = 'BEMERKUNG'.
  APPEND gs_fieldcat TO gt_fieldcat.

  CLEAR gs_fieldcat.
  gs_fieldcat-tech = 'X'.
  gs_fieldcat-fieldname = 'STYLE'.
  gs_fieldcat-ref_field = 'CELLTAB'.
  gs_fieldcat-ref_table = '/BEV1/SR_S_BOTTOM_GRID_CONT'.
  gs_fieldcat-scrtext_s = gs_fieldcat-scrtext_m =
  gs_fieldcat-scrtext_l = 'Style'.
  APPEND gs_fieldcat TO gt_fieldcat.

  cl_alv_table_create=>create_dynamic_table(
    EXPORTING
      it_fieldcatalog = gt_fieldcat
    IMPORTING
      ep_table = g_data_table ).

Ok, I try to make it with cl_abap_structdescr and cl_abap_tabledescr.

But how could I generate a filed that is a table (like STYLE) or the others? Any ideas or hints?

Thanks a lot

Michael

Accepted Solutions (1)

Accepted Solutions (1)

kesavadas_thekkillath
Active Contributor
0 Kudos

Hi,

Have a look at this Wiki by Uwe link:[Creating Flat and Complex Internal Tables Dynamically using RTTI|https://wiki.sdn.sap.com/wiki/display/Snippets/CreatingFlatandComplexInternalTablesDynamicallyusingRTTI]

Have a look from the comment "Add table type (LVC_T_STYL) as field to structure ==> complex structure"

Kesav

Answers (0)