Convert ASCII & Char in SAP 4.6

ASCII to CHAR

DATA int      TYPE i VALUE '82'.
DATA char(10) TYPE c.
DATA ascii    TYPE x.

FIELD-SYMBOLS : < fs_char >  TYPE c.

MOVE int TO ascii.
ASSIGN ascii TO < fs_char > CASTING TYPE c.
MOVE < fs_char > TO char.
WRITE char.

CHAR to ASCII

DATA int      TYPE i.
DATA char     TYPE c value 'A'.
DATA ascii    TYPE x.

FIELD-SYMBOLS : < fs_ascii >  TYPE x.

ASSIGN char TO < fs_ascii > CASTING.
ascii = < fs_ascii >.
WRITE ascii.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s