Purpose
Suppress all the superfluous columns in a table, leaving only the few we want
Solution
Use the GetFieldAttribute statement in a loop over all columns

Example
In transaction IW32 (Change Service Order) the service order operations are displayed in a table control with 89 columns:



For a particular application we only want to display 6 columns so that the user does not need to scroll horizontally and search the columns that he needs:



Instead of deleting 83 columns by their individual names we use a loop over all columns and exclude the ones that we want to keep. In addition we set some layout properties for the remaining columns:

GuiXT Script 

if Q[Transaction=IW32] and Q[Page=Operations]

  // column index
  Set V[k] 0

  label next_column
 
Set V[k] &V[k] + 1
   
GetFieldAttribute [table,&V[k]] techName="colname"

  if Q[ok]

    // columns to be shown
        if V[colname=AFVGD-VORNR] _
    or V[colname=AFVGD-LTXA1] _
   
or V[colname=AFVGD-ARBEI] _
    or V[colname=AFVGD-ARBEH] _
    or V[colname=AFVGD-FSAVD] _
    or V[colname=AFVGD-FSAVZ]

    goto next_column

   endif

   // suppress all other columns
      ColumnSize [table,&V[k]] 0

      goto next_column

  endif

   // column order
  ColumnOrder [Table,AFVGD-VORNR] 1
  ColumnOrder [Table,AFVGD-FSAVD] 2
  ColumnOrder [Table,AFVGD-FSAVZ] 3

    // column width
  ColumnWidth [Table,AFVGD-FSAVD] 12
 
ColumnWidth [Table,AFVGD-FSAVZ] 12
  ColumnWidth [Table,AFVGD-ARBEH] 6

   // column header
  ColumnHeader [Table,AFVGD-ARBEH] "Unit"

endif

Components
InputAssistant