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

Hiding columns in table control

Former Member
0 Likes
3,060

Hi Experts,

I have requirement to hide certain columns in table control. I have tried my best to use SCREEN structure with ACTIVE, INVISIBLE, INPUT, OUTPUT options, but not working properly.

The table control has nearly 10 columns with DATE as the first one. Once the screen appears after executing program, the second and third columns should be hidden and when double clicked on any date value from the basic list, the hidden columns should be visible with its values in the next level.

I am not able to hide columns in table control. By the way, suggest me options for double clicking in table control too.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,444

HI,

refer to this link..[Hiding table control columns along with header|]

Hi Experts,

I have requirement to hide certain columns in table control. I have tried my best to use SCREEN structure with ACTIVE, INVISIBLE, INPUT, OUTPUT options, but not working properly.

The table control has nearly 10 columns with DATE as the first one. Once the screen appears after executing program, the second and third columns should be hidden and when double clicked on any date value from the basic list, the hidden columns should be visible with its values in the next level.

I am not able to hide columns in table control. By the way, suggest me options for double clicking in table control too.

Thanks.

9 REPLIES 9
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,444

Hi,

Take the group1 for all the i/o fields in table control as ABC which you want to hide initially.

Now use code in PBO:-


MODULE status_8001.
  LOOP AT SCREEN.
    IF screen-group1 = 'ABC'.
      screen-invisible = 1. "hide control
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.
ENDMODULE.

This code will hide the columns in table control.

Hope this helps you.

Regards,

Tarun

Read only

Former Member
0 Likes
1,444

Hi Tarun,

I tried it already, its not working. BTW, what is the purpose of NAME component in SCREEN structure ?

Thankz,

Karthik

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,444

Hi,

In my case it is working. Can you please paste your code..!!

In screen NAME refers to the name of the current screen control. For Example : you give a name to textbox as ABCD, so you can also write:


screen-name = 'ABCD'.
"instead of
screen-group1 = 'ABC'. "as used in previous reply

Regards,

Tarun

Read only

Former Member
0 Likes
1,444

Hi Tarun,

Will test with the latest one and reply you back with points. What can we do for Double click functionality in table control. I tried the following :

GET CURSOR LINE <CNT>

READ TABLE <itab> INDEX <CNT>

How can I use the double-clicked value for further validations ? Pls suggest me on this too. I am out of office now and on my laptop, couldn't paste the code.

Regards,

Karthik

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,444

Hi,

The value of sy-ucomm when user double clicks is /CS

To get the details of field name and value use:-


GET CURSOR FIELD g_cs_field VALUE g_cs_value.

Now you can code in PAI to display those two columns initially hidden by the user:-


CASE sy-ucomm.
  WHEN '/CS'.
    IF g_cs_field = '<field1_name>'.
      LOOP AT SCREEN.
        IF screen-group1 = 'ABC'.
          screen-invisible = 0. "display control
          screen-active = 1.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    ENDIF.
ENDCASE.

Remember that in PBO of screen you have written a code to hide these same columns initially, so make sure that the code is not executed when user double clicks to display those columns.

Try this code for hidding the columns in table control initially.


MODULE status_8001.
  LOOP AT SCREEN.
    IF screen-group1 = 'ABC'.
      screen-invisible = 1. "hide control
      screen-active = 0.
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.
ENDMODULE.

Hope this helps you.

Regards,

Tarun

Read only

Former Member
0 Likes
1,444

Hi Tarun,

Thanks a lot . Have rewarded you points. Will get back to you if I have any issues. Bye until then.

Regards,

Karthik

Read only

Former Member
0 Likes
1,444

Pls close the thread once solved.

Read only

Former Member
0 Likes
1,445

HI,

refer to this link..[Hiding table control columns along with header|]

Read only

keerthy_k
Product and Topic Expert
Product and Topic Expert
0 Likes
1,444

Hi Karthikeyan,

pls see the code below..to hide the columns in table control,

TABCON is your table control.

In PBO

LOOP AT TABCON-COL .

if TABCON-COL-SCREEN-NAME = 'COLUMN_NAME'.

TABCON-COL-INVISIBLE = 'X'.

ENDIF.

ENDLOOP.

hope this will help u.

keerthi