Technology Blog Posts by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
NaotoSakai
Product and Topic Expert
Product and Topic Expert
2,131

I often get asked, "Can I use SAP Build Apps to upload files to the SAP Document Management Service and use them in SAP Build Process Automation processes?"
Although this is not impossible, there was a problem with uploading files from SAP Build Apps to DMS. (There is also a method using JavaScript, but it is not suitable as a NoCode tool.)

I thought of a way to upload without code, and wrote this article as a preparatory explanation, but in the meantime, a new feature was added to SAP Build Apps, and it has become much easier, so I would like to explain it.

Previous explanation: About the file attachment function of SAP Build Process Automation

When you use the file attachment feature in SAP Build Process Automation, the file is saved in SAP Document Management Service. Have you ever seen how files are stored on the SAP Document Management Service side? Actually, a folder is created for each file, and the files are stored in that folder. SAP Document Management Service assigns a unique ID to each folder and file for management purposes. In SAP Build Process Automation, attached files are handled using the (automatically created) folder ID rather than the file ID. This is correct

 

 

spa-res:cmis:folderid:<folder ID on DMS>

 

 

It is handled in this format.

In other words, if you upload a file to SAP Document Management Service with SAP Build Apps and want to use it in the workflow of SAP Build Process Automation, on the Build Apps side

  1. Create a folder on the SAP Document Management Service repository. At that time, obtain the ID issued to the folder.
  2. Upload the file to the above folder.
  3. When starting the SApBuild Process Automation workflow from SAP Build Apps, pass the file save destination information in the format "spa-res:cmis:folderid:<folder ID on DMS>"

That is necessary.

Preparation: Create a destination

Create a Destination to access SAP Document Management Service from SAP Build Apps.I will create this by cloning the Destination "sap_process_automation_document_store" in order to link SAP Build Process Automation and SAP Document Management Service. I thought it would be a good idea to set additional properties for use with SAP Build Apps in "sap_process_automation_document_store", but this is a Destination that has a specified method for collaboration and is automatically created. Therefore, although the content is almost the same, we will create another one for use from SAP Build Apps.

NaotoSakai_0-1737100474861.png

I cloned "sap_process_automation_document_store" and created a Destination called "sap_process_automation_document_store_ForApps".
This Destination has the following changes from "sap_process_automation_document_store".
URL: Add /root to the end
Furthermore, the following is added as Additional Properties.

BuildApps.ApiTyperest
BuildApps.Enabledtrue
HTML5.DynamicDestinationtrue
MobileEnabledtrue

Honestly, I don't think adding "/root" to the URL is necessary. However, when I checked the API used by Document Management Service in SAP Business Accelerator Hub, I decided that the URL with "/root" added could be used commonly, so I added it to reduce the effort. The items set in Additional Properties are the settings for using this Destination with SAP Build Apps.

 

I'll explain this while creating a simple app.

 

1. Creating a process on the SAP Build Process Automation side

First, create a workflow that will receive attachment information. Since this is for operation verification, I will create a very simple one.

NaotoSakai_0-1737336344174.png

The API trigger is used as trigger, and It will link from SAP Build Apps using the SAP Build Library .
Set "FolderId" as an input variable for the process.

NaotoSakai_1-1737336455904.png

NaotoSakai_2-1737336523568.png

Set a variable of type "DocumentFolder".

The form connected from the trigger is also simple.

NaotoSakai_4-1737336871644.png

Place only file objects. Please check the ReadOnly attribute for this file object.
Assign the "FolderId" set as an input variable to this form on the process.

NaotoSakai_5-1737337852580.png

Set the form Subject, Recipients User, etc. appropriately. For testing, let's set the Recipients User to be ourselves. Recipients User specifies "Process started by" in Process metadata.
Release and deploy. Remember to run Publish from the lobby so it is available from SAP Build Apps.

NaotoSakai_6-1737338075456.png

 

This is going to be long, so I'll continue with Part 2.

 

3 Comments
Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos

Very nice set of tutorials / blog posts 😺

Is there a reason to create a separate destination for build apps as opposed to the one you use for process automation? I just find there are so many destinations that I try to combine them when possible.

Can you release versions of your app and process?

Just to let people know we have some videos that show how some of this works -- though I like how you put it all together, triggering and uploading to DMS. All the videos are in a playlist: https://www.youtube.com/playlist?list=PL6RpkC85SLQCsKSvIOqMzFKW30B4TKXh- (includes background on DMS) and this is the first one on uploading from Build Apps. 

 

NaotoSakai
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Dan,

>Is there a reason to create a separate destination for build apps as opposed to the one you use for process automation? I just find there are so many destinations that I try to combine them when possible.

How to create the destination of "sap_process_automation_document_store" is specified in the help document. Therefore, I doubt that adding a property for use with SAP Build Apps to this would make it unsupported on the SAP Build Process Automation side.
If this is supported, I think it would be better to combine the destinations into one, as you say.

kazistov_v
Explorer
0 Kudos

Hello @NaotoSakai @Dan_Wroblewski ,

Thank you for your tutorials. They are very helpful! Is there any ability to download several files in one iteration to DMS from SAP Build Apps? And to pass them to the BPA workflow as well.

Thanks in advance!

Best regards,
Vladyslav