0% found this document useful (0 votes)
61 views

15 CDS Hierarchy

This document defines several views related to employee and flight meal data. It defines views for employee data including name, manager, and cost center. It then joins this data with hours data and defines calculated fields. It also defines a table for flight meal data and joins this with reference data on airlines, connections, and meal types. Views are defined for consumption, querying, and composite use of this data.

Uploaded by

Rajesh Raju
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

15 CDS Hierarchy

This document defines several views related to employee and flight meal data. It defines views for employee data including name, manager, and cost center. It then joins this data with hours data and defines calculated fields. It also defines a table for flight meal data and joins this with reference data on airlines, connections, and meal types. Views are defined for consumption, querying, and composite use of this data.

Uploaded by

Rajesh Raju
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

@AbapCatalog.

viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'My Employee Private view'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
serviceQuality: #X,
sizeCategory: #S,
dataClass: #MIXED
}
define view entity ZDEC_P_EMPLOYEE as select from zats_emp_mgr {
key empid as Empid,
empname as Empname,
managerid as Managerid,
costcenter as Costcenter
}

@AbapCatalog.sqlViewName: 'ZDECIEMPMGR'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Employee Manager Hierarchy'
@ObjectModel.representativeKey: 'Empid'
@Analytics.dataCategory: #DIMENSION
@Hierarchy.parentChild: [{
name: 'EmpMgrHier',
recurse: { parent: ['Manager' ], child: ['Employee']}

}]
define view ZDEC_I_EMPMGR as select from ZDEC_P_EMPLOYEE
association[1..*] to ZDEC_P_EMPLOYEE as _Manager on
$projection.Managerid = _Manager.Empid
{
@ObjectModel.text.element: ['EmployeeName']
key ZDEC_P_EMPLOYEE.Empid as Employee,
@Semantics.text: true
@EndUserText.label: 'Employee Name'
ZDEC_P_EMPLOYEE.Empname as EmployeeName,
@EndUserText.label: 'Manager Id'
ZDEC_P_EMPLOYEE.Managerid as Manager,
@EndUserText.label: 'Cost Center'
ZDEC_P_EMPLOYEE.Costcenter as CostCenter,
_Manager
}

@AbapCatalog.sqlViewName: 'ZDECCOEMPHOURS'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Composite view to join with hours data'
@VDM.viewType: #COMPOSITE
@Analytics.dataCategory: #CUBE

define view ZDEC_CO_EMPHOURS as select from zats_emp_hrs


association[0..1] to ZDEC_I_EMPMGR as _Employee on
$projection.Empid = _Employee.Employee
{
key zats_emp_hrs.empid as Empid,
@DefaultAggregation: #SUM
@EndUserText.label: 'Planned Effort'
zats_emp_hrs.planned as Planned,
@DefaultAggregation: #SUM
@EndUserText.label: 'Recorded Effort'
zats_emp_hrs.recorded as Recorded,
_Employee,
_Employee.EmployeeName,
_Employee.CostCenter

@AbapCatalog.sqlViewName: 'ZDECCEMPHOURS'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Employee Analytic Query'
@VDM.viewType: #CONSUMPTION
@Analytics.query: true
@OData.publish: true
define view ZDEC_C_EMPHOURS as select from ZDEC_CO_EMPHOURS {
@AnalyticsDetails.query:{
displayHierarchy: #ON,
hierarchyInitialLevel: 2,
axis: #ROWS,
totals: #HIDE,
display: #KEY_TEXT
}
key Empid,
Planned,
Recorded,
EmployeeName,
CostCenter,
@AnalyticsDetails.query.formula: 'recorded * 100 / planned'
@EndUserText.label: 'Effort Utilization'
0 as EffortUtilization
}

@EndUserText.label : 'Flight Meals'


@AbapCatalog.enhancementCategory : #NOT_CLASSIFIED
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #ALLOWED
define table zoft_meals {
key mandt : mandt not null;
key meal_id : /bobf/uuid not null;
carrid : s_carr_id;
connid : s_conn_id;
meal : s_mealnum;
total_seats : s_seatsmax;
status : flag;

}
@AbapCatalog.sqlViewName: 'ZDECCFLIGHTMEAL'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Flight meal app'
@VDM.viewType: #CONSUMPTION
@OData.publish: true
define view ZDEC_C_FLIGHT_MEAL as select from zoft_meals
association[1] to scarr as _Airline on
$projection.Carrid = _Airline.carrid
association[1] to spfli as _Connection on
$projection.Carrid = _Connection.carrid and $projection.Connid = _Connection.connid
association[1] to smeal as _Meals on
$projection.Meal = _Meals.mealnumber
{
key meal_id as MealId,
carrid as Carrid,
connid as Connid,
meal as Meal,
total_seats as TotalSeats,
status as Status,
_Airline,
_Connection,
_Meals
}

You might also like