Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Unicode: HEX via INT to Char???

Hi Experts,

I have to check our Z-Programs whether they have set the Unicode-flag and change them if necessary.

One of the programs changes special character "hex 0c".

Here's the coding of non-Unicode program:

DATA: gv_xstring TYPE x.

DATA: ff_cstring TYPE c.

DATA: BEGIN OF gv_struc,     

gv_struc_val TYPE counter1,     

END OF gv_struc.

gv_xstring = '0C'.

gv_struc-gv_struc_val = gv_xstring.

ff_cstring = gv_struc.

Debugging:

Variable:                                      Value    hex-value

GV_XSTRING                                0C        0C

GV_STRUC-GV_STRUC_VAL    12          0C

FF_CSTRING                                #            0C

With "Unicode active" it is not longer allowed to make "ff_cstring = gv_struc."

How can I change the coding so that the hex-value remains the same, 0C?

In all variants I've tried the hex value changes, even if the value remains #.

Can you please help me?

Thanks so much,

Monika

Former Member
replied

Hi.

Try this solution

CLASS cl_abap_container_utilities DEFINITION LOAD.

CALL METHOD cl_abap_container_utilities=>fill_container_c

   EXPORTING

     im_value               gv_struc

   IMPORTING

     ex_container           = ff_cstring

   EXCEPTIONS

     illegal_parameter_type = 1

     OTHERS                 = 2.


Hope to help

Bye

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question