Search help in SAP using RAP.
Refer - Sample example for managed scenario
Refer - Control action in RAP
Refer - Custom action change state
Step 1: Adding new field in table.
@EndUserText.label : 'Student interview details'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table ztl_ab_rap_stus
{
key client : abap.clnt not null;
key student_id : abap.char(10) not null;
student_name : abap.char(30);
student_i_loc : abap.char(20);
student_i_date : abap.datn;
student_status : abap_boolean;
student_gender : abap.char(1);
description : abap.char(6);
}
Step 2: Check and activate the table.
Step 3: Create a domain for gender.
* Right click -- New -- other repository object -- dictionary -- domain.
* Check and activate the domain.
Step 4: Create data definition for that domain.
* Right click -- new -- other repository object -- Core data service -- data definition.
* Click on next and select the package and click on next select define view entity.
* Write the code.
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Gender domain'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
serviceQuality: #X,
sizeCategory: #S,
dataClass: #MIXED
}
define view entity ZI_D_AB_RAP_STUDS
as select from DDCDS_CUSTOMER_DOMAIN_VALUE_T( p_domain_name: 'ZD_AB_RAP_STUS' )
{
key domain_name,
key value_position,
@Semantics.language: true
key language,
value_low as Value,
@Semantics.text: true
text as Description
}
Step 5: Goto interface view entity and add association.
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Interface entity view for student'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
serviceQuality: #X,
sizeCategory: #S,
dataClass: #MIXED
}
define root view entity ZI_AB_RAP_STUS
as select from ztl_ab_rap_stus
association to ZI_D_AB_RAP_STUDS as _gender on $projection.StudentGender = _gender.Value
{
key student_id as StudentId,
student_name as StudentName,
student_i_loc as StudentILoc,
student_i_date as StudentIDate,
student_status as StudentStatus,
student_gender as StudentGender,
_gender,
_gender.Description as Genderdesc
}
Step 6: Check and activate the interface view entity.
Step 7: Goto consumption view and add the fields.
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Consumption view for student'
@Metadata.ignorePropagatedAnnotations: true
@Metadata.allowExtensions: true
@ObjectModel.usageType:{
serviceQuality: #X,
sizeCategory: #S,
dataClass: #MIXED
}
define root view entity ZC_AB_RAP_STUS
as projection on ZI_AB_RAP_STUS as Student
{
@EndUserText.label: 'Student ID'
key StudentId,
@EndUserText.label: 'Student Name'
StudentName,
@EndUserText.label: 'Student Interview Location'
StudentILoc,
@EndUserText.label: 'Student Interview Date'
StudentIDate,
@EndUserText.label: 'Student Interview Status'
StudentStatus,
@EndUserText.label: 'Student gender'
StudentGender,
// @EndUserText.label: 'Description'
Genderdesc
}
Step 8: Check and activate the consumption view.
Step 9: Goto meta data extension and add new fields.
@Metadata.layer: #CORE
@UI: {
headerInfo:
{
typeName: 'Student',
typeNamePlural: 'Students',
title: {
type: #STANDARD,
label: 'Student',
value: 'StudentId'
}
}
}
annotate view ZC_AB_RAP_STUS
with
{
@UI.facet:
[{
id : 'Student',
purpose: #STANDARD,
type: #IDENTIFICATION_REFERENCE,
label: 'Student',
position: 10
}]
@UI:
{
lineItem: [{ position: 10 , label : 'Student ID'}],
identification: [{ position: 10 , label : 'Student ID' }],
selectionField: [{ position: 10 }]
}
StudentId;
@UI:
{
lineItem: [{ position: 20 , label : 'Student Name'}],
identification: [{ position: 20 , label : 'Student Name' }],
selectionField: [{ position: 20 }]
}
StudentName;
@UI:
{
lineItem: [{ position: 30 , label : 'Student Interview Loc'}],
identification: [{ position: 30 , label : 'Student Interview Loc' }]
}
StudentILoc;
@UI:
{
lineItem: [{ position: 40 , label : 'Student Interview Date'}],
identification: [{ position: 40 , label : 'Student Interview Date' }]
}
StudentIDate;
@UI:
{
lineItem: [{ position: 50 , label : 'Student Interview Status'},
{ type: #FOR_ACTION, dataAction: 'Selected', label: 'Selected' }],
identification: [{ position: 50 , label : 'Student Interview Status' },
{ type: #FOR_ACTION, dataAction: 'Selected', label: 'Selected' } ]
}
StudentStatus;
@UI:
{
lineItem: [{ position: 60 , label : 'Student gender'}],
identification: [{ position: 60 , label : 'Student gender' }]
}
@Consumption.valueHelpDefinition: [{ entity : { name : 'ZI_D_AB_RAP_STUDS', element: 'Value' },
distinctValues: true,
additionalBinding: [{ localElement: 'Genderdesc',
element: 'Description',
usage: #FILTER_AND_RESULT
}]
}]
StudentGender;
@UI:
{
lineItem: [{ position: 70 , label : ''}],
identification: [{ position: 70 , label : '' }]
}
Genderdesc;
}
Step 10: Check and activate the Above meta data extension.
Step 11: Goto Behavior definition for interface entity and add new fields.
managed implementation in class zbp_i_ab_rap_stus unique;
strict ( 2 );
define behavior for ZI_AB_RAP_STUS alias Student
persistent table ztl_ab_rap_stus
lock master
authorization master ( instance )
//etag master <field_name>
{
create ( authorization : global );
update;
delete;
action ( features : instance ) Selected result [1] $self;
mapping for ztl_ab_rap_stus
{
StudentId = student_id;
StudentName = student_name;
StudentILoc = student_i_loc;
StudentIDate = student_i_date;
StudentStatus = student_status;
StudentGender = student_gender;
Genderdesc = description;
}
}
Step 12: Check all are activated or not (If not please activate).
-----------------------------------------------------------------------------------------------------
Testing:
* Preview the application.
* Click on create.
* Take gender as F4 help based on F4 help description will automatically display.
If you select M description should be Male. If you select F description should be Female.
* For update also it will work.
********************************Thank You*****************************
Comments
Post a Comment