on 01-27-2011 8:31 AM
Hey Guys,
i have an XML string and i want to show this one like in an Internet Explorer.
With colours and well-arranged.
At the moment i only have this textedit, but there it is totally unclear.
Or is there a possibility to open an IE out of the WebDynpro which shows the XML string?
Thank you for your help
Best Regards
Thalin
Hi Thalin,
You may use cl_wd_runtime_services=>attach_file_to_response (you can use proper MIME type with this method for showing in HTML) to as the user for Open-Save-cancel. On click of Open it will show the XML as per the user default application setting, typically IE.
Hope this solvs your problem.
Regards
Vineet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey,
thanks for your replies.
I tried to display the xml content in an IFrame, but my problem is, that i only have an string.
So i tried to upload this string to the ICM Server-Clipboard and generate an URL which i can bind to the Iframe element.
But i can only see a white page.
Here is my coding.
Whats my mistake? =S
DATA:
lo_nd_iframe TYPE REF TO if_wd_context_node,
lo_el_iframe TYPE REF TO if_wd_context_element,
lv_content TYPE wd_this->element_transdat-content,
lo_http_response TYPE REF TO if_http_response,
lv_url TYPE string,
lv_guid TYPE guid_32.
CREATE OBJECT lo_http_response TYPE cl_http_response.
lo_http_response->set_cdata( lv_content ).
lo_http_response->set_content_type( 'text/html' ).
lo_http_response->server_cache_expire_rel( expires_rel = 500 ).
lo_http_response->set_status( code = 200 reason = 'OK' ).
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_32 = lv_guid.
CONCATENATE lv_guid '.' 'html' INTO lv_url.
cl_http_server=>server_cache_upload(
EXPORTING
url = lv_url
response = lo_http_response ).
lo_nd_iframe = wd_context->get_child_node( name = wd_this->wdctx_iframe ).
lo_el_iframe = lo_nd_iframe->get_element( ).
lo_el_iframe->set_attribute(
name = `URL`
value = lv_url ).
Hi Thalin,
The ICF of your WEbdynpro needs to be activated through tcode SICF. It may be the case that you are using your application which is embedded in some other WD but the generated URL has you component's name in the URL for the Iframe.
Alternatively you can just try the method i have given you in my prvious reply, it is quite simple which i have used in my application to show the XML in default browser. I generate and display my XML on click of a button in my WD application.
Regards
Vineet
Check whether the public services nod eis activated.
it will be there in sap/public right click on this node and check whether it is activated.
and then you need to modify the code little bit to show it with xml tags.
otherwise only the content will be shown.
here is the code that i used.
just in place of html you need to give xml.
data: cached_response type ref to if_http_response.
create object cached_response
type
cl_http_response
exporting
add_c_msg = 1.
data lv_html_text type string.
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_content LIKE ls_context-content.
* get element via lead selection
lo_el_context = wd_context->get_element( ).
* get single attribute
lo_el_context->get_attribute(
EXPORTING
name = `CONTENT`
IMPORTING
value = lv_content ).
lv_html_text = lv_content.
data: l_app_type type string.
cached_response->set_cdata( lv_html_text ).
l_app_type = 'text/xml'.
cached_response->set_header_field( name = if_http_header_fields=>content_type
value = l_app_type ).
cached_response->set_status( code = 200 reason = 'OK' ).
cached_response->server_cache_expire_rel( expires_rel = 60 ).
data: guid type guid_32.
call function 'GUID_CREATE'
importing
ev_guid_32 = guid.
DATA lv_ulr LIKE ls_context-ulr.
concatenate '/sap/public' '/' guid '.' 'xml' into lv_ulr.
lo_el_context = wd_context->get_element( ).
cl_http_server=>server_cache_upload( url = lv_ulr
response = cached_response ).
lo_el_context->set_attribute(
name = `ULR`
value = lv_ulr ).
thanks
sarbjeet singh
You can use iframe to display an HTML page.
[http://help.sap.com/saphelp_nw70ehp1/helpdata/en/15/c07941601b1d09e10000000a155106/content.htm|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/15/c07941601b1d09e10000000a155106/content.htm]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.