@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: #CHANGE_SET
}],
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;
}
CLASS lhc_Student DEFINITION INHERITING FROM cl_abap_behavior_handler.
PRIVATE SECTION.
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.
ENDCLASS.
CLASS lhc_Student IMPLEMENTATION.
METHOD get_global_authorizations.
ENDMETHOD.
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>).
<lfs_students>-Status = abap_true.
endloop.
MODIFY ENTITIES OF zrap_i_student_5001 IN LOCAL MODE
ENTITY Student
UPDATE FIELDS ( Status ) WITH CORRESPONDING #( students ).
ENDMETHOD.
ENDCLASS.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |