Skip to Content
avatar image
Former Member

Convert String to QUAN, INT1, UNIT

Hello,

Can anyone help me out with conversion String to QUAN, INT1 and UNIT?

Are there FMs available for this standard conversion?

Thanks.

Regards,

Chris Bogers

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Feb 15, 2010 at 03:54 PM

    For QUAN fields like MARA-NTGEW that have a unit like MARA-GEWEI assigned you can use:

    WRITE mara-ntgew TO s UNIT mara-gewei.

    This formats the number in the correct formatting as defined in unit customizing and user settings.

    Same for integer (here i):

    WRITE i TO s.

    Regards Jack

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I solved the issue by using the following code:

      SELECT SINGLE dcpfm "Decimal notaion

      FROM usr01 "User master record (runtime data)

      INTO l_user_decimal

      WHERE bname EQ sy-uname.

      CASE l_user_decimal.

      WHEN ' '. " Decimal point is comma: N.NNN,NN

      TRANSLATE str USING '. '.

      TRANSLATE str USING ',.'.

      WHEN 'X'. " Decimal point is period: N,NNN.NN

      TRANSLATE str USING ', '.

      WHEN 'Y'. " Decimal point is N NNN NNN,NN

      TRANSLATE str USING ',.'.

      ENDCASE.

      CONDENSE str NO-GAPS.

      amount = str.

      Thanks & Regards,

      Chris