Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[Fiori] Creating a Launchpad Plugin using BAS

Since there is no Wizard anymore for creating a Launchpad Plugin, as there was in WebIDE, you have to create it manually. The following two guides helped me create a Launchpad Plugin in BAS from scratch:
https://github.com/SAP-samples/fiori-custom-plugin-abap/tree/main
https://github.com/SAP-samples/launchpad-service-samples
In my scenario, I had to deploy to a normal S/4 HANA system, so I skipped all the Steampunk or WorkZone parts.

In the first sample, for some reason they use jQuery to call an OData Service, in the second sample no OData is called at all. But of course, an OData Service can be used in a Plugin the same way as you do in every other Fiori App. You just have to add your service in the manifest.json like you would normally do:

  "sap.app": {
    ...
    "dataSources": {
      "ZFLP_TEST_SRV": {
        "uri": "/sap/opu/odata/sap/ZFLP_TEST_SRV",
        "type": "OData",
        "settings": {
          "odataVersion": "2.0",
          "localUri": "localService/metadata.xml"
        }
      }
    }
  },
  ...
  "sap.ui5": {
    ...
    "models": {
      "": {
        "dataSource": "ZFLP_TEST_SRV",
        "preload": true,
        "settings": {
          "defaultCountMode": "Inline",
          "metadataUrlParams": {
            "sap-documentation": "heading"
          }
        }
      }
    }

And for i18n

  "sap.ui5": {
     ...
    "models": {
      "i18n": {
        "type": "sap.ui.model.resource.ResourceModel",
        "settings": {
          "bundleName": "ne.flp.plugin.flp_my_plugin.i18n.i18n"
        }
      }
    }

To activate the deployed Plugin, use these transactions:

  • /ui2/flp_conf_def → Define FLP Plugins → Create new entry
  • /ui2/flp_sys_conf → Make Plugin available system-wide
  • /ui2/flp_cus_conf → Make plugin available in specific clients
  • /ui2/flp → open Fiori Launchpad to test plugin

[SAPUI5] Replace OData Service manually in Extension Project

After redefining an OData Service like it is described here, you also have to add your new service in your Extension Project, so that the App knows, that it should use your redefined service instead of the default one. In the WebIDE there was a wizard that helped you with this task. In BAS there is also a wizard, but only for Adaptions Projects. For a classic extension project, there is no wizard anymore, and you have to manually add your new service to the manifest.json. But it is quite simple. You have to add your new service as data source and then also as a model. When no model name is provided, it will be used as default model.

	"sap.app": {
		"dataSources": {
			"ZMY_NEW_SERVICE": {
				"uri": "/sap/opu/odata/sap/ZHCMFAB_LEAVE_REQUEST_SRV/",
				"type": "OData",
				"settings": {
					"odataVersion": "2.0",
					"localUri": "localService/metadata.xml"
				}
			}
		}
	"sap.ui5": {
		"models": {
			"": {
				"dataSource": "ZMY_NEW_SERVICE",
				"preload": true,
				"settings": {
					"defaultBindingMode": "TwoWay",
					"useBatch": true,
					"refreshAfterChange": false,
					"disableHeadRequestForToken": true,
					"defaultCountMode": "Inline",
					"metadataUrlParams": {
						"sap-documentation": "heading"
					}
				}
			}
		}
	},