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

Enable / Disable in Table Control

0 Likes
558

Hi experts,

in the tab control that have 9 cols. and output willl come Dynamically . EX.. Output coming in Cols 1,2,3,5, so i want that

Cols will disable 6,7,8,9 . which have no output so Please tell me.

thank's

Amit

Hi experts,

in the tab control that have 9 cols. and output willl come Dynamically . EX.. Output coming in Cols 1,2,3,5, so i want that

Cols will disable 6,7,8,9 . which have no output so Please tell me.

thank's

Amit

2 REPLIES 2
Read only

Former Member
0 Likes
531

HI,

U can do this but there is one problem , as u said u want to disable column based on the data in it right ?

In tcontrol there might be multiple records so if the first row in the tcontrol has no value in the col 6 and has value in the second row, then should the column be displayed If yes then u have to check row by row and if all row in the col 6 is blank then only u have to disable the column.

In PBO

loop at it.

module screen_property.

endloop.

in the module write the code by

module screen_property.

loop at screen.

if it-col6 is initial.

screen-input = 1.

endif.

modify screen

endloop.

end module

this is the make the field display mode , But if u want to make invisible the column the n u have to check first tat all rows are initial and then make invisible the column then use the structure CXTAB_COLUMN and make the column invisble

Regards,

Madhukar Shetty.

Edited by: Madhukar Shetty on Oct 6, 2010 7:14 AM

Read only

Former Member
0 Likes
531

Hi Amit,

You will have the table control defined in your program as

CONTROLS <ctrl> TYPE TABLEVIEW USING SCREEN <scr>.

This table has the structure of type CXTAB_CONTROL which has one field called column

which we can repfer as <ctrl>-cols and this cols has a structure CXTAB_COLUMN by varying

the attributes of this cols field you can disable the fields.

Write below code in your PBO

If flag = 'X' (condition on which you will be varying the table control o/P to show 1,2,3,5 column)

data wa_cols type cxtab_column.

LOOP AT <ctrl>-COLS INTO wa_cols.

 IF wa_cols-index = 6 or
    wa_cols-index = 7 or
    wa_cols-index = 8 or
    wa_cols-index = 9 or.    
    wa_cols-INVISIBLE= 'X'. 
    MODIFY <ctrl>--COLS FROM wa_cols INDEX SY-TABIX.
 ENDIF.
ENDLOOP.

else. (condition on which you will be varying the table control o/P to show 6,7,8,9 column)

in above code just replace 6,7,8,9 with 1,2,3,5

endif.

Regards,

Pawan