Skip to Content
0

Creating attachments in SAP Document Management System using HANA XS Services

Dec 19, 2017 at 12:15 PM

28

avatar image
Former Member

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers