Deprecated: Creation of dynamic property Pusher\Log\Logger::$file is deprecated in /html/wordpress/wp-content/plugins/wppusher/Pusher/Log/Logger.php on line 18

Deprecated: Creation of dynamic property Pusher\Log\Logger::$file is deprecated in /html/wordpress/wp-content/plugins/wppusher/Pusher/Log/Logger.php on line 18

Deprecated: Creation of dynamic property Pusher\Dashboard::$pusher is deprecated in /html/wordpress/wp-content/plugins/wppusher/Pusher/Dashboard.php on line 68

Deprecated: Creation of dynamic property Pusher\Log\Logger::$file is deprecated in /html/wordpress/wp-content/plugins/wppusher/Pusher/Log/Logger.php on line 18

Deprecated: Creation of dynamic property Pusher\Log\Logger::$file is deprecated in /html/wordpress/wp-content/plugins/wppusher/Pusher/Log/Logger.php on line 18
Fiori Archives - j&s-soft

Category: Fiori

  • SAP UI5 Adaptation Project

    TL;DR: There are times in which the functionality of an SAP Fiori App is not enough. In this blog, we investigate if it is possible to add an adaptation project to the corresponding Fiori App. Furthermore, we provide tips and best practices for developers.

    Adaptation projects offer a great way to extend the SAP standard apps. This blog gives an introduction about what requirements have to be met, and it should also serve as a cheat sheet for developers. Thus, the blog is split up into two main sections. The first one ensures feasibility whereas the second part focuses more on the development side of an adaptation project.

    Feasibility of an Adaptation Project

    Adaptation Project

    Adaptation Projects are used to meet customer requirements in SAP Standard Apps. Examples can be adding custom behavior which will be invoked by pressing an added button to the standard app.
    Be aware that not every standard app delivered by SAP can be extended with an adaptation project. Only the apps which are developed with SAP UI5 can be extended this way. In the Fiori apps library, it is easy to determine the developing language of the app.

    Entry of the Fiori apps library which can be extended

    Once the criteria are met and the app can be extended with an adaptation project the visual editor comes into place. The visual editor is integrated into the SAP Business Application Studio (SAP BAS) which allows the user to adjust the properties of the standard app as well as to add custom controls and logic. To do so rightclick on the area which should be extended and add your control or logic.
    There is a safe mode that can be activated, this one should ensure that the extension will work with future system upgrades.

    Make the Adaptation project visible

    To test the adaptation project in the original app the launchpad customizing has to be adjusted. Therefore it is best practice to create a new mapping for the routing as well as a new tile which will then open the created variant. Hence, the standard app will still be available if in the deployed extension an error occurs. The target mapping requires the parameter sap-appvariant-id and should look like the following:

    Target mapping of an adaptation project

    Once the target mapping is created the app variant (the adaptation project) can be called by using the # of the original app in combination with the URL parameter sap-appvar-id: #YAIFMessage-display?sap-appvar-id=customer.<namespace>

    To ensure, that the adaptation project is called the inspector is required. Above the directory of the developed and standard apps there will be another directory for adaptation projects.

    Debug extension

    In the inspector, you then can see that a directory lrep/flex/modules which contain the extension.
    In this directory, you can find the coding of your adaptation project. If this entry is not listed then it is a hint that there might be a syntax error within your extension.

    Useful tools by SAP

    SAP delivered some useful tools to further investigate an app. As a reminder those tools are listed with the corresponding keyboard shortcuts.

    Keyboard Shortcuts der SAP: SAPUI5 SDK Demo Kit

    Development of an Adaptation Project

    Extension coding

    In the adaptation project it is possible to either override the methods of the extended controller (be careful on this one), to define your methods and execute them as well as to override the lifecycle methods of the standard app. When overriding lifecycle methods be aware that your coding in the extension will not replace the coding of the standard app – rather your coding will be called before or after the lifecycle method of the standard app. See the following picture as a demonstration.

    Source: UI5 extension of controller and lifecycle methods

    return ControllerExtension.extend("customer.<namespace>.ExcelReport", {
        override:{
            onInit: function(oEvent){
                ...
            },
            onAfterRendering: function(oEvent){
                ...
            }
        },
        myMethod(){
          ...
        },
        anotherMethod(){
          ...
        }
    })

    The context of the controller extension can be retrieved via

     this.base.extension.<namespace>

    (in the debugger). The context of the extented controller can be retrieved via

    this.base.getView().getController()

    Contexts and extension Methods

    The following information lists the commands to navigate between the contexts of the controller and the extension. Hence, use the controller context of the original app as well as the context of the extension.

    Context of the extension

    this.base.extension.<namespace>
    this.base.extension.customer.SysMsgMonitorOverview.OverviewExtension

    this Context of the current controller

    this.base.<variable> = 'abc'

    Controller of the current view

    this.base.getView().getController()

    Helpfull skills

    Further helpful skills which might come in handy are:

    • UI5 Eventhandling

    sap.ui.getCore().getEventBus().publish("YourEventChannel", "getAllData", {})
    sap.ui.getCore().getEventBus().subscribe(
                            "YourEventChannel",
                            "getAllData",
                            this.getAllData,
                            this);
    • Basic jQuery
      • to retrieve a control if it is available (fully rendered and with available data)
      • to automatically scroll up and down in an section

    var intervalId = setInterval(
        () => {
            var oExtContext = this.base.extension.customer.namespace.OverviewExtension
            // if the cards (especially the headers) are rendered
            if ($("div[id*='cardHeader']")[0]) { 
                ...
                window.clearInterval(intervalId);
            }
          
        },1000, this, intervalId);

    Problems which can occur

    • More than one extension project could be required while navigating to a detail view (check the app-ID after navigating)
    • If the standard app uses the OData v4 Model it can be very hard to retrieve the data which are binded to the view. Since the Model / Context methods getProperty() and getObject() are not available in the v4 Model. On a binding (get it from the view) it is possible to use the method requestObject() which then will return a promise.

    await this.base.getView().byId(<id>).getBindingContext().requestObject()
        .then(function(oData) {
            ...
        })
        .catch(function(oErr) {
            ...
        })

    This post is part IV of a blog series.

    Read also part I: Fiori Introduction

    part II: Fiori Customization

    part III: Extensibility Scenario With Key User Tools

  • Extensibility Scenario With Key User Tools

    In this part of the blog series we are going to create our own business object. After the customization in the previous blogs we are going to take a look about an extensibility option which is provided by the key-user-tools – the app ‘Custom Business Objects’. With this app we are able to create a new database table, an application logic as well as an OData service within a matter of minutes. With the created OData service we can quickly create an Fiori application which we can then integrate on our Fiori Launchpad after deployment.

    Create a Custom-Business-Object

    In order to create a custom business object start the app ‘custom business object’ and create a new business object. After entering a name for the new object we receive the following overview (first picture).

    With the different tabs we are able to set the details of the business object. When creating a new business object it is useful to set the checkbox ‘Service Generation’. By setting this checkbox an OData service, based on cds-views, will be generated. This OData service enables us to activate it in our sap system.

    For the purpose of this post we activated the OData service and requested the metadata in a browser.

    With the activated OData service we have several options to use the created structure to our needs. We could go the way of ‘side-by-side’ extensibility and build an app which modifies our data outside of our system. With the help of the Web IDE or Business Application Studio we can create an Fiori app, developed with either Fiori Elements or SAP UI5. For this post we chose to create the app with an Fiori Elements template in the Web IDE.

    In the Web IDE we create a new project from template, choose the desired template and then use the category ‘service url’ to select the activated OData service. There is a minor prerequisite to be able to use the category ‘service url’. In your environment (cloud-foundry or neo) a connection to the source system, in which we just created the custom business object, has to be specified. If this is the case you will be able to call the OData service and it should look like something in the picture below. If you don’t have a connection setup you could either set it up or you could use one of the other two options (a custom UI5 or CAP app) to work with your data from the created business object.

    Once we are done with the development we can deploy it to our system and register it on to the Fiori Launchpad. By doing so the created app will automatically appear in our theme, which we created in the last edition of the blog series.

    Closing

    As you can see there are several options to customize as well as to enhance the Fiori standard apps without much effort. With a bit more time it is possible to launch different types of extension projects. Let us know about your experiences with the customization and extension of Fiori standard apps!

    This post is part of a blog series.

    Read also part I: Fiori Introduction

    part II: Fiori Customization

    part IV: SAP UI5 Adaptation Project