cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Guidance on Retrieving and Downloading Attachment Folder Data

SAPSupport
Employee
Employee
0 Likes
877

Assistance with retrieving and downloading attachment folder data from an attachment folder using the web service ManageAttachmentFolderIn or the BusinessObject AttachmentFolder.


Could you please provide guidance on how to achieve this scenario?


------------------------------------------------------------------------------------------------------------------------------------------------
Learn more about the SAP Support user and program here.

Accepted Solutions (1)

Accepted Solutions (1)

SAPSupport
Employee
Employee
0 Likes

Dear,

Hope all is well.

To retrieve the data using the ManageAttachmentFolderIn service interface, the document UUID of the attachment document is required. In order to gather this UUID, an initial query to the service interface of the business object needs to be performed, which will query all attachments of that specific object and their respective UUID. Then this can be used to query the attachment as a binary object using the attachment folder interface.

For example:

To retrieve the attachment data of the Material ABC, you can perform a query for the material using the service interface "QueryMaterialIn" with the example payload below:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:glob="http://sap.com/xi/SAPGlobal20/Global">
   <soapenv:Header/>
   <soapenv:Body>
      <glob:MaterialByElementsQuery_sync>
      
         <RequestedElements>
            <Material>ABC</Material>
         </RequestedElements>
         
      </glob:MaterialByElementsQuery_sync>
   </soapenv:Body>
</soapenv:Envelope>

*Where ABC refers to the Material ID*

In the response payload, you can search for the UUID under the Attachment Folder field in the payload.

Once the UUID of the document is located, you can use the UUID of the document to retrieve the Attachment data.

For retrieving the data, you can perform a query using the ManageAttachmentFolderIn with the operation ReadDocumentsFileContent, using the example below.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:glob="http://sap.com/xi/SAPGlobal20/Global">
   <soapenv:Header/>
   <soapenv:Body>
      <glob:AttachmentFolderDocumentsFileContentByIDQuery_sync>
         <AttachmentFolderDocumentFileContentByIDQuery>
            <!--Zero or more repetitions:-->
            <DocumentUUID>CDF</DocumentUUID>
         </AttachmentFolderDocumentFileContentByIDQuery>
      </glob:AttachmentFolderDocumentsFileContentByIDQuery_sync>
   </soapenv:Body>
</soapenv:Envelope>

*Where CDF refers to the Document UUID retrieved in the previous query.*

*The examples above where taken from our internal systems, therefore the headers must be adjusted for your respective WSDL .*

In the response payload, you will receive the Binary Object of the attachment.

In this case, a Base64 decoder will be required to convert the data into the Original file.

Please refer to the below blog and Web Service documentation, which provide more insights on the matter.

Inbound Service Manage Attachment Folders

https://help.sap.com/doc/a2b4c7ef61d64397b2b1d052082a8a08/2405/en-US/PSM_ISI_R__DOC_II_MANAGE_ATTCHM...

Read and Write ByDesign Attachments using Web Services

https://community.sap.com/t5/enterprise-resource-planning-blogs-by-sap/read-and-write-bydesign-attac...

Regards,
Vinicius

Answers (0)