cancel
Showing results for 
Search instead for 
Did you mean: 

Sapui5 - Xml view open pdf

Giacomo_Savioli
Explorer
0 Kudos

Hi, I'm developing a Fiori custom web application and I need to open a pdf file in a xml view.

I've develop a custom oData service for implementing the method


/IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_STREAM

Returning the data stream as:


ls_stream-value = l_value.

ls_stream-mime_type = 'application/pdf'.

copy_data_to_ref( EXPORTING is_data = ls_stream

                              CHANGING  cr_data = er_stream )

In xml view I've put


<core:HTML id="idFrame"/>

The relative controller is


var html = this.getView().byId("idFrame");

var url = "/sap/opu/odata/sap/*****('YYYYY')/$value";

html.setContent('<iframe src="' + url +'" width="100%" height="100%"></iframe>');

When I open the view nothing appears and in Chrome console I've got this message

How can I solve it out?

Kind regards,

Giacomo

Accepted Solutions (1)

Accepted Solutions (1)

saurabh_vakil
Active Contributor
0 Kudos

What is the result if you call the URL http://<host>:<port>/sap/opu/odata/sap/*****('YYYYY')/$value in the browser? Does it open the PDF?

Giacomo_Savioli
Explorer
0 Kudos

Hi, yes I tried to open the link in the browser and I can view the pdf.

saurabh_vakil
Active Contributor
0 Kudos

You can try opening the PDF from your UI5 app by implementing the below code in your controller:


parent.window.open(pdfURL, '_blank');

Answers (1)

Answers (1)

Former Member
0 Kudos

This message was moderated.