Objectives
After completing this lesson, you will be able to:
- Explain ABAP programming models.
- Use ABAP Development Tools.
- Explain SAP Fiori elements.
ABAP Programming Models
The three phases of the development of an SAP Fiori application are data modeling, service building, and UI development.
Watch the video explaining the key steps of SAP Fiori development.
Since SAP NetWeaver 7.0, it is possible to use SAP Gateway to build OData services that access arbitrary business data through existing ABAP frameworks (function modules, RFC, BAPI, SPI…). This can either be done through service development or through service generation using SAP Gateway Service Builder.
For the UI part, SAPUI5 apps are deployed as Business Server Pages (BSP) in the FES and run in the SAP Fiori launchpad (FLP).
Since SAP NetWeaver 7.40, it is possible to use CDS views as data source. SAP Gateway uses the Service Adaptation Definition Language (SADL) to access CDS views. There, everything is defined to read data from application tables, so no additional (ABAP) code must be written by any developer.
Requests that perform changes can be implemented using code-based implementation of the create, update, and delete method in the data provider extension (DPC_EXT) class. In addition since 7.50, CDS views referenced as data source in the SAP Gateway Service Builder can be combined with code-based implementation.
Since SAP NetWeaver 7.51 SP01, a first managed runtime is supported that leverages the Business Objects Processing Framework (BOPF). The business objects (ABAP classes) are generated based on appropriate annotations in the CDS view. They are implemented using code-based implementations to call existing APIs performing change requests to business data. This model is called ABAP Programming Model for SAP Fiori (CDS-based BOPF).
Since ABAP Platform 7.54, an enhanced managed runtime is available that leverages CDS behaviors. Therefore, the business objects of CDS-based BOPF are replaced by behavior definitions (ABAP interfaces) and behavior implementations (ABAP classes). This model is called ABAP RESTful Application Programming Model (RAP).
Code-based implementation can still be used to call existing custom code or if CDS views are not suitable to solve the business scenario.
Note
For more information about this topic, see:
ABAP Development Tools for On-Premise
The ABAP Development Tools (ADT) are a collection of plug-ins for Eclipse supporting development projects reaching beyond pure ABAP. Eclipse is a development environment, originally conceived for Java, that offers a framework for which vendors - including SAP - can provide plug-ins that support development in any given language.
Because different languages and platforms have different requirements, developers need a different set of tools within the same Eclipse window. Such a set of tools is called a perspective combining views and functions suiting for one purpose. There are views showing the source code, structural outline, properties, errors, and many more. Every perspective can be customized, new ones can be created, or existing ones can be reset to the last saved state.
The development objects or source code is organized in projects. Each project defines the frame for the (development) task. The files comprising this task are saved in a local folder.
To install the plug-ins of ADT, proceed as follows:
- Get an installation of Eclipse from https://www.eclipse.org/downloads/packages (for example, Eclipse IDE for Java Developers).
- In Eclipse, choose Help→Install New Software....
- Enter the URI https://tools.hana.ondemand.com/latest.
- Choose Enter to display the available features.
- Select ABAP Development Tools and choose Next.
- On the next wizard page, you get an overview of the features to be installed. Choose Next.
- Confirm the license agreements and choose Finish to start the installation.
ABAP Project
An ABAP project is like any other project in Eclipse a folder with files comprising the development task. For ABAP these are the connection information to an ABAP system. ABAP is a server language, so all source code is saved in an ABAP repository of the ABAP platform.
Watch the video to see how to create ABAP project in ABAP development tools.
The developer needs suitable user authorizations to work via ADT in an ABAP system. A list of roles and authorization objects is available in the following guide:
https://help.sap.com/doc/2e65ad9a26c84878b1413009f8ac07c3/202210.000/en-US/config_guide_system_backend_abap_development_tools.pdf
To enable ABAP developers to share HTTP links between themselves, activate the /sap/bc/adt ICF service. The receiver of the link can then render the target development object in his or her default Web browser.
To make documentation available to ABAP developers connected to an AS ABAP lower 7.55, activate the following ICF-services:
- /sap/bc/abap/docu
- /sap/bc/abap/toolsdocu
- /sap/public/bc/abap/docu
- /sap/public/bc/abap/toolsdocu
Expanding the System Library in an ABAP project allows direct access to all development objects of an ABAP repository. Especially when accessing an SAP S/4HANA system, this can be quite overwhelming. Therefore, the developer can define favorite packages and objects in an ABAP project.
The Open ABAP Development Object button provides a simple search for development objects based on their names. By choosing a development object from the list, it is opened in the suitable editor and connected views like Outline or Problems.
Many more views allow additional information around developing ABAP. One important one is the Transport Organizer view to open assigned transport requests or create new ones.
Development Paradigm Shift
SAP HANA is more than just a database. SAP HANA can perform calculations on a data level much faster than any previous technology, including ABAP programs. In the SAP Business Suite, the data was brought to the code. It was read from the database and processed in ABAP. With SAP HANA, it is more efficient to bring the code to the data, by pushing down calculations from the ABAP Platform in SAP HANA and only returning the results.
Moving calculations to the database to benefit from its features is not new to SAP HANA. Stored procedures could be used previously for calculations in many databases. However, they were rarely used in ABAP. They only run in the database they are developed in and are not transportable. With SAP S/4HANA, the ABAP repository was extended with two new database objects: ABAP Core Data Services (CDS) Views and ABAP Managed Database Procedures (AMDP). ABAP CDS Views are deployed as SAP HANA views in the SAP HANA Database (HDB), and the AMDPs are deployed as stored procedures. This is comparable to deploying a transparent table of the ABAP repository as a database table in any DB.
CDS views are the next generation data definition and access for database-centric applications. CDS views provide a cross-platform unified abstraction layer - similar to OData for UI abstraction. For SAP S/4HANA, ABAP CDS views are used. Using CDS views provides a maximum transparency for different programing models. ABAP CDS views provide a consistent lifecycle management and extensibility as with all other ABAP artifacts and are transported using the correction and transport system.
On the one hand, ABAP CDS Views are classic database views compatible with any DB. On the other hand, they include side elements such as annotations, which can only be interpreted by an SAP HANA database. Although CDS Views are stored in the ABAP repository, they can only be viewed using transaction SE80 in the SAP GUI. CDS Views are developed using ABAP Development Tools (ADT) in Eclipse.
Like CDS Views, AMDPs are developed using ADT and can only be viewed using transaction SE80 in SAP GUI. An AMDP is a global class method containing SQLScript as the programming language. The set of SQL extensions for the SAP HANA database that allow developers to push data intensive logic into the database is called SQLScript. Conceptually, SQLScript is related to stored procedures as defined in the SQL standard, but SQLScript is designed to provide superior optimization possibilities. SQLScript is used in cases where CDS Views are not sufficient, for example, for complex selections or calculations.
AMDPs can be identified by the syntax BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT behind the method name. Classes containing AMDPs implement the marker interface IF_AMDP_MARKER_HDB.
Note
For more information about this topic, see:
Test ABAP CDS Views
Task 1: Log on an SAP S/4HANA System in Eclipse
Steps
Start Eclipse and create an ABAP project connecting to your SAP S/4HANA (S4H) system.
In the Windows start menu, choose Eclipse IDE.
Close the Welcome screen.
Choose Open Perspective in the upper right corner.
Select ABAP and choose Open.
Choose New→ABAP Project.
In the Connection Settings popup, in the System ID field, enter the SID of your S4H.
Select the Activate Secure Network Communication (SNC) checkbox.
Choose Next >.
In the Client field, enter the client of your S4H.
In the User field, enter your user.
Choose Finish.
Task 2: Examine and Test an ABAP CDS View
Steps
Examine and test the CDS view UX100_C_Product in Eclipse on your S4H.
In Eclipse, choose Navigate→Open ABAP Development Object....
In the Search field, enter ux100_c_product.
Select UX100_C_Product (Data Definition) and choose OK.
Examine the CDS view.
Choose Run→Run As→ABAP Application.
Result
A list of products is displayed.
SAP Fiori Elements
SAP Fiori elements is a metadata-driven development of SAPUI5 applications and distinguishes the following floorplans:
- List Report
- Allows users to view and work with items (objects) organized in list (table) format.
- Object Page
- Provides functionality to view, edit, and create (business) objects.
- Overview Page
- Visualizes large amount of data in cards with different formats for different types of content.
- Analytical List Page
- Identifies relevant areas within data sets or significant single instances using data visualization and business intelligence.
- Worklist
- Displays a collection of items that a user must process.
The main source of the metadata for SAP Fiori elements is metadata extensions in the Core Data Services (CDS). Although you can add UI-annotations directly in data definitions, it is recommended to separate the definition of the UI from the data model definition.
The metadata of the SAP Gateway service providing the business data provides the parts of the UI definition suitable to the OData standard. On top of that the /IWFND/CATALOGSERVICE of the SAP Gateway framework provides all other parts, which are not allowed to be part of the metadata of an OData service.
In the SAPUI5 development environment, you can enrich the UI definition by adding annotations in the annotation.xml or by mapping page config files. These JSON-files describe certain parts of the UI in more detail.
This example shows the definition of a list report combined with an object page. At the top, some general header information for both SAP Fiori elements is set. Then an object page facet is created defining a frame for the data. The ProductUUID is hidden from the user. Product is the semantic key defined as line item in the list report. Finally, Price is set as an identifier in the object page.
Without using any SAPUI5 development environments, a preview of the list report can be provided via a service binding in the ABAP Development Tools (ADT). This preview directly runs on the ABAP system that the ADT is connected to but does not perform any deployment. Only the UI-annotations in data definitions and metadata extensions are considered, the metadata available on the ABAP-level.
The SAP Fiori tools as part of the SAP Business Application Studio and available in Visual Studio Code are the recommended tool for developing the SAP Fiori elements artifacts on UI-level. The Guided Development of the SAP Fiori tools offers many guides to add more features to the application. A guide offers a documentation of steps, screenshots of the expected result, code snippets, and often a wizard for applying the feature directly in an application in the workspace.
Test SAP Fiori Elements List Report
Task 1: Examine the Source Code of a List Report
Steps
In Eclipse connected to your SAP S/4HANA (S4H) system, examine the UI-definition in the metadata extension of the UX100_C_PRODUCT data definition.
In Eclipse connected to your S4H, open the UX100_C_PRODUCT data definition.
In the Outline, right-click UX100_C_PRODUCT.
Choose Get Where-used List.
In the Search view, double-click UX100_M_PRODUCT (Metadata Extension).
Examine the @UI-tags in the metadata extension.
Check the source name of the data exposed by the UX100_UI_PRODUCT_LIST service definition. Examine the data provided by the list report preview of the UX100_UI_PRODUCT_LIST service binding.
In the Search view, double-click UX100_UI_PRODUCT_LIST (Service Definition).
Check the exposed data source name.
In the Outline, right-click UX100_UI_PRODUCT_LIST.
Choose Get Where-used List.
In the Search view, double-click UX100_UI_PRODUCT_LIST (Service Binding).
In the Entity Set and Association list, select Product.
Choose Preview....
In the Select a certificate popup, select your certificate and choose OK.
In the list report, choose Go.
Examine the list of products.
Task 2: Test a List Report in the SAP Fiori Launchpad
Steps
In the SAP Fiori launchpad of your S4H, test the Display Products app of the UX100 - SAP Fiori Elements catalog.
In the SAP Fiori launchpad of your S4H, choose Home in the upper left corner.
In the Navigation Menu, choose UX100 - SAP Fiori Elements from the list of catalogs.
Choose Display Products.
Choose Go.
Operate the app as you wish.