Posts

Showing posts from March, 2023

Custom App State in Fiori Elements V2

Image
FE V2 allows applications to extend app state with custom data. It provides some hook functions; applications need to implement these hook functions to manage the lifecycle of custom state data. Scenario: In an ALP, users can navigate to a object page from list report table by selecting multiple records. On the object page, one table only displays selected records by providing filters to its row binding . But if users refresh the object page, since the added filters are gone, all documents will be displayed in this table. The expected behavior is, when refresh the object page, the table displays the same data as before refreshing. Solution: The idea is saving selected record keys(from ALP) as the object page's app state. Once the object table's binding filter is updated, call function onCustomStateChange of extension API. The ideal place of calling this for this case is event handler of before table rebinding. This is to inform framework that custom state is changed and need to...

Karma Configuration for Authentication During SAPUI5 OPA Testing

Scenario: I want to execute SAPUI5 OPA tests base on backend OData services directly instead of pre-prepared mock-up data or generated mock-up by mock server. The challenge here is authentication against backend server when the tests are executed via Jenkins. Unlike manual execution by which user and password can be provided manually, automatic Jenkins execution has to overcome the BASIC authentication without any manual interventions.  Investigation: A Nodejs web server is started by Karma when launch the tests. The first thing I need to verify is whether the web server has the ability of proxying OData requests to designated backend servers or not. I searched keywords 'Karma proxy' and found below Karma official page about its configurations.  Karma - Configuration File proxies: { '/static' : 'http://gstatic.com' , '/web' : 'http://localhost:9000' , '/img/' : '/base/test/images/' , '/proxyfied' : { 'targe...

Create A New Object from Fiori Launchpad Directly

For a typical FE list report application, general process of creating a new object is: 1. Start the list report application 2. Click Create button to create a new object And it is also possible to launch object creation page directly from the FLP. For both FE V2 and V4, the trick here is adding parameter preferredMode=create as the launch parameter. Define the launchpad parameter in CDM: "parameters:{     "preferredMode":{            "value": {                    "value": "create",                    "format": "plain"                }           } }