Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

Using ABAP to open a pdf file in the Web Browser

Former Member
0 Kudos

Hi all,

I am creating a web application using SAP UI5 (for SAP SRM). I need to open the pdf document containing the Shopping cart data in a web browser when the user clicks a specific button.

I am able to retrieve the pdf data from the backend in the form of XSTRING ( Byte stream). I am in search of a way to use this data to open the browser in the client machine with byte stream converted in pdf format.

Since SAP UI5 uses javascript to render webpages, I tried using javascript to convert this byte stream into pdf in the browser, but there is no provision in the native javascript or SAPUI5 to achieve this. (Any help to use javascript to convert bytestream into pdf is also welcome)

So I am trying to use ABAP itself to create the pdf file and open and display it in the browser. I tried using:


CL_GUI_HTML_VIEWER , but in vain.

But this I guess is not the right approach.

The similar functionality was already implemented using ABAP webdynpro. But since I am in the process of removing Webdynpro and using SAPUI5, I am unable to use it.

Any help or directions to proceed will be really helpful.

Thanks & Regards,



Former Member
0 Kudos

Hi Mohamed,

Why not call a smartforms which has the shopping cart details in it..?

I think smartforms output appear as pdf in web browser.

PS: I have very little knowledge on the UI part. Please excuse me if am completely out of context.


Manikandan JN.

Active Participant
0 Kudos

Hi Mohamed,

Like , I too have limited knowledge of SAP UI5. Though, if WDA like functionality is not supported in it, you can have a rather ugly method:

  • Save the PDF on the SAP R/3 using dataset syntax.
  • Retrieve the PDF file as a resource. The browser should render automatically.

0 Kudos

Thanks for the response Abhijeet and Manikandan.

I won't be able to use smartform

I tried to create the file from ABAP itself, but I was unable to create. Is there any type in ABAP that can be used to hold a file as such?

And how can I create a Pdf from ABAP?

Thanks & Best Regards,


0 Kudos

Hi Mohamed,

If you requirement is to print the contents of internal table, the presumed meaning of 'ABAP itself', you need to move it to spool and then convert the spool to PDF using FM CONVERT_ABAPSPOOLJOB_2_PDF.