on 06-15-2020 9:07 AM
HI All,
I want to call the get_stream method of an Odata Model in SAPUI5 in a batch operation. I am able to call it via window.open("//url//") way but the issue is that I do not want to directly call the URL.
My requirement is to first call a Get_Entityset method to generate an xstring value which can later be retrieved via Get_Stream method. The xstring basically refers to an excel file.
I am doing it like:
var oModel = oController.getView().getModel("mainModel");
oModel.setDeferredGroups(["ReadExcel"]);
var mParameters = {
groupId: "ReadExcel",
success: function (odata, resp) {
// window.open(resp.requestUri);
// window.open("/destinations/XXX/sap/opu/odata/sap/ZXXXX_SRV/FileSet(Mandt='101',Filename='test_file')/$value");
},
error: function (odata, resp) {}
};
oModel.read("/DummySet", {
groupId: "ReadExcel",
filters: [new sap.ui.model.Filter({
path: "RepName",
operator: sap.ui.model.FilterOperator.EQ,
value1: oController.getView().byId("idRepName").getValue().toUpperCase()
})]
});
oModel.read("/FileSet(Mandt='101',Filename='test_file')/$value", {
groupId: "ReadExcel"
});
//Submit Batch
oModel.submitChanges(mParameters);
I am able to receive the xstring data as I see in network tab
HTTP/1.1 200 OK
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Content-Length: 12610
sap-metadata-last-modified: Wed, 03 Jun 2020 01:47:07 GMT
cache-control: no-store, no-cache
x-content-type-options: nosniff
content-disposition: inline; filename=main.xlsx
dataserviceversion: 2.0
......
PKÐ<ÏPE6cdocProps/core.xmlmÍnÂ0_ÅòP©ª¢D= VíÕØKp´^yû:M#ÁͳóíHë)WWÛ°`4Þ-yÍ9§¼6®^òÏ·Ùg«ªT¡Pa>ÈÒ
K~$
QÁÊ%Â%óàÑJJk¤:ÉÄb>HjIRô³0&rvËÔjÌgl4`ÁQy L6>Ü)j
u²æ?~f$Û¶ÍÚ§M7äâ{ó¾ÎI:¼*µ*ÈPLïxÞÿ¢R<V»õ}Á~½+ÅdÚÿï ºÖ£·
Q¡ zé' hd¤Mjæ`@¿vÓ¤{³ç.¦¯µÊbC öØõÑâ®ÜêPKÐ<ÏPKrÛa´-docProps/app.xmlÍ0_¥é
1¥ÄD½xPï¤,кM»|{«Ä³{ÛÙ/3²ÇMàA[ò<Í8«±1¶+ùå|HÖUJ<:ðd °ø`CÉ{"·"èÆ:¤Q¶QiÑ5ÅÕwÛÖhØ¡¾`IY¶0ØÄ}-ÈÍDÿRÔÏáz¾»TrëÜ`tM±:í1`Kl?k¤øÎëÒ^åEÅyÞ7)¾ÍÕPKÐ<ÏP!7M#Í[xl/workbook.xmlÁn0DÅÚ¨!Jªár(çHÉÙÅK¼
ö"ÛôïcH9ö63ßÌÖ#ÇóCL®÷QMi¨¤E§ãèóKÇÁém¸Ë8Ô&ZÄäz¹+Oé4yxªðwµxæöסO/HÀ^'b-
......
but I also get the following error in console:
Log-dbg.js:456 2020-06-15 16:00:38.229250 The following problem occurred: no handler for data -
datajs.js?eval:17 Uncaught TypeError: Cannot read property 'body' of undefined
at constructor.I._createEventInfo (ODataModel-dbg.js:1226)
at constructor.I._processSuccess (ODataModel-dbg.js:3924)
at W (ODataModel-dbg.js:3283)
at V (ODataModel-dbg.js:3009)
at ODataModel-dbg.js:6142
at eval (datajs.js?eval:17)
at XMLHttpRequest.p9 (datajs.js?eval:17)
and the control doesn't go inside the success function.
Please provide your inputs/thoughts regarding this issue or any work-around so achieve the same.
Hi Deepak,
Can you please share at what step are you getting the error?
Can you check whether the x-string length is causing the issues?
Regards,
Karan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
8 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.