Former Member

### ALV Hide zero in certain row

Hi,

I am aware of NO_ZERO='X' solution but it hides all zeros in certain column.

What I want to do is hide zero values but only for certain rows ?

i.e. I have columns A, B, C, all numerical (like mseg-dmbtr)

```A     B     C
0     2     [empty]
2     2     0.00
2     1     1.00
```

C is empty if A = 0

C is 0.00 if A=B

otherwise C = A-B

I'd like to solve it by not converting the fields into character fields.

Any clues ?

Bart

10|10000 characters needed characters exceeded

• Mar 04, 2010 at 11:25 AM

hiiiiiiiiiiii

use alv grid display

and use wa_fieldcatalog-no_zero = 'X'.

10|10000 characters needed characters exceeded
• >

> hiiiiiiiiiiii

> use alv grid display

> and use wa_fieldcatalog-no_zero = 'X'.

Nonsense. This will affect all rows, and this is against requirement.

• Mar 04, 2010 at 10:43 AM

Hello,

I am aware of NO_ZERO='X' solution but it hides all zeros in certain column.

Possibility 1 ruled out completely.

I'd like to solve it by not converting the fields into character fields.

You don't want to take this approach.

You must be aware character type variables have ' ' (space) as initial values (TYPE I, P, NUMC have zeroes as initial value) so i think that you can achieve this defining Column C as character.

May be other SDNers have some better ideas. Lets see !!!

BR,

Suhas

10|10000 characters needed characters exceeded

Hi,

The user is aware of sum problems thus I stated:

"I'd like to solve it by not converting the fields into character fields."

😊

Cheers,

Bart

• Mar 04, 2010 at 11:15 AM

Check what sourav has suggested here

Just try

if input = '0.00' or input is initial.

output = ' '.

endif.

10|10000 characters needed characters exceeded
• Mar 04, 2010 at 11:18 AM

Create a fourth column in your internal table named D. Declare that column as Character. Put that new column in your fieldcatalog, dont put colum C in your fieldcatalog.

Right before displaying loop over your table:

```loop at it_out assigning <p>.
if <p>-a is initial.
clear <p>-d.
elseif <p>-a = <p>-b.
<p>-d = '0.00'.
else.
tmp = <p>-a - <p>-b.
write tmp to <p>-d.
endif.
endloop.```

10|10000 characters needed characters exceeded

Possibly, but here we're still looking for a solution to the original problem, and the positive aspects outweigh, in my opinion.

Shouldn't stop you from keeping your eyes open, thanks for your ongoing help.

Thomas

• Former Member
Mar 04, 2010 at 11:24 AM

I haven't tried this but you may give it a try and let us know.

SET_ZERO method of CL_SALV_COLUMN.

I think this is as good as no_zero....I don't think it is possible to display 0.00 in such cases...For a change you may color such cells to distinguish them

Regards,

Mohaiyuddin

Edited by: Mohaiyuddin Soniwala on Mar 4, 2010 5:01 PM