Skip to Content

Any Function Module to convert from string to Packed Decimal.


Hi,

Any Function module to convert from String to Packed decimal?

String value : "15-.00"

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 02, 2015 at 12:35 PM

    Hi,


    you could check for some conversion FM, e.g. BAPI_CURRENCY_CONV_TO_EXTERNAL / INTERNAL, or PP_CATT_CONVERT_DECIMAL_POINT.



    BR,

    EH

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 02, 2015 at 12:45 PM

    Hi Dhinesh,

    Here in the string Negative sign comes inbetween the value looks like the below.

    15-.00

    • First replace the sign to the front as shown below.

    Ex:

    data Str_value type string value "15-.00".

    data dec_value type p decimals 2.

    "Check whether negative sign in the variable

    if str_value CA '-'.

         "Replace Negative sign

         REPLACE ALL OCCURRENCES OF '-' IN str_value WITH ``.

       

         "Add the sign value into the first place

         concatenate '-' str_value into str_value.

    endif.

    Output

    -15.00

    • And then convert the string to Decimal value

    "Remove Empty space

    condense str_value.

    "Convert the value

    dec_value = str_value.

    Regards

    Rajkumar.

    Add comment
    10|10000 characters needed characters exceeded