Application Development and Automation 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: 
Read only

Dymanic Columns in Table Control

Former Member
0 Likes
595

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?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
439

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?

1 REPLY 1
Read only

Former Member
0 Likes
440

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