Monday 18 April 2022

How to use the latest SAPUI5 library for the Fiori Elements preview in ADT?

When using the RAP Generator it is necessary to use the latest version of the SAPUI5 libraries.

Please note:

If you don’t have the latest version of the SAPUI5 libraries installed you will get no dialogue asking you for the name of the root entity and for the name of the package when pressing the New Project button in the RAP Generator.

While this is automatically ensured when using a SAP ABAP BTP Environement system (aka Steampunk) in on premise systems the classes that are called when using the Fiori Elements preview will use the locally installed SAPUI5 version instead. Since I am testing my RAP Generator in various test systems where the latest SAPUI5 version was not deployed I thought about a workaround.

The workaround is using an implicit enhancement in the method get_sapui5core_resources_url( ) in the class cl_adt_odatav2_feap.

Please note:

This workaround is only required if (for whatever reason) it is not possible to install the latest SAPUI5 libraries locally on your ABAP on premise system.

◉ Start transaction SE24 and open the class CL_ADT_ODATAV2_FEAP and double-click on the method get_sapui5core_resources_url.

SAP ABAP RESTful Application Programming Model, SAP ABAP Development, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Skill

◉ In the menue click on Edit > Enhancement operations > Show implicit enhancement options

SAP ABAP RESTful Application Programming Model, SAP ABAP Development, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Skill

◉ In the menue choose Method > Enhance

SAP ABAP RESTful Application Programming Model, SAP ABAP Development, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Skill

◉ Click on the line with the arrow right after the METHOD statement and click on the CREATE button

SAP ABAP RESTful Application Programming Model, SAP ABAP Development, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Skill

◉ In the “Choose Enhancement Mode” dialogue box choose the option “Code”.

SAP ABAP RESTful Application Programming Model, SAP ABAP Development, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Skill

◉ Enter the following values and press the green check mark
    ◉ Enhancement Implementation : ZDMO_RAP_GENERATOR_FEAP_O2
    ◉ Short text: Use latest SAPUI5 version for OData V2 Fiori Elements preview

SAP ABAP RESTful Application Programming Model, SAP ABAP Development, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Skill

◉ In the “Create object directory” dialogue enter the name of a package (e.g. $TMP) and press “Save”.

SAP ABAP RESTful Application Programming Model, SAP ABAP Development, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Skill

◉ Enter the following two lines of code and press “Save Enhancements” and Activate your changes.

SAP ABAP RESTful Application Programming Model, SAP ABAP Development, SAP ABAP Exam, SAP ABAP Exam Prep, SAP ABAP Preparation, SAP ABAP Career, SAP ABAP Jobs, SAP ABAP Skill

rv_sapui5core_resources_url = 'https://sapui5.hana.ondemand.com/resources/sap-ui-core.js'.
return.

Source: sap.com

No comments:

Post a Comment