
Header Table

Line Item table

User Mapping table
@AbapCatalog.sqlViewName: 'ZTIMEHDRBAS'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Time Header Basic view'
@VDM.viewType: #BASIC
define view ZCDS_I_TIME_HEADER_BAS
as select from zttime_hdr1
{
key uuid,
counter,
pernr,
workdate,
lchg_date_time,
lchg_uname,
crea_date_time,
crea_uname
}@ObjectModel.writeDraftPersistence: 'ZTTIME_HDR1_D'@AbapCatalog.sqlViewName: 'ZTIME_HDR1'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Time sheet Header'
@VDM.viewType: #COMPOSITE
//@VDM.viewType: #TRANSACTIONAL
@ObjectModel.modelCategory:#BUSINESS_OBJECT
@ObjectModel.compositionRoot:true
@ObjectModel.transactionalProcessingEnabled:true
@ObjectModel.writeActivePersistence:'ZTTIME_HDR1'
@ObjectModel.createEnabled:true
@ObjectModel.deleteEnabled:true
@ObjectModel.updateEnabled:true
@ObjectModel.draftEnabled: true
@ObjectModel.semanticKey:['counter']
@ObjectModel.entityChangeStateId: 'lchg_date_time'
@ObjectModel.writeDraftPersistence: 'ZTTIME_HDR1_D'
@Search.searchable: true
@OData.publish: false
define view ZCDS_I_TIME_HEADER1
as select from ZCDS_I_TIME_HEADER_BAS
association [1..*] to ZCDS_I_TIME_ITEM1 as _item on $projection.uuid = _item.uuid
association [1] to ZCDS_I_TIME_ITEM_SUM as _itemhrs on $projection.uuid = _itemhrs.uuid
{
@ObjectModel.readOnly: true
key uuid,
@EndUserText.label: 'Unique ID'
@Search.defaultSearchElement: true
counter,
@Search.defaultSearchElement: true
@EndUserText.label: 'Personnel Number'
pernr,
@EndUserText.label: 'Work Date'
workdate,
ZCDS_I_TIME_HEADER_BAS.lchg_date_time,
ZCDS_I_TIME_HEADER_BAS.lchg_uname,
crea_date_time,
crea_uname,
@ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
_item,
_itemhrs.LongHrsMins,
_itemhrs
}@AbapCatalog.sqlViewName: 'ZCTIME_HDR'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Time Sheet App'
@VDM.viewType: #CONSUMPTION
@Search.searchable: true
@ObjectModel.compositionRoot: true
@ObjectModel.transactionalProcessingDelegated: true
@ObjectModel.createEnabled:true
@ObjectModel.deleteEnabled:true
@ObjectModel.updateEnabled:true
@ObjectModel.draftEnabled: true
@ObjectModel.semanticKey:['counter']
@Metadata.allowExtensions: true
@UI.headerInfo.description.label: 'Nobia Time Sheet App'
@UI.headerInfo.description.value: 'counter'
@UI.headerInfo.typeName: 'Timesheet'
@UI.headerInfo.typeNamePlural: 'Timesheets'
@OData.publish: true
define view ZCDS_C_TIME_HEADER
as select from ZCDS_I_TIME_HEADER1
association [1..*] to ZCDS_C_TIME_ITEM as _item on $projection.uuid = _item.uuid
{
key uuid,
@EndUserText.label: 'Timesheet ID'
@Search.defaultSearchElement: true
@ObjectModel.readOnly: true
counter,
@EndUserText.label: 'Personnel Number'
@ObjectModel.readOnly: true
pernr,
@EndUserText.label: 'Work Date'
@ObjectModel.mandatory: true
@Consumption.filter.selectionType: #INTERVAL
workdate,
@Semantics.systemDateTime.lastChangedAt: true
@EndUserText.label: 'At'
@ObjectModel.readOnly: true
ZCDS_I_TIME_HEADER1.lchg_date_time,
@EndUserText.label: 'By'
@Semantics.user.lastChangedBy: true
@ObjectModel.readOnly: true
ZCDS_I_TIME_HEADER1.lchg_uname,
@EndUserText.label: 'At'
@Semantics.systemDateTime.createdAt: true
@ObjectModel.readOnly: true
ZCDS_I_TIME_HEADER1.crea_date_time,
@EndUserText.label: 'By'
@Semantics.user.createdBy: true
@ObjectModel.readOnly: true
ZCDS_I_TIME_HEADER1.crea_uname,
@EndUserText.label: 'Hours/Mins on work date'
@ObjectModel.readOnly: true
LongHrsMins,
@ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
_item
}
@AbapCatalog.sqlViewName: 'ZTIMEITMBAS'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Time Item Basic view'
@VDM.viewType: #BASIC
define view ZCDS_I_TIME_ITEM_BAS
as select from zttime_item1
{
key itemuuid,
uuid,
linecounter,
timetype,
timestart,
timeend,
lchg_date_time,
lchg_uname,
crea_date_time,
crea_uname
}
@ObjectModel.writeDraftPersistence: 'ZTTIME_ITEM1_D'@AbapCatalog.sqlViewName: 'ZTIME_ITM1'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Time sheet Item table'
@VDM.viewType: #COMPOSITE
@ObjectModel.modelCategory:#BUSINESS_OBJECT
@ObjectModel.writeActivePersistence:'ZTTIME_ITEM1'
@ObjectModel.createEnabled:true
@ObjectModel.updateEnabled:true
@ObjectModel.deleteEnabled:true
@ObjectModel.writeDraftPersistence: 'ZTTIME_ITEM1_D'
@ObjectModel.semanticKey:['linecounter']
@ObjectModel.entityChangeStateId: 'lchg_date_time'
@Search.searchable: true
define view ZCDS_I_TIME_ITEM1
as select from ZCDS_I_TIME_ITEM_BAS
association [1] to ZCDS_I_TIME_HEADER1 as _header on $projection.uuid = _header.uuid
association [1] to ZCDS_VH_TIMETYPES as _timetype on $projection.timetype = _timetype.DomainValue
{
@ObjectModel.readOnly: true
key itemuuid,
@ObjectModel.readOnly: true
uuid,
@Search.defaultSearchElement: true
@ObjectModel.readOnly: true
linecounter,
@ObjectModel.foreignKey.association: '_timetype'
@ObjectModel.mandatory: true
timetype,
@ObjectModel.mandatory: true
timestart,
@ObjectModel.mandatory: true
timeend,
lchg_date_time,
lchg_uname,
crea_date_time,
crea_uname,
@ObjectModel.association.type: [#TO_COMPOSITION_PARENT, #TO_COMPOSITION_ROOT]
_header,
_timetype
}
@AbapCatalog.sqlViewName: 'ZCTIME_ITM'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Time sheet Item table'
@VDM.viewType: #CONSUMPTION
@ObjectModel.semanticKey:['linecounter']
@Metadata.allowExtensions: true
@ObjectModel.createEnabled:true
@ObjectModel.deleteEnabled:true
@ObjectModel.updateEnabled:true
@UI.headerInfo.description.label: 'Time sheet Item'
@UI.headerInfo.description.value: 'linecounter'
@Search.searchable: true
define view ZCDS_C_TIME_ITEM
as select from ZCDS_I_TIME_ITEM1
association [1] to ZCDS_C_TIME_HEADER as _header on $projection.uuid = _header.uuid
{
key itemuuid,
uuid,
@EndUserText.label: 'Time Entry ID'
@Search.defaultSearchElement: true
@ObjectModel.readOnly: true
linecounter,
@ObjectModel.mandatory: true
@EndUserText.label: 'Time Type'
timetype,
@ObjectModel.mandatory: true
timestart,
@ObjectModel.mandatory: true
timeend,
@Semantics.systemDateTime.lastChangedAt: true
@EndUserText.label: 'At'
@ObjectModel.readOnly: true
lchg_date_time,
@Semantics.user.lastChangedBy: true
@EndUserText.label: 'By'
@ObjectModel.readOnly: true
lchg_uname,
@Semantics.systemDateTime.createdAt: true
@EndUserText.label: 'At'
@ObjectModel.readOnly: true
crea_date_time,
@Semantics.user.createdBy: true
@EndUserText.label: 'By'
@ObjectModel.readOnly: true
crea_uname,
@ObjectModel.association.type: [#TO_COMPOSITION_ROOT, #TO_COMPOSITION_PARENT]
_header,
_timetype
}
@AbapCatalog.sqlViewName: 'ZTIMEITMHRS'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Hours between times'
@VDM.viewType: #COMPOSITE
define view ZCDS_I_TIME_ITEM_HRS
as select from ZCDS_I_TIME_ITEM_BAS
association [1] to ZCDS_I_TIME_HEADER_BAS as _header on $projection.uuid = _header.uuid
{
key itemuuid,
uuid,
linecounter,
timetype,
timestart,
timeend,
_header.workdate,
_header.counter,
tstmp_seconds_between(dats_tims_to_tstmp(_header.workdate, timestart, abap_system_timezone($session.client,'NULL' ) ,
$session.client, 'INITIAL'), dats_tims_to_tstmp(_header.workdate,
timeend, abap_system_timezone($session.client,'NULL' ), $session.client, 'INITIAL'), 'INITIAL') as SecsBT
}
@AbapCatalog.sqlViewName: 'ZTSITMCUMUL'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Time Item cumulative view'
define view ZCDS_I_TIME_ITEM_CUMUL
as select from ZCDS_I_TIME_ITEM_HRS
{
key uuid,
sum(SecsBT) as SumSecsBT
}
group by
uuid
@AbapCatalog.sqlViewName: 'ZTSITMSUM'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Time Item Sum view'
@VDM.viewType: #COMPOSITE
define view ZCDS_I_TIME_ITEM_SUM
as select from ZCDS_I_TIME_ITEM_CUMUL
{
key uuid,
cast(floor(division(division(SumSecsBT,60,2),60,2)) as abap.char(21)) as WholeHours,
cast((div(SumSecsBT,60) - (floor(div(div(SumSecsBT,60),60)) * 60)) as abap.char(21)) as WholeMins,
concat(cast(floor(division(division(SumSecsBT,60,2),60,2)) as abap.char(21)),cast((div(SumSecsBT,60) - (floor(div(div(SumSecsBT,60),60)) * 60)) as abap.char(21))) as HrsMins,
@EndUserText.label: 'Hours/Mins for work date'
cast(concat_with_space(concat(cast(floor(division(division(SumSecsBT,60,2),60,2)) as abap.char(21)),'hrs'), concat(cast((div(SumSecsBT,60) - (floor(div(div(SumSecsBT,60),60)) * 60)) as abap.char(21)), 'mins'), 1) as abap.char(50) ) as LongHrsMins
}

Time Type Domain
@AbapCatalog.sqlViewName: 'ZVHTIMETYPE'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Value Help for Time Types'
@ObjectModel.resultSet.sizeCategory: #XS
define view ZCDS_VH_TIMETYPES
as select from I_DomainFixedValue
{
key DomainValue
}
where
SAPDataDictionaryDomain = 'ZTIMETYPE'@Metadata.allowExtensions: true@Metadata.layer: #CUSTOMER
annotate view ZCDS_C_TIME_HEADER with
{
@UI.facet: [
{
label: 'Date Entry',
id : 'GeneralInfo',
purpose: #STANDARD,
type : #COLLECTION,
position: 10
},
{ type: #FIELDGROUP_REFERENCE ,
label : 'Entry',
parentId: 'GeneralInfo',
id: 'idIdentification' ,
position: 10,
targetQualifier: 'dates' },
{ type: #FIELDGROUP_REFERENCE ,
label : 'Created',
parentId: 'GeneralInfo',
id: 'idIdentification2' ,
position: 20,
targetQualifier: 'audit' },
{ type: #FIELDGROUP_REFERENCE ,
label : 'Last Changed',
parentId: 'GeneralInfo',
id: 'idIdentification5' ,
position: 30,
targetQualifier: 'audit2' },
{
label: 'Time Entries',
id : 'TimeData',
type : #LINEITEM_REFERENCE,
targetElement: '_item' ,
position: 20
},
{ type: #IDENTIFICATION_REFERENCE ,
label : 'Times',
parentId: 'TimeData',
id: 'idIdentification1' ,
position: 20
}
]
@UI.identification: [{ position: 10, label:'TimeSheet ID',importance: #HIGH}]
@UI.lineItem: [{ importance: #HIGH, position: 10, label :'Timesheet ID'}]
@UI.hidden: true
counter;
@UI.fieldGroup: [{qualifier: 'dates', position: 20 }]
@UI.selectionField: [{position: 10}]
@UI.lineItem: [{position: 20, importance: #HIGH, label: 'Personnel Number' }]
@UI.identification: [{ position: 20, importance: #HIGH }]
pernr;
@UI.fieldGroup: [{qualifier: 'dates', position: 30 }]
@UI.selectionField: [{position: 20}]
@UI.lineItem:[{position: 30, importance: #HIGH, label: 'Work date'}]
@UI.identification: [{ position: 30, importance: #HIGH }]
workdate;
@UI.hidden: true
@UI.lineItem: [{position: 40, importance: #HIGH, type: #FOR_ACTION, dataAction: 'BOPF:COPY_HEADER', label: 'Copy'}]
uuid;
@UI.fieldGroup: [{qualifier: 'audit', position: 10 }]
@UI.identification: [{ position: 10, label:'By',importance: #HIGH}]
crea_uname;
@UI.fieldGroup: [{qualifier: 'audit', position: 20 }]
@UI.identification: [{ position: 20, label:'At',importance: #HIGH}]
crea_date_time;
@UI.fieldGroup: [{qualifier: 'audit2', position: 30 }]
@UI.identification: [{ position: 30, label:'By',importance: #HIGH}]
lchg_uname;
@UI.fieldGroup: [{qualifier: 'audit2', position: 40 }]
@UI.identification: [{ position: 40, label:'At',importance: #HIGH}]
lchg_date_time;
@UI.fieldGroup: [{qualifier: 'dates', position: 40 }]
@UI.identification: [{ position: 50, label:'Hours/Mins on work date',importance: #HIGH}]
@UI.lineItem:[{position: 50, importance: #HIGH}]
LongHrsMins;
}@Metadata.layer: #CUSTOMER
annotate view ZCDS_C_TIME_ITEM with
{
@UI.facet: [
{
label: 'Time Worked',
id : 'TimeInfo',
purpose: #STANDARD,
type : #COLLECTION,
position: 10
},
{ type: #FIELDGROUP_REFERENCE ,
label : 'Entry',
parentId: 'TimeInfo',
id: 'idIdentification' ,
position: 10,
targetQualifier: 'times' },
{ type: #FIELDGROUP_REFERENCE ,
label : 'Created',
parentId: 'TimeInfo',
id: 'idIdentification2' ,
position: 20,
targetQualifier: 'audit' },
{ type: #FIELDGROUP_REFERENCE ,
label : 'Last Changed',
parentId: 'TimeInfo',
id: 'idIdentification5' ,
position: 30,
targetQualifier: 'audit2' }
]
@UI.lineItem: [{ importance: #HIGH, label: 'Time Entry ID', position: 40 }]
@UI.identification: [{ position: 40, importance: #HIGH }]
@UI.fieldGroup: [{qualifier: 'times', position: 40 }]
linecounter;
@UI.lineItem: [{ importance: #HIGH, label: 'Time Type', position: 50 }]
@UI.identification: [{ position: 50, importance: #HIGH }]
@UI.fieldGroup: [{qualifier: 'times', position: 50 }]
timetype;
@UI.lineItem: [{ importance: #HIGH, label: 'Time Start', position: 60 }]
@UI.identification: [{ position: 60, importance: #HIGH }]
@UI.fieldGroup: [{qualifier: 'times', position: 60 }]
timestart;
@UI.lineItem: [{ importance: #HIGH, label: 'Time end', position: 70 }]
@UI.identification: [{ position: 70, importance: #HIGH }]
@UI.fieldGroup: [{qualifier: 'times', position: 70 }]
timeend;
@UI.hidden: true
uuid;
@UI.hidden: true
itemuuid;
@UI.fieldGroup: [{qualifier: 'audit', position: 10 }]
@UI.identification: [{ position: 10, label:'By',importance: #HIGH}]
crea_uname;
@UI.fieldGroup: [{qualifier: 'audit', position: 20 }]
@UI.identification: [{ position: 20, label:'At',importance: #HIGH}]
crea_date_time;
@UI.fieldGroup: [{qualifier: 'audit2', position: 30 }]
@UI.identification: [{ position: 30, label:' By',importance: #HIGH}]
lchg_uname;
@UI.fieldGroup: [{qualifier: 'audit2', position: 40 }]
@UI.identification: [{ position: 40, label:'At',importance: #HIGH}]
lchg_date_time;
}@ObjectModel.modelCategory:#BUSINESS_OBJECT
@ObjectModel.transactionalProcessingEnabled:true
Business Object showing Root and Child node
CLASS zcl_cds_d_get_hdr_counter DEFINITION
PUBLIC
INHERITING FROM /bobf/cl_lib_d_supercl_simple
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS /bobf/if_frw_determination~execute
REDEFINITION .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_cds_d_get_hdr_counter IMPLEMENTATION.
METHOD /bobf/if_frw_determination~execute.
DATA lt_data TYPE ztcds_i_time_header13.
DATA: lt_item TYPE ztcds_i_time_item13,
wa_item TYPE zscds_i_time_item13.
io_read->retrieve(
EXPORTING
iv_node = is_ctx-node_key " uuid of node name
it_key = it_key " keys given to the determination
IMPORTING
eo_message = eo_message " pass message object
et_data = lt_data " itab with node data
et_failed_key = et_failed_key " pass failures
).
DATA lv_counter TYPE char12.
DATA lv_timestamp TYPE timestampl.
LOOP AT lt_data REFERENCE INTO DATA(lr_data).
IF lr_data->counter IS INITIAL.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'ZTIMEHDR'
IMPORTING
number = lv_counter
EXCEPTIONS
interval_not_found = 1
number_range_not_intern = 2
object_not_found = 3
quantity_is_0 = 4
quantity_is_not_1 = 5
interval_overflow = 6
buffer_overflow = 7
OTHERS = 8.
IF sy-subrc <> 0.
*
ENDIF.
lr_data->counter = lv_counter.
lr_data->counter = |{ lr_data->counter ALPHA = IN }|.
IF lr_data->pernr IS INITIAL.
SELECT zpernr FROM zusrpernr INTO @DATA(lv_pernr)
WHERE zuser = @sy-uname.
ENDSELECT.
lr_data->pernr = lv_pernr.
lr_data->crea_uname = sy-uname.
lr_data->lchg_uname = sy-uname.
GET TIME STAMP FIELD lv_timestamp.
lr_data->lchg_date_time = lv_timestamp.
lr_data->crea_date_time = lv_timestamp.
ENDIF.
io_modify->update(
EXPORTING
iv_node = is_ctx-node_key " uuid of node
iv_key = lr_data->key " key of line
is_data = lr_data " ref to modified data
it_changed_fields = VALUE #( ( zif_cds_i_time_header13_c=>sc_node_attribute-zcds_i_time_header1-counter )
( zif_cds_i_time_header13_c=>sc_node_attribute-zcds_i_time_header1-pernr )
( zif_cds_i_time_header13_c=>sc_node_attribute-zcds_i_time_header1-crea_uname )
( zif_cds_i_time_header13_c=>sc_node_attribute-zcds_i_time_header1-lchg_uname )
( zif_cds_i_time_header13_c=>sc_node_attribute-zcds_i_time_header1-lchg_date_time )
( zif_cds_i_time_header13_c=>sc_node_attribute-zcds_i_time_header1-crea_date_time )
)
).
* Create a default line item
wa_item-crea_uname = sy-uname.
wa_item-lchg_uname = sy-uname.
wa_item-lchg_date_time = lv_timestamp.
wa_item-crea_date_time = lv_timestamp.
APPEND wa_item TO lt_item.
LOOP AT lt_item REFERENCE INTO DATA(lr_item).
io_modify->create(
EXPORTING
iv_node = zif_cds_i_time_header13_c=>sc_node-zcds_i_time_item1 " Node to Create
* is_data = lr_item_copy " Data
is_data = lr_item " Data
iv_assoc_key = zif_cds_i_time_header13_c=>sc_association-zcds_i_time_header1-_item " Association
iv_source_node_key = zif_cds_i_time_header13_c=>sc_node-zcds_i_time_header1 " Parent Node
iv_source_key = lr_data->key " NodeID of Parent Instance
).
io_modify->end_modify( iv_process_immediately = abap_true ).
ENDLOOP.
ELSE.
lr_data->lchg_uname = sy-uname.
GET TIME STAMP FIELD lv_timestamp.
lr_data->lchg_date_time = lv_timestamp.
io_modify->update(
EXPORTING
iv_node = is_ctx-node_key " uuid of node
iv_key = lr_data->key " key of line
is_data = lr_data " ref to modified data
it_changed_fields = VALUE #(
( zif_cds_i_time_header13_c=>sc_node_attribute-zcds_i_time_header1-lchg_uname )
( zif_cds_i_time_header13_c=>sc_node_attribute-zcds_i_time_header1-lchg_date_time )
)
).
ENDIF.
ENDLOOP.
ENDMETHOD.
ENDCLASS.
Generated Structures and Table Types
@UI.hidden: true
@UI.lineItem: [{position: 40, importance: #HIGH, type: #FOR_ACTION, dataAction: 'BOPF:COPY_HEADER', label: 'Copy'}]
uuid;CLASS zcl_cds_a_copy_header DEFINITION
PUBLIC
INHERITING FROM /bobf/cl_lib_a_supercl_simple
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS /bobf/if_frw_action~execute
REDEFINITION .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_cds_a_copy_header IMPLEMENTATION.
METHOD /bobf/if_frw_action~execute.
DATA: lr_head_copy TYPE ztcds_i_time_header13,
lr_item_copy TYPE ztcds_i_time_item13,
lv_timestamp TYPE timestampl.
" Internal tab for Header & Item Data
" Created using reference to Generated Table Type
DATA(lt_head) = VALUE ztcds_i_time_header13( ).
DATA(lt_item) = VALUE ztcds_i_time_item13( ).
" Get Dates Head Data
io_read->retrieve(
EXPORTING
iv_node = is_ctx-node_key " Node Name
it_key = it_key " Key Table
IMPORTING
et_data = lt_head " Data Return Structure
).
" Get Times Item Data
io_read->retrieve_by_association(
EXPORTING
iv_node = is_ctx-node_key " Node Name
it_key = it_key " Key Table
iv_association = zif_cds_i_time_header13_c=>sc_association-zcds_i_time_header1-_item " Name of Association
iv_fill_data = abap_true
IMPORTING
et_data = lt_item " Data Return Structure
).
GET TIME STAMP FIELD lv_timestamp.
" For Each Node Instance
LOOP AT lt_head REFERENCE INTO DATA(lr_head).
CLEAR: lr_head->counter,
lr_head->crea_date_time,
lr_head->crea_uname,
lr_head->lchg_date_time,
lr_head->lchg_uname.
lr_head->crea_uname = sy-uname.
lr_head->lchg_uname = sy-uname.
lr_head->lchg_date_time = lv_timestamp.
lr_head->crea_date_time = lv_timestamp.
" Create New date entry
io_modify->create(
EXPORTING
iv_node = is_ctx-node_key " Node to Create
* is_data = lr_head_copy " Data
is_data = lr_head " Data
IMPORTING
ev_key = DATA(lv_head_copy_key)
).
LOOP AT lt_item REFERENCE INTO DATA(lr_item) WHERE parent_key = lr_head->key.
CLEAR: lr_item->linecounter,
lr_item->crea_date_time,
lr_item->crea_uname,
lr_item->lchg_date_time,
lr_item->lchg_uname.
lr_item->crea_uname = sy-uname.
lr_item->lchg_uname = sy-uname.
lr_item->lchg_date_time = lv_timestamp.
lr_item->crea_date_time = lv_timestamp.
io_modify->create(
EXPORTING
iv_node = zif_cds_i_time_header13_c=>sc_node-zcds_i_time_item1 " Node to Create
* is_data = lr_item_copy " Data
is_data = lr_item " Data
iv_assoc_key = zif_cds_i_time_header13_c=>sc_association-zcds_i_time_header1-_item " Association
iv_source_node_key = zif_cds_i_time_header13_c=>sc_node-zcds_i_time_header1 " Parent Node
iv_source_key = lv_head_copy_key " NodeID of Parent Instance
).
ENDLOOP.
ENDLOOP.
io_modify->end_modify( iv_process_immediately = abap_true ).
ENDMETHOD.
ENDCLASS.CLASS zcl_cds_v_check_header DEFINITION
PUBLIC
INHERITING FROM /bobf/cl_lib_v_supercl_simple
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS /bobf/if_frw_validation~execute
REDEFINITION .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_cds_v_check_header IMPLEMENTATION.
METHOD /bobf/if_frw_validation~execute.
DATA lt_head TYPE ztcds_i_time_header13.
" Retrieve the data of the requested node instance
io_read->retrieve(
EXPORTING
iv_node = is_ctx-node_key
it_key = it_key
IMPORTING
et_data = lt_head
eo_message = eo_message
et_failed_key = et_failed_key
).
LOOP AT lt_head ASSIGNING FIELD-SYMBOL(<fs_head>).
IF <fs_head>-workdate IS INITIAL.
IF <fs_head>-isactiveentity = abap_false.
DATA(lv_lifetime) = /bobf/cm_frw=>co_lifetime_state. "draft
ELSE.
lv_lifetime = /bobf/cm_frw=>co_lifetime_transition. "active
ENDIF.
eo_message = /bobf/cl_frw_factory=>get_message( ).
eo_message->add_message(
EXPORTING is_msg = VALUE #( msgid = 'TimeSheet' "
msgno = 1
msgv1 = 'Workdate cannot be blank: '
msgv2 = <fs_head>-workdate
msgty = /bobf/cm_frw=>co_severity_error
)
iv_node = is_ctx-node_key
iv_key = <fs_head>-key
iv_attribute = zif_cds_i_time_header13_c=>sc_node_attribute-zcds_i_time_header1-workdate
iv_lifetime = lv_lifetime
).
APPEND VALUE #( key = <fs_head>-key ) TO et_failed_key.
ENDIF.
ENDLOOP.
ENDMETHOD.
ENDCLASS.@OData.publish: true
Entity Selection

List Report

Annotations that show how entry is persisted to Active table

Draft entries in the List Report
"dataLoadSettings": {
"loadDataOnAppLaunch": "always"
}
Auto Load in Manifest.json

Remove Editing Status field

Header Create scenario

Item creation from Header

Setting Create mode to inline

Creating a Line Item

Persisted Entry
@ObjectModel.createEnabled:true
@ObjectModel.deleteEnabled:true
@ObjectModel.updateEnabled:true
@ObjectModel.draftEnabled: true
Selecting multiple items in a table
@UI.selectionField: [{position: 10}]
Date field selection Range
@Consumption.filter.selectionType: #INTERVAL
Date Range Manifest addition

Field Groups highlighted

Field Groups linked to metadata extension

Item Field Groups highlighted

Item Field Groups link to metadata extension

Item to Field Group linking

Showing Hours/Minutes in the Header List Report

Hours/Minutes in the Object Page

List Report Annotations for Hours/Minutes

Metadata Extension update for Hours/Minutes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 3143 | |
| 1916 | |
| 1916 | |
| 1212 | |
| 1079 | |
| 757 | |
| 755 | |
| 742 |