Skip to Content
author's profile photo Former Member
Former Member

Leading zero problem!

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Posted on Dec 05, 2007 at 12:57 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 12:58 PM

    Shift <Variable> left deleting leading '0'.

    Regards,

    Satish

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 01:00 PM

    use the FM CONVERSION_EXIT_ALPHA_OUTPUT

    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

    EXPORTING

    INPUT =w_xyz

    IMPORTING

    OUTPUT =w_xyz

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 01:02 PM

    Hi,

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

    SHIFT w_xyz LEFT DELETING LEADING '0'.

    Regards,

    Nicolas.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 01:16 PM

    I think you should use:

    SHIFT w_xyz LEFT DELETING LEADING '0'.

    😊)

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.