Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[ABAP] convert string to xstring and convert back

DATA(lv_string) = |My string I want to convert to xstring.|.

TRY.
    DATA(lv_xstring)        = cl_abap_codepage=>convert_to( lv_string ).
    DATA(lv_string_decoded) = cl_abap_codepage=>convert_from( lv_xstring ).

    WRITE: / lv_string,
           / lv_xstring,
           / lv_string_decoded.

  CATCH cx_root INTO DATA(e).
    WRITE: / e->get_text( ).
ENDTRY.

Leave a Reply

Your email address will not be published. Required fields are marked *