Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
Hello community,

Last year SAP announced the possibility to upload files in SAP Build Process Automation forms with BTP DMS:

This blog shows how to utilize BTP DMS in both automations and forms and how to pass files between these artifacts.

Challenge & use-case:

Organizations need to have access to their data every day to analyze and monitor day to day business and to be able to react on appearing challenges. The data might be needed for simple and complex analysis as well as for auditing purposes. Extracting big volumes of data can be a tedious task. Therefore automating it would be beneficial for everyone and would help free up people from doing it manually and also help to increase compliance. Let's consider the following scenario on how we can automate extracting data for financial auditing purposes and create an approval process with SAP Build Process Automation and BTP Document management system.

The process can be triggered by a form or an API, since the request can be initiated by a person or an external auditing system. In the next step an RPA bot automatically extracts financial statement information from S/4HANA and sends the extracted information in a file for approval in SAP Build Process Automation and, if the approval is received, sends this information to a final receiver/system.

Process flow:


BTP DMS integration option

SAP Build Process Automation

Destination for DMS on a BTP subaccount (make sure the authentication type is OAuth2ClientCredentials).

Designing the process and automations:

First, we would need to build a process. The example process above can consist of several steps. I am going to focus on two automations:

  • An automation that extracts the data from S/4HANA and provides information into the form.

  • An automation that moves the file from a temporary DMS folder into a folder with all the reports.

Before we start with the automations it is important to create two folders in our DMS repository. We are going to use one folder for a new report that has been extracted and another as an archive for all the reports that were extracted earlier. It might be necessary for compliance reasons to store these reports for a certain amount of time. If we don't need to store them there is no need to have two folders, we can just delete file from the folder once the request is processed.

There is an API request to create a folder. Specification can be found here:

In my case I created two folders: "temporary" and "reportsFolder" with similar parameters below:

cmisaction createFolder
propertyId[0] cmis:name
propertyValue[0] Yourfoldername
propertyId[1] cmis:objectTypeId
propertyValue[1] cmis:folder

Now let's look at the first automation:

In my case I have an RPA automation that helps to extract the specified report form S/4HANA, which I have to upload into the "temporary" folder.

Let me focus on the uploading part here. First I need to upload the file to the temporary folder. There are two ways to do it:

  1. create your own custom automation that will call web service to upload the file.

  2. use the automation from SAP Build Process Automation store project that called How to use Document Management Service.

This project consist of several automations that show how to upload, retrieve and remove documents from DMS folders and repositories. It also has a DMS object data type, that can be copied to your projects as well as other artifacts. Feel free to utilize it in your projects, or you can create your own automations and data types.

In this scenario I used template automation to upload an extracted document.

To setup this automation I provided the local file path to the extracted document, DMS folder name in the following format: root/yourfoldername and the filename.

Note: you don't have to do this step if it is enough to send the document to the form from a local machine, like it is done in Invoice Processing with Document Management Service project in SAP Build Process Automation store. However, this scenario shows how it can be done with BTP DMS if this file needs to be accessible from the shared folder, for example. You can find information on how to work with shared folders in this blog post.

Another template automation that was utilized in this project is "Get folder content". To setup this automation I provided the folder name in the following format: root/yourfoldername

In this step we need to retrieve information about a DMS object, because we are going to move this object to the reports folder in an upcoming  step and need the object id.

The last step to make the file available in the form is to return a folder object (And, since this is temporary folder it is always going to consist of just one file, we can simply refer to the entire folder). Here's an example how to do it with a simple custom script:

Now if I run my process I can see that the form has an attachment that was extracted and returned by the automation.

Once the file is reviewed and sent to the next step we can move the object to the reports folder with the custom automation. Here is an example code snippet:
let options = {
method: 'POST',
metadataType: irpa_core.enums.request.metadataType.formData,
objectId: objectId,
sourceFolderId: folderName,
targetFolderId: targetFolderID
if (folderName){
options.url = folderName;
return options;

To enhance this scenario further you can add a process visibility scenario to get an end-to-end view of the process, monitor it's KPIs and make sure that it is compliant and every step is running on time.


SAP Build Process Automation offers different capabilities to work with documents and integration with SAP BTP DMS is one of them. It provides the capability to store documents in a collaborative environment.

To start working with SAP BTP DMS you can leverage prebuilt content from the SAP Build process automation store as well as create custom automations and forms.

Please share your thoughts and questions in the comments and let me know what other use cases you would like to see us cover.