Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert CHAR to NUMC and vice versa?

Former Member
0 Kudos

Hi,

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

4 REPLIES 4

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi, Try to use FM 'FLTP_CHAR_CONVERSION'

Former Member
0 Kudos

Hi,

To Convert from NUMC to CHAR, just do like this

WRITE LV_NUM to LV_STR.

Regards,

Satish