cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic HTML Page

Former Member
0 Kudos

Hey

I want to create a dynamic HTML page similar to this examples:

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c033445e-ccc4-2d10-59aa-99a3233f7...

/people/valery.silaev/blog/2005/11/23/display-formatted-text-using-webdynpro-for-java

The problem is both are for Web Dynpro Java , and i cant seem to find the equivalent statements in ABAP for:

- "final IWDCachedWebResource resource = WDWebResource.getWebResource" cant find a WebResource with the same methods in ABAP

- formattedStr.getBytes("UTF-8")

Could anyone help me ?

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thaks Thomas

I think i need something just like this , im gonna give it a go later today

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

If you need just plain HTML content, why would you not use BSP instead of WDA? Do you want to embedd HTML within an iFrame in WDA? If that is the case, it is possible although the approach is different than WDJ. Here is a sample:

data lo_el_text type ref to if_wd_context_element.
  data lv_html_text type wd_this->element_text-html_text.
  data lv_iframe_url type wd_this->element_context-iframe_url.

  lo_el_text = wd_context->get_child_node( name = wd_this->wdctx_text )->get_element( ).
  lo_el_text->get_attribute(
    exporting
      name =  `HTML_TEXT`
    importing
      value = lv_html_text ).

****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.
*  cached_response->set_compression( options = cached_response->IF_HTTP_ENTITY~CO_COMPRESS_IN_ALL_CASES ).
  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 ).