[[{“value”:”
Introduction
The Custom Business Configurations (CUBCO) app serves as an entry point to the Business Configuration Maintenance Object (SMBC) provided by custom applications or partners.
This blog explains how to define the default grouping and sorting for the tables of the business configuration object.
The basic procedure is already explained here, but we apply it directly to the result of the ADT wizard.
This blog is relevant for
Further reading:
- Related blog posts
- Learn how you can use ABAP technology to develop innovative applications and business solutions across SAP’s portfolio on SAP Learning Site.
Example scenario
Company codes are defined in the configuration table ZDEMO_CC. In the CUBCO app, the rows are to be grouped and sorted by country.
@EndUserText.label : ‘Company Code’
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #C
@AbapCatalog.dataMaintenance : #ALLOWED
define table zdemo_cc {
key client : abap.clnt not null;
key company_code : abap.numc(4) not null;
country : land1;
last_changed_at : abp_lastchange_tstmpl;
local_last_changed_at : abp_locinst_lastchange_tstmpl;
}
Define presentation variant
First you use the ADT wizard to generate a Business Configuration Maintenance Object for this table.
In the generated CDS view ZI_COMPANYCODE_S of the Singleton entity, you change the facet type from #LINEITEM_REFERENCE to #PRESENTATIONVARIANT_REFERENCE and add the targetQualifier attribute:
@ui.facet: [ {
id: ‘ZI_CompanyCode’,
purpose: #STANDARD,
type: #PRESENTATIONVARIANT_REFERENCE,
targetQualifier: ‘myVariant’,
label: ‘Company Codes’,
position: 1 ,
targetElement: ‘_CompanyCode’
} ]
.lineItem: [ {
position: 1
} ]
key 1 as SingletonID,
In the metadata extension ZI_COMPANYCODE of the company code entity, add the following presentation variant:
@ui.presentationVariant: [
{
qualifier: ‘myVariant’,
sortOrder: [
{
by: ‘Country’,
direction: #ASC
}
],
groupBy: [ ‘Country’ ],
visualizations: [{type: #AS_LINEITEM}]
}
]
annotate view ZI_CompanyCode with
Finally, open the generated SMBC object ZCOMPANYCODE in ADT and open the table settings section. Change the table type attribute from Grid Table to Responsive Table because grouping is not supported for grid tables. If you only need the default sorting, you can continue to use the grid table.
“}]]
[[{“value”:”IntroductionThe Custom Business Configurations (CUBCO) app serves as an entry point to the Business Configuration Maintenance Object (SMBC) provided by custom applications or partners.This blog explains how to define the default grouping and sorting for the tables of the business configuration object.The basic procedure is already explained here, but we apply it directly to the result of the ADT wizard.This blog is relevant for Further reading:Related blog postsLearn how you can use ABAP technology to develop innovative applications and business solutions across SAP’s portfolio on SAP Learning Site.Example scenarioCompany codes are defined in the configuration table ZDEMO_CC. In the CUBCO app, the rows are to be grouped and sorted by country.@EndUserText.label : ‘Company Code’
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #C
@AbapCatalog.dataMaintenance : #ALLOWED
define table zdemo_cc {
key client : abap.clnt not null;
key company_code : abap.numc(4) not null;
country : land1;
last_changed_at : abp_lastchange_tstmpl;
local_last_changed_at : abp_locinst_lastchange_tstmpl;
}Define presentation variantFirst you use the ADT wizard to generate a Business Configuration Maintenance Object for this table.In the generated CDS view ZI_COMPANYCODE_S of the Singleton entity, you change the facet type from #LINEITEM_REFERENCE to #PRESENTATIONVARIANT_REFERENCE and add the targetQualifier attribute: @ui.facet: [ {
id: ‘ZI_CompanyCode’,
purpose: #STANDARD,
type: #PRESENTATIONVARIANT_REFERENCE,
targetQualifier: ‘myVariant’,
label: ‘Company Codes’,
position: 1 ,
targetElement: ‘_CompanyCode’
} ]
.lineItem: [ {
position: 1
} ]
key 1 as SingletonID,In the metadata extension ZI_COMPANYCODE of the company code entity, add the following presentation variant:@ui.presentationVariant: [
{
qualifier: ‘myVariant’,
sortOrder: [
{
by: ‘Country’,
direction: #ASC
}
],
groupBy: [ ‘Country’ ],
visualizations: [{type: #AS_LINEITEM}]
}
]
annotate view ZI_CompanyCode withFinally, open the generated SMBC object ZCOMPANYCODE in ADT and open the table settings section. Change the table type attribute from Grid Table to Responsive Table because grouping is not supported for grid tables. If you only need the default sorting, you can continue to use the grid table.”}]] Read More Technology Blog Posts by SAP articles
#SAPCHANNEL