Skip to Content
avatar image
Former Member

How shd i convert 30.00 to 15 char 000000000030.00 ?

Hi guys,

i have a requirement to convert variable packed decimal 30.00 to 15 char 000000000030.00 ?

Is there any std FM or i will have to manually prefix Zero's in variable.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Aug 16, 2007 at 10:37 AM

    Hi..

    Use this code.

    Write v_pack to v_char right-justified.

    REPLACE ALL OCCURRENCES OF SPACE WITH '0' INTO V_CHAR.

    <b>Reward if Helpful</b>

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2007 at 10:27 AM

    Hi

    for decimal ponts this fm is not possible (CONVERSION_EXIT_ALPHA_INPUT

    )

    so do one thing split str at '.' into var1 and var2.

    and pass var1 to CONVERSION_EXIT_ALPHA_INPUT

    and again concatenate

    it will work

    reward points to all helpful answers

    kiran.M

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2007 at 10:45 AM

    Split like Kiran says or use OVERLAY with '000000000000000'

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2007 at 11:10 AM

    Hi,

    Use FM <b>CONVERSION_EXIT_ALPHA_INPUT</b>

    Reward if helpful.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2007 at 10:21 AM

    Hi,

    You can try func. mod.

    CONVERSION_EXIT_ALPHA_INPUT

    Ashvender

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2007 at 10:31 AM

    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.

    Usage:

    call function 'CONVERSION_EXIT_ALPHA_INPUT'

    exporting

    input = v_input

    importing

    output = v_output

    exceptions

    others = 1.

    CONVERSION_EXIT_ALPHA_INPUT - converts any number into a string fill with zeroes-right

    example:

    input = 30.00

    output = 000000000030.00

    regards,

    srinivas

    <b>*reward for useful answers*</b>

    Add comment
    10|10000 characters needed characters exceeded