<-- previous rule | overview | next rule -->
Fixes upper and lower case of known entity names and field names, and of aliases named after known entity names.
This rule only changes view and field names where they are defined; usages are automatically adjusted upon save. Custom view and field names from rule 'Use CamelCase for known CDS names' are reused.
- Fix known entity names to CamelCase
- Fix aliases named after known entity names to CamelCase
- Fix known field names to CamelCase
- Fix references in annotations to CamelCase
- Only use approved names
- Only change field names if all field names in this entity are known
define view entity i_Companycode
as select from t001 as d
association[0..1] to I_Country as _country
on $projection.Country = _country.Country
association[0..1] to I_ChartOfAccounts as _chartofaccounts
on $projection.ChartOfAccounts = _chartofaccounts.ChartOfAccounts
{
@ObjectModel.text.element: ['companycodename']
key d.bukrs as companycode,
d.butxt as companyCodename,
d.ort01 as CityName,
@ObjectModel.foreignKey.association: '_country'
d.land1 as COUNTRY,
@ObjectModel.foreignKey.association: '_CHARTOFACCOUNTS'
d.ktopl as chArtOfAccOUnts,
d.periv as FiscalyeaRVariant,
@Consumption.valueHelpDefinition: [{entity: { name: 'i_controllingareastdvh',
element: 'CONTROLLINGAREA' }}]
d.kokrs as controllingarea,
d.mwska as nontaxabletransactiontaxcode,
d.xvatdate as TAXRPTGDATEISACTIVE,
d.xskfn as cashdiscountbaseamtisnetamt,
// Once the definitions of aliases etc. are corrected to _ChartOfAccounts etc. above,
// any usage of these names will automatically be adjusted once the view is saved.
// Therefore, it would not help to fix names that are defined in a different place,
// because that would be undone when saving the view (except for annotation values).
_country,
_chartofaccounts
}
Resulting code:
define view entity I_CompanyCode
as select from t001 as d
association[0..1] to I_Country as _Country
on $projection.Country = _country.Country
association[0..1] to I_ChartOfAccounts as _ChartOfAccounts
on $projection.ChartOfAccounts = _chartofaccounts.ChartOfAccounts
{
@ObjectModel.text.element: ['CompanyCodeName']
key d.bukrs as CompanyCode,
d.butxt as CompanyCodeName,
d.ort01 as CityName,
@ObjectModel.foreignKey.association: '_Country'
d.land1 as Country,
@ObjectModel.foreignKey.association: '_ChartOfAccounts'
d.ktopl as ChartOfAccounts,
d.periv as FiscalYearVariant,
@Consumption.valueHelpDefinition: [{entity: { name: 'i_controllingareastdvh',
element: 'ControllingArea' }}]
d.kokrs as ControllingArea,
d.mwska as NonTaxableTransactionTaxCode,
d.xvatdate as TaxRptgDateIsActive,
d.xskfn as CashDiscountBaseAmtIsNetAmt,
// Once the definitions of aliases etc. are corrected to _ChartOfAccounts etc. above,
// any usage of these names will automatically be adjusted once the view is saved.
// Therefore, it would not help to fix names that are defined in a different place,
// because that would be undone when saving the view (except for annotation values).
_country,
_chartofaccounts
}