Skip to Content
avatar image
Former Member

Display negative Quantities in ALV with "-" sign in front of number?

Hi,

is it possible to somehow change the display in ALV grid, so that negative figures will be displayed with the "-" sign in front of the figures?

This would be helpful to be able to simply ctrl-Y / ctrl-C / ctrl-V copy values from ALV-grid to excel withouth having to use download to local file functionality.

Apart from that my customer would prefer that view.

Thanks for any help with this maybe very easy - maybe not solvable question!!!!

Regards,

Guido

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Sep 03, 2009 at 09:46 AM

    Thanks for your help Amit! This lead a step further.

    Though if i have a QUAN 13/3 field, use 'RRV__________,___' as Edit mask, a figure like -200,5 would be displayed in the grid as

    '-______200,500' (with the "_" being blanks actually)

    It is probably not possible to get the sign directly next to the figures using this method?

    BR,

    Guido

    Edited by: Guido76 on Sep 3, 2009 11:47 AM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      For your 2nd question, thats the only answer, because concatenate, condense,overlay,replace,etc functions would work only with STRING & CHAR data types.

      Please mark thread as answered, if your query is solved.

      Regards,

      Amit

  • avatar image
    Former Member
    Sep 03, 2009 at 09:14 AM

    Hi,

    Check here

    Field EDIT_MASK in ALV fieldcatalog

    Regards,

    Amit

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 03, 2009 at 10:06 AM

    Hi Sumyaprakash,

    thanks for the suggestion!

    This would be a possible quick&dirty solution of course, but i dont really like to abuse char type for values/quantities 😉 Last but not least to keep possibility of subtotalling etc.

    Apart from that i would have to add that kind of code to all concerned reports while i hoped it might be possible to do some general setting or just assign a conversion exit to some domains.

    BR,

    Guido

    Edited by: Guido76 on Sep 3, 2009 12:09 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 03, 2009 at 11:31 AM

    . (sorry for double posting)

    Edited by: Guido76 on Sep 3, 2009 1:31 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 03, 2009 at 11:31 AM

    Hi,

    i asked another colleague of mine and he advised to use conversion exit and it actually works.

    using this conversion exit:

    FUNCTION conversion_exit_itm01_output.
    *"----------------------------------------------------------------------
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(INPUT) TYPE  ANY
    *"  EXPORTING
    *"     VALUE(OUTPUT) TYPE  CLIKE
    *"----------------------------------------------------------------------
      DATA: string(20) TYPE c.
    
      IF input < 0.
        input = input * -1.
        write input to string.
        SHIFT string LEFT DELETING LEADING space.
        CONCATENATE '-' string INTO output.
      ELSE.
        write input to output.
      ENDIF.
    
    ENDFUNCTION.

    and setting it in the fieldcat give me the wished result.

    Thanks everyone.

    Add comment
    10|10000 characters needed characters exceeded

    • I know this is an old, answered thread, but I was doing some searching and I'm having the same issue that Guido76 was having. I'm trying to implement his solution of creating a conversion exit for the field via fieldcatalog edit mask, but obviously I can't create the FM within the program. When I go to create it as a separate FM within a known Z function group, I get an error that the function module name is reserved for SAP (makes sense, since it doesn't start with Z). However, I believe I can only change the <name> part of CONVERSION_EXIT_<name>_INPUT (and OUTPUT), so how do I get around this? How does one go about creating a custom conversion exit without violating the naming conventions?