Advertising:
How to use Cloud API CV ATTACHMENT SRV for attachments with Generic Object Services
From SAP Knowledge Base
This wiki entry was written at the time of version 1.00 / last modified on October 17, 2024.
- https://api.sap.com/api/API_CV_ATTACHMENT_SRV/overview
- https://help.sap.com/docs/SAP_S4HANA_CLOUD/7489fa08cede494cbdf08fa3651598af/2e1be0a60d08400b8e4b1f6b57140a28.html?locale=en-US
Gängige Business Objekte
- Purchase Order: BUS2012
- Purchase Requisition: BUS2105
- Purchase Requisition Item: BUS2009
- Sales Order: BUS2032
- Customer Quatation: BUS2031
- Sales Contract: BUS2034
GOS
Get attachments
Note |
The display of attachments works for business objects such as BUS2032. However, not with your own created business objects with this service. See linked alternative. |
- HTTP-Methode: GET
- /sap/opu/odata/sap/API_CV_ATTACHMENT_SRV/GetAllOriginals?BusinessObjectTypeName='BUS2032'&LinkedSAPObjectKey='6000000062'
Alternatively:
Create attachments
Note |
If there are object links in Customizing for the business object in DMS, the API tries to upload the attachment with DMS. To avoid this, a separate business object with transaction "SWO1" must be created/copied and used. This is the case, for example, with sales document items (VBAP). |
File
- HTTP-Methode: POST
- Request-URI: /sap/opu/odata/sap/API_CV_ATTACHMENT_SRV/AttachmentContentSet
- HTTP-Request (heaer-name : value) :
- BusinessObjectTypeName : business object z.B. BUS2032 for salesorder
- Content : path + filename.filetype from client
- Content-Type : text/plain for .txt (application/pdf for .pdf etc.)
- LinkedSAPObjectKey : Key e.g. for BUS2032 ten-digit document number. 6000000062
- slug : filename.txt
Delete attachments
Note |
For business objects like BUS2032, deleting the specific attachment works with the parameters that you get via the display. However, not with your own created business objects with this service. See linked alternative. |
- HTTP-Methode: DELETE
- Request-URI: /sap/opu/odata/sap/API_CV_ATTACHMENT_SRV/AttachmentContentSet(DocumentInfoRecordDocType='GOS',DocumentInfoRecordDocNumber='EXT49000000000424',DocumentInfoRecordDocVersion=,DocumentInfoRecordDocPart=,LogicalDocument='0050569C5BC91EDFA6EE7C8249EFB2C8',ArchiveDocumentID='0050569C5BC91EDFA6EE7C8249EFD2C8',LinkedSAPObjectKey='6000000062',BusinessObjectTypeName='BUS2032')
Alternatively: