|
| 1 | +--- |
| 2 | +auto_validation: true |
| 3 | +time: 15 |
| 4 | +tags: [ tutorial>beginner, software-product>sap-service-and-asset-manager ] |
| 5 | +primary_tag: software-product>sap-service-and-asset-manager |
| 6 | +author_name: Jose Luis Phillips |
| 7 | +author_profile: https://github.com/I545182 |
| 8 | +parser: v2 |
| 9 | +--- |
| 10 | + |
| 11 | +# Create an SAP Mobile Services App for the SAP Service and Asset Manager Mobile App |
| 12 | +<!-- description -->Create and update an SAP Mobile Services app for the SAP Service and Asset Manager mobile app using the Mobile Services App Create program /MERP/CORE_CPMS_APPCREATE_PROG in the SAP GUI. |
| 13 | + |
| 14 | +## Prerequisites |
| 15 | +- Access to SAP BTP Mobile Services service in your SAP BTP subaccount. |
| 16 | +- Implement note 3329001 to get the latest updates for the MS App Create program. |
| 17 | + |
| 18 | +## You will learn |
| 19 | +- How to create and update an SAP Mobile Services app using the MS App Create program. |
| 20 | +- How to review the created MS app. |
| 21 | +- Additional options to use RFC Destination and add 'sap-client' header to the destinations. |
| 22 | +- How to troubleshoot. |
| 23 | + |
| 24 | +## Intro |
| 25 | +In this mission you will learn how to create and update an SAP Mobile Services app for the SAP Service and Asset Manager mobile app using the Mobile Services App Create program **`/MERP/CORE_CPMS_APPCREATE_PROG`** in the SAP GUI. The Mobile Services app created by the program may be used to On-Board your SAP Service and Asset Manager mobile app. |
| 26 | + |
| 27 | +--- |
| 28 | + |
| 29 | +### Gather the Required Information |
| 30 | + |
| 31 | +1. **Admin API link**. The Admin API link can be found in the 'Important Links' section of the SAP BTP Mobile Services service in your SAP BTP subaccount. |
| 32 | + |
| 33 | +  |
| 34 | + |
| 35 | +2. **SAP Cloud Connector Location Id, Virtual Host & Port**. The SCC Location Id, Virtual Host & Port can be found in the Cloud Connector section of the SAP BTP Cockpit for your subaccount. |
| 36 | + |
| 37 | +  |
| 38 | + |
| 39 | + 1. **SAP Cloud Connector Location Id**: The Location Id is within the parenthesis (i.e., `ConvergedCloud`). If there are no parenthesis, then the Location Id is not required. |
| 40 | + |
| 41 | + 2. **Virtual Host & Port**: The Virtual Host and Port are separated by a colon (i.e., `<host>`:`<port>`). |
| 42 | + |
| 43 | + |
| 44 | +### Create the Mobile Services App via the MS App Create Program |
| 45 | + |
| 46 | +1. Execute report **`/MERP/CORE_CPMS_APPCREATE_PROG`** in **SE38**, then choose a variant. |
| 47 | + |
| 48 | +  |
| 49 | + |
| 50 | +2. Fill in the **Admin API, SCC Location Id, Virtual Host & Port** and execute. |
| 51 | + |
| 52 | +  |
| 53 | + |
| 54 | + >**IMPORTANT:** The Background Job User is used to schedule the Usage Metering background job with daily frequency. If no user is provided, then the user executing the program is used. Please ensure the Background Job User will maintain authorization to run background jobs. |
| 55 | + |
| 56 | +3. If you receive a prompt to sign-in after execution, please use your SAP BTP sign-in credentials to sign-in. |
| 57 | + |
| 58 | +  |
| 59 | + |
| 60 | +4. Take note of the **Mobile Services App ID, Middleware Server and Background Job** name. |
| 61 | + |
| 62 | +  |
| 63 | + |
| 64 | + >Please allow ~5 minutes to complete processing. |
| 65 | +
|
| 66 | + Your Mobile Services app is now created and can be viewed within the SAP Mobile Services service in your subaccount. |
| 67 | + |
| 68 | +5. The application can be updated by re-executing the program with and selecting the features to update when prompted. See additional info for each option below. |
| 69 | + |
| 70 | +  |
| 71 | + |
| 72 | + | Feature | What is Updated? | |
| 73 | + | :----------------------- | :--------------------------------------------------------------------------------------------------------------------- | |
| 74 | + | Mobile Offline Access | Updates the offline configuration file of your app | |
| 75 | + | Mobile Connectivity | Updates the offline and online destination settings of your app | |
| 76 | + | Mobile App Update | Assigns the feature to your app if not already assigned | |
| 77 | + | Mobile Push Notification | Assigns the feature to your app if not already assigned | |
| 78 | + | Usage Metering | Creates Usage Metering Middleware Server and Background Job. Existing Middleware Server and Background Job are deleted | |
| 79 | + |
| 80 | + |
| 81 | +### Review the Created Mobile Services App |
| 82 | + |
| 83 | +1. In the **Native/MDK** section of the SAP Mobile Services service for your subaccount you should see your app in a **Started State** with the **MS Application ID** provided in the selection screen during step 2 of the app creation. |
| 84 | + |
| 85 | +  |
| 86 | + |
| 87 | +2. Select your app to see the Assigned Features. The following features should be assigned to your app: |
| 88 | + |
| 89 | +  |
| 90 | + |
| 91 | + | Assigned Feature | |
| 92 | + | :----------------------- | |
| 93 | + | Mobile App Update | |
| 94 | + | Mobile Connectivity | |
| 95 | + | Mobile Offline Access | |
| 96 | + | Mobile Push Notification | |
| 97 | + | Mobile Settings Exchange | |
| 98 | + |
| 99 | +3. Select the Mobile Connectivity feature. You should see two destinations created. Clicking the **Launch in Browser Action** should return the metadata, if prompted to sign in after clicking the **Launch in Browser Action** then please see troubleshooting step 1. |
| 100 | + |
| 101 | +  |
| 102 | + |
| 103 | + 1. **Launch in Browser Action** |
| 104 | + |
| 105 | + |
| 106 | + | Destination Name | Destination Path | |
| 107 | + | :------------------------------- | :---------------------------------------------------- | |
| 108 | + | `DEST_SAM<version>_PPROP` | `/sap/opu/odata/MERP/SAP_SRV_ASSET_MANAGER_<version>` | |
| 109 | + | `DEST_SAM<version>_ONLINE_PPROP` | `/sap/opu/odata/MERP/SAP_ONLINE_LOOKUP_EXT_<version>` | |
| 110 | + |
| 111 | +4. If you select the Service keys tab in the Mobile Connectivity feature you should see a key with an alias matching your system and client. If the key is missing, then please see troubleshooting step 3. |
| 112 | + |
| 113 | +  |
| 114 | + |
| 115 | +5. If you select the Mobile Offline Access feature you should be able to display the offline configuration file. The name in the file should match the destination name `DEST_SAM<version>_PPROP`. If the offline configuration file does not exist, then please see troubleshooting step 2. |
| 116 | + |
| 117 | +  |
| 118 | + |
| 119 | + Example File Snippet: |
| 120 | + |
| 121 | +  |
| 122 | + |
| 123 | +6. The onboarding QR Code is available in the APIs tab of your application. |
| 124 | + |
| 125 | +  |
| 126 | + |
| 127 | +7. In the Admin Panel (transaction **/SYCLO/ADMIN**) verify that the Metrics Middleware Server created by the App Create program has the properties below. If the middleware server and/or properties are missing the please see troubleshooting step 5. |
| 128 | + |
| 129 | +  |
| 130 | + |
| 131 | + | Property | Value | |
| 132 | + | :--------------------- | ---------------------------------------------- | |
| 133 | + | Mobile Application | `<mobile_app>` | |
| 134 | + | Server Name | `<ms_app_id>_MS_UNIFIED_SERVER` | |
| 135 | + | `Middleware Svr SerNo` | SCP | |
| 136 | + | Server GUID | `<autogenerated_guid>` | |
| 137 | + | Port | 00443 | |
| 138 | + | UI Host Name | `https://example.cfapps.sap.hana.ondemand.com` | |
| 139 | + |
| 140 | +  |
| 141 | + |
| 142 | + | Property Group | Property Name | Property Value | |
| 143 | + | :------------- | :------------- | :------------------------------------- | |
| 144 | + | METERING | X-API-Key | `<autogenerated_key>` | |
| 145 | + | METERING | `service_path` | `/mobileservices/service-key/metering` | |
| 146 | + |
| 147 | +8. Verify the Metrics Background Job is scheduled in transaction **SM37** with a daily frequency. If the background job is missing, then please see troubleshooting step 5. |
| 148 | + |
| 149 | +  |
| 150 | + |
| 151 | + Display Job: |
| 152 | + |
| 153 | +  |
| 154 | + |
| 155 | + |
| 156 | +### Additional Options |
| 157 | + |
| 158 | +1. Create the MS App using an RFC Destination (Middleware Server). |
| 159 | + |
| 160 | + 1. In transaction **SM59**, create an RFC destination and fill out the Target System settings. The Target Host and Path Prefix can be derived from the MS Admin API (see example below). Please ensure you append **`/app`** to the Path Prefix as it is not part of the Admin API by default. The **HTTP Proxy Options** are available in the RFC Destination Technical Settings if required. |
| 161 | + |
| 162 | +  |
| 163 | + |
| 164 | + | Setting | Value | |
| 165 | + | :---------------- | :--------------------------------------------------------- | |
| 166 | + | Target Host | **`mobile-service-cockpit-example.sap.hana.ondemand.com`** | |
| 167 | + | Service No.(Port) | **`443`** | |
| 168 | + | Path Prefix | **`/cockpit/v1/org/ExampleOrg/space/ExampleSpace/app`** | |
| 169 | + |
| 170 | + 2. In the **Logon & Security** tab of your RFC destination please activate the **SSL** setting. Using **Basic Authentication** is optional. Using Basic Authentication will bypass the sign-in prompt during step 3 of the app creation. If you are using **Basic Authentication** then please provide your SAP BTP credentials as the User and Password. |
| 171 | + |
| 172 | +  |
| 173 | + |
| 174 | + | Setting | Value | |
| 175 | + | :------ | :----------- | |
| 176 | + | SSL | **`Active`** | |
| 177 | + |
| 178 | + 2. Go to the Admin Panel (transaction **/SYCLO/ADMIN**) and navigate to the **Administration** > **Server Management** section. Click **Create** to create a new Middleware Server. |
| 179 | + |
| 180 | +  |
| 181 | + |
| 182 | + 3. Please fill out the required information below and click **Save**. |
| 183 | + |
| 184 | +  |
| 185 | + |
| 186 | + | Property | Value | |
| 187 | + | :--------------------- | :------------------------- | |
| 188 | + | Mobile Application | **`<mobile_app>`** | |
| 189 | + | Server Name | **`Z_MS_ADMIN_API`** | |
| 190 | + | Server GUID | **`<autogenerated_guid>`** | |
| 191 | + | Port | **`07003`** | |
| 192 | + | `Middleware Svr SerNo` | **`SCP`** | |
| 193 | + | RFC Destination | **`Z_MS_ADMIN_API`** | |
| 194 | + |
| 195 | + 3. The generated Middleware Server GUID can now be used in the selection screen of the App Create program instead of the Admin API during step 2 of the app creation. The Middleware Server can also be searched for from the selection screen of the App Create program using F4 Help. |
| 196 | + |
| 197 | +  |
| 198 | + |
| 199 | +2. Add the **sap-client** header to the offline and online destinations. |
| 200 | + |
| 201 | + 1. In the selection screen of the App Create program click **Advanced Mode**. |
| 202 | + |
| 203 | +  |
| 204 | + |
| 205 | + 2. Under the Mobile Services Connection Configuration, fill out the Destination Headers for the offline and online destinations with |
| 206 | + ```JSON |
| 207 | + {"name": "sap-client", "value": "<client>", "overwrite": false} |
| 208 | + ``` |
| 209 | + substituting `<client>` with the desired client. |
| 210 | + |
| 211 | +  |
| 212 | + |
| 213 | + |
| 214 | +### Troubleshooting |
| 215 | + |
| 216 | +1. After selecting the **Launch in Browser Action** for the destinations created, a sign-in prompt appears. |
| 217 | + |
| 218 | +  |
| 219 | + |
| 220 | + 1. To fix, add the **sap-client** header to the offline and online destinations by following the steps for Additional Option 2, or by editing each destination in the SAP Mobile Services Mobile Connectivity feature. |
| 221 | + |
| 222 | +  |
| 223 | + |
| 224 | + >Click **Next** to go through the settings and then click **Save**. |
| 225 | + |
| 226 | + | Header Name | Header Value | |
| 227 | + | :---------- | :----------- | |
| 228 | + | sap-client | `<client>` | |
| 229 | + |
| 230 | + Substitute `<client>` with the desired client. |
| 231 | + |
| 232 | + |
| 233 | +2. Missing Offline Configuration file |
| 234 | + |
| 235 | + 1. Follow step 5 of the app creation and select **Mobile Offline Access** feature when prompted. The offline configuration file will be re-generated and sent to SAP Mobile Services. If the file is still missing in Mobile Services, you may try the next step. |
| 236 | + |
| 237 | + 2. Alternately, you may generate the file using the Offline Configuration program **`/MERP/CORE_OFFLINE_CONFIG_PROG`**. The generated file can then be uploaded in the SAP Mobile Services Mobile Offline Access feature for your app. |
| 238 | + |
| 239 | + 1. Execute the program **`/MERP/CORE_OFFLINE_CONFIG_PROG`** in **SE38**, then select a variant and execute. Please ensure to save the file with a `.ini` file extension. |
| 240 | + |
| 241 | +  |
| 242 | + |
| 243 | + 2. Upload the file in the Mobile Offline Access feature of your app. |
| 244 | + |
| 245 | +  |
| 246 | + |
| 247 | +3. Metrics Middleware Server Missing and/or Properties Missing. |
| 248 | + |
| 249 | + 1. Follow step 5 of the app creation and select **Usage Metering** feature when prompted. If the Metrics Middleware Server is still missing, you may try the next steps. |
| 250 | + |
| 251 | + 2. Go to the Admin Panel (transaction **/SYCLO/ADMIN**) and navigate to the **Administration** > **Server Management** section. Click **Create** to create a new Middleware Server with the following values: |
| 252 | + |
| 253 | +  |
| 254 | + |
| 255 | + | Property | Value | |
| 256 | + | :--------------------- | ---------------------------------------------- | |
| 257 | + | Mobile Application | `<mobile_app>` | |
| 258 | + | Server Name | `<ms_app_id>_MS_UNIFIED_SERVER` | |
| 259 | + | `Middleware Svr SerNo` | SCP | |
| 260 | + | Server GUID | `<autogenerated_guid>` | |
| 261 | + | Port | 00443 | |
| 262 | + | UI Host Name | `https://example.cfapps.sap.hana.ondemand.com` | |
| 263 | + >The UI Host name can be found in the APIs tab of the Mobile Services app created. |
| 264 | + > |
| 265 | + > |
| 266 | + |
| 267 | + 3. Add the following properties to the Middleware Server (case sensitive). |
| 268 | + |
| 269 | +  |
| 270 | + |
| 271 | + | Property Group | Property Name | Property Value | |
| 272 | + | :------------- | :------------- | :------------------------------------- | |
| 273 | + | METERING | X-API-Key | `<key>` | |
| 274 | + | METERING | `service_path` | `/mobileservices/service-key/metering` | |
| 275 | + >**IMPORTANT:** To generate X-API-Key go to the Mobile Connectivity feature in your Mobile Services and select the **Service Keys** tab. Click **+** to add a service key with the following values: |
| 276 | + > |
| 277 | + > |
| 278 | + >|Property|Value| |
| 279 | + >|:-|:-| |
| 280 | + >|Alias|Any Alias is okay (i.e., **`PR1`**)| |
| 281 | + >|Roles|**`sap_application_metering`**| |
| 282 | + >|Type|**`API Key`**| |
| 283 | + > |
| 284 | + >Copy the generated key. |
| 285 | + > |
| 286 | + > |
| 287 | + |
| 288 | +4. Metrics Background Job Missing. |
| 289 | + |
| 290 | + 1. Follow step 5 of the app creation and select **Usage Metering** feature when prompted. If the background job is still missing, you may try the next step. |
| 291 | + |
| 292 | + 2. Execute report **`/MFND/CORE_CLOUD_METRICS_PROG`** and provide Mobile Application. Then click **F9** or select menu option **Program** > **Execute in Background**. Click **Date/Time** and set **Period Values** to **Daily** then click **Save** |
| 293 | + |
| 294 | +  |
0 commit comments