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

Leading zero problem!

Hi everybody!

My requirement is that i want a field with fixed length so that if i delete leading zero by using shift or conversion exit the length should not vary(no should not move left).

i.e if the field value is '000567' then i need the output as ' 567', zero's to be replaced by blank characters.

pls help.

Regards,

Parwez.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 10:21 AM

    HI,

    SHIFT var LEFT DELETING LEADING '0'.

    <b>example:</b>

    data:var(5) value '00123'.

    write:/ var.

    SHIFT var LEFT DELETING LEADING '0'.

    write:/ var.

    rgds,

    bharat.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 10:24 AM

    SHIFT <variable> LEFT DELETING LEADING '0'.

    or

    use this function module

    <b>CONVERSION_EXIT_ALPHA_OUTPUT</b> converts any number with zeroes right into a simple integer

    Example:

    input = 00000000000123

    output = 123

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 05, 2007 at 10:26 AM

    Hi,

    Use translate.

    data c1(6) value '000567'.

    data i1 type i.

    translate c1 using ' 567'.

    i1 = strlen( c1 ).

    write c1.

    write i1.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 10:28 AM

    hi mirza,

    you can use TRANSLATE, WRITE, SHIFT commands to perform required operation.........

    Regards,

    Kunjal

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 05, 2007 at 10:31 AM

    Hi Mirza,

    Use FM 'CONVERSION_EXIT_ALPHA_OUTPUT'

    for eg.

    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

    EXPORTING

    input = <varb>

    IMPORTING

    OUTPUT = <varb> .

    hope this helps.

    regards,

    vikas.

    plz reward if useful

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 05, 2007 at 10:45 AM

    var = '00028'.

    write var using edit mask '==ALPHA'.

    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.