Skip to Content
avatar image
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 ?

Thanks in advance,

Bart

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Mar 04, 2010 at 11:25 AM

    hiiiiiiiiiiii

    use alv grid display

    and use wa_fieldcatalog-no_zero = 'X'.

    Add comment
    10|10000 characters needed characters exceeded

  • 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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Kesavadas Thekkillath

      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.

    Add comment
    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Thomas Zloch Kesavadas Thekkillath

      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

  • avatar image
    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

    Add comment
    10|10000 characters needed characters exceeded