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

Issue getting DMS Folder Content in SAP Build Process Automation - Undefined DMS Destination

SandipAgarwalla
Active Contributor
0 Kudos
1,698

Hi

I am trying to get the DMS Folder Content using the SAP provided activity "get DMS Folder Content", but I keep getting this error

SandipAgarwalla_0-1738133608388.png

The file Is uploaded using File Upload in SBPA Form, so initial DMS Destination is already set. I am using this activity to get the folder content

SandipAgarwalla_1-1738133667256.png

In the folder path, I am passing the hash number which I received after uploading the file. Is this the correct value? Also what specific destination we need to use the DMS Related Activities? 

The documentation does not have any details around these. Appreciate if someone can help. 

Thanks

Sandip

Accepted Solutions (1)

Accepted Solutions (1)

Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos

You are getting 405 because you are missing "root" in the path. The underlying API for this activity (I believe) is:

https://{{endpoint}}/browser/{{repo}}/root/myfolder

I cannot see the full destination URL, but I assume it is not there. In any event, I would not put root in the destination but put it in the path of the activity, as then you can reuse the same destination for other purposes.

Also, this activity takes a path, not an object ID. When you said "folder ID" I assumed you meant objectID.

SandipAgarwalla
Active Contributor
0 Kudos

Hi Dan,

The destination url does not have 'root' in it, this is how it looks

https://<host>/browser/repoID

Yes, when I said folderID - it is the object ID which we get once we upload a file via the SPA forms. Example of it - 

spa-res:cmis:folderid:PiZaWRq8AYvDLC83fQWAbOBCcUtpiqDZ-2P4D6oeprI

So in the folderPath property of "Get DMS Folder Content" - I tried the following options

1) /root/PiZaWRq8AYvDLC83fQWAbOBCcUtpiqDZ-2P4D6oeprI

2) root/PiZaWRq8AYvDLC83fQWAbOBCcUtpiqDZ-2P4D6oeprI

neither worked, but this time I get a different error - 404 not found

 

SandipAgarwalla_2-1738567146660.png

 

Regards

Sandip

 

Dan_Wroblewski
Developer Advocate
Developer Advocate

You can try knocking a square peg in a round whole but it won't work. Not your fault: Some of the DMS activities need a folder and some need an objectID.

This needs a folder.

Until they add the option for the objectID, you will have to convert the objectID to a folder, using the Get Properties API.

Go into the store and create a project from the template "How to Use Document Management Service", which provides the "old" way of doing DMS calls. There is an automation called "Get folder content", which has 2 activities -- custom script and call web service with destination. This shows you how to call DMS by creating your own call. Modify the call according to the API ... it should be quite simple.

Dan_Wroblewski_0-1738567948024.png

Here is the API for Get Properties: https://api.sap.com/api/GetPropertiesApi/path/get_browser__repository_id__root

Not that you need it here, but you only need the name so you could add the query parameter filter=cmis:name to return only the name.

 

Answers (2)

Answers (2)

Dan_Wroblewski
Developer Advocate
Developer Advocate

I have now created a blog that explains this: Convert DMS Folder ID to Name in Automation

Enjoy 😺

Dan_Wroblewski
Developer Advocate
Developer Advocate

You need to:

  • define an environment variable of type destination
  • Add this activity before you call any other DMS activities:
    Dan_Wroblewski_0-1738223141133.png
  • Then when you run (or deploy) you need to specify a destination. I use a destination that ends with the repo ID I want to use, and then I add /root or whatever else I need in the DMS activities when I need to specify a path. 

As for the path, yes, I think there is a missing activity allowing you to get folder content with object ID. But you can do it the "old" way directly with Web Service Call with Destination, which you can see examples of if you go to the store and import the template "How to use Document Management Service".

You'd call the Get Properties API - https://api.sap.com/api/GetPropertiesApi/path/get_browser__repository_id__root and you can filter for just the name.

Here's how it looks in Postman:

Dan_Wroblewski_1-1738224486235.png

And here's how it looks in a project that gets the folder name:

Dan_Wroblewski_2-1738225196401.png

Perhaps there's an easier way. I'm pretty sure development was working on adding that activity.

 

 

SandipAgarwalla
Active Contributor
0 Kudos
Hi Dan, Thanks for your inputs. My doubt is related to destination, we have only one destination for DMS - "Sap_process_automation_document_store". We need to give this destination name?
Dan_Wroblewski
Developer Advocate
Developer Advocate
No, you do not have to name it anything special -- though I would try to use the same destination you used for setting up DMS and Process Automation. You select the destination when you deploy or test the automation, so it can be called anything.
SandipAgarwalla
Active Contributor
0 Kudos

Hi Dan

Thanks for your reply. So, I added the destination under Control Tower -> Destination. This was missing. I also added another activity in the Automation "Select DMS", and gave the destination under its property. When I run the automation now, I do not get the Destination issue.

However I am getting another issue, "Response Code 405 (Method not allowed", I am using the standard DMS activity to get folder content  (well atleast the SAP help docs says so). 

SandipAgarwalla_0-1738303886898.png

Regards

Sandip

Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos
Please show your destination URL, and the values you are providing to the Get DMS Folder Content
SandipAgarwalla
Active Contributor
0 Kudos

Hi Dan

Here is the destination set up, 

SandipAgarwalla_0-1738330062098.png

Our Repo starts with "a4b82******" . 

For Get DMS Folder Content - in the folderPath property, I tried different options but I keep getting 405 method not allowed

Option1: a4b****/TdUra3lLBAc1tM6IkUh9cLkm**** (RepoID/folderID, I got the folder ID from DMS UI) 

Option2: /repoID/folderID

Option3: folderID (with & without /)

Thanks

Sandip