2009 Oct 26 2:53 PM
Hallo Experts,
I need to create dymanic columns in a Table Control. The column has to by dymanically created based upon a flag entry in one master table.
We have a master table with some rows with a flag entry as shown below,
TEXT FLAG
-
AAAA X
BBB X
CCC
DDD X
-
I have to show the above entries which are set (AAAA, BBB and DDD) as a columns in the table control.
My Table Control, already have many columns and on the top of that i have to populate this rows as a columns dymamically..
The sample table control structure should looks like the below,
-
PERNR NAME LAND1 AAAA BBB DDD
-
-
How to acheive this?
2009 Oct 26 3:10 PM
Hi
U need to change the attribute of the colunms of the table control, your table control is defined like the type TABLEVIEW:
CONTROLS <table contrl> TYPE TABLEVIEW USING SCREEN <screen number>.
The type TABLEVIEW is based on the type CXTAB_CONTROL, here there's the field COLS (like the type CXTAB_COLUMN) where the attribute of the columns are stored: u need to change the attribute of COLS.
COLS is an internal table, so u need to define a workarea based on CXTAB_COLUMN and set the attribute INVISIBLE in order to hide a certain colunm.
TYPE-POOLS: CXTAB_COLUMN.
DATA: WA_COL TYPE CXTAB_COLUMN.
LOOP AT <table control>-COLS INTO WA_COL.
IF WA_COL-SCREEN-NAME = ...........
WA_COL-INVISIBLE = 'X'.
MODIFY <table control>-COLS FROM WA_COL.
ENDIF.
ENDLOOP.Now u need to insert the right condition in order to show or hide a certain column
Max
Hallo Experts,
I need to create dymanic columns in a Table Control. The column has to by dymanically created based upon a flag entry in one master table.
We have a master table with some rows with a flag entry as shown below,
TEXT FLAG
-
AAAA X
BBB X
CCC
DDD X
-
I have to show the above entries which are set (AAAA, BBB and DDD) as a columns in the table control.
My Table Control, already have many columns and on the top of that i have to populate this rows as a columns dymamically..
The sample table control structure should looks like the below,
-
PERNR NAME LAND1 AAAA BBB DDD
-
-
How to acheive this?
2009 Oct 26 3:10 PM
Hi
U need to change the attribute of the colunms of the table control, your table control is defined like the type TABLEVIEW:
CONTROLS <table contrl> TYPE TABLEVIEW USING SCREEN <screen number>.
The type TABLEVIEW is based on the type CXTAB_CONTROL, here there's the field COLS (like the type CXTAB_COLUMN) where the attribute of the columns are stored: u need to change the attribute of COLS.
COLS is an internal table, so u need to define a workarea based on CXTAB_COLUMN and set the attribute INVISIBLE in order to hide a certain colunm.
TYPE-POOLS: CXTAB_COLUMN.
DATA: WA_COL TYPE CXTAB_COLUMN.
LOOP AT <table control>-COLS INTO WA_COL.
IF WA_COL-SCREEN-NAME = ...........
WA_COL-INVISIBLE = 'X'.
MODIFY <table control>-COLS FROM WA_COL.
ENDIF.
ENDLOOP.Now u need to insert the right condition in order to show or hide a certain column
Max