cancel
Showing results for 
Search instead for 
Did you mean: 

Fiori exception "no handler for data"

former_member268046
Discoverer
0 Kudos

I have built a gateway service which successfully sends a pdf file. I used the media functionality and the GET_STREAM method to do this. It works in the Gateway cleint and when called from a browser.

However when I call the read method of the service from UI5, using the exact same syntax that works in the gateway (e.g. /sap/opu/odate/sap/ZINT_CRSTO_SRV/pdfSet(Ebeln='123')/$value ), I get an exception thrown in file datajs.js as "no handler for data" at line 7854.

The service is called successfully and returns a 200 status. The error is raised as the content type showing 'application/pdf' and there is no handler for this in the list

(there are handlers for 'application/json', 'application/atom+xml,application/atomsvc+xml,application/xml', 'application/xml' and 'text/plain')

I repeat, the gateway service works, the error is being thrown in UI5.

Any ideas where my error is?

Accepted Solutions (0)

Answers (4)

Answers (4)

daihao
Employee
Employee

Hi,

You can find the root cause and some alternative ways in this Github issue - https://github.com/SAP/openui5/issues/3519

Regards,

Hao

feliperodrigues
Contributor
0 Kudos

You don't need to consume the PDF via OData model, since the Fiori Launchpad is usually published in the same application server of the SAP Gateway you can publish a simple link in your application based on the relative path, this way the browser will handle automatically the consumption of the PDF file.

Use a simple javascript window.open( ) and send the OData URL file as a parameter, in your case:

/sap/opu/odate/sap/ZINT_CRSTO_SRV/pdfSet(Ebeln='123')/$value
Muthukumaran
Explorer
0 Kudos

Hello,

In your scenario, how to pass the header parameter in window.open()?

I need to pass custom header parameter, I have tried to set it in the component.js but it is not taking the header value.

Please let me know if you have any work around for this SAP issue.

Thanks,

Muthu.

0 Kudos

Hello Felipe,

your method allows users to download a file, but how can we check if the file exists or not? If you open the link in a new tab, but the file does not exist, how to handle the error?

Best regards,
Roman

jajaniks
Explorer
0 Kudos

Even if the question is a little older, others may also face this issue:

The URL in the read method must not contain /$value.

Need your help. I'm also facing the same issue. Please let me know how to call GET_STREAM method without adding $value in read method. Thanks !

junwu
Active Contributor
0 Kudos

from ui5 side, what you do after getting the data?

former_member268046
Discoverer
0 Kudos

The data is not coming back, the exception is being raised inside the oModel .read call and therefore success callback function is not being called, I just get the oError object with a message that there is no handler for data and an uncaught exception in standard code.

I have attached a screenshot of the Chrome debugger as the exception is thrown.

Does this help anyone?

I am also raising an OSS message, but this forum is usually quicker 😉