Skip to Content
avatar image
Former Member

How to convert CHAR to NUMC and vice versa?

Hi,

Please let me know the conversion exits for converting CHAR to NUMC and NUMC to CHAR?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Feb 01, 2008 at 07:13 AM

    FM for converting char to numc : CHAR_NUMC_CONVERSION

    for numc to char, u can use move the destination field should be character type.

    Madhavi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 01, 2008 at 07:17 AM

    Hi..

    USE

    CALL FUNCTION 'CHAR_NUMC_CONVERSION'

    EXPORTING

    INPUT = 0

    • IMPORTING

    NUMCSTR =

    .

    or use

    Sample code below:

    codeDATA: lv_chr(4) type c,

    lv_num type p.

    CALL FUNCTION 'MOVE_CHAR_TO_NUM'

    EXPORTING

    CHR = lv_chr

    IMPORTING

    NUM = lv_num

    EXCEPTIONS

    CONVT_NO_NUMBER = 1

    CONVT_OVERFLOW = 2

    OTHERS = 3.

    IF SY-SUBRC 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.[/code]

    or USE

    CONVERT_STRING_TO_INTEGER

    or USE THESE FMs

    MOVE_CHAR_TO_NUM

    C14W_CHAR_NUMBER_CONVERSION

    CHAR_NUMC_CONVERSION

    REGARDS,

    GAURAV J.

    Edited by: GAURAV on Feb 1, 2008 8:18 AM

    Edited by: GAURAV on Feb 1, 2008 8:20 AM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 01, 2008 at 07:17 AM

    Hi, Try to use FM 'FLTP_CHAR_CONVERSION'

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 01, 2008 at 07:21 AM

    Hi,

    To Convert from NUMC to CHAR, just do like this

    WRITE LV_NUM to LV_STR.

    Regards,

    Satish

    Add comment
    10|10000 characters needed characters exceeded