4 weeks ago
I'm working on reading data from an Excel file, but due to customer restrictions, I'm unable to use third-party libraries. My approach is to upload the Excel file to the backend, process the content there, and then send the data back to the frontend.
I am using UploadSet for the file upload, and while the upload process claims to be successful, the corresponding table in the backend is not being populated. I also tried using unmanaged save with RAP, but the code doesn't seem to be triggered when I attempt to upload the file.
Doe anyone know how to handle this scenario or what I am doing wrong?
Sample Codes:
UploadSet:
<upload:UploadSet
id="idAttach"
instantUpload="false"
uploadEnabled="true"
uploadUrl="/sap/opu/odata/sap/SERVICE/InvoiceAttachSet"
mode="None">
</upload:UploadSet>
Upload JS:
onUploadBtn: function(){
var oAttachmentUpl = that.getView().byId("idAttach");
var aIncompleteItems = oAttachmentUpl.getIncompleteItems();
var iIncompleteItems = aIncompleteItems.length;
for(var i = 0; i < iIncompleteItems; i++){
var sFileName = aIncompleteItems[i].getProperty("fileName");
var oXCSRFToken = new sap.ui.core.Item({
key: "X-CSRF-Token",
text: that.getOwnerComponent().getModel("SERVICE").getSecurityToken()
});
var oSlug = new sap.ui.core.Item({
key: "SLUG",
text: sEingangnr + "/" + sFileName
});
oAttachmentUpl.addHeaderField(oXCSRFToken).addHeaderField(oSlug);
oAttachmentUpl.uploadItem(aIncompleteItems[i]);
oAttachmentUpl.removeAllHeaderFields();
}
}
RAP Behavior Definition:
managed implementation in class xxx unique;
strict ( 2) );
define behavior for xxx alias Excelupload
with unmanaged save
lock master
authorization master ( instance )
{
create;
update;
field (readonly) Equnr;
}
@Marian_Zeis Yeah I saw this tool, but unfortunately cant use it, since im restricted to the UI5 library. Would be really helpfull otherwise.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
67 | |
10 | |
10 | |
10 | |
10 | |
8 | |
8 | |
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.