on 03-08-2010 3:44 PM
Hi, I would like to display a html page in a WebDynpro View, ie: I have the html code in a "string" variable and would now display this string now not with the html tags visible, but as a "real" html page.
I found a thread in WebDynpro for ABAP but I am a little bit lost in converting the logic to ABAP world.
Thanks
>I found a thread in WebDynpro for ABAP but I am a little bit lost in converting the logic to ABAP world.
I'm a little bit confused by this statement. Do you mean you found a thread in Web Dynpro Java, perhaps?
Regardless the approach is possible using the iFrame UI. The warning about the iFrame is that it is deprecated in NetWeaver 7.0 and 7.01 and my not be usable depending upon your support package level. However in NetWeaver 7.02 the iFrame returns to fully supported status.
If you have the HTML content in a string, you can simply place it into the ICM cache. This will provide a temporary URL for the content (you supply the lifetime of the URL) that can be referenced via the iFrame URL or even the LinkToURL if you want to open in a new window.
Here is the code for placing the string into the ICM Cache:
****Create the cached response object that we will insert our content into
data: cached_response type ref to if_http_response.
create object cached_response
type
cl_http_response
exporting
add_c_msg = 1.
try. " ignore, if compression can not be switched on
call method cached_response->set_compression
exporting
options = cached_response->co_compress_based_on_mime_type
exceptions
others = 1.
catch cx_root.
endtry.
****set the data and the headers
data: l_app_type type string.
cached_response->set_cdata( lv_html_text ).
l_app_type = 'text/html'.
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.
concatenate '/sap/public' '/' guid '.' 'html' into lv_iframe_url.
****Cache the URL
cl_http_server=>server_cache_upload( url = lv_iframe_url
response = cached_response ).
wd_context->get_element( )->set_attribute(
name = `IFRAME_URL`
value = lv_iframe_url ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Sir,
I followed everything what you said. It works perfectly and displays html string in the IFRAME.
However some of the HTML characters are still displayed in the IFRAME. for e.g » TEST HTML «
Now in the IFRAME we see it as » TEST HTML «
I was expecting the IFRAME can render » character and display it in HTML.
Can you help me understand why is it displaying this special character?
Cheers
Dear Thomas,
works fine - thanks for the example so far.
Another question: is it possible to update the content with new data reusing the http response object and the URL? I tried to set "new data" on changing the lead selection of my elements, hoping that the new content is shown; but it always displays the initial content.
Any idea to solve this as well?
Best regards, Daniel
Hello Sir,
I followed everything what you said. It works perfectly and displays html string in the IFRAME.
However some of the HTML characters are still displayed in the IFRAME. for e.g » TEST HTML «
Now in the IFRAME we see it as » TEST HTML «
I was expecting the IFRAME can render » character and display it in HTML.
Can you help me understand why is it displaying this special character?
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
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.