‎2008 Dec 16 5:35 AM
Hi All,
How to add field in existing table control
I hve made one table control with the help of wizard now i want add one field in it .
I have manually added the Fields to the table control.But i do not want to display these newly added
fields (invisible).These newly added fields are only for Processing purpose.
When i went to check the invisible checkbox in display options that button was disabled.
Can anyone help me out?
‎2008 Dec 16 5:49 AM
In PBO:
MODULE HIDE_TC_COLUMNS.
In above module, code like
" TC is table control name
IF <SOME CONDITION>
LOOP AT TC-COLS INTO TC_COLS.
IF TC_COLS-SCREEN-GROUP1 = 'XYZ'." Assign XYZ as GROUP1 for columns u dont want to display
TC_COLS-INVISIBLE = 1.
MODIFY TC-COLS FROM TC_COLS INDEX SY-TABIX.
ENDIF.
ENDLOOP.
ENDIF.
"Where TC_COLS isof type SCXTAB_COLUMN.
‎2008 Dec 16 5:54 AM
Hi Madan,
If you want to add a new field (column) to the existing table control follow the steps given below.
1. goto -> secondary window -> dictionary fields or program fields...
2. enter the table or program name... and drag that filed in to your table control header
3. Or you can enter I/O field from tool box and text field from tool box for header of that I/O field
4. You can adjust visible length... for your new field...
5. Save and activate.
For making the fields, invisible you can follow the below method.
in PBO
MODULE hide_columns_dynamically.
MODULE hide_columns_dynamically OUTPUT.
IF (Required condition).
DATA:cols TYPE cxtab_column.
LOOP AT table_control-cols INTO cols.
IF cols-index = 3 OR
cols-index = 4 OR
cols-index = 5 OR
cols-index = 6 AND
cols-screen-input = '0'.
This will hide the 5th, 6th, 7th and 8th columns
cols-invisible = 'X'.
MODIFY table_control-cols FROM cols.
ENDIF.
ENDLOOP.
ENDIF.
ENDMODULE. " hide_columns_dynamically OUTPUT
Best Regards,
Deepa Kulkarni
‎2008 Dec 16 6:27 AM
Hi,
If you want to make some fields or columns invisible at runtime...then give a groupname to them
and add this code given below:
controls tbl_ctrl type tableview ...
wa like tbl_ctrl-cols.
loop at tbl_ctrl-cols into wa.
if wa-screen-group1 = <group defined for the column>
wa-invisible = 1.
modify tbl_ctrl-cols from wa
endif
endloop
Regards:
Alok Bansal
‎2008 Dec 16 6:30 AM
hi,
You can check---
and also If you want to make some fields or columns invisible during runtime then create a groupname to such fields and add the code given below:
controls tbl_ctrl type tableview ...
wa like tbl_ctrl-cols.
loop at tbl_ctrl-cols into wa.
if wa-screen-group1 = <group defined for the column>
wa-invisible = 1.
modify tbl_ctrl-cols from wa
endif
endloop
Regards:
Alok Bansal
‎2008 Dec 16 1:48 PM