Skip to Content

Loading PDF document from CRM Web UI or Interaction center(IC) is a common use-case across different services. Here in this document we will go through all the steps involved in creating a PDF display from CRM UI/ IC.

There are two ways in which we can load the PDF:

  •      PDF URL
  •      PDF content using BSP page.

Loading PDF URL

The first option is the simplest, where you have URL for the PDF file and you would like to load it from Web UI. If the URL is static we can use a URL based transaction launcher and load in the UI. There are many articles available in SDN which talks about this topic so I will not elaborate on this. Alternatively, you can also load the URL’s using the get_p_<attr> method of the context node attribute. This approach will be useful in cases where the URL is dynamic. Again I am not going into the details as there are multiple documents published in SDN on this.

Loading PDF content

The second approach, loading the PDF content from web UI / IC is a common scenario in migration project. Let us take an example where the customer legacy system uses a third party archive tool for storing all the historical bills of customers. More often than not after migration, customers would like to retain the third party tool and just have a display view for those bills in CRM. Let us assume in this case the bills are stored in PDF form and the third party can send us the PDF content in the XSTRING format.

Below are the steps to load PDF on click of a hyperlink from the view.

Create a new controller Billdoc.pdf under your BSP component.


Now create a handler class and set it to the controller.


For the above created controller redefine do_request( ) method and set the response data. Let us assume in our case we are going to get PDF content through an RFC and below is the sample code for setting the response.

DATA: ebc_t_raw_data     TYPE  TABLE OF tbl1024,

      xdata              TYPE  xstring.

*Get PDF content

      DESTINATION rfc_dest
= lv_opbel
= ebc_t_raw_data
= return
= 3
OTHERS                = 4.

*   Build xstring from itab format (dependent on itab type)
IF ebc_t_raw_data IS NOT INITIAL.
LOOP AT ebc_t_raw_data INTO ebc_line.
CONCATENATE xdata ebc_lineline INTO xdata IN BYTE MODE.

*   Determine data length
size = xstrlen( xdata ).

*   Export response data
CALL METHOD response->if_http_entity~append_data
data   = xdata
= size.

*   Set response content-type as PDF
CALL METHOD response->if_http_entity~set_header_field
= ‘content-type’                              “#EC NOTEXT
value = ‘application/pdf’.                          “#EC NOTEXT

There are two key things to note in the above code:

  • Set the xstring content to response.
  • Set the header field content-type as PDF.

Also note that we can play around with the content type to load different types of files.

And the last step is to load this BSP page on click of a hyperlink in the UI view.


Redefine get_p method and load the BSP page. Below is the sample code.

      CALL METHOD cl_bsp_runtime=>get_runtime_instance
= lr_runtime.

*     create url using runtime
CALL METHOD lr_runtime->construct_bsp_url
= ‘ZIUICINVOICE’       “BSP component name
= ‘Billdocument.pdf’      “bsp controller created above
= lt_params
= rv_value.

Thus we are all set to load the PDF, click on the hyperlink and a new browser window containing PDF will be loaded. Below is the sample screen shot.


To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. yang yang

    Very helpful, thank you.

    But i have a question, how to pass value to the bsp controller Billdocument.pdf.

    I see you use the input lt_params, can i read the inner table in the method
    do_request( ) ?

    thank you .


    I find the solution. In the method do_request( ) use

    request->get_form_field( ‘fieldname’ ) to get the value in lt_params, fieldname = lt_params-name.

  2. T. Mimaroglu

    HI Gopal,

    I did all steps but it doesn’t work yet! wat do you mena exactly with method get_p? is it the method of….?

    in my solution scenario i did the following steps:

    – Added a button in WEBUI (object BP_HEAD)

    – I created BSP application and controller as you explained above

    – in do_request method of this controller class i create PDF and format to xstring etc..

    and i also set the following:



      as you explane above.

    – finally i set the code of



    as you explane above in the click event of the webui button.

    But solution doesn’t work! can you say me please what i need to do to fix this?

    do i forget somethink? where i can find method get_p? do i need to make a service via SICF?

    I can open my PDF in a CRM popup but i want to open it in the web browser because the popup causes some problems when u use it in Citrix environment.

    Please i hear from you.

    Thanks in advance



Leave a Reply