on 2021 Sep 28 6:34 PM
Hello All.
I'm creating an App to upload files into SAP DMS.
I read many blogs showing how to do it. So, first I created an OData Service and implemented the CREATE_STREAM method.
When I test the service through GW_CLIENT, the file is upload successful and I can see it in CV03N:
GW_CLIENT:
CV03N:
File Content in MS Word:
Well, in my UI5 app, I call the OData Service through ajax. The "data" parameter in ajax call have the same length when I call the OData service through GW_CLIENT (640747):
Ajax Call:
GW_CLIENT: (IS_MEDIA_RESOURCE-VALUE)
But after the ajax call, the length of IS_MEDIA_RESOURCE-VALUE is to bigger than when the call is do through GW_CLIENT:
So, when I save this content as a File in DMS, the file is corrupt an it cannot be open through MS Word.
When the file is pure TXT format, the operation is sussecsful.
My ajax call:
$.ajaxSetup({cache: false});
jQuery.ajax({
url: "/sap/opu/odata/sap/ZSG_FI_SOLCRED_SRV/fileSet",
processData: false,
async: false,
data: file.Content,
dataType: file.MimeType,//"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
type: "POST",
beforeSend: function(xhr){
xhr.setRequestHeader("X-CSRF-Token", that.token);
xhr.setRequestHeader("Content-Type", file.MimeType);
xhr.setRequestHeader("slug", slug);
},
success: function(oData){
that.message("File Ok");
},
error: function(error){
that.message("F");
}
});
I would to like to know why the content of IS_MEDIA_RESOURCE-VALUE comes different through GW_CLIENT and Ajax Client? And how to fix it.
Thanks for advance.
BR,
João Mariano
Request clarification before answering.
User | Count |
---|---|
89 | |
12 | |
7 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.