Thursday, 5 November 2020

Substitution/Delegation app- Using and extending the standard My Inbox app

Recently, I have came across a scenario where one of the standard FIORI application- ‘My Inbox’ was implemented but the default landing page was different than the default page of My Inbox. Also, there was no semantic object mentioned in its tile to locate the standard application. The requirement was to add some custom code in that tile but I didn’t find any link as to where I can add the code as I was not aware of the corresponding application.

After reading some articles on internet, I was able to map the tile using the Roles assigned to my user but sometimes, developer has no Authorization to access the Roles.

In this blog, I will talk about how to determine which content layer to enhance while extending the standard FIORI applications, what are different options available while Redefining an OData service and I will also explain different ways of mapping a tile to standard application.

Step 1: Before enhancing any standard FIORI application, we should determine at which Content Layer we need to enhance the application. In case of Transactional applications, we have 3 Layers through which the application can be enhanced-

◉ Business Suite layer – This contains the back-end logic of the application. If I have all inputs required from the application but I need to perform some operations based on that input data. Or if I need to fetch some more data to pass in UI layer, then in that case I need to enhance the Business Suite.

◉ Gateway layer – This is the OData service which works as connection between front-end and back-end. If I need to pass any additional data from back-end to front-end or vice-versa, then in those cases, I will enhance the Gateway Layer.

◉ UI layer – This is the front-end part of the application. If I have everything from back-end but is not displayed to user or if I need to take some additional inputs from user, in that case I will enhance the UI Layer of application.

Step 2: To enhance the Business Suite layer or UI layer, I can easily find exits or BAdI through the FIORI Apps Library. If required BAdI is not available for Business Suite enhancement, then I can also opt for the Implicit enhancement in the standard class.

Now, to enhance the Gateway layer (which is my case), I need to redefine the standard OData service. When I select the OData service to redefine, I will get the option which Artifacts I have to copy. Its better to copy all Artifacts, so that it is future-ready.

After doing all required changes to my Artifacts, I will go to ‘Generate Runtime Objects’ button. I will get below popup with all values pre filled-

SAP ABAP Tutorial and Material, SAP ABAP Exam Prep, SAP ABAP Certification, SAP ABAP Prep
Service and Model definition

This simply asks for name of classes, Model and Service names to be generated. Its always suggested that we should generate the DPC Classes as well.

There is also one checkbox in last block ‘Overwrite Base/Extended Service’. If I don’t want to use the standard application ever in my system, then I can tick this checkbox. It will replace the standard Service of Original OData Service with my new service. So creation of new Semantic Object or Catalog won’t be required for this OData Service to be used in FIORI application. I will be able to use the original application with this new update. The only thing left in this case will be to assign the OData Model to FIORI application using extension project and give Authorization of new OData Service.

If I don’t tick the checkbox, then I will need to create new Semantic Object, new Catalog with new Group and assign my extension project to it. 

Step 3: Now, I have to add the standard FIORI application in my FIORI Launchpad, I can use the standard catalog provided by SAP which contains the Target Mapping for its Semantic Object-

SAP ABAP Tutorial and Material, SAP ABAP Exam Prep, SAP ABAP Certification, SAP ABAP Prep
Business Catalog for My Inbox application

But I don’t want to give access to all applications of that catalog to user, so I will create custom catalog with new tile. When I choose to create a custom tile for standard FIORI application, I don’t need to create Target Mapping again. I can reuse the standard mapping with Semantic Object of the application (as I have not updated the UI layer and used the checkbox while enhancing Gateway layer).

To add a Tile in Catalog, I have 3 options-

SAP ABAP Tutorial and Material, SAP ABAP Exam Prep, SAP ABAP Certification, SAP ABAP Prep
Different types of Tile

◉ Static Tile is used to show static content on Tile like title, Icon.

◉ Dynamic Tile is used to show static content with a dynamic count which is refreshed at regular intervals.

◉ News Tile is used to display multiple feeds or list display

After selecting the Static Tile, you will see the below properties of Tile-

SAP ABAP Tutorial and Material, SAP ABAP Exam Prep, SAP ABAP Certification, SAP ABAP Prep
Properties of Tile

Here, we have mostly used the Semantic Object directly with ‘Use Semantic object navigation’ checkbox where we provide the Semantic Object name and Action. But I will tell about how we can use the Target URL option here.

First, remove the tick from checkbox. Then Target URL will be modifiable and other 3 fields will become display only viz Semantic Object, Action and Parameters. To create the Target URL, I have to use the Semantic Object and Action in same format which is generated by checkbox previously:

#<Semantic Object>-<Action>

But, this tile will take me to default page only of My Inbox application which is list of pending actions. Instead I want to display the Substitution application default page through my tile -

SAP ABAP Tutorial and Material, SAP ABAP Exam Prep, SAP ABAP Certification, SAP ABAP Prep
Substitution application

So, I will go to the UI5 application of it which can be get from Fiori Apps Library and open it in SAP Web IDE. Open the ‘Component.js’ file of this application-

SAP ABAP Tutorial and Material, SAP ABAP Exam Prep, SAP ABAP Certification, SAP ABAP Prep
Component.js

Here, I can see the different page available to display directly through Page Routes option and also whether the particular page requires any input or not. Pattern shows the path to be used in Target URL and View contains the view name which is mapped to it. Here, in case of detail_deep view, it contains some input parameters as well which we can also pass in view using the OData service or by hard-coding them in the Path.

To add Substitution page in Tile, I have to add Pattern name in Target URL in below format-

#<Semantic Object>-<Action>&/<Pattern name>

In case of Semantic object, just add ‘&/<Pattern name>’ in Parameters field to change the default page.

SAP ABAP Tutorial and Material, SAP ABAP Exam Prep, SAP ABAP Certification, SAP ABAP Prep

This will create the custom tile in FIORI Launchpad which will directly trigger the Substitution application instead of default page of My Inbox. Similarly, we can also add any parameters in Target URL instead of using Semantic Object to get the desired page in output.

No comments:

Post a Comment