|
| 1 | +--- |
| 2 | +author_name: Xavier Dupeyrat |
| 3 | +author_profile: https://github.com/xavierdupeyrat |
| 4 | +keywords: tutorial |
| 5 | +auto_validation: true |
| 6 | +time: 40 |
| 7 | +tags: [ tutorial>beginner, type>tutorial, software-product>sap-build, software-product>sap-build-process-automation ] |
| 8 | +primary_tag: software-product>sap-cloud-alm |
| 9 | +parser: v2 |
| 10 | +--- |
| 11 | + |
| 12 | +# SAP Cloud ALM: Create SAP Build Process Automation Action for a SAP Cloud ALM |
| 13 | +<!-- description --> In this tutorial, we will learn how to develop SAP Build Process Automation Action for SAP Cloud ALM. |
| 14 | + |
| 15 | +## You will learn |
| 16 | +- How to setup SAP Build Process Automation **Action** to trigger the creation of a `SAP Cloud ALM Task` in a remote SAP Cloud ALM tenant. |
| 17 | + |
| 18 | +## Prerequisites |
| 19 | +- You need a user with the "Destination Administrator" authorizations in the SAP BTP sub-account in which SAP Build Process Automation is subscribed. |
| 20 | +- You need to obtain the SAP Cloud ALM Service Key to connect to your SAP Cloud ALM account. |
| 21 | +- You must have "Space Developer" access for the space in which the instance was created in your SAP Cloud ALM sub-account. |
| 22 | + |
| 23 | +## Introduction |
| 24 | +**SAP Build Process Automation Workflow Action** |
| 25 | + |
| 26 | +Action is a feature in SAP Build Process Automation to connect processes with external systems (SAP or non-SAP systems). |
| 27 | + |
| 28 | +In this tutorial, you will create an `action` project based on the `SAP Cloud ALM Tasks APIs`. The Tasks API is already available in API Business Hub. |
| 29 | + |
| 30 | +Check the following [Tutorial](https://developers.sap.com/group.connect-process-external-sap-bpa.html) to discover how to manage actions. |
| 31 | + |
| 32 | + |
| 33 | +**SAP Cloud ALM API** |
| 34 | + |
| 35 | +Designed for the Intelligent Suite, SAP Cloud ALM is an application lifecycle management platform tailor-made for cloud-centric customers. It ensures accelerated implementation and smooth operations of your end-to-end business solution throughout the entire lifecycle. |
| 36 | + |
| 37 | +The `SAP Cloud ALM APIs` make it simple to extend SAP Cloud ALM functionalities to provide new features, services and applications for your SAP application lifecycle. |
| 38 | + |
| 39 | +Discover and experiment SAP Cloud ALM APIs in the [SAP API Hub](https://api.sap.com/package/SAPCloudALM). |
| 40 | + |
| 41 | + |
| 42 | +### Create SAP BTP Destination |
| 43 | +In the SAP BTP Cockpit, create a `destination` that will be used in the action editor to test the Action in the process execution. |
| 44 | + |
| 45 | +The destination should contain the following additional property `sap.processautomation.action.enabled`. The destinations which have this property set as true can be discovered and added in SAP Build Process Automation. |
| 46 | + |
| 47 | +The destination should also contain the following additional property `sap.applicationdevelopment.actions.enabled`. The destinations which have this property set as true can be used in the SAP Build Process Automation Action Editor. |
| 48 | + |
| 49 | + |
| 50 | +1. Go to **Connectivity** >> **Destinations** in your BTP Cockpit. |
| 51 | +2. Add a destination. |
| 52 | +3. Enter the following details as below: |
| 53 | + |
| 54 | + |Name |Value| |
| 55 | + |-------|-----| |
| 56 | + |Type |HTTP| |
| 57 | + |Client ID | | |
| 58 | + |Client Secret | | |
| 59 | + |Service URL | The service url to your SAP Cloud ALM tenant. This URL should contain the host of your SAP Cloud ALM and end with `/api` ex: `https://<your tenant>/api` | |
| 60 | + |Token Service URL |The final URL should be something like this: `https://<your tenant>.authentication.<domain>.hana.ondemand.com/oauth/token` | |
| 61 | +4. Add the following properties: |
| 62 | + |
| 63 | + |Name |Value| |
| 64 | + |-------|-----| |
| 65 | + |sap.applicationdevelopment.actions.enabled |true | |
| 66 | + |sap.processautomation.enabled |true| |
| 67 | + |
| 68 | +5. Save the destination |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | +### Configure Destination for SAP Build Process Automation |
| 73 | + |
| 74 | +To allow the usage of the SAP BTP Destination, you have to add the Destination in SAP Build Process Automation from the SAP Build Lobby settings panel. |
| 75 | + |
| 76 | +1. Open SAP Build development workbench. |
| 77 | +2. Click **Settings**. |
| 78 | +3. Go to Destinations section, and click **New Destination**. |
| 79 | +4. From **Add** Destination pop-up, select the destination created in the previous steps to your SAP Cloud ALM tenant. |
| 80 | +5. Click **Add** to add a new destination in SAP Build Process Automation. |
| 81 | + |
| 82 | +A new destination will be added. |
| 83 | + |
| 84 | + |
| 85 | +### Select an API |
| 86 | +The first step is to select an API with an Open API specification file. |
| 87 | + |
| 88 | +1. Download and extract Open API Specification |
| 89 | + For APIs that are available in SAP API Business Hub, you can directly download the specification from the API overview section. The API from SAP Cloud ALM are accessible [here](https://api.sap.com/package/SAPCloudALM/rest). |
| 90 | +2. Select the [Tasks API](https://api.sap.com/package/SAPCloudALM/rest) and press the **download** button in the `API Reference` section |
| 91 | +  |
| 92 | +3. Download the API specification file. |
| 93 | + |
| 94 | + |
| 95 | +### Create a SAP Action |
| 96 | +From the SAP Build lobby, you should create an Action that will be integrated in your automation process. |
| 97 | + |
| 98 | +1. Open SAP Build Lobby with your username and password |
| 99 | +  |
| 100 | +2. then click **Create**. |
| 101 | +3. In the popup, choose **Build an Automated Process** and then select `Actions`. |
| 102 | +4. In the popup |
| 103 | + - Enter the Project Name. |
| 104 | + - Enter the Short Description as API to **create a Task Action in SAP Cloud ALM** |
| 105 | + - Click to Browse the open specification file downloaded in step below: |
| 106 | +  |
| 107 | + - Click **Create**. |
| 108 | + |
| 109 | + |
| 110 | +### Configure action project |
| 111 | +Once the action project is created, select it to open the Action Editor. The Add Actions pop up will automatically open. |
| 112 | + |
| 113 | +1. In the popup, you have to select **POST** method of /`Tasks` API. |
| 114 | + |
| 115 | +  |
| 116 | + |
| 117 | +2. Now, you can update the input/output fields of the action project to keep only the mandatory fields that are needed to create a Task. |
| 118 | + |
| 119 | +  |
| 120 | + |
| 121 | +3. Change the API path settings. |
| 122 | + Click on the `Settings` icon in the top-right corner to open the setting tabs |
| 123 | + |
| 124 | +  |
| 125 | + |
| 126 | +4. Go the **URL Prefix** tab |
| 127 | + |
| 128 | +5. Enter the URL prefix for the SAP Cloud ALM Task API: `/calm-tasks/v1` |
| 129 | + |
| 130 | +  |
| 131 | + |
| 132 | +6. Press **Save** |
| 133 | + |
| 134 | + |
| 135 | +### Test your Action |
| 136 | +1. Select the REST operations you want to test. |
| 137 | +2. Navigate to the **Test** section. |
| 138 | +3. Select your SAP Cloud ALM destination |
| 139 | + |
| 140 | +  |
| 141 | +4. Enter the input values for your API. |
| 142 | + |
| 143 | +  |
| 144 | +5. Press the `Test` button |
| 145 | +6. Once the execution is successful, you see 201 Created response with the details |
| 146 | + |
| 147 | +  |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | + |
| 152 | + |
| 153 | + |
| 154 | +### Deploy and Release your Action to the library. |
| 155 | + |
| 156 | +You will now release the action project to create version(s) and then publish a selected version in the action repository. |
| 157 | +Published actions can be used in different processes to connect to external systems. |
| 158 | + |
| 159 | +1. Press the `Release` in the top-right corner. |
| 160 | +2. Select your version |
| 161 | +3. Press Release. |
| 162 | + |
| 163 | + |
| 164 | +Once the action project is released, you can then publish any release version of the action. |
| 165 | + |
| 166 | +1. Click `Publish to Library` from top-right corner. |
| 167 | +2. Enter Line of Business information |
| 168 | +3. Enter Product information |
| 169 | + |
| 170 | +  |
| 171 | + |
| 172 | + |
| 173 | +### Consumption in Process |
| 174 | + From the SAP Build Lobby, select your process. |
| 175 | + |
| 176 | +The first step is to create a Destination in SAP Build Process Automation: |
| 177 | + |
| 178 | +1. In the Project Properties pop-up, select Environment Variables and choose Create to create an environment variable |
| 179 | + |
| 180 | +2. Enter the following to create an environment variable: |
| 181 | + - SAPCloudALM as **Identifier**. |
| 182 | + - Any **Description** of your choice |
| 183 | + - **Destination** as variable type.for this business processes. |
| 184 | + |
| 185 | +3. Click **Create** |
| 186 | +add the newly created action from the library. |
| 187 | + |
| 188 | + |
| 189 | +Add a process dependency to the Action |
| 190 | + |
| 191 | +1. Navigate to the project **settings**. |
| 192 | +2. Click to the **Add an Actions project dependency** from the **Add Dependency** button |
| 193 | + |
| 194 | +  |
| 195 | +3. Select your `Action` and Press **Save**. |
| 196 | + |
| 197 | +  |
| 198 | + |
| 199 | + |
| 200 | +Then, you can add your `action` into your Process: |
| 201 | + |
| 202 | +1. In the Process Builder canvas, click the **+** in output connector. |
| 203 | +2. In the list, choose **Actions > Browse library**. |
| 204 | +3. In the action library pop up, search for the actions for SAP Cloud ALM products. |
| 205 | + |
| 206 | +  |
| 207 | +4. Select the destination variable to use for the selected action |
| 208 | +5. Manage the Tasks API input by mapping the attributes from your processes. For the SAP Tasks API, we need to enter the mandatory parameters as projectID and Title. |
| 209 | + |
| 210 | +  |
| 211 | +6. Save, `Releases` and `Deploy` your work. |
| 212 | + |
| 213 | + |
| 214 | + |
| 215 | + |
| 216 | + |
| 217 | + |
| 218 | + |
| 219 | + |
| 220 | + |
| 221 | + |
| 222 | + |
| 223 | + |
| 224 | + |
0 commit comments