Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Get XML data

Former Member
0 Kudos
145

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.

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos
78

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

3 REPLIES 3

uwe_schieferstein
Active Contributor
0 Kudos
79

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

0 Kudos
78

Hi Uwe.

Can you explain "convert XML stream -> DOM"?

Thanks.

0 Kudos
78

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