$npx -y skills add likweitan/abap-skills --skill sap-fiori-apps-referenceGenerate SAP Fiori Launchpad URLs from app names using AppList.json. Looks up app information by name and constructs proper FLP URLs with required parameters like sap-client and sap-language.
| 1 | # SAP Fiori URL Generator Skill |
| 2 | |
| 3 | This skill enables you to generate SAP Fiori Launchpad (FLP) URLs based on app names from the AppList.json file. |
| 4 | |
| 5 | ## References |
| 6 | |
| 7 | When you need to look up SAP Fiori app information: |
| 8 | |
| 9 | **App List Database**: Read `references/AppList.json` - contains all SAP Fiori apps with their Semantic Object-Action mappings, App IDs, descriptions, and technical details. |
| 10 | |
| 11 | Use this reference to: |
| 12 | |
| 13 | - Search for apps by name (partial match, case-insensitive) |
| 14 | - Extract the "Semantic Object - Action" field for URL generation |
| 15 | - Provide app details (ID, description, component) to users |
| 16 | - Suggest similar apps when exact match is not found |
| 17 | |
| 18 | ### Updating AppList.json |
| 19 | |
| 20 | The AppList.json data can be obtained from SAP's Fiori Apps Library: |
| 21 | |
| 22 | 1. Go to https://pr.alm.me.sap.com/launchpad#FALApp-display |
| 23 | 2. Export the app list to Excel |
| 24 | 3. Convert the Excel file to JSON format |
| 25 | |
| 26 | This ensures the app list stays current with the latest SAP Fiori applications. |
| 27 | |
| 28 | ## Overview |
| 29 | |
| 30 | When a user provides: |
| 31 | |
| 32 | 1. A base SAP Fiori URL (e.g., `https://myserver.com:44300`) |
| 33 | 2. An app name (e.g., "Create Maintenance Request") |
| 34 | |
| 35 | You will: |
| 36 | |
| 37 | 1. Search the AppList.json file for the app |
| 38 | 2. Extract the "Semantic Object - Action" field |
| 39 | 3. Construct the complete FLP URL with proper parameters |
| 40 | |
| 41 | ## URL Structure |
| 42 | |
| 43 | The complete SAP Fiori Launchpad URL follows this pattern: |
| 44 | |
| 45 | ``` |
| 46 | {BASE_URL}/sap/bc/ui2/flp?sap-client={CLIENT}&sap-language={LANGUAGE}#{SEMANTIC_OBJECT}-{ACTION} |
| 47 | ``` |
| 48 | |
| 49 | ### Required Parameters (MUST be provided by user) |
| 50 | |
| 51 | - **BASE_URL**: The SAP system base URL (e.g., `https://myserver.com:44300`) |
| 52 | - MUST be provided by user |
| 53 | - No default value |
| 54 | - **sap-client**: The SAP client number (e.g., `100`) |
| 55 | - MUST be provided by user |
| 56 | - No default value |
| 57 | - Required for all SAP Fiori Launchpad URLs |
| 58 | |
| 59 | ### Optional Parameters |
| 60 | |
| 61 | - **sap-language**: Language code (e.g., `EN`, `DE`, `FR`) |
| 62 | - Default: `EN` if not specified by user |
| 63 | - Can be customized per request |
| 64 | |
| 65 | ### Auto-Generated Parameters |
| 66 | |
| 67 | - **SEMANTIC_OBJECT-ACTION**: Automatically extracted from the "Semantic Object - Action" field in AppList.json |
| 68 | - No user input required |
| 69 | - Looked up based on app name |
| 70 | |
| 71 | ## Implementation Steps |
| 72 | |
| 73 | ### Step 1: Read AppList.json |
| 74 | |
| 75 | First, read the AppList.json file to access the app data: |
| 76 | |
| 77 | ```javascript |
| 78 | const fs = require("fs"); |
| 79 | const appList = JSON.parse(fs.readFileSync("AppList.json", "utf8")); |
| 80 | ``` |
| 81 | |
| 82 | ### Step 2: Search for the App |
| 83 | |
| 84 | Search for the app by name (case-insensitive, partial match): |
| 85 | |
| 86 | ```javascript |
| 87 | function findAppByName(appName) { |
| 88 | const normalizedSearch = appName.toLowerCase().trim(); |
| 89 | |
| 90 | return appList.find( |
| 91 | (app) => |
| 92 | app["App Name"] && |
| 93 | app["App Name"].toLowerCase().includes(normalizedSearch), |
| 94 | ); |
| 95 | } |
| 96 | ``` |
| 97 | |
| 98 | ### Step 3: Extract Semantic Object-Action |
| 99 | |
| 100 | Get the "Semantic Object - Action" field: |
| 101 | |
| 102 | ```javascript |
| 103 | function getSemanticObjectAction(app) { |
| 104 | const semanticAction = app["Semantic Object - Action"]; |
| 105 | |
| 106 | if (!semanticAction || semanticAction === "NaN" || semanticAction === null) { |
| 107 | throw new Error("No Semantic Object-Action found for this app"); |
| 108 | } |
| 109 | |
| 110 | return semanticAction; |
| 111 | } |
| 112 | ``` |
| 113 | |
| 114 | ### Step 4: Construct the URL |
| 115 | |
| 116 | Build the complete FLP URL: |
| 117 | |
| 118 | ```javascript |
| 119 | function generateFioriUrl(baseUrl, client, semanticAction, language = "EN") { |
| 120 | // Validate required parameters |
| 121 | if (!baseUrl) { |
| 122 | throw new Error("BASE_URL is required and must be provided by user"); |
| 123 | } |
| 124 | if (!client) { |
| 125 | throw new Error("sap-client is required and must be provided by user"); |
| 126 | } |
| 127 | |
| 128 | // Remove trailing slash from base URL if present |
| 129 | const cleanBaseUrl = baseUrl.replace(/\/$/, ""); |
| 130 | |
| 131 | return `${cleanBaseUrl}/sap/bc/ui2/flp?sap-client=${client}&sap-language=${language}#${semanticAction}`; |
| 132 | } |
| 133 | ``` |
| 134 | |
| 135 | ## Complete Example |
| 136 | |
| 137 | ### Input (ALL required parameters must be provided by user) |
| 138 | |
| 139 | - Base URL: `https://myserver.com:44300` (**USER MUST PROVIDE**) |
| 140 | - SAP Client: `100` (**USER MUST PROVIDE**) |
| 141 | - App Name: `Create Maintenance Request` (**USER MUST PROVIDE**) |
| 142 | - Language: `EN` (optional - defaults to EN if not specified) |
| 143 | |
| 144 | ### Process |
| 145 | |
| 146 | 1. Read AppList.json |
| 147 | 2. Search for "Create Maintenance Request" |
| 148 | 3. Find entry with "Semantic Object - Action": `MaintenanceWorkRequest-create` |
| 149 | 4. Construct URL using user-provided base URL and client |
| 150 | |
| 151 | ### Output |
| 152 | |
| 153 | ``` |
| 154 | https://myserver.com:44300/sap/bc/ui2/flp?sap-client=100&sap-language=EN#MaintenanceWorkRequest-create |
| 155 | ``` |
| 156 | |
| 157 | ## Error Handling |
| 158 | |
| 159 | ### App Not Found |
| 160 | |
| 161 | If the app name is not found in AppList.json: |
| 162 | |
| 163 | ``` |
| 164 | Error: App "{app_name}" not found in AppList.json |
| 165 | Suggestion: Check spelling or try searching with partial name |
| 166 | ``` |
| 167 | |
| 168 | ### Missing Semantic Object-Action |
| 169 | |
| 170 | If the app exists but has no Semantic Object-Action: |
| 171 | |
| 172 | ``` |
| 173 | Error: App "{app_name}" (ID: {app_id}) does not have a Semantic Object-Action |