Skip to Content

Display PDF file from Kpro in webbrowser

Hi experts,

I need to display a PDF file in a web browser, therefore I use the function module "SDOK_PHIO_GET_URL_FOR_GET" to generate an HTTP link.

When I use this link in the web browser the file gets downloaded. It however doesn't have a file type so it doesn't automatically get opened in the web browser. It is no problem to open it with the adobe reader. I think the cause is that the link only contains the document id. Could it be that it has anything to do with the mime types? How could I fix this problem?

Here you can see the link.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Dec 12, 2018 at 12:48 PM

    When a file is stored in the KPro, it is stored along with a file name and a MIME type. When you execute the URL, SAP will extract the file based on the "docId" and "contRep" (there's possibly also the "compId" which refers exactly to one file), and send the HTTP response with header's ContentType set to the MIME type, and the file content is in the response body.

    So, there should be no error unless the MIME type was incorrectly stored in the content repository.

    When your URL is executed, the class CL_HTTP_EXT_CSIF is executed (as you can see in transaction SICF for the service contentserver), "docGet" corresponds to the method PROCESS_DOCGET, so you may set a user break-point inside the method to understand what's going on more precisely (make sure which user is to be debugged).

    Add comment
    10|10000 characters needed characters exceeded