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: 

How to remove spaces when printing amounts

Former Member
0 Kudos

Hello.

When I execute this code


WRITE: '"' NO-GAP, itab-wrbtr, '"' NO-GAP.
* where: 
*    itab - internal table
*    wrbtr - is amount (similar in BSEG)

It has this kind of output: " 19,994,548.66 "

I think the spaces is like an allotment to fill the field length (13).

But, how can I remove this? I need to have this output: "19,994,548.66"

Thank you!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

you can do like this

write : (10) itab-wrbtr.

or use

write : itab-wrbtr no-gap.

for previous field also you have to use no-gap

regards

shiba dutta

8 REPLIES 8

Former Member
0 Kudos

Hi Ricardo,

Use <b>PACK</b>

Thanks.

Former Member
0 Kudos

you can do like this

write : (10) itab-wrbtr.

or use

write : itab-wrbtr no-gap.

for previous field also you have to use no-gap

regards

shiba dutta

Former Member
0 Kudos

Hi,

If you want to just display the amount, you can collect it in a char variable & then condense it.

Thanks

Sandeep

Former Member
0 Kudos

First take it to a field using CONCATENATE...

Then use

SHIFT <filed> LEFT DELETING LEADING SPACE

Former Member
0 Kudos

But all of this suggestion requires me to convert the amount into string or character format.

My dilemma with this is that by doing converting the data type, the comma separators are removed ("19994548.66") and I need to display it.

Thanks!

0 Kudos

if you convert the in character format , separator will be there ... but you can try my previous suggestion it was not changing the data type it is just formatting...

regards

shiba dutta

0 Kudos

I see..

But, how do I convert without losing the comma's?

Also, I cannot use the format of limiting the characters to (10) because I am printing in a loop and cannot determine the specific amount per record.

Thank you so much!

Former Member
0 Kudos

Impossible to include commas.