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.

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:


This is a wiki created in the spare time of a private person working in the SAP ERP area. The aim is to collect knowledge for the own use. The wiki is maintained to the best of knowledge and belief.
All products shown, including in form of screenshots, belong to SAP SE. Their trademarks are, among others: SAP®,ABAP®,SAP Fiori®,SAP HANA®,SAP NetWeaver®,SAP® R/3®,SAP S/4HANA®,SAP S/4HANA® Cloud