Skip to Content

Creating attachments in SAP Document Management System using HANA XS Services

Hi Experts,

We have a requirement where attachments are created in SAP DMS using HANA XS services (xsjslib). Please see the scenario below:

Step 1: User uploads a file from front-end (SAPUI5)

Step 2: File Information is stored in HANA in a Table. File Contents are stores as "ArrayBuffer".

Step 3: A service needs to post this informtion to create new document and attach the file in SAP DMS using gateway services

When we try to call the gateway service and post the data (in arraybuffer format), The File cannot be viewed in DMS as it is corrupt. Please see code below:

/*this.attachDest is the connection to the gateway attachment service*/
var newExtSrv = new ExtServiceLib.ExtService(this.conn, $.net.http.POST, this.attachDest);

        oHeaders.push({
            name: "Content-Type",
            value: attachmentData.MimeType
        });

        var dataToSend = attachmentData.FileContent;
        var response = newExtSrv.execute(dataToSend, queryPath, null, oHeaders);

Sample Data stored in the HANA table:

When we try to upload the same file from a UI5 front-end(using a FileUploader), the file is created and can be viewed as a file.

Queries:

1)Is it because I am sending the file-contents in Binary format(array Buffer).

2) Should we be converting this data into a string before posting.

3) How do we handle the conversion for different mime types.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.