2

Following code in PBO doesn't work to hide the column completely.

LOOP AT SCREEN.

    IF SCREEN-NAME EQ 'GT_SO-POSNR'
      SCREEN-INPUT = 0.
      SCREEN-ACTIVE = 0.
      SCREEN-INVISIBLE = 1.
      MODIFY SCREEN.
    ENDIF.
ENDLOOP.

But above is disabling the column, not hiding it. Any help how to hide the Column?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Pasan Eeriyagama
  • 277
  • 1
  • 4
  • 15

4 Answers4

2

Use the field INVISIBLE of the COLS table in the structure defined by the CONTROLS statement. The whole structure is documented here. There should be a sample program named RSDEMO02 in your system that lets you modify the properties of the table control and examine the results as you do so.

vwegert
  • 18,371
  • 3
  • 37
  • 55
  • Hi, Any other property than invisible? I tried INVISIBLE but no luck, it doesn't make it invisible, instead it converts the contents to '*********', I guess this is meant to make the content invisible? Probably Like Password field.. But my need is to hide the entire column with data and header. Thanks. – Pasan Eeriyagama Jul 01 '13 at 04:03
2

We had the same problem in our project and we figure out how to do it.

See below sample:

PROCESS BEFORE OUTPUT.
MODULE STATUS.
LOOP WITH CONTROL TABCTRL.
  MODULE MODIFY_100.
ENDLOOP.


MODULE MODIFY_100 OUTPUT.
  DATA wa_tabctrl TYPE cxtab_column .

* loop at the table control
  LOOP AT TABCTRL-COLS INTO WA_TABCTRL.
    IF WA_TABCTRL-NAME =  'POSNR'.  
*     once you get to the desired screen, flag the INVISIBLE field for the table control, not the SCREEN table.             
      WA_TABCTRL-INVISIBLE =  'X'. 
*     Modify the table for table control
      MODIFY TABCTRL-COLS FROM WA_TABCTRL.
     ENDIF.
  ENDLOOP.

ENDMODULE.
Ice
  • 21
  • 1
1

Check the way you are trying to hide the particular column. Whenever you have a Table control on the screen there is CXTAB structure that is created against it. So disabling a field is not as simple as writing the name of the Internal table followed by the name of the column.

Your code should be something like this

PROCESS BEFORE OUTPUT.
MODULE STATUS.
LOOP WITH CONTROL TABCTRL.
  MODULE MODIFY_100.
ENDLOOP.


MODULE MODIFY_100 OUTPUT.
  DATA wa_tabctrl TYPE cxtab_column .

  LOOP AT TABCTRL-COLS INTO WA_TABCTRL.
    IF WA_TABCTRL-NAME =  'POSNR'.                    
      WA_TABCTRL-SCREEN-INVISIBLE =  '1'. 
      MODIFY TABCTRL-COLS FROM WA_TABCTRL.
    ENDIF.
  ENDLOOP.

ENDMODULE.
Rahul Kadukar
  • 858
  • 3
  • 15
  • 35
0

It shouldn't be necessary to loop through the table control content to hide the column for each line separately, as the columns definition is central for the table view.

A cleaner and much more efficient solution could look like this:

*********************************
* PBO include
*********************************
PROCESS BEFORE OUTPUT.
  MODULE hide_column_0100.

*********************************
MODULE hide_column_0100 OUTPUT.
  PERFORM hide_column.
ENDMODULE.

*********************************
* form include
*********************************
FORM hide_column.
  FIELD-SYMBOL <col> TYPE cxtab_column.
  LOOP AT table_control_0100-cols ASSIGNING <col>.
    IF <col>-screen-name = 'HIDE'.
      <col>-invisible = 1.
    ENDIF.
  ENDLOOP.
ENDFORM.

It's better to put the code into an own subroutine (FORM) to avoid unnecessary global variables (like for the work area of the LOOP). It often gets forgotten that MODULE code belongs to the global scope.

kybos
  • 21
  • 4