on 04-16-2018 10:19 AM
Hello,
I want to invoke an oData read service which returns PDF file as output. The oData url would look as follows:
/sap/opu/odata/SAP/ZYG_PDF_DWNLD_SRV/FILE_ENTITYSet('XYZ')/$value
I know how to invoke read operation from an entity set using standard SAPUI5 APIs. However, I am confused about the $value suffix in this oData invocation. How can I invoke the above url using SAPUI5 oData APIs.
Please provide the SAPUI5 code snippet which executes the above oData service
Note: If nothing is possible, my final work around is: construct the url in the above format using javascript and execute it using an ajax call. Before I do that, I would like to know the approach using standard API, hence posted this thread.
SAP Learner
Hi SAP Learner,
You can try this approach
File Upload/Download through NetWeaver Gateway
Regards,
Tri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey,
You can visit the below article for pdf download in sapui using odata. Hope so this will help you out.
blogs.sap.com/2016/11/23/pdf-download-option-with-sapui5/
Regards,
Adrian Gates
System Admin - CloudDesktopOnline
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I know is a pretty old post. But I'm facing the same problem related to the oData PDF request. I just keep getting the "no handler for data" error message, when I make the $value call. I'm using the "oModel.read(sRead" call structure, and some others, but nothing seems to work.
Any change you or any other can help me?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Jose..
I could not get a solution here. At the end, I have made an Ajax call using XMLHttpRequest call (not oData read. To my surprise, jQUery AJAX call also did not work as expected for me!!), which gave me the result.. Not sure why oData.read/jQuery AJAX did not yield the result!! 😞
I mean, solution is something like this:
var xhr = new XMLHttpRequest();
xhr.open('GET', "/sap/opu/odata/PDF_ENTITYSet(Empid='50160458',Begda=datetime'2018-05-31T00:00:00',Endda=datetime'2018-05-31T00:00:00')/$value" , true);
xhr.responseType = 'blob'; xhr.onload = function (e) { var oPdf_Blob = xhr.response; //That can be saved to db
}
oPdf_Blob has the PDF object.
Regards,
SAP Learner
Hello All,
I am trying to execute the following oData url from UI5 controler. It returns pdf file, when executed from Gateway client.
/sap/opu/odata/XXX/YYY_SRV/PDF_ENTITYSet(Empid='50160458',Begda=datetime'2018-05-31T00:00:00',Endda=datetime'2018-05-31T00:00:00')/$value
Code which I have tried to execute from controller is as follows:
var sServicePath = "/PDF_ENTITYSet(Empid='50160458',Begda=datetime'2018-05-31T00:00:00',Endda=datetime'2018-05-31T00:00:00')/$value";
oBackendModel.read(sServicePath, null, null, true, that.function(){ alert("Read success"),function(){ alert("Read failed");});
However, it fails always and shows "Read Failed" alert. I have gone through many examples where input is a normal string everywhere and tried to follow that approach here as well. I did not see single example where date is used as input to Entity set parameter. I am guessing that the issue is with datetime input in the url supplied during read.
Can anyone spot the issue here and provide suggestion on how to make this working?
Regards,
SAP Learner
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Couple of things you can update here after verifying your codebase -
1. See sample code here
2. Debug the behavior of GET_STREAM or READ_STREAM method.
Hi SAP learner,
This is more related to the gateway technology than to UI5. Adjust your tags so that the community can address the question better.
Best regards,
Désirée
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can someone please help me here?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.