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 a table control

Former Member
0 Likes
4,033

Hi,

I have a requirement where I need to hide the entire table control based on a condition. I am able to hide the table control by setting the INVISIBLE attribute.

The problem is that even when the table control is hidden, the screen area allocated to it is still used up. If there are any field after the table control, they are not moved up. You see a blank area where the table control should have been. Normally the screen compresses and removes any hidden/empty lines.

The only suggestions I have got till now is to create the table control in a subscreen, and not include the subscreen if the condition is not met.

Has anybody come across a solution for this problem ? We are on 4.6C.

Regards,

Raj

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,282

We can do without subscreen.

TYPE-POOLS: cxtab.

CONTROLS:

tc1 TYPE TABLEVIEW USING SCREEN '0100'.

START-OF-SELECTION.

CALL SCREEN '0100'.

MODULE status_0100 OUTPUT.

PERFORM status.

ENDMODULE.

FORM status .

DATA wa_col TYPE cxtab_column.

LOOP AT tc1-cols INTO wa_col.

wa_col-screen-invisible = 0.

wa_col-screen-active = 0.

MODIFY tc1-cols FROM wa_col.

ENDLOOP.

ENDFORM. " status

21 REPLIES 21
Read only

Former Member
0 Likes
3,282

hi,

check this thread...

regards

vijay

Read only

0 Likes
3,282

hi

Are the fields which you are expecting to occupy the place of Table control declared in sub screen itself?? if not then the area declared as subscreen holder will remain blank when ever you hide the table control.

Regards

Santosh

Read only

0 Likes
3,282

Hi,

I don't have problem hiding the table control. My problem is the empty space left behind when the table control is hidden.

Raj

Read only

0 Likes
3,282

Hi,

Currently I have everything in one screen and no subscreens. I want to get all my options before I go done the path of creating subscreens just so I can hide the table control.

Regards,

Raj

> hi

>

> Are the fields which you are expecting to occupy the

> place of Table control declared in sub screen

> itself?? if not then the area declared as subscreen

> holder will remain blank when ever you hide the table

> control.

>

>

> Regards

> Santosh

Hi Santosh,

Currently all the

Read only

0 Likes
3,282

hi raj

Once the subscreen area is assigned it will remain blank when ever you make it contents invisible...

its only during the PBO run the program know that it has to hide particular field based on given conditions. I don't think you can change the design part at that stage.

Regards

Santosh

Read only

0 Likes
3,282

Hi,

Currently I have only one screen and no subscreen. The screen look like as follows :

Fields ABC

Table Control TC200

fields XYZ

Now if I hide the table control using the invisible attribute, the screen shows up with a blank area between the fields ABC and XYZ where the table control should have been. If instead of table control it was a field and it was hidden, that line would have been compressed and the two fields ABC & XYZ would appear on adjacent rows.

My question is, what can I do so that after the table control is hidden, the empty space between the fields is removed.

Thanks for prompt reply.

Regards,

Raj

> hi raj

>

> Once the subscreen area is assigned it will remain

> blank when ever you make it contents invisible...

>

> its only during the PBO run the program know that it

> has to hide particular field based on given

> conditions. I don't think you can change the design

> part at that stage.

>

>

> Regards

> Santosh

Read only

0 Likes
3,282

Pls verify that in the "Attributes" for your screen containing the table control...in the "Settings" group has the property "Switch off runtime compress" is not selected....

this is not selected by default....if that was switched on the behaviuor would be similar to what you are getting....

Read only

0 Likes
3,282

Hi,

It is not selected. The compress works fine on the screen with all other fields except for table control.

Regards,

Raj

> Pls verify that in the "Attributes" for your screen

> containing the table control...in the "Settings"

> group has the property "Switch off runtime compress"

> is not selected....

>

> this is not selected by default....if that was

> switched on the behaviuor would be similar to what

> you are getting....

Read only

0 Likes
3,282

Raj, the only way that you are going to achieve this is by using subscreens. Here is an example. Screen 100 includes a subscreen area, then under that there are two fields with labels. There is a subscreen 101 which has the table control defined in it. Also there is a dummy screen 102 which we will use when the table control is to be hidden.

In the flow logic of the screen 100. it should look like this, where the SUBA is the subscreen area in screen 100. SUBSCREEN_VAR is a variable which we will use to tell it to fire 101 or 102.



process before output.

  module status_0100.

  <b>call subscreen suba including sy-repid  subscreen.</b>

process after input.

 <b> call subscreen suba.</b>

 module user_command_0100.

Here is the program code.




report zrich_0002 .

data: begin of itab occurs 0,
      fld1 type c,
      fld2 type c,
      end of itab.

data: subscreen_VAR type sy-dynnr.

*&spwizard: declaration of tablecontrol 'ITABCON' itself
controls: itabcon type tableview using screen 0101.

parameters: p_sho radiobutton group grp1 default 'X',
            p_hid radiobutton group grp1.

start-of-selection.

  call screen 100.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module status_0100 output.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.

<b>  if p_sho = 'X'.
    subscreen = '0101'.
  elseif p_hid = 'X'.
    subscreen = '0102'.
  endif.</b>

endmodule.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module user_command_0100 input.

  set screen 0.
  leave screen.

endmodule.                 " USER_COMMAND_0100  INPUT


Notice in the PBO, we are setting the subscreen that is to be fired, if the table control is to be shown, we fire 101,, if not we fire the dummy screen 102. Doing this will allow the other fields of the screen 100, to move up when the table control is not being shown. i just tested all of this and it is working great.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
3,283

We can do without subscreen.

TYPE-POOLS: cxtab.

CONTROLS:

tc1 TYPE TABLEVIEW USING SCREEN '0100'.

START-OF-SELECTION.

CALL SCREEN '0100'.

MODULE status_0100 OUTPUT.

PERFORM status.

ENDMODULE.

FORM status .

DATA wa_col TYPE cxtab_column.

LOOP AT tc1-cols INTO wa_col.

wa_col-screen-invisible = 0.

wa_col-screen-active = 0.

MODIFY tc1-cols FROM wa_col.

ENDLOOP.

ENDFORM. " status

Read only

0 Likes
3,282

Vemlateswara, hes not asking about hiding columns. He wants to hide the entire control and not have any empty space in between the hidden table contol and the rest of the fields on the screen. For this he needs subscreens.

Regards,

Rich Heilman

Read only

0 Likes
3,282

Hi Rich Heilman,

You can call me Venkat.

Here I am suggesting solution to hide the entire control by inactivating the table control and hiding. On my system given piece of code is working as Rajendra has requested.

Thanks

Venkat

Read only

0 Likes
3,282

Do you have other fields besides the table control on your screen under the table control. When you make the control invisible, do these fields move to the top of the screen? This is what he is asking for.

Regards,

Rich Heilman

Read only

0 Likes
3,282

I tested code by placing table control between 2 text fileds.

On hiding table control, bottom text field moved up right below the top text field.

Read only

0 Likes
3,282

What version of SAP are you working with. I am not having the same results in my system.

Regards,

Rich Heilman

Read only

0 Likes
3,282

SAP 4.7

Read only

0 Likes
3,282

I'm in 46c. Its not compressing in 46c. Also you code doesn't work for me either. I modified it like so...



    data wa_col type cxtab_column.
    loop at itabcon-cols into wa_col.
      <b>wa_col-invisible = 1.</b>
      modify itabcon-cols from wa_col.
    endloop.

And it does make the control disappear, but it doesn't close the gap in between the top of screen and other fields like it does when using a subscreen.

Regards,

Rich Heilman

Read only

0 Likes
3,282

replace

<b>

wa_col-invisible = 1.

</b>\

with

<b>

wa_col-screen-invisible = 0.

wa_col-screen-active = 0.

</b>

Read only

0 Likes
3,282

Venkat, I got it working now. I had that flag checked on from when I was playing around with it eariler, I forgot to uncheck it. This is now working.




module status_0100 output.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.


  data wa_col type cxtab_column.
  loop at itabcon-cols into wa_col.
<b>     wa_col-invisible = 1.
*    wa_col-screen-invisible = 1.
*    wa_col-screen-active    = 0.</b>
    modify itabcon-cols from wa_col.
  endloop.


endmodule.                 " STATUS_0100  OUTPUT

If I use.......




wa_col-invisible = 1.

The gap is closed and the table control is invisible.

If I use....



    wa_col-screen-invisible = 1.
    wa_col-screen-active    = 0.

The table control is invisible, but the gap is not closed.

Are you seeing the same?

Regards,

Rich Heilman

Read only

0 Likes
3,282

Raj, looks like you have a couple of options to solve your problem here. Please rememeber to award points for any helpful answers and/or discussions and mark your post as solved when solved completely. Thanks.

Regards,

Rich Heilman

Read only

0 Likes
3,282

Hi all,

Thank you for all your input. The solution did work. As it turns out to hide a table control you have to make the table control and all its fields invisible, and only then the screen real estate is freed.

It saved me time from creating additional subscreens just for hiding the control.

Raj