Application Development 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: 

Limits of ALV Grid

rainer_hbenthal
Active Contributor
0 Kudos
465

Hi,

how many Columns does ALV Grid support? Or is there no limit?

//Rainer

1 ACCEPTED SOLUTION

Former Member
78

This message was moderated.

5 REPLIES 5

Former Member
0 Kudos
78

This message was moderated.

Former Member
0 Kudos
78

This message was moderated.

former_member196280
Active Contributor
0 Kudos
78

It can support 99 columns and you can surpress fields.

Regards,

Sairam

Former Member
79

This message was moderated.

uwe_schieferstein
Active Contributor
0 Kudos
78

Hello Rainer

With the following sample report I had no problem to create and display an ALV list having 6.900 columns.

*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_RTTI_CREATE_ITAB_1
*&
*&---------------------------------------------------------------------*
*& NOTE: check limitation of columns for ALV list
*&
*&---------------------------------------------------------------------*

REPORT  zus_sdn_rtti_create_itab_1.


TYPE-POOLS: abap.




DATA:
  gd_tabnam        TYPE string,
  gd_tabfield      TYPE string,
  gd_fldname       TYPE fieldname,
  go_table         TYPE REF TO cl_salv_table,
  go_sdescr        TYPE REF TO cl_abap_structdescr,
  go_sdescr_new    TYPE REF TO cl_abap_structdescr,
  go_tdescr        TYPE REF TO cl_abap_tabledescr,
  go_typedescr     TYPE REF TO cl_abap_typedescr,
  gdo_handle       TYPE REF TO data,
  gs_component     TYPE abap_compdescr,
  gt_components    TYPE abap_compdescr_tab,
*
  gs_comp          TYPE abap_componentdescr,
  gt_comp          TYPE abap_component_tab.
*


FIELD-SYMBOLS:

  <gt_p0002x>        TYPE STANDARD TABLE.


PARAMETER:
  p_tabnam      TYPE tabname  DEFAULT 'P0002',
  p_repeat      TYPE i        DEFAULT '1'.




START-OF-SELECTION.



  " Describe structure
  go_sdescr ?= cl_abap_structdescr=>describe_by_name( p_tabnam ).
  gt_components = go_sdescr->components.


  REFRESH: gt_comp.
  DO p_repeat TIMES.
    LOOP AT gt_components INTO gs_component.
      "   Build fieldname
      CONCATENATE p_tabnam gs_component-name INTO gd_tabfield
                                              SEPARATED BY '-'.

      CLEAR: gs_comp.
     gs_comp-type ?= cl_abap_datadescr=>describe_by_name( gd_tabfield ).
      gs_comp-name  = gs_component-name.
      APPEND gs_comp TO gt_comp.
    ENDLOOP.

  ENDDO.

  " Renaming of columns
  LOOP AT gt_comp INTO gs_comp.
    WRITE syst-tabix TO gd_fldname NO-ZERO.
    REPLACE ALL OCCURRENCES OF '.' IN gd_fldname WITH ' '.
    CONDENSE gd_fldname NO-GAPS.
    CONCATENATE 'COLUMN_' gd_fldname INTO gd_fldname.
    CONDENSE gd_fldname NO-GAPS.
    gs_comp-name = gd_fldname.

    MODIFY gt_comp FROM gs_comp INDEX syst-tabix.
  ENDLOOP.

  DESCRIBE TABLE gt_comp.
  MESSAGE s398(00) WITH 'No. of columns =' syst-tfill space space.


  " Display component list
  TRY.
      CALL METHOD cl_salv_table=>factory
        IMPORTING
          r_salv_table = go_table
        CHANGING
          t_table      = gt_comp.
      go_table->display( ).
    CATCH cx_salv_msg .
  ENDTRY.

  go_sdescr_new  = cl_abap_structdescr=>create( gt_comp ).
  go_tdescr      = cl_abap_tabledescr=>create( go_sdescr_new ).
  "   Create data refence followed by table creation
  CREATE DATA gdo_handle TYPE HANDLE go_tdescr.

  ASSIGN gdo_handle->* TO <gt_p0002x>.

  DO 10 TIMES.
    APPEND INITIAL LINE TO <gt_p0002x>.
  ENDDO.

  TRY.
      CALL METHOD cl_salv_table=>factory
        IMPORTING
          r_salv_table = go_table
        CHANGING
          t_table      = <gt_p0002x>.
      go_table->display( ).
    CATCH cx_salv_msg .
  ENDTRY.


END-OF-SELECTION.

Regards

Uwe