Skip to Content
0
Jan 05, 2012 at 08:35 AM

Dynamic Table - Dir Full

181 Views

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