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 BO node, will contain a parameter flag. This flag will be filled during runtime. If it is an insert entry, then the flag will have a blank value. If it is an update or delete entry, then the flag will be filled with ‘X’.
Based on the flag, Insert or Update/Delete operations can be segregated. This is the crucial step where each developer has to take care before committing the entry into actual database.
The actual app will look like below, when Draft feature is enabled and we do transactional operations to it.
Thus, through the above processes and tutorials we are able to develop both Read-only and Transactional type of Fiori Apps.
ABAP Programming Model for SAP Fiori
We are planning to start an Instructor Led Paid Online Practical Training on ABAP Programming Model for SAP Fiori. If learning this new programming model is in you study kitty, you may want to register and enroll in this course. Please register using below link and we will provide more information to the registered participants.
Introduction to ABAP Programming Model for SAP Fiori Training – Registration Form
Please follow our LinkedIn Page, LinkedIn Group, Facebook Page, Twitter and Instagram.
Save our number +1-646-727-9273 and send us a Whatsapp message ‘LEARN’ to be part of our Learning Community.