ABAP RESTful Application Programming Model

Salvation after 5+ years and variety of technological marriages, ABAP RAP is here finally. Fiori and WebAPI development can take a deep breath. This post is about common and uncommon snippets for ABAP RAP. This post is updated on regular manner.

ABAP RAP
ABAP Restful Application Programming Model

All the snippets here denote one of the round boxes/components of the Programming Model.

Administrative Data

At the beginning of time, we had to manually update admin fields of changes within BOPF determinations manually. Alternatively we created reusable base determination classes combined with custom Z annotations and reuse it within CDS views and generated BOPF objects freely. Now we can relax a bit more, RAP spports this out of the box, you just need to annotate your timestamp and username fields, system does the rest.

"Database table fields

  created_by            : syuname;
  created_at            : timestampl;
  last_changed_by       : syuname;
  last_changed_at       : timestampl;
  local_last_changed_at : timestampl;

--CDS: Data Modelling

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

Admin fields populated automatically