2007 Oct 18 10:30 AM
Hi to all,
I want to read a XML document containing in a tree (Linked objects).
In my program I use the method CL_SCMG_CASE_API-GET_BACKEND_RECORD (view code).
This method returns a ref to CL_SCMG_REC_CASE_BE.
The structure G_CONTENT_XML_BUFFER of this class contains a table (BIN_CONTENT_TAB) with 14 lines type x(1022):
3C3F786D6C2076657273696F6E............
72696E67222064656661756C74............
I think this is the content of XML. How could I convert the lines to the XML data?
Could I do it in another way?
This is the code:
INCLUDE <cntn01>.
DATA:
bor_case TYPE swc_object,
container_tab TYPE STANDARD TABLE OF swcont.
DATA BEGIN OF swo_return.
INCLUDE STRUCTURE swotreturn.
DATA END OF swo_return.
DATA: l_ref_if_scmg_case_api TYPE REF TO if_scmg_case_api,
case_type TYPE scmgcase_type,
tty_namevalueasstring TYPE ty_namevalueasstring.
bor_case-header = 'OBJH'.
bor_case-type = 'SWO '.
CALL FUNCTION 'SWO_CREATE'
EXPORTING
objtype = 'SCASE'
objkey = 'DC0D01..........'
IMPORTING
object = bor_case-handle
return = swo_return.
IF swo_return-code NE 0.
bor_case-handle = 0.
ENDIF.
CALL METHOD cl_scmg_case_api=>read_case_type
EXPORTING
im_case_guid = 'DC0D01..........'
RECEIVING
re_case_type = case_type.
CALL METHOD cl_scmg_case_api=>if_scmg_case_api~create
EXPORTING
im_case_type = case_type
im_case_guid = 'DC0D01..........'
RECEIVING
re_case = l_ref_if_scmg_case_api
EXCEPTIONS
failed = 1
no_authority = 2
path_creation_failed = 3
others = 4
.
IF sy-subrc EQ 0.
ENDIF.
data: l_ref_IF_SRM_SP_RECORD type ref to IF_SRM_SP_RECORD.
CALL METHOD l_ref_if_scmg_case_api->get_backend_record
receiving
re_record_backend = l_ref_IF_SRM_SP_RECORD
EXCEPTIONS
failed = 1
others = 2
.
IF sy-subrc <> 0.
ENDIF.
2007 Oct 18 1:12 PM
Hello Anja
For displaying the XML you can use class<b> CL_XML_DOCUMENT</b>. Create an instance of this class and call methods:
PARSE_TABLE (convert XML stream -> DOM) " followed by
DISPLAY
Using method GET_AS_TABLE (use table of type STRING) you should be able to retrieve the XML as string.
Regards
Uwe
2007 Oct 18 1:12 PM
Hello Anja
For displaying the XML you can use class<b> CL_XML_DOCUMENT</b>. Create an instance of this class and call methods:
PARSE_TABLE (convert XML stream -> DOM) " followed by
DISPLAY
Using method GET_AS_TABLE (use table of type STRING) you should be able to retrieve the XML as string.
Regards
Uwe
2007 Oct 18 3:56 PM
2007 Oct 18 3:59 PM
Hello Anja
The stream is
3C3F786D6C2076657273696F6E............
72696E67222064656661756C74............
as you described. The method converts this byte stream into a <b>document object model</b> (DOM) representing the hierarchical XML structure.
For sample reports please refer to package <b>SIXML_TEST</b>.
Regards
Uwe