Application Development 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: 

column not invisible in table control

Former Member
0 Kudos

hi,

i want to make 2-3 columns in my table control invisible for some conditions i have done that in the follwing code in PBO but the column is not becoming invisible.

LOOP AT SCREEN.
    IF g_push = 'NM'.
      IF screen-name = 'I_MAT_MASTER-APPR_STORE_BY' .
        screen-invisible = '1'.
        MODIFY SCREEN.
      ENDIF.
    ENDIF.


  ENDLOOP.

kindly suggest how can i make the columns visible or invisible in table control for different conditions.

abhishek suppal

Message was edited by: Abhishek Suppal

7 REPLIES 7

aris_hidalgo
Contributor
0 Kudos

Hi,

Please put in

LOOP AT SCREEN.

IF g_push = 'NM'.

IF screen-name = 'I_MAT_MASTER-APPR_STORE_BY' .

  • screen-input = '1'.

screen-invisible = '1'.

MODIFY SCREEN.

ENDIF.

ENDIF.

ENDLOOP.

That will make your screen invisible.

Regards!

P.S. please award points for useful answers.

0 Kudos

i have tried that also but not able to succeed

0 Kudos

Hi,

or you can try: screen-active = '0'.

Regards!

former_member188685
Active Contributor
0 Kudos

Hi,

Did you check the Demo Program RSDEMO02 , here there is a checkbox invisible, see the code related to that option.you can understand better.

also check these..

Regards

vijay

former_member186741
Active Contributor
0 Kudos

you need to set the field 'invisible' in the table control to 'X' for the column you wish to make invisible.

eg, if your table control is called tc01. tc01-cols is a table which consists of the 'screen' structure and then column 'invisible'. Have a look in debug and it should make sense.

EG,

DECLARE THIS:

dATA w_TC LIKE LINE OF TC01-cols.

Have this in a PBO module:

loop at tc01-cols into w_TC.

if w_TC-screen-name = 'ZNRW_TC-COL04'.

w_TC-invisible = 'X'.

modify tC01-cols from w_TC.

endif .

endloop.

Former Member
0 Kudos

Hi,

<b>Components of CXTAB_COLUMN</b>

Each column of the table control corresponds to a row of the table CXTAB_COLUMN. The internal table CXTAB_COLUMN has no header line and the following columns:

Components are:- SCREEN,INDEX,SELECTED,VISLENGTH and <b>INVISIBLE</b>

<b>SCREEN</b>

Structure for the attributes of screen elements of the column (see below).

<b>INDEX</b>

Current position of the column in the table control. Transfered with initial value from Screen Painter. At PAI the current column configuration of the table control is withdrawn. Can be changed in the ABAP program.

<b>SELECTED</b>

Flag (X or blank) whether column is selected or not. At PAI the current status of the table control is withdrawn. Can be changed in the ABAP program.

<b>

VISLENGTH</b>

Visible length of the column. Transferred from Screen Painter. Can be changed in the ABAP program.

<b>INVISIBLE:</b>

<i>type : C(1)</i>

Flag (X or blank) whether column is visible. Transferred from Screen Painter. Can be changed in the ABAP program.

<b>have a look at this code</b>

1. define group name(s) for the columns to be hidden 
2. Add the following code... 
(define) 
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

See the below link for more info..

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac9f35c111d1829f0000e829fbfe/content.htm

Thanks

Sudheer

Former Member
0 Kudos

hi,

for this u can use TYPE-POOLS: CXTAB.

See the Sample code for this:

REPORT ZTEST_TX .

<b>TYPE-POOLS: CXTAB .</b>

DATA : BEGIN OF ITAB OCCURS 0.

INCLUDE STRUCTURE MARA.

DATA : END OF ITAB.

<b>DATA COL TYPE CXTAB_COLUMN.</b>

CONTROLS : TC TYPE TABLEVIEW USING SCREEN 100.

START-OF-SELECTION.

SELECT * FROM MARA INTO TABLE ITAB.

IF SY-SUBRC = 0 .

ENDIF.

END-OF-SELECTION.

CALL SCREEN 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'ZTEST'.

  • SET TITLEBAR 'xxx'.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& ModulE E INPUT

&----


  • tExt

----


MODULE E INPUT.

LEAVE PROGRAM.

ENDMODULE. " E INPUT

&----


*& Module read INPUT

&----


  • text

----


MODULE READ INPUT.

READ TABLE ITAB INDEX TC-CURRENT_LINE.

ENDMODULE. " read INPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

DATA: FLDNAME(100),HELP(100).

DATA : T LIKE SY-TABIX.

<b>READ TABLE TC-COLS INTO COL WITH KEY SELECTED = 'X'.</b>

IF SY-SUBRC = 0 .

CLEAR T.

<b>T = SY-TABIX.</b>

ENDIF.

CASE SY-UCOMM .

WHEN 'S-'.

<b>COL-INVISIBLE = 'X'.</b>

<b>MODIFY TC-COLS FROM COL INDEX T.</b>

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

- Selvapandian Arunachalam