This is a test message to test the length of the message box.
Login
ABAP RAP Draft
Created by Software-Heroes

RAP - Draft (Part 2)

685

The second part on the subject of draft handling in RAP objects is about better displaying the draft status at the individual positions in the list.



In the last article we added draft handling to our app. However, you should also have noticed that the display of the current draft in the list was not very good, since the status of the sentence was not recognizable. In this article we will show you how the display can be made even better and more detailed.

 

Introduction

After we activated and made the draft handling available, we could admire the first version of the list report:

 

Unfortunately, the draft status is still not displayed in this version and we can only find positions that have been changed but not yet saved via the filter. We want to change this with this article and take over the necessary components. In the last article we implemented the minimum for draft handling.

 

Tables

First of all, the partner table has to be adjusted again. At the end we add further information about the person who made the change, but also about the creator of the data record. The ZBS_DMO_PARTNER table now looks like this:

define table zbs_dmo_partner {
  key client       : abap.clnt not null;
  key partner      : abap.char(10) not null;
  name             : abap.char(60);
  street           : abap.char(80);
  city             : abap.char(60);
  country          : land1;
  payment_currency : abap.cuky;
  last_changed_at  : abp_locinst_lastchange_tstmpl;
  last_changed_by  : abp_locinst_lastchange_user;
  created_at       : abp_creation_tstmpl;
  created_by       : abp_creation_user;
}

 

For a clean management of the status, the implementation of all 5 fields is recommended. In the next step, the draft table must also be adjusted to include the new information. You should make sure that the field names correspond to the names in the interface view and thus differ from the table fields:

define table zbs_dmo_dpartner {
  key mandt         : mandt not null;
  key partnernumber : abap.char(10) not null;
  key draftuuid     : sdraft_uuid not null;
  partnername       : abap.char(60);
  street            : abap.char(80);
  city              : abap.char(60);
  country           : land1;
  paymentcurrency   : abap.cuky;
  lastchangedat     : abp_locinst_lastchange_tstmpl;
  lastchangedby     : abp_locinst_lastchange_user;
  createdat         : abp_creation_tstmpl;
  createdby         : abp_creation_user;
  "%admin"          : include sych_bdl_draft_admin_inc;
}

 

Core Data Service

As a next step, the call stack of the Core Data Services has to be expanded, for this the fields of the table are taken over. There is a corresponding annotation for each field, which we now assign so that the meta information can be properly derived in the app.

@Semantics.systemDateTime.lastChangedAt: true
last_changed_at  as LastChangedAt,
@Semantics.user.lastChangedBy: true
last_changed_by  as LastChangedBy,
@Semantics.systemDateTime.createdAt: true
created_at       as CreatedAt,
@Semantics.user.createdBy: true
created_by       as CreatedBy

 

Furthermore, the following objects still have to be adjusted, which we won't go into in detail here because they are small adjustments. You can find more information in the commit in the git repository:

  • Projection View - Adoption of the new fields in the projection layer and thus make them available in the app.
  • Behavior Definition - Extension of the mapping in the behavior definition to include the new fields.

 

Metadata Extension

After the adjustments, however, the information for the draft is still not visible in the positions. To do this, the metadata, specifically the header information, must be expanded. To do this, we add the following UI annotation in the header:

@UI.headerInfo.title: { type: #STANDARD, value: 'PartnerName' }

 

What exactly happened in the app? First of all, additional information was displayed in the header area on the detail screen when an entry was selected:

 

Furthermore, the draft status is now displayed in the list of entries. If you click on the entry, you will receive information about the last change. If you are the changer, then only "Draft" is displayed, if someone else is the changer, then information about the user is also displayed:

 

Conclusion

In addition to a better presentation of the draft information, your app now also has an automatic management of the technical information. Not even many changes are necessary to implement a certain standard in the apps.


Included topics:
RAPBTPDraftDraft Handling
Comments (0)



And further ...

Are you satisfied with the content of the article? We post new content in the ABAP area every Friday and irregularly in all other areas. Take a look at our tools and apps, we provide them free of charge.


RAP - Deep Table Action

Category - ABAP

Is it currently possible to pass tables to actions in RAP? This article is intended to provide a better insight into the topic.

01/07/2025

ABAP Cloud - Programming Model

Category - ABAP

Which programming model is used with ABAP Cloud and what can we learn from its predecessor? More details in the article.

01/03/2025

RAP - Side Effects

Category - ABAP

How can you update parts of the Fiori UI without doing a complete refresh? With Side Effects, this is easily possible in ABAP and RAP.

12/27/2024

RAP - Events

Category - ABAP

How can you actually create events in RAP and process them with ABAP? Here you can find out more about event-driven processing.

12/23/2024

RAP - Load Excel File

Category - ABAP

In this practical example we look at processing Excel in ABAP with the new XCO classes and how we get the file into our RAP object.

12/20/2024