@EndUserText.label : 'Database table for Office'
@AbapCatalog.enhancementCategory : #NOT_EXTENSIBLE //change to EXTENSIBLE_ANY to add a structure to DB table
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #LIMITED
define table zpdb_office {
key sapclient : mandt not null; // identifies which system are we running on
key officeuuid : /bobf/conf_key not null; // uniquely identifies the office
name : abap.string(256);
location : abap.string(256);
}
@EndUserText.label : 'Database table for Workstation.'
@AbapCatalog.enhancementCategory : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #LIMITED
define table zpdb_workstation {
key sapclient : mandt not null; // which system are we running on?
key workstationuuid : /bobf/conf_key not null; // uniquely identifies the workstation
officeuuid : /bobf/conf_key; // answers the question to which office does the workstation belong to?
workstationid : abap.string(256);
}
@EndUserText.label : 'Database table for Employee.'
@AbapCatalog.enhancementCategory : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #LIMITED
define table zpdb_employee {
key sapclient : mandt not null; // purpose: which system are we running on?
key employeeuuid : /bobf/conf_key not null; // purpose: uniquely identifies the employee
officeuuid : /bobf/conf_key; // purpose: in which office does the employee work?
name : abap.string(256);
employee_position : abap.string(256);
gender : abap.char(1);
experience_years : abap.int4;
}
@AbapCatalog.sqlViewName: 'ZIPDBOFFICE'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Interface for office.'
@VDM.viewType: #BASIC
define view ZIPDB_OFFICE as select from ZPDB_OFFICE {
key ZPDB_OFFICE.officeuuid, //taking the officeuuid variable from our DB table ZPDB_OFFICE
ZPDB_OFFICE.name, //taking the name variable ...
ZPDB_OFFICE.location
}
@AbapCatalog.sqlViewName: 'ZIPDBWORKSTATION'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Interface for workstation.'
@VDM.viewType: #BASIC
define view ZIPDB_WORKSTATION as select from zpdb_workstation {
key zpdb_workstation.workstationuuid,
zpdb_workstation.officeuuid,
zpdb_workstation.workstationid
}
@AbapCatalog.sqlViewName: 'ZIPDBEMPLOYEE'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Interface for employee.'
@VDM.viewType: #BASIC
define view ZIPDB_EMPLOYEE as select from zpdb_employee {
key zpdb_employee.employeeuuid,
zpdb_employee.officeuuid,
zpdb_employee.name,
zpdb_employee.employee_position,
zpdb_employee.gender,
zpdb_employee.experience_years
}
@AbapCatalog.sqlViewName: 'ZIPDBOFFICETP'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Transactional view for office.'
@ObjectModel: {
modelCategory: #BUSINESS_OBJECT,
transactionalProcessingEnabled: true,
transactionalProcessingUnitRoot: true, //identifies this entity as root
compositionRoot: true, //identifies this entity as root
writeActivePersistence: 'zpdb_office', //writes all changes to our database table zpdb_office, which is the one for the office entity
createEnabled: true, //allows you to create new entities of type office
updateEnabled: true, //allows you to update ...
deleteEnabled: true, //allows you to delete ...
representativeKey: 'officeuuid', //indicates that the officeuuid variable uniquely identifies the office; that there is no two same values of officeuuid.
semanticKey: ['name'], //indicates that the name variable identifies the office through the gui, as we will not want to use the officeuuid to classify the offices (00A5E333 is not user-friendly identification)
usageType: {
dataClass: #TRANSACTIONAL,
sizeCategory: #L,
serviceQuality: #C
}
}
@VDM.viewType: #TRANSACTIONAL
define view ZIPDB_OFFICE_TP as select from ZIPDB_OFFICE //notice our data source is our basic view created in the previous step!
association [1..*] to ZIPDB_EMPLOYEE_TP as _Employee on $projection.officeuuid = _Employee.officeuuid
association [1..*] to ZIPDB_WORKSTATION_TP as _Workstation on $projection.officeuuid = _Workstation.officeuuid
{
key ZIPDB_OFFICE.officeuuid,
ZIPDB_OFFICE.name,
ZIPDB_OFFICE.location,
//indicates that the CDS view with alias _Employee is a child of this CDS view, ZIPDB_OFFICE_TP (which is a view for our office entity)
@ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
_Employee,
//similar case...
@ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
_Workstation
}
@AbapCatalog.sqlViewName: 'ZIPDBWORKSTATP'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Transactional view for workstation.'
@ObjectModel: {
modelCategory: #BUSINESS_OBJECT,
transactionalProcessingEnabled: true,
writeActivePersistence: 'zpdb_workstation',
createEnabled: true,
updateEnabled: true,
deleteEnabled: true,
representativeKey: 'workstationuuid',
semanticKey: ['workstationid'],
usageType: {
dataClass: #TRANSACTIONAL,
sizeCategory: #L,
serviceQuality: #C
}
}
@VDM.viewType: #TRANSACTIONAL
define view ZIPDB_WORKSTATION_TP as select from ZIPDB_WORKSTATION
association [1..1] to ZIPDB_OFFICE_TP as _Office on $projection.officeuuid = _Office.officeuuid
{
key ZIPDB_WORKSTATION.workstationuuid,
@ObjectModel.foreignKey.association: '_Office'
ZIPDB_WORKSTATION.officeuuid,
ZIPDB_WORKSTATION.workstationid,
@ObjectModel.association.type: [#TO_COMPOSITION_PARENT, #TO_COMPOSITION_ROOT]
_Office
}
@AbapCatalog.sqlViewName: 'ZIPDBEMPLOYEETP'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Transactional view for employee.'
@ObjectModel: {
modelCategory: #BUSINESS_OBJECT,
transactionalProcessingEnabled: true,
writeActivePersistence: 'zpdb_employee',
createEnabled: true,
updateEnabled: true,
deleteEnabled: true,
representativeKey: 'employeeuuid',
semanticKey: ['name'],
usageType: {
dataClass: #TRANSACTIONAL,
sizeCategory: #L,
serviceQuality: #C
}
}
@VDM.viewType: #TRANSACTIONAL
define view ZIPDB_EMPLOYEE_TP as select from ZIPDB_EMPLOYEE
association [1..1] to ZIPDB_OFFICE_TP as _Office on $projection.officeuuid = _Office.officeuuid
{
key ZIPDB_EMPLOYEE.employeeuuid,
@ObjectModel.foreignKey.association: '_Office'
ZIPDB_EMPLOYEE.officeuuid,
ZIPDB_EMPLOYEE.name,
ZIPDB_EMPLOYEE.employee_position,
ZIPDB_EMPLOYEE.gender,
ZIPDB_EMPLOYEE.experience_years,
@ObjectModel.association.type: [#TO_COMPOSITION_PARENT, #TO_COMPOSITION_ROOT]
_Office
}
@AbapCatalog.sqlViewName: 'ZCPDBOFFICETP'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Consumption view for office.'
@ObjectModel:{
transactionalProcessingDelegated: true,
//modelCategory: #BUSINESS_OBJECT,
representativeKey: 'officeuuid',
semanticKey: ['name'],
usageType: {
dataClass: #TRANSACTIONAL,
serviceQuality: #B,
sizeCategory: #L
},
createEnabled: true,
updateEnabled: true,
deleteEnabled: true
}
@UI: {
headerInfo: {
typeName: 'Office',
typeNamePlural: 'Offices'
}
}
@Search.searchable: true //will show a search field to be able to search specific instances of Office
@VDM.viewType: #CONSUMPTION
define view ZCPDB_OFFICE_TP as select from ZIPDB_OFFICE_TP
association [1..*] to ZCPDB_EMPLOYEE_TP as _Employee on $projection.officeuuid = _Employee.officeuuid
association [1..*] to ZCPDB_WORKSTATION_TP as _Workstation on $projection.officeuuid = _Workstation.officeuuid
{
//allows to organize the order of the entities in the Object Page in Fiori Elements. This is why
//in one picture I have of the UI below, the Office information is before that of Employee, and
//Employee is before Workstation.
@UI:{
facet:[
{
label:'Employee',
position: 20,
type: #LINEITEM_REFERENCE,
targetElement: '_Employee'
},
{
label: 'Workstation',
position: 30,
type: #LINEITEM_REFERENCE,
targetElement: '_Workstation'
},
{
label: 'Office',
id: 'officeId',
position: 10,
type: #COLLECTION
},
{
parentId: 'officeId',
type: #FIELDGROUP_REFERENCE,
targetQualifier: 'officeIdFG'
}
]
}
@Consumption.filter.hidden: true
key ZIPDB_OFFICE_TP.officeuuid,
@Search.defaultSearchElement: true //annotation required on one field if you want to be able to search instances
//fieldGroup is important to determine where the variable is placed - is it placed with Employee entity? Office entity? Set the qualifier appropriately.
@UI: {
fieldGroup: [{ qualifier: 'officeIdFG', position: 10, label: 'Office Name' }],
identification: { position: 10, importance: #HIGH }, //position holds same importance; determines what shows first
lineItem: [{position: 10, label: 'Office Name'}]
}
ZIPDB_OFFICE_TP.name,
@UI: {
fieldGroup: [{ qualifier: 'officeIdFG', position: 20, label: 'Office Location' }],
identification: { position: 20, importance: #HIGH },
lineItem: [{position: 20, label: 'Office Location'}]
}
ZIPDB_OFFICE_TP.location,
@ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
_Employee,
@ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
_Workstation
}
@AbapCatalog.sqlViewName: 'ZCPDBEMPLOYEETP'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Consumption View'
@ObjectModel:{
transactionalProcessingDelegated: true,
//modelCategory: #BUSINESS_OBJECT,
representativeKey: 'employeeuuid',
semanticKey: ['name'],
usageType: {
dataClass: #TRANSACTIONAL,
serviceQuality: #B,
sizeCategory: #L
},
createEnabled: true,
updateEnabled: true,
deleteEnabled: true
}
@UI: {
headerInfo: {
typeName: 'Employee',
typeNamePlural: 'Employees'
}
}
@Search.searchable: true
@VDM.viewType: #CONSUMPTION
define view ZCPDB_EMPLOYEE_TP as select from ZIPDB_EMPLOYEE_TP
association [1..1] to ZCPDB_OFFICE_TP as _Office on $projection.officeuuid = _Office.officeuuid
{
@UI: {
facet: [
{
label: 'Employee',
id: 'employeeId',
position: 10,
type: #COLLECTION
},
{
parentId: 'employeeId',
type: #FIELDGROUP_REFERENCE,
targetQualifier: 'employeeIdFG'
}]
}
@UI.lineItem.position: 10
@UI.hidden: true
key ZIPDB_EMPLOYEE_TP.employeeuuid,
@UI.hidden: true
ZIPDB_EMPLOYEE_TP.officeuuid,
@Search.defaultSearchElement: true
@UI: {
fieldGroup: [{ qualifier: 'employeeIdFG', position: 10, label: 'Employee Name' }],
identification: { position: 10, importance: #HIGH },
lineItem: [{position: 10, label: 'Employee Name'}]
}
ZIPDB_EMPLOYEE_TP.name,
@UI: {
fieldGroup: [{ qualifier: 'employeeIdFG', position: 20, label: 'Employee Position' }],
identification: { position: 20, importance: #HIGH },
lineItem: [{position: 20, label: 'Employee Position'}]
}
ZIPDB_EMPLOYEE_TP.employee_position,
@UI: {
fieldGroup: [{ qualifier: 'employeeIdFG', position: 30, label: 'Employee Gender' }],
identification: { position: 30, importance: #HIGH },
lineItem: [{position: 30, label: 'Employee Gender'}]
}
ZIPDB_EMPLOYEE_TP.gender,
@UI: {
fieldGroup: [{ qualifier: 'employeeIdFG', position: 40, label: 'Employee Experience in Years' }],
identification: { position: 40, importance: #HIGH },
lineItem: [{position: 40, label: 'Employee Experience in Years'}]
}
ZIPDB_EMPLOYEE_TP.experience_years,
@ObjectModel.association.type: [#TO_COMPOSITION_PARENT, #TO_COMPOSITION_ROOT]
_Office
}
@AbapCatalog.sqlViewName: 'ZCPDBWORKSTATP'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Consumption view for workstation.'
@ObjectModel:{
transactionalProcessingDelegated: true,
//modelCategory: #BUSINESS_OBJECT,
representativeKey: 'workstationuuid',
semanticKey: ['workstationid'],
usageType: {
dataClass: #TRANSACTIONAL,
serviceQuality: #B,
sizeCategory: #L
},
createEnabled: true,
updateEnabled: true,
deleteEnabled: true
}
@UI: {
headerInfo: {
typeName: 'Workstation',
typeNamePlural: 'Workstations'
}
}
@Search.searchable: true
@VDM.viewType: #CONSUMPTION
define view ZCPDB_WORKSTATION_TP as select from ZIPDB_WORKSTATION_TP
association [1..1] to ZCPDB_OFFICE_TP as _Office on $projection.officeuuid = _Office.officeuuid
{
@UI: {
facet: [
{
label: 'Workstation',
id: 'workstationId',
position: 10,
type: #COLLECTION
},
{
parentId: 'workstationId',
type: #FIELDGROUP_REFERENCE,
targetQualifier: 'workstationIdFG'
}]
}
@UI.lineItem.position: 10
@UI.hidden: true
key ZIPDB_WORKSTATION_TP.workstationuuid,
@UI.hidden: true
ZIPDB_WORKSTATION_TP.officeuuid,
@Search.defaultSearchElement: true
@UI: {
fieldGroup: [{ qualifier: 'workstationIdFG', position: 10, label: 'Workstation Identifier' }],
identification: { position: 10, importance: #HIGH },
lineItem: [{position: 10, label: 'Workstation Identifier'}]
}
ZIPDB_WORKSTATION_TP.workstationid,
@ObjectModel.association.type: [#TO_COMPOSITION_PARENT, #TO_COMPOSITION_ROOT]
_Office
}
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 | |
14 | |
13 | |
13 | |
12 | |
8 | |
8 | |
7 | |
6 | |
5 |