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: 

Leading zero problem!

Former Member
0 Kudos

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

former_member491305
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Shift <Variable> left deleting leading '0'.

Regards,

Satish

Former Member
0 Kudos

use the FM CONVERSION_EXIT_ALPHA_OUTPUT

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

INPUT =w_xyz

IMPORTING

OUTPUT =w_xyz

Former Member
0 Kudos

Hi,

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

SHIFT w_xyz LEFT DELETING LEADING '0'.

Regards,

Nicolas.

Former Member
0 Kudos

I think you should use:

SHIFT w_xyz LEFT DELETING LEADING '0'.

)