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: 

display XML in SAP from String

Former Member
0 Kudos

Hi,

it is me again,

following situation

in a apab program i have a xmlfile as content of a string (not load from the filesystem - it is generated). Now i try to show the data in SAP Gui. Are there any possibilities?

Thanks in advance Stefan

1 ACCEPTED SOLUTION

athavanraja
Active Contributor
0 Kudos

data: l_xml type ref to cl_xml_document .

create object l_xml.

call method l_xml->parse_string

exporting

stream = xml_out. "xml_out is the variable which is holding the xml string

call method l_xml->display.

alternate option: you can use a custom control and show the xml using cl_gui_html_viewer class

4 REPLIES 4

former_member194669
Active Contributor
0 Kudos

Hi,

Please check for class CL_WD_RUNTIME_SERVICES

I try to display XSTRING as PDF document. may this will help you

CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE

athavanraja
Active Contributor
0 Kudos

data: l_xml type ref to cl_xml_document .

create object l_xml.

call method l_xml->parse_string

exporting

stream = xml_out. "xml_out is the variable which is holding the xml string

call method l_xml->display.

alternate option: you can use a custom control and show the xml using cl_gui_html_viewer class

Former Member
0 Kudos

Hi,

first:I used call method lxml->display. and can see my xml file display in a small pop up window. How can I display the result without the pop up window ? (I only want to see one screen, no pop up window)

second:

how can i use the business document navigator? When I set the parameter 'WITH_BDN' to 'X' I see the navigator but my xml is nowhere to be seen. What I am doing wrong?

Thanks

0 Kudos

Hi Maria,

To get that displayed on the same screen, you need to create a custom screen for that.

Step 1: Create the custom screen , say with number 100.

Step 2: Create a custom container within it and give a name say 'CONTAINER'.

Step 3: In its PBO create module and call the below static method


DATA lr_xml_ref TYPE REF TO cl_swf_wsp_xml_view.

   cl_swf_wsp_xml_view=>create(

     EXPORTING

       i_container_name = 'CONTAINER'

       i_repid          sy-repid   " ABAP Program: Current Main Program

       i_dynnr          '100'   " ABAP Program: Number of Current Screen

       i_xml_stream     = lv_xml

     IMPORTING

       e_xml_view       = lr_xml_ref    " HTML Control for WSDL Display

   ).

sy-repid: As you know, this should be the program name from which the custom screen will be called .

I assume you already have the XML in xstring format and the same gets saved in variable lv_xml.

Once that create is called you will get the instance of the class

cl_swf_wsp_xml_view and then simple call the show method.


   lr_xml_ref->show( ).

This should make the XML display within same screen and not as a Popup.

- Thanks , Somnath