Symptom
This knowledge article introduces how to use API API_CV_ATTACHMENT_SRV to download attachment from supplier invoice.
Environment
SAP S/4HANA Cloud Public Edition
Resolution
- Call GET method with operation GetAllOriginals to retrieve the metadata of the attachment associated with the supplier invoice object.
For supplier invoice, use BusinessObjectTypeName = 'BUS2081' and LinkedSAPObjectKey = '<invoice number><fiscal year>'.
Sample request URL:
GET <host>/sap/opu/odata/sap/API_CV_ATTACHMENT_SRV/GetAllOriginals?BusinessObjectTypeName='BUS2081'&LinkedSAPObjectKey='51056040192024'
The following properties can be found in response body:
<d:DocumentInfoRecordDocType>SI1</d:DocumentInfoRecordDocType>
<d:DocumentInfoRecordDocNumber>10000000617</d:DocumentInfoRecordDocNumber>
<d:DocumentInfoRecordDocVersion>00</d:DocumentInfoRecordDocVersion>
<d:DocumentInfoRecordDocPart>000</d:DocumentInfoRecordDocPart>
<d:LogicalDocument>AD450F13BF3C1EDFA2C0C51DC7A086B2</d:LogicalDocument>
<d:ArchiveDocumentID>AD450F13BF3C1EDFA2C0C51DC7A0C6B2</d:ArchiveDocumentID>
<d:LinkedSAPObjectKey>51056040192024</d:LinkedSAPObjectKey>
<d:BusinessObjectTypeName>RBKP</d:BusinessObjectTypeName> - Use the properties retrieved from step 1 to call GET method with entity AttachmentContentSet to download the attachment content.
Sample request URL:
GET <host>/sap/opu/odata/sap/API_CV_ATTACHMENT_SRV/AttachmentContentSet(DocumentInfoRecordDocType='SI1',DocumentInfoRecordDocNumber='10000000617',DocumentInfoRecordDocPart='000',DocumentInfoRecordDocVersion='00',LogicalDocument='AD450F13BF3C1EDFA2C0C51DC7A086B2',ArchiveDocumentID='AD450F13BF3C1EDFA2C0C51DC7A0C6B2',LinkedSAPObjectKey='51056040192024',BusinessObjectTypeName='RBKP')/$value
Keywords
API_CV_ATTACHMENT_SRV, attathment, supplier invoice, download, BUS2081, RBKP, GetAllOriginals, AttachmentContentSet , KBA , MM-FIO-IV-2CL , Fiori UI for Invoice Verification (Public Cloud) , How To
Product
SAP S/4HANA Cloud Public Edition all versions