Convert string to xstring without using function module

I want to convert a string to xstring. I know that there is a function module named "SCMS_STRING_TO_XSTRING"

But since it’s not a good habit to use function modules anymore, a class-based solution would be my preferred way.

I know that there is a class

cl_abap_conv_in_ce 

but I can only verify that this class can convert xstrings to string. I wand to have the opposite case. Does anyone have experience with this class?

+5
source share
2 answers

Meanwhile, I found a solution on my own. For people who may be interested:

  DATA(lo_conv) = cl_abap_conv_out_ce=>create( ). lo_conv->write( data = lv_content ). DATA(lv_xstring) = lo_conv->get_buffer( ). 
+5
source

The help text for XSTRING provides a nice functional method for this: cl_abap_codepage=>convert_to( )

+1
source

Source: https://habr.com/ru/post/1275455/


All Articles