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

remove zeros

Former Member
0 Likes
2,346

Hi all,

I have an internal table in which some fields contain zeros only. i want to remove the zeros, and make the fields blank.

Please help me..

Thanks

Pranati

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,621

Hi,

Try this..

DATA: V_NUMC(3) TYPE N VALUE '000'.

CLEAR: V_NUMC WITH space.

Thanks,

Naren

7 REPLIES 7
Read only

0 Likes
1,621

If you mean you don't want to write the zeros when you use the WRITE statement then:

WRITE: itab-field1 no-zero.

Read only

Former Member
0 Likes
1,621

Hi,

You can use SHIFT.

DATA: V_CHAR(10) VALUE '00000'.

SHIFT V_CHAR LEFT DELETING LEADING '0'.

Thanks,

Naren

Read only

0 Likes
1,621

Hi Naren,

Thanks for your reply.. it worked. is there any way we can make it work using 'clear' ?

I tried using...

CONSTANTS hex(1) TYPE x VALUE IS INITIAL.

CLEAR f with hex.

but it was giving me syntax error.

Thanks

Pranati.

Read only

0 Likes
1,621

Yes you can use CLEAR aswell.

itab-a = '000'.

append itab.

loop at itab.

<b> clear itab-a.</b>

modify itab.

endloop .

Thanks,

Santosh

Read only

Former Member
0 Likes
1,621

Sorry. Yes its possible with SHIFT. I didnt know that.

May be you can do something like this:

data: begin of itab occurs 0,

a type c,

end of itab.

itab-a = '0'.

append itab.

loop at itab.

shift itab-a left deleting leading '0'.

modify itab.

endloop.

write itab.

Thanks,

Santosh

null

Read only

Former Member
0 Likes
1,622

Hi,

Try this..

DATA: V_NUMC(3) TYPE N VALUE '000'.

CLEAR: V_NUMC WITH space.

Thanks,

Naren

Read only

Former Member
0 Likes
1,621

Hi all,

problem solved..so i am closing the thread.. thanks everyone for helping me out..

Cheers

Pranati