cancel
Showing results for 
Search instead for 
Did you mean: 

Creating attachments in SAP Document Management System using HANA XS Services

sahud
Participant
0 Kudos

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.

Accepted Solutions (0)

Answers (0)