cancel
Showing results for 
Search instead for 
Did you mean: 

S4hana cloud api attachment API_CV_ATTACHMENT_SRV

MarioFranco
Participant
0 Kudos

Hi

I am using the api to upload file to s4hana cloud, API_CV_ATTACHMENT_SRV to a supplier invoice document

in the entity /AttachmentContentset I'm trying to load

I find an error that tells me that in the name of the file can not be empty, knowing that in the structure I am reporting the name of the file

how can I load the pdf file and convert it to base64?

and where should I report the address of the file?

----------------------------Error response from api-------------

"error": {

"code": "SY/530",

"message": {

"lang": "en",

"value": "Attachment name cannot be empty"

},

--------------------------------------------------

the structure that I am using :

{ "DocumentInfoRecordDocType": "GOS",

"DocumentInfoRecordDocNumber": "EXT43",

"DocumentInfoRecordDocVersion": "",

"DocumentInfoRecordDocPart": "",

"LogicalDocument": "FA163E597C0",

"ArchiveDocumentID": "FA16B72DEB7C0",

"LinkedSAPObjectKey": "51056001902018",

"BusinessObjectTypeName": "BUS2081",

"SemanticObject": "",

"WorkstationApplication": "PDF",

"FileSize": "17408",

"FileName": "File.pdf",

"DocumentURL": "",

"MimeType": "application/pdf",

"Content": "", --------------------------------------------->>>>>>>>>>??????????????????????

"BusinessObjectType": "BUS2081",

"StorageCategory": "",

"ArchiveLinkRepository": ""

}

Accepted Solutions (1)

Accepted Solutions (1)

MarioFranco
Participant
0 Kudos

Thanks a lot. We appreciate your help.

Enda
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Mario ,

I been in contact with the Development Team responsible for the API API_CV_ATTACHMENT_SRV and they have suggested an incident needs to be created with an example of the error you receive so they can debug it to see why its raised.

Please can you create an incident / support ticket on the component area CA-CMS so they can check the issue .

Thank you for your cooperation.

Enda.

Answers (2)

Answers (2)

cobbaut_matthias
Explorer

Hello,

I am currently facing the same issue a year later.

Is there any update available on this issue?

Kind regards,

Matthias

Christopher
Participant
0 Kudos

Same here! The API is not clear about the parameters and even though the attachment name is set I'm getting the error "Attachment name cannot be empty"

Enda
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Mario

Could you please check the online documentation for the API API_CV_ATTACHMENT_SRV if you havent already ?

https://help.sap.com/viewer/243e3966d3664ad9adaebe084815d897/1805.500/en-US/2e1be0a60d08400b8e4b1f6b...

The parameters such as DocumentInfoRecordDocPart and DocumentInfoRecordDocNumber are mandatory but empty above

Thank you

Enda

MarioFranco
Participant
0 Kudos

Hi.

yes. I see the documentation of the api

but I found that it was necessary to add some parameters in the call of the api to be able to do the load

at the end the structure stayed like this:

/ sap / opu / odata / SAP / API_CV_ATTACHMENT_SRVAttachmentContentSet

-----------------------Body:--------------------------

{

   "MimeType": "string",

   "Content": ""

}

-------------------Header parameters ---------------

Slug = filename

Content-Type = tipe of file

BusinessObjectTypeName = 1234567892018 / num of doc supplier and year

LinkedSAPObjectKey = BUS2081 // for suplier invoice

But right now I'm faced with another problem loading the Png-type image file in base64 format

in body of the call

{

"MimeType": "image / png",

   "Content": "iVBORw0KGg ................................... etc" // base64

}

in document of supplier invoice when i download the previously loaded image and when trying to open it I get format error

With what format should I convert the image?

Thaks and regards

Enda
Product and Topic Expert
Product and Topic Expert

Hi Mario ,

Im currently checking what format is needed when using the API .when i have more information il update you

Enda

Christopher
Participant
0 Kudos

Hello here,

I have the same problem, I'm trying to upload the file as a base64 String, it is uploaded successfully but when I try to open the file in S4 it does not open because the file is not readable.

Christopher
Participant
0 Kudos

enda.fennelly

Hello Enda, I'm facing the same problem, I can't open any of the files I upload (tried base64, base64Url). Do you have any updates?