cancel
Showing results for 
Search instead for 
Did you mean: 

How do I pass the raw data as content for Attachment API_DOCUMENT_SRV

Hi Experts

I would like to add attachments with API_CV_ATTACHMENT_SRV to sales orders from Sap Build Process Automation.

For this I have done some testing of the API from Postman and SAP gateway client.

Is it possible to use this API with postman or gateway client without using the "Select File" or "Add file" function?

What I see is that the attachment is displayed correctly when using the option.

I also tested the conversion to base64 but unfortunately the file does not open

I would like to point out that the Content = file path does not work when it is added in the header as indicated on the post.

Any help or hint would be highly appreciated. Thanks a lot in advance.

Regards

Abdoulaye

OwenLiu
Product and Topic Expert
Product and Topic Expert
0 Kudos

Removed SAP S/4HANA Cloud tag.

janv7306
Active Participant
0 Kudos

The same issue is with another BAPI funtions ;-( Just examples:

SO_NEW_DOCUMENT_ATT_SEND_API1, CVAPI_DOC_CHECKIN, etc.

Accepted Solutions (1)

Accepted Solutions (1)

Raghu
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi abdoulaye.sangare ,

Kindly review this best practice content,

https://store.build.cloud.sap/store/05adaf4e-79a6-45f5-9f41-0eb14e512b96

webservice-api-call.jpg

Regards

Raghu

0 Kudos

Hi Raghu,

Thank you for your help,

I managed to solve the problem with the instruction on page 110 - 11

Here is the solution

let url = "/sap/opu/odata/sap/API_CV_ATTACHMENT_SRV/AttachmentContentSet";var csrf = obj.headers['x-csrf-token'];auth.csrf = csrf;
var payload = { 'method': 'POST', 'url': url, 'headers': { 'x-csrf-token': auth.csrf, 'Slug': 'TestASAN_Auto.pdf', 'BusinessObjectTypeName': 'BUS2032', 'LinkedSAPObjectKey': '0000013809', 'Accept': "*/*", 'content-Type': 'application/pdf' }, metadata:[ { name:'file', file: 'C:\\CdeGrossisteDOM.pdf', type:'application/pdf' } ]};
return payload;

Jaman
Participant
0 Kudos

Hi All,

Can anyone please tell me how do we pass the data as raw content as binary instead of uploading the file locally?

I have the data in Base64String format. How do we pass this data to this api? any conversion needed?

Thanks,

Ahamed

Answers (0)