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

Leading zero problem!

Former Member
0 Likes
739

Hi !

i have a numeric type variable i.e. 'w_xyz type n length 7'

now i want to delete the leading zero's for this variable simultaneously want to retain the length of the field unaltered i.e.

if w_xyz = '0000987' then i want

w_xyz = ' 987'.

any help pls,

Thanks in advance.

Regards,

Parwez.

5 REPLIES 5
Read only

former_member491305
Active Contributor
0 Likes
702

Hi,

Move that into character variable and unpack it and then use STRLEN funtion on the char variable .

data:v_char(7).

v_char = w_xyz.

unpack v_char to v_char.

n = strlen(v_char).

Regards,

Vigneswaran S

Read only

Former Member
0 Likes
702

Shift <Variable> left deleting leading '0'.

Regards,

Satish

Read only

Former Member
0 Likes
702

use the FM CONVERSION_EXIT_ALPHA_OUTPUT

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

INPUT =w_xyz

IMPORTING

OUTPUT =w_xyz

Read only

Former Member
0 Likes
702

Hi,

There is a simple way to achieve that : just use shift statement.

SHIFT w_xyz LEFT DELETING LEADING '0'.

Regards,

Nicolas.

Read only

Former Member
0 Likes
702

I think you should use:

SHIFT w_xyz LEFT DELETING LEADING '0'.

)