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 rows in ALV without affecting total sum at the end of table?

Former Member
0 Kudos

Hi,

I need some help in hiding particular rows in an ALV Grid without affecting the total sum at the end of the table. I am trying to hide the rows that have negative quantities, but I still need those values so that the user can still compute for the total sums. Can anyone help? Thanks.

Joseph

12 REPLIES 12

Former Member

any one got solution for this?

I need it badly..

0 Kudos

yess

u can use no col in field catalouge ..

or else make one more internal table with rows which u need to display and pass it to grid disply

cheers.,

0 Kudos

select internal table with upto rows or give condition and pass it to grid display..

Former Member
0 Kudos

After suming up all u just delete those records which u do want..

as per condition

if it is usefull Plz Reward

regards

Anbu

Former Member
0 Kudos

Hi,

Hopw this way you can hide the rows in the GRID.

DATA:

ld_column TYPE lvc_fname,

ld_hide TYPE abap_bool.

FIELD-SYMBOLS:

<ls_entry> TYPE any,

<ld_fld> TYPE any.

ld_column = 'COL_1'. " column which you want to suppress if everything is zero

ld_hide = abap_true. " = 'X'; default hide column

LOOP at <gt_outtab> ASSIGNING <ls_entry>.

ASSIGN COMPONENT (ld_column) OF STRUCTURE <ls_entry> TO <ld_fld>.

IF ( <ld_fld> > 0 ).

ld_hide = abap_false. " display column because at least single value > 0

EXIT. " leave LOOP

ENDIF.

ENDLOOP.

READ TABLE gt_fcat INTO ls_fcat

WITH KEY fieldname = ld_column.

IF ( syst-subrc = 0 ).

ls_fcat-no_out = ld_hide.

MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.

ENDIF.

hop you will get the total with for those columns too.

Regards,

Madhavi

0 Kudos

1) i dont want to hide COLOUM but ROW..

2) I am summing up by using do-sum = 'x' in field cataloug.

so if i delete the record b4 display,the deleted record will not effect the SUM..(i.e i want the deelted record to b considered for SUM but shouldnt be displayed)

0 Kudos

Have u got the solution for hiding the row in ALV? , if pls send me the code and solution...

0 Kudos

you have got for the ans for same

ritesh_dugad2
Active Participant
0 Kudos

You can sum up the records inside the program and store them in another internal table. Use this table to display only the sum in the alv output. With this you can have something like summary and details options.

0 Kudos

yah u can do it,

1)

pass it_filter to FM "reuse_*** _alv"

in it_filter u can filter values > 0.

2) go to output

select the sum column , goto filter put condition " > 0"

save this layout.

and set this layout in ur program.

Former Member
0 Kudos

Normal ALV it is not possible.

Check it with OOPS alv

Former Member
0 Kudos

It is still very simple:

First register the subtotal event in your alv (link with a subroutine).

Display the alv with your reduced rows.

When the subtotal event is triggered (before display)

You get the subtotal line and can overwrite it with your own values(maybe in an internal table with the whole content).

You have to check if it is a subtotal or total.

you can hide the sumup functions in the toolbar to reduce confusion....

But still set the columns where you want to sum_up in the fieldcat to max_value to avoid a field overflow.

Your own values will be overwritten, when colum is set to AVG!.

Regards,

Christian