Skip to Content

Approach content repository other way then URL approach

Hi all,

I'm facing the following problem. I've a web dynpro ABAP application. In this application I need to show a scanned image (invcoice) from the content repository. I want to do this via creating an URL from the ArchiveLink parameters. This I do with function module ALINK_RFC_DOCUMENT_URLS_GET. It gives me an URL like this:

http://vws027:5580/cs?get&pVersion=0045&contRep=A1&docId=48DCF054EABB01AA0000000091324DFD&compId=data&accessMode=r&authId=CN%3DBSQ,OU%3DIINITIAL,OU%3DSAPWebAS,O%3DSAPTrustCommunity,C%3DDE&expiration=20081003142459&secKey="very long secret key"

This URL I use in an Iframe and this should show me the picture. However, via the above URL I approach the content repository directly...in this case via port 5580. At this customer site they do not want to open this port. Here, it is only possible to approach the content via ECC.

Is there an other way of showing the image from the content repository besides approaching the content directly via an URL?

Regards,

Joost

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 09, 2008 at 11:58 AM

    I guess I don't understand how they could use the content repository, but not expose the URL. Is it that they don't want to expose the content repository URL to the internet? If so, you could use the ABAP CL_HTTP_CLIENT class to read the image data from the Content Repository into ABAP memory on the ECC server. This way the content repository only needs to be accessible within your local network. Once the image data is in memory in ABAP, you can place it into the ICM cache and generate a temporary URL for it (which you can then download to the user, use in an Image UI element, or the iFrame UI element - although the iFrame is technically depreciated).

    I've got an example of using the CL_HTTP_CLIENT class in this blog:

    BSP a Developer's Journal Part XIV - Consuming WebServices with ABAP

    Just remember that the body will be a binary object so use GET_DATA instead of GET_CDATA.

    For the ICM caching and URL generation have a look at this sample. In this sample I am working with HTML/Text, so you will have to make minor adjustments for the binary content you get back from the Content Repository - so once again just use SET_DATA instead of SET_CDATA and don't forget to set your MIME type:

    ****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 ).

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Joost van Poppel

      Dear J.van Poppel,

      can you please share your solution ..

      I have a requirement to upload pdf to http content server (DMS)from webdynpro ABAP.

      Kindly suggest the possible solution...