1 xml转table
CALL FUNCTION 'SCMS_BASE64_DECODE_STR'
EXPORTING
input = e_string
* UNESCAPE = 'X'
IMPORTING
output = output
EXCEPTIONS
failed = 1
OTHERS = 2.
CHECK sy-subrc EQ 0.
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
from_codepage = '4110'
in_xstring = output
* OUT_LEN =
IMPORTING
out_string = lv_string.
CHECK lv_string IS NOT INITIAL.
TRY.
CALL TRANSFORMATION /bshm/lo_ctm_inb_upd
SOURCE XML lv_string
RESULT ctm_bsh_inb_syn_update = ls_inb_upd.
CATCH cx_root INTO gs_rif_ex.
gs_var_text = gs_rif_ex->get_text( ).
e_return = gs_var_text.
* MESSAGE e000(su) WITH 'XML2ABAP Error!'.
ENDTRY.
2 table转xml
DATA: ls_ctm TYPE /bshm/ctm_inb_upd,
lv_xml TYPE xstring.
TRY.
CALL TRANSFORMATION (lv_trans)
SOURCE ctm_bsh_inb_syn_update = ls_ctm
RESULT XML lv_xml.
CATCH cx_root INTO gs_rif_ex.
gs_var_text = gs_rif_ex->get_text( ).
e_return = gs_var_text.
* MESSAGE gs_var_text TYPE 'E' DISPLAY LIKE 'W'.
ENDTRY.
sap解析出来为utf-16,根据需求转为utf-8
IF lv_xml IS NOT INITIAL.
CALL METHOD cl_abap_conv_in_ce=>create
EXPORTING
input = lv_xml "(Xstring variable with XML)
RECEIVING
conv = lr_conv.
CALL METHOD lr_conv->read
IMPORTING
data = lv_request_xml. "(String variable with XML Encoding UTF-8)
**Convert string to xstring
CALL FUNCTION 'HR_KR_STRING_TO_XSTRING'
EXPORTING
codepage_to = '4110'
unicode_string = lv_request_xml
* OUT_LEN =
IMPORTING
xstring_stream = lv_xstring
EXCEPTIONS
invalid_codepage = 1
invalid_string = 2
OTHERS = 3.
**BASE64 Encode
CALL FUNCTION 'SCMS_BASE64_ENCODE_STR'
EXPORTING
input = lv_xstring
IMPORTING
output = lv_string.
e_string = lv_string.
ENDIF.