Application Development and Automation 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: 
Read only

ABAP --Reports

Former Member
0 Likes
611

Hi Experts,

Could any one provide me with the code for replacing the minus sign from behind the totol to the front.

Like in the output screen at the bottom wher total is displayed, it is displayed as for example 24257480 - at the last minus sign

so I want it as - 24257480, I want it in the begining, the minus sign

Please help me out .

THanx

Hi Experts,

Could any one provide me with the code for replacing the minus sign from behind the totol to the front.

Like in the output screen at the bottom wher total is displayed, it is displayed as for example 24257480 - at the last minus sign

so I want it as - 24257480, I want it in the begining, the minus sign

Please help me out .

THanx

5 REPLIES 5
Read only

Former Member
0 Likes
588

Use

SHIFT string UP TO str CIRCULAR.

Where String is your field value and str is '-'.

Hope this helps.

Vinodh Balakrishnan

Read only

Former Member
0 Likes
588

Check if you have this FM in your system: CLOI_PUT_SIGN_IN_FRONT

Read only

0 Likes
588

you can try this code:

if z_val<0

z_val = z-val * -1.

write: '-', z_val.

else

write z_val.

endif.

but it might leave a space between - and no. ( iam not sure)

like '- 234'.

Read only

Former Member
0 Likes
588

try this..


DATA: minus_sign(1) ,
total(16) type c.

total = '24257480-'. "assign your variable

SEARCH total FOR '-'.
IF SY-SUBRC = 0 AND SY-FDPOS NE 0.
SPLIT total AT '-' INTO total minus_sign.
CONDENSE total.
CONCATENATE '-' total INTO total.
ELSE.
CONDENSE total.
ENDIF.

Read only

Former Member
0 Likes
588

Hi aman,

You need to manually display the "-" symbol before the value.

Have a look on the following example code.so that u can get the idea.

data: str type i value -1234543.

write:/ '-' no-gap,str no-sign left-justified.

reward points,if it is useful.

Thanks,

chandu.