Wednesday, 7 October 2020

Cannot Load Metadata for Service /sap/opu/odata/sap/service_name

While working with SAP UI5 and FIORI applications, we generally encounter error "Service failed. Contact your system administrator" or "Cannot call service with URL /sap/opu/odata/sap/service_name". These types of errors generally occurs when the authorization object is missing for the user in the backend server.

To resolve these issues, log on to the backend server and assign the S_RFCACL missing authorization object for the end user.

Tuesday, 6 October 2020

Clear Cache : FIORI APPS

While implementing SAP UI5/FIORI applications, we should always clear the cache before testing the changes i the browser. There is persistence layer in the FIORI and UI5 applications that uses the caching mechanism.

We have transaction codes to clear the cache on frontend and as well as backend servers. Also we can run the reports to synchronization chip cache on frontend.

Transaction codes to clear the Metadata cache

  • /IWFND/CACHE_CLEANUP - Transaction code to clear cache on frontend server.
  • /IWBEP/CACHE_CLEANUP - Transaction code to clear cache on backend server.

Reports to Synchronize Chip Cache
  • /UI2/CHIP_SYNCHRONIZE_CACHE
  • /UI2/DELETE_CACHE_AFTER_IMP
  • /UI2/DELETE_CACHE

Saturday, 3 October 2020

Could Not Open App | SAP FIORI Troubleshooting

When we log on to Fiori Launchpad and access any application we get error message in the pop up saying "Could Not Open App".



Now open the browser "Developer Tools" to check the error details. How to open Developer Tools - Right click on the browser window and click on "inspect". 


Check the Network and console section of developer tools to view the error details. In console window you will find error "Failed to load Component.js from /sap/bc/ui5_ui5/sap/app_name/Component.js" 

 This type of error generally occurs when SICF node is not activated. How to Activate the UI5 application SICF node?

  • Open transaction code SICF
  • In the service name field give the BSP application name and press enter. 
  • If application name is grayed out in the list under ui5_ui5 node then right click on the application name and click on activate to activate the application.


Sunday, 27 September 2020

SAP UI5 CSS Best Practices

 

CSS

        1.

Rule Specificity

Organize the stylesheet in top down structure as per the rule specificity.

 

        2.

Structure

Structure CSS in the selectors right to left. Browser while resolving CSS selectors, parses it from right to left.

 

        3.

Compressed CSS

Always try to keep CSS as compact and precise as possible, we can also use compressed CSS file.

 

Avoid using multiple properties which can be replaced by single property.

 

        4.

CSS Classes

If multiple elements share same properties always try to combine them by using classes.

 

        5.

CSS Comments

Always use comments as much as you can in CSS file for complex applications.

 

        6.

Efficiency

-        ID's are the most efficient, Universal are the least.

 

-        The descendant selector is the most expensive selector in CSS. It is dreadfully expensive — especially if the selector is in the Tag or Universal Category.

 

        7.

Selector

-        Keep the selector short. Most of the time extra item in the selector will mess up the code.

 

-        Avoid using universal selectors.

 

       8.

Stylesheet Size

Always keep the size of stylesheet as less as possible, it will help browser during the style resolution step. Remove unwanted selectors, avoid duplicate css and use tools like uncss to make sure stylesheet contain css that is being used in the page.

 

        9.

CSS Expressions

Avoid CSS Expressions since they are deprecated started with IE version 8.

 

Integration of Google Analytics with SAP UI5 custom application

Google Analytics is tool for tracking site usage which gives deep dive analysis of user statistics and other important information on application usage. With google analytics we can determine where the visitors are coming from, which links on your site are getting the most hits and how long the visitors spend on various pages of your site. In addition to providing critical marketing data, it also tracks browser features so that you can make informed design decisions.

 Integration of Google Analytics with custom SAPUI5 application will provide a view into how the users are using the system, as well as key demographic information on the users.

Depending on results, we can make changes in application. It will also help us reduce the number of clicks by moving the frequently accessed information on the landing page.

There are other methods as well to get user statistics on the application by tracking the ODATA services but I find google analytics more effective as it gives detailed analysis on application usage. We can execute report “/IWFND/R_METERING_VIEW” to get the analysis. We have standard job “SAP_IWFND_METERING_DEL” that works behind report “/IWFND/R_METERING_VIEW”.

This job is also scheduled daily, it cleans up aggregation data older than 2.5 years back, and cleans up the data from /IWFND/L_MET_DAT on monthly level


Steps to integrate Google Analytics with SAP UI5


  1. Go to http://www.google.com/analytics
  2. Enter your Google account email and password and click Sign In
  3. Click on the Admin tab at the top header area of the site.
  4. In the ‘Account’ section, choose to ‘Create a new Account’.
  5. On the next page, you will be asked ‘what would you like to track. Choose ‘Website’.

6.     Create new project add URL of application and get Tracking ID of URL



7.     Get JavaScript code from Google Analytics and add it into index.html page of Fiori application.


Note - It can take up to 24 hours for a new Google analytics account to start tracking data also SAP do not provide any support on google analytics integration if there are any issues with tracking code or integration we need to work with google support team.


Live Screenshots of application for user statistics



How do you acquire users?



How are your active users trending over time?



How well do you retain users?



When do your users visit?


Google Analytics will also help in determining which links on your site are getting the most hits and how long the visitors spend on various pages of your site.

 

Where are your users?

With google analytics we can determine where the visitors are coming from and from which country they are logging in.


What are your top devices?




What pages do your users visit?