SAP Knowledge Base Article - Public

3648499 - How to Use API_CV_ATTACHMENT_SRV to Download Attachments for Enterprise Projects and Professional Services Projects at SAP S/4HANA Cloud Public Edition

Symptom

This knowledge article introduces how to use the Attachment Service API (API_CV_ATTACHMENT_SRV) to download attachments for enterprise projects and professional services projects. 

Environment

SAP S/4HANA Cloud Public Edition

Resolution

1. Call GET method with operation GetAllOriginals to retrieve the metadata of the attachment associated with the project:

  • For enterprise project, use BusinessObjectTypeName = '/S4PPM/PRJ' and LinkedSAPObjectKey = '<UUID for project>' or '<UUID for WBS element>'
  • For professional services project, use BusinessObjectTypeName = '/CPD/EP' and LinkedSAPObjectKey = '<external ID for project>'
  • For professional services project element, use BusinessObjectTypeName = '/CPD/PFP' and LinkedSAPObjectKey = '<external ID for work package>'

For BusinessObjectTypeName = '/S4PPM/PRJ' , the LinkedSAPObjectKey should be maintained without dashes , for example FA163E9B123D1FE199C809A4A8164123 instead of 00123e30-4e2a-1123-bbe7-8dd143753123 


Sample request URL for professional services work package:
GET <host>/sap/opu/odata/sap/API_CV_ATTACHMENT_SRV/GetAllOriginals?BusinessObjectTypeName='/CPD/PFP'&LinkedSAPObjectKey='<external ID for work package> '

The following properties can be found in response body:
<d:DocumentInfoRecordDocType>xxx</d:DocumentInfoRecordDocType>
<d:DocumentInfoRecordDocNumber>xxxxxxxxx</d:DocumentInfoRecordDocNumber>
<d:DocumentInfoRecordDocVersion>xx</d:DocumentInfoRecordDocVersion>
<d:DocumentInfoRecordDocPart>xxx</d:DocumentInfoRecordDocPart>
<d:LogicalDocument>xxxxxxxxx</d:LogicalDocument>
<d:ArchiveDocumentID>xxxxxxxxx</d:ArchiveDocumentID>
<d:LinkedSAPObjectKey>xxxxxxxxx</d:LinkedSAPObjectKey>
<d:BusinessObjectTypeName>xxxxxxxxx</d:BusinessObjectTypeName>

2. 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='xxx',DocumentInfoRecordDocNumber='xxxxxxxxx',DocumentInfoRecordDocPart='xxx',DocumentInfoRecordDocVersion='xx',LogicalDocument='xxxxxxxxx',ArchiveDocumentID='xxxxxxxxx',LinkedSAPObjectKey='xxxxxxxxx',BusinessObjectTypeName='xxxxx')/$value

See Also

Keywords

API, download, attachment, customer project, internal project, enterprise project, professional services project, work package, API_CV_ATTACHMENT_SRV, Attachment Service API , KBA , PPM-SCL-STR , Project Structure (Public Cloud) , CA-CPD-SS , S/4HANA Public Cloud – Professional Service Projects , How To

Product

SAP S/4HANA Cloud Public Edition all versions