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

trim all zero

Former Member
0 Likes
566

hi, im trying to download an itab into a text file.... using gui download....

the thing is that i have been requested to cut off all the zeros from the fields... but they must still be aligned right like a number....

for example

Material

00001254

00015680

should be

Material

1254

15680

any help will be rewarded

Edited by: JAVIER SALAZAR on Mar 12, 2008 8:57 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
540

You can try:

data: Mat(10) value '0000001254'.
translate mat using '0 '.    "<====  zero to space

Rob

4 REPLIES 4
Read only

Former Member
0 Likes
540

You Can use the following statement:

SHIFT c LEFT DELETING LEADING c1.

eg.,

data : matnr(8) value '00001234'.

write : matnr.

shift matnr left deleting leading '0'.

write : matnr.

Output:

000001234

1234

Reward points if it is useful..

Read only

Former Member
0 Likes
541

You can try:

data: Mat(10) value '0000001254'.
translate mat using '0 '.    "<====  zero to space

Rob

Read only

0 Likes
540

i tried both solutions

1. it does the change but doesnt align to the right

2. Does the changes but also deletes zeros from the number....EG wont work for 52060..

help!

Read only

0 Likes
540

Well, I'm a bit embarassed. I usually check that sort of thing. So try:

DATA: mat(10) VALUE '0000001054'.
SHIFT mat LEFT DELETING LEADING '0'.
SHIFT mat RIGHT DELETING TRAILING ' '      "<==== space.

Rob