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: 

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

Former Member
0 Kudos

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

9 REPLIES 9

Former Member
0 Kudos

Hi,

Check here

Regards,

Amit

Former Member
0 Kudos

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

0 Kudos

define the field of internal table as a string.

and while passing the currency value:

if gv_cur GE 0.

is-cur_str = gv_cur.

else.

concatenate '-' gv_cur into is-cur_str.

endif.

hope this logic helps

0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

conversion exits wont work. its come as set in your SU01 defaults.

Former Member
0 Kudos

. (sorry for double posting)

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

Former Member
0 Kudos

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.

0 Kudos

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?