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>'
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
- SAP Help Portal: Attachments for Project Definitions and Project Elements
- SAP Help Portal: Attachments for Projects and Work Packages
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
SAP Knowledge Base Article - Public