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
Create a folder on the SAP Document Management Service repository. At that time, obtain the ID issued to the folder.Upload the file to the above folder.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.
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.ApiTyperestBuildApps.EnabledtrueHTML5.DynamicDestinationtrueMobileEnabledtrue
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.
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.
Set a variable of type “DocumentFolder”.
The form connected from the trigger is also simple.
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.
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.
This is going to be long, so I’ll continue with Part 2.
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 AutomationWhen 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 sideCreate a folder on the SAP Document Management Service repository. At that time, obtain the ID issued to the folder.Upload the file to the above folder.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 destinationCreate 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.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 endFurthermore, the following is added as Additional Properties.BuildApps.ApiTyperestBuildApps.EnabledtrueHTML5.DynamicDestinationtrueMobileEnabledtrueHonestly, 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 sideFirst, create a workflow that will receive attachment information. Since this is for operation verification, I will create a very simple one.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.Set a variable of type “DocumentFolder”.The form connected from the trigger is also simple.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.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. This is going to be long, so I’ll continue with Part 2. Read More Technology Blogs by SAP articles
#SAP
#SAPTechnologyblog