Skip to Content
Technical Articles
Author's profile photo Abhishek Sharma

ABAP Restful Application Programming Model (RAP) – Update multiple records using RAP #CHANGE_SET


In this beginner blog post we are going to see how we can use #CHANGE_SET (Change Set Processing) in ABAP Restful Application Programming Model. Update multiple records at once using RAP




Use Case:

Change Set processing can be used when there is requirement to operate on multiple records with single Action example in list report Application. using change set processing user can enable multi-inline editing on the list control.

As this #CHANGE_SET is added to List report using UI Annotation @UI.LineItem the action is then processed for all selected records (instances) in once change set.


#CHANGE_SET  can be used with





@UI.identification, by adding parameter invocationGrouping to UI annotation


This UI annotation is not specific to ABAP Restful Application Model, but it can be used with any Fiori Application.


Example Implementation:

For demo we are going to create RAP based Fiori Application using Managed scenario and V2 Service type.

In this example we are using V2 Service type because we are not going to Implement Draft capability in our application. As a limitation of RAP architecture if Draft Implementation is not done then application will not display Create and Edit buttons.


Step 1

Created DB Table


@EndUserText.label : 'Student Table'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table zrap_stud_5001 {
  key client         : abap.clnt not null;
  key id             : sysuuid_x16 not null;
  firstname          : abap.char(100);
  lastname           : abap.char(100);
  age                : abap.numc(4);
  course             : abap.char(50);
  courseduration     : abap.numc(4);
  status             : abap_boolean;
  gender             : abap.char(1);
  dob                : abap.dats;
  lastchangedat      : timestampl;
  locallastchangedat : timestampl;


Step 2

Created Interface CDS View Entity for reading data from DB table created in previous step


@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Interface View Entity for Student'
@Metadata.ignorePropagatedAnnotations: true
    serviceQuality: #X,
    sizeCategory: #S,
    dataClass: #MIXED
define root view entity ZRAP_I_STUDENT_5001 
as select from zrap_stud_5001
  key id                 as Id,
      firstname          as Firstname,
      lastname           as Lastname,
      age                as Age,
      course             as Course,
      courseduration     as Courseduration,
      status             as Status,
      gender             as Gender,
      dob                as Dob,
      lastchangedat      as Lastchangedat,
      locallastchangedat as Locallastchangedat



Created Projection CDS View for Interface view andadd annotations.


@EndUserText.label: 'projection View for Student'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@Metadata.ignorePropagatedAnnotations: true
@Metadata.allowExtensions: true
    serviceQuality: #X,
    sizeCategory: #S,
    dataClass: #MIXED

define root view entity ZRAP_C_STUDENT_5001 
as projection on ZRAP_I_STUDENT_5001 as Student

      @EndUserText.label: 'Student ID'
  key Id,
      @EndUserText.label: 'First Name'
      @EndUserText.label: 'Last Name'
      @EndUserText.label: 'Age'
      @EndUserText.label: 'Course Name'
      @EndUserText.label: 'Course Duration'
      @EndUserText.label: 'Status'
      @EndUserText.label: 'Gender'
      @EndUserText.label: 'DOB'


Create Metadata Extension for Consumption View. This will help creating UI for Fiori Application


@Metadata.layer: #PARTNER
annotate view ZRAP_C_STUDENT_5001 with

  @UI.facet: [{ id: 'Student', purpose: #STANDARD,
                type: #IDENTIFICATION_REFERENCE,
                label: 'Student', position: 10

  @UI: {
      lineItem: [{ position: 10,
                   label: 'Update Status',
                   type: #FOR_ACTION,
                   dataAction: 'statusUpdate',
                   invocationGrouping: #CHANGE_SET
      identification: [{ position: 10, label: 'Student ID' }]
  @UI: {
      lineItem: [{ position: 20, label: 'First Name' }],
      identification: [{ position: 20, label: 'First Name' }]
  @UI: {
      lineItem: [{ position: 30, label: 'Last Name' }],
      identification: [{ position: 30, label: 'Last Name' }]
  @UI: {
      lineItem: [{ position: 40, label: 'Age' }],
      identification: [{ position: 40, label: 'Age' }]
  @UI: {
      lineItem: [{ position: 50, label: 'Course' }],
      identification: [{ position: 50, label: 'Course' }]
  @UI: {
      lineItem: [{ position: 60, label: 'Course Duration' }],
      identification: [{ position: 60, label: 'Course Duration' }],
      selectionField: [{ position: 10 }]
  @UI: {
      lineItem: [{ position: 70, label: 'Status' }],
      identification: [{ position: 70, label: 'Status' }]
  @UI: {
      lineItem: [{ position: 80, label: 'Gender' }],
      identification: [{ position: 80, label: 'Gender' }]
  @UI: {
      lineItem: [{ position: 90, label: 'DOB' }],
      identification: [{ position: 90, label: 'DOB' }]



In above Metadata extension for Projection View we have added parameters to @UI.lineItem annotation to enable Batch processing. Refer below screen shot.


Action Method is added with name statusUpdate.



Step 3

Create behavior Definition for Interface View, also create Class and Implementation as well.


managed implementation in class zbp_rap_i_student_5001 unique;
strict ( 1 );
define behavior for ZRAP_I_STUDENT_5001 alias Student
persistent table ZRAP_STUD_5001
lock master
authorization master ( global )
//etag master <field_name>
  action statusUpdate;
  field ( numbering : managed, readonly ) Id;
  mapping for ZRAP_I_STUDENT_5001 {
    //Id = id;
    Firstname = firstname;
    Lastname = lastname;
    Age = age;
    Course = course;
    Courseduration = courseduration;
    Status = status;
    Gender = gender;
    Dob = dob;
    Lastchangedat = lastchangedat;
    Locallastchangedat = locallastchangedat;


In behavior Definition for Interface View we have added action statusUpdate shown in below screen shot.



Create Behavior Definition for Projection View


strict ( 1 );

define behavior for ZRAP_C_STUDENT_5001 alias Student
  use create;
  use update;
  use delete;
  use action statusUpdate;


Step 4

Create Service Definition for Projection / Consumption View.





Once Service Definition is created


@EndUserText.label: 'Service Defination for Student'
define service ZRAP_EXPOSE_STUDENT_5001 {
  expose ZRAP_C_STUDENT_5001;


Step 5

Create Service Binding. Activate the Service Bindings and then Publish. Once Published successfully Binding looks like below screen shot.



Step 6


Testing Application:

Select Entity Set name and click on Preview button to run Application. Once Executed Application looks like below Screen shot.

New action button with caption Update Status is added.


As next Step we are going to create List and Object Page Fiori Application using created V2 Service in Business Application Studio.


Once Application is create and run below is output. We got Action Button available correctly but we are still seeing Single select option in List.



If V2 service is used List report will always show single select option (Radio Buttons)

If V4 service is used List report will always show multi select option (Checkbox)



Now to convert List report from single select to multi select we need to make changes in manifest.json file

Refer below changes in manifest.json file. Once the tableSettings  multiSelect property is set to true, List report will show Multi Select option (Checkbx)



Refresh application again and see the Radio Buttons are now replaced with Checkbox on each line.

Once Checkbox are selected Update Status action button gets activated. Now our goal is to update Status field with Yes once Action button is pressed. All selected records should be updated at once.




Step 7


Updating statusUpdate method with core update logic. We have Implemented statusUpdate method. updating Status field for all selected records with abap_true.


Since we have activated the #CHANGE_SET with @UI.LineItem parameter  invocationGrouping 

we will be getting all selected record’s keys.


CLASS lhc_Student DEFINITION INHERITING FROM cl_abap_behavior_handler.

    METHODS get_global_authorizations FOR GLOBAL AUTHORIZATION
      IMPORTING REQUEST requested_authorizations FOR Student RESULT result.

    METHODS statusUpdate FOR MODIFY
      IMPORTING keys FOR ACTION Student~statusUpdate.



  METHOD get_global_authorizations.

  METHOD statusUpdate.

  Read ENTITIES OF zrap_i_student_5001 IN LOCAL MODE
    ENTITY Student
    RESULT DATA(students)
    FAILED failed.

    SORT students BY Status DESCENDING.
    LOOP AT students ASSIGNING FIELD-SYMBOL(<lfs_students>).

        <lfs_students>-Status = abap_true.


    MODIFY ENTITIES OF zrap_i_student_5001 IN LOCAL MODE
    ENTITY Student
    UPDATE FIELDS ( Status ) WITH CORRESPONDING #( students ).




Once Implementation is completed Activate the changes and Run Fiori Application again and select multiple records from List and execute Update Status Action.



Previous Blog Posts

ABAP RAP – Instance Authorization

ABAP RAP – Global Authorization







Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Abdah Azim Hisham
      Abdah Azim Hisham

      Definitely helpful!


      Thanks Abhishek