cancel
Showing results for 
Search instead for 
Did you mean: 

Open PDF retrieved via odata service in SAPUI5

Former Member
0 Kudos

Hi all,

How can I show a PDF file retrieved via an ODATA service in to my SAPUI5 application?  I have looked for some controls or api's but I can not find one in the SAPUI5 labrary. Also can not find any good information on the internet.

Can someone tell me a solution?

Kind regards,

Richard

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Martin,

I think it is a flat pdf.

I saved my PDF document in a xstring. When I call the Odata service then I use get_stream method to produce the pdf. The same way to  retreive a Photo.

Kind regards,

Richard

Former Member
0 Kudos

For our solution we had to display a PDF from the ADS, and therefore got this directly from a URL.

Therefore we used a HTML Object from the Core library, sorry did not ask with part of SAPUI5 you were using.

We then created a OBJECT or IFRAME tag inside this to display the PDF, and had that point at URL end point that returned just the PDF Object itself.

A quick example of this would be something like this, and then just add the oHTML Content to a Control like an Overlay or something like this.

//Create Place holder for the iFrame using a HTML Object
var oHTML = new sap.ui.core.HTML();
   

//Set the iFrame up to call the Form Controller passing in the Form Data so the
var oContent = '<iframe id="iframeContentPanel" ' + 'src="formGetController.do?' + formData + '"width="100%" height=600px'"></iframe>';

oHTML.setContent(oContent);

It's not the complete answer, but hopefully will help.

Martin

Former Member
0 Kudos

I had not thought about making use of an iFrame.

This is a good suggestion.

Kind regards

Miki von Ketelhodt

Answers (3)

Answers (3)

karthikarjun
Active Contributor
0 Kudos

Hi All,

I tried your solutions...I can able to View my pdf in Desktop....when i create apk It is going to blank screen

I am using SAP Netweaver Gateway service to show my pdf in mobile...Can you please give some idea to me ....

Thanks,

Karthik A

Former Member
0 Kudos

Hi R. Middelburg,

As explained earlier and in previous threads, there is no control in the SAPUI5 Framework that allows you to embed a PDF document within the application, as is possible in Web Dynpro using Adobe Document Services.

As I understand it, you are currently returning an xstring via OData services? Correct me if I am wrong.

I would like to suggest an alternative option: Business Document Services. In the backend, you could call the Adobe Document Services to return the PDF file and store it in Business Document Services. You can then retrieve the required information from the Business Document Services via the "BDS_BUSINESSDOCUMENT_GET_URL" Function Module and set the web_applic_server_url_only property to abap_true. This will return a URL that points to the requested document, which is stored in Business Document Services. You can then return this URL via OData to your SAPUI5 application.

Depending on the client (mobile or desktop) the url will download the file and display it. For example, if you open up the URL which links to a PDF file in Google Chrome, it will download it and open the file in a new tab in the browser. This will have to suffice until, hopefully, the SAPUI5 Framework allows embedding of documents as it is done in Web Dynpro.

I hope my suggestion is valuable to your scenario.

Kind regards

Miki von Ketelhodt

ChandraMahajan
Active Contributor
0 Kudos

Hi,

Please refer solution as last reply in thread http://scn.sap.com/thread/3410292

also refer thread

Regards,

Chandra

Former Member
0 Kudos

What type of PDF are you trying to show? And interactive one from ADS or just a flat display PDF?

Martin

Former Member
0 Kudos

Hi Chandra,

I Have tryed the solution of the last replay!

`The way i implemented my solution is to call the adobe form without viewing it.

You will get the form in one of the returning parameters as raw string.

You need to convert the Raw string into Xstring.

Then create a MIME object from that Xstring.

Embed the MIME file in you UI5 application.`


when I test my odata service with mime/type  `application/pdf` in the service

PDFPayslipSet(PayslipMonth='01',PayslipType='',PayslipYear='2013')/$value I see my pdf.

when I test my odata service with mime/type  `'image/jpeg'` in the service

PDFPayslipSet(PayslipMonth='01',PayslipType='',PayslipYear='2013')/$value I see my pdf.

I see a image error.

Normally I use sap.m.image to show images in my application, but I think can not use that for PDF´s


Now I,m looking for source to imbed the PDF.


Richard




ChandraMahajan
Active Contributor
0 Kudos

Hi Richard,

I just wrote blog on displaying smartform in sapui5. Please refer my blog

I hope this will solve your issue.

Regards,

Chandra

Former Member
0 Kudos

HI,

How can we upload those file in MIME repository ?

My requirement is ==>

I have upload file in SAP-UI5, those file should upload in MIME repository (SAP-ECC)back end.

How can i do this? 

I have referred below link (which is shown  Gateway connection details).

http://scn.sap.com/community/netweaver-gateway/blog/2013/08/14/how-to-upload-and-download-files-usin...

Kindly help me on this...

Former Member
0 Kudos

HI,

How can we upload those file in MIME repository ?

My requirement is ==>

I have upload file in SAP-UI5, those file should upload in MIME repository (SAP-ECC)back end.

How can i do this?

I have referred below link (which is shown  Gateway connection details).

http://scn.sap.com/community/netweaver-gateway/blog/2013/08/14/how-to-upload-and-download-files-usin...

Kindly help me on this...