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: 

how to hide a column in alv grid output?

Former Member
0 Kudos

Hi experts,

I am displaying an alv grid containing 24 columns.

My functionality is: the 3rd column should be in such a way that it should be hided if the user doesnt want to see it.

Can I do it as:

1. Placing a push button on the top of the alv grid so that if the user when clicks on it , the 3 rd column

gets hidden.

Can you please suggest me how to do that?

and also I have another question..

q) In the same alv grid output there is a column by name" group account" which displays the account numbers . They start with a series such as 37002001 ,37002002................another series such as 38001000..38001001...etc..

My functional req is that I should total the account numbers belonging to the same series ( eg here: 37002001+ 37002002 ..etc) and display it before the next series(38001000..38001001) starts..

this total should also be displayed in the same column( group account)..

Can anyone please suggest how to do this?

<<text removed>>.

Thanks a lot in advance..

Edited by: Matt on Nov 22, 2008 2:23 PM

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos

Hello Prasanth

The basic principle of ALV lists is that as developer we put as much information (full-range of columns) into the list whereas the user decides which of these columns he or she actually needs (i.e. the user defines the layout).

In order to hide columns programatically you have two options in the fieldcatalog where you define the column properties:

LVC_S_FCAT-NO_OUT = 'X'.  " not displayed but available in the layout
LVC_S_FCAT-TECH     = 'X'.  " neither displaye nor available in the layout

For OO-based ALV lists (or using fm REUSE_ALV_GRID_DISPLAY_LVC) you can enable the option that the users can define and store their own layouts:

DISVARIANT-REPORT = <name of report>
DISVARIANT-HANDLE = 'GRID'.   " Can be any 4Chars name => uniquely identifies the ALV list

The variant has to be provided for parameter IS_VARIANT. In addition, you need to set

I_SAVE = 'A'

so the users can save both global and user-specific layouts.

For more details please refer to:

[Easy Reference For ALV Grid Control|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907]

Regards

Uwe

3 REPLIES 3

former_member181995
Active Contributor
0 Kudos

>

> I need your valuable help and response very urgently....

.

Today is weekend eve as every one(Atleast me) is enjoying their moments,so don't expect VERY URGENTLY responses.

And Before posting please read posting rules which is on top of each forum.

uwe_schieferstein
Active Contributor
0 Kudos

Hello Prasanth

The basic principle of ALV lists is that as developer we put as much information (full-range of columns) into the list whereas the user decides which of these columns he or she actually needs (i.e. the user defines the layout).

In order to hide columns programatically you have two options in the fieldcatalog where you define the column properties:

LVC_S_FCAT-NO_OUT = 'X'.  " not displayed but available in the layout
LVC_S_FCAT-TECH     = 'X'.  " neither displaye nor available in the layout

For OO-based ALV lists (or using fm REUSE_ALV_GRID_DISPLAY_LVC) you can enable the option that the users can define and store their own layouts:

DISVARIANT-REPORT = <name of report>
DISVARIANT-HANDLE = 'GRID'.   " Can be any 4Chars name => uniquely identifies the ALV list

The variant has to be provided for parameter IS_VARIANT. In addition, you need to set

I_SAVE = 'A'

so the users can save both global and user-specific layouts.

For more details please refer to:

[Easy Reference For ALV Grid Control|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907]

Regards

Uwe

uwe_schieferstein
Active Contributor
0 Kudos

Hello Prasanth

Regarding your second question I would recommend to add an additional column (e.g. ACCTGROUP) where you programatically fill the unique part for each account group (e.g. for series such as 38001000..38001001...etc you fill the colum with '38').

Now when the user sorts the list according to the account he can define the total for all accounts and th subtotal for each ACCTGROUP. Thus, your list would look like this:

37002001
37002002
- Subtotal group 37 = ...
38002001
38002002
- Subtotal group 38 = ...
- Total = ...

Regards

Uwe