8 Replies Latest reply: Nov 29, 2007 8:52 AM by Guest RSS

Delete leading zeros

Harman .
Currently Being Moderated

hi,

 

I have suppose 0010000073 No.

I want to pass this value to other table for with value as 10000073.

 

which statement i should use for deleting the zeros

  • Re: Delete leading zeros
    Rama Jyothi P
    Currently Being Moderated

    data: w_vbeln type vbak-vbeln,

    w_char(10).

     

               w_vbeln = '000012345'.

     

               write w_vbeln to w_char no-zero.

  • Re: Delete leading zeros
    Omkaram Yanamalamanda
    Currently Being Moderated

    Hi,

     

    You can use the fm CONVERSION_EXIT_ALPHA_OUTPUT

     

     

    or you can use the SHIFT.

     

     

    SHIFT <yourField> LEFT DELETING LEADING '0'.

     

    Regards,

    Omkar.

  • Re: Delete leading zeros
    Ramesh Hirial
    Currently Being Moderated

    Hi,

     

      Use the statement as below:

     

    SHIFT  C  LEFT DELETING LEADING '0'.

  • Re: Delete leading zeros
    Florian Kemmer
    Currently Being Moderated

    data: lv_swap type c length 10.

     

    write your_variable to lv_swap no-zero.

  • Re: Delete leading zeros
    Swathi Kodimyala
    Currently Being Moderated

    U can even make use of the function module

    CONVERSION_EXIT_ALPHA_OUTPUT

  • Re: Delete leading zeros
    Ramkumar Muthurajan
    Currently Being Moderated

    ch = '0010000073'.

     

    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

      EXPORTING

        INPUT         = ch

    IMPORTING

       OUTPUT        = ch.

  • Re: Delete leading zeros
    Sravan Prakash Varanasi
    Currently Being Moderated

    The function Module 'CONVERSION_EXIT_ALPHA_OUTPUT' is used to remove the leading zeros in a field.

     

    the following is a sample code which i have used for 'Commitment item' in my report. replace the field with your required field.

     

     

        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

          EXPORTING

            INPUT  = IT_FMIT1-RFIPEX

          IMPORTING

            OUTPUT = IT_FMIT1-RFIPEX.

     

     

    Rewards if useful.

  • Re: Delete leading zeros
    Currently Being Moderated

    Conversion exit ALPHA, external->internal

     

    ALPHA conversion is used especially with account numbers. During conversion from the external to the internal format, the system checks to see if input in the INPUT field is purely numeric, that is, if this input consists only of numbers, possibly with spaces before and after them. If this is the case, then the number string is inserted right- justified in the display field OUTPUT and all spaces to the left of the value are filled with zeroes ('0'). If the input is not purely numeric, it is inserted in the display field from left to right and all extra spaces are filled with blanks.

     

    Example:

     

    (Input field and output field are both eight characters in length)

     

    1. '1234 ' --> '00001234'

    2. 'ABCD ' --> 'ABCD '

    3. ' 1234 ' --> '00001234'

     

    Conversion from the internal to the external format (function module CONVERSION_EXIT_ALPHA_OUTPUT) is undertaken in exactly the opposite manner.

Actions