Advertising:
How to use onPrem CV ATTACHMENT SRV for attachments with Generic Object Services
From SAP Knowledge Base
If possible, Cloud API_CV_ATTACHMENT_SRV should be used when using business objects that the API supports. Custom or standard business objects such as VBAP are not supported and the CV_ATTACHMENT_SRV service must be used.
Common business objects
- Purchase order: BUS2012
- Purchase order items: -
- Purchase requisition: BUS2105
- Purchase requisition items: BUS2009
- Sales order: BUS2032
- Customer offer: BUS2031
- Sales contract: BUS2034
GOS
Get attachments
- HTTP method: GET
- Request URI: /sap/opu/odata/sap/CV_ATTACHMENT_SRV/GetAllOriginals?ObjectType='YVBAP'&ObjectKey='6000000062000010'
Create attachments
Delete attachments
Note |
The ApplicationID and FileID are required for deletion (see CL_ODATA_CV_GOS_BO->GET_LOIO_PHIO_FOR_GOS, import with object ID e.g. EXT49000000000438). You usually get these when you display all attachments, unless they were uploaded via GUI. In this case, the ApplicationID and FileID are empty. If this is not provided, the service assumes that it is an attachment in draft and looks for this entry in the "ODATA_CV_ATTACH" table. However, if you do not work with drafts, you will not find your entry there. You get always the status code 204, because in some spot the sy-subrc is wrong handled (as of November 5, 2024). |
Note |
The ObjectKey is required encoded and service decode it in "ORIGINALCONTENTS_DELETE_ENTITY" method with cl_http_utility. |
- HTTP method: DELETE
- Request Uri: /sap/opu/odata/sap/CV_ATTACHMENT_SRV/OriginalContentSet(Documenttype='GOS',Documentnumber='EXT49000000000440',Document part=,Documentversion=,ApplicationId='0050569C5BC91EDFA6F31885BF9072C8',FileId='0050569C5BC91EDFA6F31885BF9092C8')
- HTTP request (header name : value) :
- ObjectKey : NjAwMDAwMDA2MjAwMDAxMA== (6000000062000010)
- ObjectType: YVBAP
- isdraft : 'false'
- markfordeletion : true