How to hide a column on table grid

Problem: you have a table grid control on a screen and you want to hide a column on this grid.

Solution: First of all you need to find variable which represents your table grid. If you have used a wizard to put table grid on your screen this variable will be defined in the top include of your report.

Now, that you have this variable all you need to do is loop through its column definition table and hide the one that you don’t want to show.

  DATA:
    ld_column TYPE REF TO cxtab_column.

* hide column My_Column
  LOOP AT tctrl_my_table-cols REFERENCE INTO ld_column.
    IF ld_column->screen-name CS 'MY_COLUMN'.
      ld_column->invisible = 1.
    ENDIF.
  ENDLOOP.

And that is it! The column will be invisible from now on.

Komentowanie jest zakończone.