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: 

Sap script option

Former Member
0 Kudos

Hi sapper~

I'd like to change "1,230,450.00-" to "-1,230,450"

ex)

Follow the example use two option.

1&symbol& --> 1,230,450.00-

2. &symbol(<)& --> &-1,230,450.00&

3. &symbol(.0)& --> &-1,230,450&

Do you know how to apply number 2,3 to number 1 a time ?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi jake ,

for this scenario u need to handle with an Fm

1.

declare the variables in CHARACTERS ,

TYPE C

2. to put the sign in front ..

use this Functional module ..

CLOI_PUT_SIGN_IN_FRONT

  • check the code ..

REPORT zex3 .

data : p1 type p decimals 3 .
p1 = '123450.000'.

data: p2(13) type c.
write:/ p1.


*normal calculation
p1 = p1 * -1.

write:/ p1.
p2 = p1.

*with fm

CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
  CHANGING
    value         =  p2.


write:/ p2.

note that this takes the input in character format and

o/p in character format ..

3. supress the zeros in the diaplay

&symbol(7.0)&

depending on the length of the field .. . (X.0 ) will

supress the zeros

regards,

Vijay

4 REPLIES 4

Former Member
0 Kudos

can u be more eloborate

Former Member
0 Kudos

try with

<b> &symbol(.0<)&</b>

former_member283648
Participant
0 Kudos

Hi,

I would suggest you to make the data type of the variable to character instead of amount field and then do string operation rotate to make the negative sign to be the first character.

Former Member
0 Kudos

hi jake ,

for this scenario u need to handle with an Fm

1.

declare the variables in CHARACTERS ,

TYPE C

2. to put the sign in front ..

use this Functional module ..

CLOI_PUT_SIGN_IN_FRONT

  • check the code ..

REPORT zex3 .

data : p1 type p decimals 3 .
p1 = '123450.000'.

data: p2(13) type c.
write:/ p1.


*normal calculation
p1 = p1 * -1.

write:/ p1.
p2 = p1.

*with fm

CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
  CHANGING
    value         =  p2.


write:/ p2.

note that this takes the input in character format and

o/p in character format ..

3. supress the zeros in the diaplay

&symbol(7.0)&

depending on the length of the field .. . (X.0 ) will

supress the zeros

regards,

Vijay