ABAP Programming Model for SAP Fiori – Part – 12

BOPF with Draft

In this tutorial, lets analyse how to work on Draft class to retrieve data from other entities and push all the data model’s data into respective tables. For our Airline scenario, we don’t have any specific business logic, so direct INSERT or UPDATE or DELETE operations to DB will work.

Our objective inside the Draft class is to collect the data from all the entities and then do DB operations accordingly.

In the Draft generated class, we redefine method /bobf/if_frw_draft~copy_draft_to_active_entity to apply our business logic for the Save sequence.

To retrieve the own data model entity and its child data model entities retrieve() and retrieve_by_association() methods can be used respectively. Follow the below code for retrieving the data from all the entities.

Once the retrieval is complete, data has to be organised in order to find whether the data has to be inserted or updated. Table type of each

Read More

ABAP Programming Model for SAP Fiori – Part 2

CDS Intro

Core Data Services (CDS) is one of the pillars of all SAP S/4HANA Application Types. They are deployed on top of ECC or new S/4HANA tables and enable the development of semantically rich data models that fosters the code push-down to the SAP HANA database. We have a complete tutorial series on CDS and we also had 3 batches of training on ABAP CDS.

This tutorial will help the beginners in ABAP CDS who want to get a quick byte on Core Data Services and continue ABAP Programming Model in SAP Fiori without traversing and jumping to multiple pages. But we highly recommend, do take our tutorial series on Core Data Services to dive deep into it.

What happens upon creation of CDS View?

On activation of a CDS view, two artifacts are generated: a corresponding SQL View i.e. Data Dictionary (DDIC) view in the ABAP Dictionary (@AbapCatalog.sqlViewName) and a

Read More

ABAP Programming Model for SAP Fiori – Part 3

CDS Creation

Core Data Service should no longer be a surprise or niche to ABAP developers. CDS and ABAP developers should have the relationship like water and milk. If you have not embraces CDS yet, then this tutorial will bring you one step closer to learning and understanding Core Data Services.

Let’s start creating the data model for our Application. In general, it is a best practice to create a Package and encapsulate the data model which will be created by CDS views.

Create a Package

Go to SE80 transaction and create a package as below;

Create Data Model using CDS Views

Let’s assume the Data model of Airline Industry scenario. Airline Industry will have the Carrier of Airline related information and the Flight travelling schedule.

With this minimal basic requirement, let’s start building the data model. For this scenario, three standard Database tables are referred:

  1. SCARR – Airline Info.
Read More

ABAP Programming Model for SAP Fiori – Part – 8

CRUD Operation in SAP BOPF

From our data model of Airline which we have created, there are three Composite Interface views. It is always good practice to add semantic business object annotations to the composite interface views. Because Basic Interface views has to be reused in other applications as well, so we apply business object annotations on Composite interface views. To generate a BOPF business object based on the three composite CDS views, we must add several @ObjectModel annotations to the views.

In the Airline root view (ZAPF_I_AIRLINE), we must add the annotations on the header level.

Read More

ABAP Programming Model for SAP Fiori – Part – 10

Action in BOPF

Action has the literal meaning in BOPF. Do something. We can create an Action to an existing business object node by carrying out the following steps,

  • Open the business object (ZAPF_I_AIRLINE).
  • In the business object editor, click on Go to the Root Node link.
  • Select Actions tab, and choose New.

A dialog appears, where we must specify the details of the action:

  • Name: Enter the name of the action; in our case, we enter “Set URL”.
  • Description: Enter description that describes the purpose of the action, for instance, “Set the URL”.
  • Implementation Class: We can simply accept the suggestion that will lead to the generation of a global ABAP class or enter an already existing class that implements the interface /bobf/if_frw_action~execute. We will call the class ZCL_A_LOCK_APF_I_AIRLINE.
  • Instance Multiplicity: Select multiple node instances here, as we want the action to operate on several
Read More