Xstring => String => XML ve popupta XML Gösterimi

Blob/Xsting içerikli verilerin önce binary tabloya sonra da stringe çevrilmesi,
+xml içeriğin popup pencerede gösterimi

    TYPES BEGIN OF ty_bin_tab ,
             data TYPE LENGTH 1024,
            END OF ty_bin_tab.
    TYPES  : t_type_binary TYPE TABLE OF ty_bin_tab.



form f_xml_goster_xstring using  prm_XSTRING type XSTRING.

data: lv_string type string.
data: lv_xstring type XSTRING.
data: lt_binary type t_type_binary.
data: lv_size_in TYPE  I.
data: lv_size_out TYPE  I.



call function `SCMS_XSTRING_TO_BINARY`
  exporting
    buffer                = prm_XSTRING
    APPEND_TO_TABLE       = `X`
 IMPORTING
   OUTPUT_LENGTH         = lv_size_in
  tables
    binary_tab            = lt_binary
          .

call function `SCMS_BINARY_TO_STRING`
  exporting
    input_length        = lv_size_in
*   FIRST_LINE          = 0
*   LAST_LINE           = 0
*   MIMETYPE            = ` `
*   ENCODING            =
 IMPORTING
   TEXT_BUFFER         = lv_string
   OUTPUT_LENGTH       = lv_size_out
  tables
    binary_tab          = lt_binary
 EXCEPTIONS
   FAILED              = 1
   OTHERS              2
          .
if sy-subrc <> 0.
* Implement suitable error handling here
endif.



data: l_xml type ref to cl_xml_document .

create object l_xml.

call method l_xml->parse_string
exporting
stream = lv_string. "

call method l_xml->display.
endform.