Skip to content

Instantly share code, notes, and snippets.

@viniciustavanoferreira
Created September 5, 2019 13:16
Show Gist options
  • Save viniciustavanoferreira/813c38229219ea8cbf23e46f8cd14576 to your computer and use it in GitHub Desktop.
Save viniciustavanoferreira/813c38229219ea8cbf23e46f8cd14576 to your computer and use it in GitHub Desktop.
* ls_evento-arquivo_string is the XML that needs to be converted.
if ( ls_evento-arquivo_string is not initial ).
lv_len = strlen( ls_evento-arquivo_string ).
create data lo_cdata type c length lv_len.
clear lv_len.
assign lo_cdata->* to field-symbol(<fs_cdata>).
if ( <fs_cdata> is assigned ).
<fs_cdata> = ls_evento-arquivo_string.
assign <fs_cdata> to <ls_conv> casting.
if ( <ls_conv> is assigned ).
lo_conv = cl_abap_conv_in_ce=>create( encoding = '4110' input = <ls_conv> replacement = '*' ignore_cerr = 'X' ).
call method lo_conv->read
importing
data = lv_4110
len = lv_len
exceptions
others = 1.
if ( sy-subrc is initial ).
ls_evento-arquivo_string = lv_4110.
endif.
endif.
endif.
endif.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment