cancel
Showing results for 
Search instead for 
Did you mean: 

CL_GUI_XML_EDITOR or Internet Explorer to render XML in SAP GUI?

Former Member
0 Kudos

We are trying to render an XML document (just like Internet Explorer opens the XML document) within the SAP GUI. We have stored the XML in the application server - we can load this into the DOM and iterate through it and print out the elements and values, etc.

Within SAP GUI, is it possible to load the XML through the internet explorer ActiveX control? XI does this in SXMB_MONI.

I can't find any documentation on CL_GUI_XML_EDITOR.

Any help is appreciated.

Regards,

Jay

Accepted Solutions (0)

Answers (1)

Answers (1)

uwe_schieferstein
Active Contributor
0 Kudos

Hello Jay

The class <b>CL_GUI_XML_EDITOR</b> is intended for displaying and editing eCATT related XML. However, it can be used as a general XML editor.

The following sample report shows two ways of displaying XML in SAP. Perhaps it may be useful for you.

*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_GUI_XML_EDITOR
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zus_sdn_gui_xml_editor.



DATA:
  gd_okcode       TYPE ui_func,
  go_docking      TYPE REF TO cl_gui_docking_container,
  go_xml_editor   TYPE REF TO cl_gui_xml_editor.

DATA:
  gd_xml          TYPE xstring,
  gt_knb1         TYPE STANDARD TABLE OF knb1.


START-OF-SELECTION.


  SELECT * FROM knb1 INTO TABLE gt_knb1 UP TO 3 ROWS
    WHERE bukrs = '1000'.


  CALL TRANSFORMATION id
    SOURCE itab = gt_knb1
    RESULT XML gd_xml.


* Create docking container
  CREATE OBJECT go_docking
    EXPORTING
      parent                      = cl_gui_container=>screen0
      ratio                       = 90
    EXCEPTIONS
      OTHERS                      = 6.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.



  CALL METHOD cl_gui_xml_editor=>create
    EXPORTING
      im_container = go_docking
      im_xml       = gd_xml
    IMPORTING
*      EX_DATA      =
*      EX_SCHEMA    =
      ex_editor    = go_xml_editor.




* Link the docking container to the target dynpro
  CALL METHOD go_docking->link
    EXPORTING
      repid                       = syst-repid
      dynnr                       = '0100'
*      CONTAINER                   =
    EXCEPTIONS
      OTHERS                      = 4.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


* ok-code field = GD_OKCODE, no elements on screen
  CALL SCREEN '0100'.
* Flow logic:
*PROCESS BEFORE OUTPUT.
*  MODULE STATUS_0100.
**
*PROCESS AFTER INPUT.
*  MODULE USER_COMMAND_0100.



" Second way to display XML in SAP
data:
  gd_retcode  type syst-subrc,
  go_xml      type ref to cl_xml_document.

" Create XML document instance
  create object go_xml.

  CALL METHOD go_xml->parse_xstring
    EXPORTING
      stream  = gd_xml
    receiving
      retcode = gd_retcode.

  go_xml->display( ).


END-OF-SELECTION.


*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STATUS_0100'.
*  SET TITLEBAR 'xxx'.


ENDMODULE.                 " STATUS_0100  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

  CASE gd_okcode.
    WHEN 'BACK' OR
         'END'  OR
         'CANC'.
      SET SCREEN 0. LEAVE SCREEN.


    WHEN OTHERS.
  ENDCASE.

  CLEAR: gd_okcode.

ENDMODULE.                 " USER_COMMAND_0100  INPUT

Regards

Uwe

Former Member
0 Kudos

Thanks Uwe,

This is very helpful. I will try out the code. We intended up using the CL_GUI_HTML_CONTROL which can load the XML document. But i will use the the CL_GUI_XML_EDITOR to provide the editing capabilities

Regards,

Jay

Former Member
0 Kudos

You can use the following methods too:

cl_gui_frontend_services=>gui_download

and

cl_gui_frontend_services=>execute

to display your xml document

Regards,

Walter