on 03-30-2021 8:39 AM
Good morning,
I've created 3 CDS views to cover a header/item relationship.
CDS view for header:
@AbapCatalog.sqlViewName: 'ZTXIFHEADER'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Interface header'
define view Ztx_cds_IF_HEADER
as select from ztx_if_header
{
key instance_id,
instance_type,
instance_status,
create_time,
create_user,
process_date,
process_time,
process_user,
log_handle,
ext_entity_id,
}
CDS view for items:
@AbapCatalog.sqlViewName: 'ZTXIFITEM'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Interface item'
define view Ztx_cds_IF_item
as select from ztx_if_item
{
key instance_id as InstanceId,
key entity_type as EntityType,
key internal_id as InternalId,
create_date as CreateDate,
create_time as CreateTime,
created_by as CreatedBy
}
CDS view for association between header and items:
@AbapCatalog.sqlViewName: 'ZTXIFHDRITEMS'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Association between header and items'
@OData.publish: true
@UI.headerInfo.typeName: 'Interface instance'
@UI.headerInfo.typeNamePlural: 'Interface instances'
define view Ztx_cds_IF_hdritems
as select from ztx_if_header as header
association [0..*] to ztx_if_item as _IFITEMS on $projection.instance_id = _IFITEMS.instance_id
@UI: {
identification: [ {
position: 20
} ]
}
key header.instance_id,
@UI: {
lineItem: [ {
position: 10
} ],
identification: [ {
position: 10
} ],
selectionField: [ {
position: 10
} ]
}
header.ext_entity_id,
@UI: {
lineItem: [ {
position: 30
} ],
identification: [ {
position: 30
} ],
selectionField: [ {
position: 20
} ]
}
header.instance_type,
@UI: {
lineItem: [ {
position: 40
} ],
selectionField: [ {
position: 30
} ],
identification: [ {
position: 40,
} ]
}
header.instance_status,
@UI: {
lineItem: [ {
position: 50,
} ],
selectionField: [ {
position: 40
} ],
identification: [ {
position: 50
} ]
}
header.create_date,
@UI.lineItem.position: 60
header.create_time,
@UI: {
lineItem: [ {
position: 60,
} ],
selectionField: [ {
position: 50
} ],
identification: [ {
position: 60
} ]
}
header.create_user,
@UI.lineItem.position: 70
_IFITEMS
}
where
header.instance_id is not initial
The first screen is shown correctly:
But when clicking on the header entry, it doesn't show the corresponding item record, because the fields are hidden:
Only when I click on the settings, I can choose the fields to be displayed:
I guess I need somehow to add annotations for the items in order to get them displayed.
But unfortunately I couldn't figure out how to do that.
Any suggestions?
Thanks in advance!
You haven't defined any UI.LineItem annotations for the item level. Use a metadata extension for your Line Item CDS View or it may work if you just add them to the Line Item CDS View in the same way you have done for the Header CDS View. If neither work, you can also add them on as local annotations in WebIDE/BAS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
73 | |
8 | |
8 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.