Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting string into xstring without using function module

Tags:

abap

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

But since it is not a good habit to use function modules anymore, a class based solution would be my prefered way to go.

I know that there is a class

cl_abap_conv_in_ce

but I can only validate, that this class can convert xstrings into string. I wand to have the reverse case. Does anyone have experience on how to do that class based?

like image 865
Felix Avatar asked Feb 19 '18 13:02

Felix


1 Answers

Meanwhile, I found the solution on my own. For people who might be interested:

    DATA(lo_conv) = cl_abap_conv_out_ce=>create( ).
    lo_conv->write( data = lv_content ).
    DATA(lv_xstring) = lo_conv->get_buffer( ).
like image 51
Felix Avatar answered Sep 18 '22 18:09

Felix