Definition
To read the file content of one or multiple Documents within an Attachment Folder
Business Context and Use
The web service interface Read Documents File Content enables you to read the content of multiple attachment with one request.
To create attachments you need to use web service interfaces of the business object where you want to store the attachments.
Prerequisites
Use web service interfaces of the business object where the attachments are stored (host object) to determine the key (UUID) and other information (e.g. type and name) of the attachments.
This service is used to read the actual document content.
In order to use the service you need to first create a communication scenario to specify for which host object you want to read the attachments. If you need to read attachments of different host object you will need to create several communication scenarios.
To get a technical user with the authorization to call this web service you need to create a communication arrangement for the above communication scenario.
Structure
AttachmentFolderDocumentFileContentByIDQuery_sync (Request)
The request message type contain two sub structures described below.
AttachmentFolderDocumentFileContentByIDQuery
Contains one or multiple entries "DocumentUUID" which contains the UUID of the attachments which should be read.
ProcessingConditions
The field QueryFileSizeMaximumNumberValue contains the limit for the sum of file sizes retrieved with one request. The unit is kB (1024 Bytes).
AttachmentFolderDocumentsFileContentByIDResponse_sync (Response)
The response message type contains two sub structures described below.
AttachmentFolderDocumentFileContent
This table contains the fields DocumentUUID and BinaryObject. The BinaryObject is the base64 encoded file content.
ProcessingConditions
This structure contains the field MoreHitsAvailableIndicator which is true in case the size limit (as specified in the request) was exceeded and not all documents could be returned due to this.
Example
Request
This xml snippet reads the content of two attachments. The response will be restricted in a way that the total size of the returned files does not exceed 1MB (1024kB).
<n0:AttachmentFolderDocumentsFileContentByIDQuery_sync xmlns:n0="http://sap.com/xi/SAPGlobal20/Global"
<AttachmentFolderDocumentFileContentByIDQuery>
<DocumentUUID>12345678-90AB-CDEF-0123-456789ABCDEF</DocumentUUID>
<DocumentUUID>12345678-90AB-CDEF-0123-456789ZXYUUZ</DocumentUUID>
</AttachmentFolderDocumentFileContentByIDQuery>
<ProcessingConditions>
<QueryFileSizeMaximumNumberValue>1024</QueryFileSizeMaximumNumberValue>
</ProcessingConditions>
</n0:AttachmentFolderDocumentsFileContentByIDQuery_sync>
Response
The size of the second document would have exceeded the specified limit. Therefore, it is not returned and MoreHitsAvailableIndicator is returned as true.
<?xml version="1.0"?>
<n0:AttachmentFolderDocumentsFileContentByIDResponse_sync xmlns:prx="urn:sap.com:proxy:QCH:/1SAI/TAS443E8909F47F876ABE5F:804" xmlns:n0="http://sap.com/xi/SAPGlobal20/Global">
<AttachmentFolderDocumentFileContent>
<DocumentUUID>12345678-90ab-cdef-0123-456789abcdef</DocumentUUID>
<BinaryObject mimeCode="text/plain">SnVzdCBhIHRlc3Qu</BinaryObject>
</AttachmentFolderDocumentFileContent>
<ProcessingConditions>
<MoreHitsAvailableIndicator>true</MoreHitsAvailableIndicator>
</ProcessingConditions>
</n0:AttachmentFolderDocumentsFileContentByIDResponse_sync>
Note
In case the returned BinaryObject is empty, there are 2 probable reasons: either the requested DocumentUUID is invalid, or the user with which the service was called does not have the required authorization to retrieve the document. This can also be the case when the document is attached to a host object that differs from the host object specified in the communication scenario.