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: 

SALV - Hide rows based on certain condtion

former_member194669
Active Contributor
0 Kudos

All,

I have searched a lot in this forum this answer, but could not find any nearest one.

I am using CL_SALV_TABLE (SALV) for an ALV report. I wanted to hide some rows based on some condition say for example

in the ALV one of the column is MATNR say i wanted to hide rows that having MATNR less than 1000.

How we can do this ?

Thanks

11 REPLIES 11

Former Member
0 Kudos

Hi,

the standard alv functions offer a filter. Doesn't this meet your requirements?

Best regards,

Oliver

0 Kudos

Oliver,

Thanks for your reply.

If have used the filter those line will not reflect in the total. I wanted only lines to be hide and for totalling that hided lines to be considered.

I know this quite odd. but the requirement is like that.

0 Kudos

HI!

I think u first calculate total in internal table. save that totals into some veriable and then remove those lines which u dont want to show from internal table and then calculated total append into that internal table .

I thinks it will work!

all the best!

0 Kudos

Hi,

what about using a tree view?

Best regards,

Oliver

0 Kudos

Hi a®s,

the ALV/SALV standard will always take into consideration only visible data for totals calculation. If i were a user I would always expect the total as the sum of what I see.

Hidden secret knowledge is always dangerous. Try to persuade the requiring people to accept that you give the to-be-filtered-out-but-included-in-total lines just another color, i.e. light grey or what ever they like.

If you create buttons for filters for, say, show all with colored filtered rows, show only filtered out lines, show only remaining lines, the user can also see the different totals which may add up information value.

If people insist on the requirement, disable SUM and create your own total line.

Regards

Clemens

0 Kudos

Clemens,

You are right, In ALV/SALV what we see only get total.

So i decidied to remove the sorting and filtering buttons from toolbar and TOTAL lines will display in different color.

(If we given sorting and filtering then user can change sequence)

Thanks

0 Kudos

Good day, everyone!

Ive faced the same issue - I either have to hide a row or to change subtotal line manually.

Have anyone solved this already?

HI!

> I think u first calculate total in internal table. save that totals into some veriable and then remove those lines which u dont want to show from internal table and then calculated total append into that internal table .

> I thinks it will work!

> all the best!

I can't find anything that looks like a table for subtotals - they are counting somewhere inside SALV.

Or, maybe, you know something that I dont?

If people insist on the requirement, disable SUM and create your own total line.

Add my own total line? How can I do this?

0 Kudos

You can implement Static Filter on SALV to hide your rows from coming on the ALV display. This way Total / Subtotal wont recognize them.

Check [SALV Static Filter|http://help-abap.zevolving.com/2011/10/salv-table-16-static-filters/]

Regards,

Naimesh Patel

0 Kudos

Hi Volodja,

adding own total line isn't for beginners, but it's not too hard:

After you have your table ready for display, you add one more line. In this line you put the total values according to your own definition (we did something like that with totals of weighed averages). This line will get the color COL_TOTAL (yellow) of type-pool COLOR.

But to keep it consistent, you must disable filter, sorting and totaling functionality in the ALV display.

Regards,

Clemens

0 Kudos

Good day and thanks for replies!

Hi Volodja,

> After you have your table ready for display, you add one more line. In this line you put the total values according to your own definition (we did something like that with totals of weighed averages). This line will get the color COL_TOTAL (yellow) of type-pool COLOR.

Unfortunately, that doesn't fit me well - I need subtotals as technical rows in case of exporting to excel.

http://imageshost.ru/photo/88647/id994202.html

original SALV is to the left and required one is to the right

Former Member
0 Kudos

Hi,

check with the class...CL_SALV_COLUMN_TABLE.

Ram.