| #CHANGE_SET | #ISOLATED |
| 1- Multiple records can be processed at once | 1- Multiple records can be processed at once |
| 2- All records must be valid | 2- Only valid records are processed leaving Invalid records unprocessed |
| 3- Single Session created for processing the records | 3- Multiple Session are created, one per record to be processed |
| 4- All records are processed in one go | 4- Individual record processed one by one |
@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;
}@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Interface View Entity for Student'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
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
}@EndUserText.label: 'projection View for Student'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@Metadata.ignorePropagatedAnnotations: true
@Metadata.allowExtensions: true
@ObjectModel.usageType:{
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'
Firstname,
@EndUserText.label: 'Last Name'
Lastname,
@EndUserText.label: 'Age'
Age,
@EndUserText.label: 'Course Name'
Course,
@EndUserText.label: 'Course Duration'
Courseduration,
@EndUserText.label: 'Status'
Status,
@EndUserText.label: 'Gender'
Gender,
@EndUserText.label: 'DOB'
Dob,
Lastchangedat,
Locallastchangedat
}
@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: #ISOLATED
}],
identification: [{ position: 10, label: 'Student ID' }]
}
Id;
@UI: {
lineItem: [{ position: 20, label: 'First Name' }],
identification: [{ position: 20, label: 'First Name' }]
}
Firstname;
@UI: {
lineItem: [{ position: 30, label: 'Last Name' }],
identification: [{ position: 30, label: 'Last Name' }]
}
Lastname;
@UI: {
lineItem: [{ position: 40, label: 'Age' }],
identification: [{ position: 40, label: 'Age' }]
}
Age;
@UI: {
lineItem: [{ position: 50, label: 'Course' }],
identification: [{ position: 50, label: 'Course' }]
}
Course;
@UI: {
lineItem: [{ position: 60, label: 'Course Duration' }],
identification: [{ position: 60, label: 'Course Duration' }],
selectionField: [{ position: 10 }]
}
Courseduration;
@UI: {
lineItem: [{ position: 70, label: 'Status' }],
identification: [{ position: 70, label: 'Status' }]
}
Status;
@UI: {
lineItem: [{ position: 80, label: 'Gender' }],
identification: [{ position: 80, label: 'Gender' }]
}
Gender;
@UI: {
lineItem: [{ position: 90, label: 'DOB' }],
identification: [{ position: 90, label: 'DOB' }]
}
Dob;
}
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>
{
create;
update;
delete;
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;
}
}
projection;
strict ( 1 );
define behavior for ZRAP_C_STUDENT_5001 alias Student
{
use create;
use update;
use delete;
use action statusUpdate;
}

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




METHOD statusUpdate.
READ ENTITIES OF zrap_i_student_5001 IN LOCAL MODE
ENTITY Student
ALL FIELDS WITH CORRESPONDING #( keys )
RESULT DATA(students)
FAILED failed.
SORT students BY Status DESCENDING.
LOOP AT students ASSIGNING FIELD-SYMBOL(<lfs_students>).
IF <lfs_students>-Age < 25.
APPEND VALUE #( %tky = <lfs_students>-%tky ) TO failed-student.
APPEND VALUE #( %tky = <lfs_students>-%tky
%msg = new_message_with_text(
severity = if_abap_behv_message=>severity-error
text = <lfs_students>-Firstname && ' has Age less then 25, status not updated '
) ) TO reported-student.
ELSE.
<lfs_students>-Status = abap_true.
ENDIF.
ENDLOOP.
IF failed-student IS INITIAL.
SORT students BY Status DESCENDING.
MODIFY ENTITIES OF zrap_i_student_5001 IN LOCAL MODE
ENTITY Student
UPDATE FIELDS ( Status ) WITH CORRESPONDING #( students )
.
ENDIF.
ENDMETHOD.


You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 26 | |
| 25 | |
| 21 | |
| 20 | |
| 19 | |
| 14 | |
| 14 | |
| 14 | |
| 14 | |
| 10 |