@EndUserText.label: 'Purchasing Category'
@VDM.viewType : #CONSUMPTION
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #REQUIRED
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #M
@ObjectModel.semanticKey: 'PurchasingCategory'
@AbapCatalog.sqlViewName: 'CPURGCATEGORYFS'
@AbapCatalog.compiler.compareFilter: true
@Search.searchable: true
@UI.headerInfo: {
typeName: 'Purchasing Category',
typeNamePlural: 'Purchasing Categories',
typeImageUrl: '/sap/bc/ui5_ui5/sap/slc_purgcats1/images/purchasingcategory.jpg',
title.value: 'PurgCatTitle',
description.value: 'PurchasingCategory' }
@UI.presentationVariant.sortOrder: [
{ by: 'PurgCatDescription',direction: #ASC }
]
@UI.presentationVariant: [{
requestAtLeast: ['UICT_IsReadOnly']
}]
define view C_PurchasingCategoryFs
with parameters
@Consumption.hidden: true
@Environment.systemField: #SYSTEM_DATE
P_KeyDate : sydate
as select from I_PurchasingCategory
association [0..*] to C_SupplierByPurchasingCat as _SupplierByPurchasingCat on $projection.PurgCatUUID = _SupplierByPurchasingCat.PurgCatUUID
association [0..1] to P_PurgCatSupplierInfo as _PurgCatSupplierInfo on $projection.PurgCatUUID = _PurgCatSupplierInfo.PurgCatUUID
association [0..1] to P_TotalOrderValue as _TotalOrderValue on $projection.PurgCatUUID = _TotalOrderValue.PurgCatUUID
association [0..*] to C_ActivitiesByPurgCat as _SupplierActivity on $projection.PurgCatUUID = _SupplierActivity.PurgCatUUID
association [0..1] to I_InactiveStatusText as _InactiveStatusText on $projection.PurgCatIsInactive = _InactiveStatusText.PurgCatIsInactive
and _InactiveStatusText.Language = $session.system_language
association [0..*] to C_PurgCatMatlGroup as _PurgCatMatlGroup on $projection.PurgCatUUID = _PurgCatMatlGroup.PurgCatUUID
association [0..*] to C_PurgCatPlanSpend as _PurgCatPlanSpend on $projection.PurgCatUUID = _PurgCatPlanSpend.PurgCatUUID
//associations for Value Helps
association [0..1] to I_PurchasingCategoryValueHelp as _PurchasingCategoryValueHelp on $projection.PurchasingCategory = _PurchasingCategoryValueHelp.PurchasingCategory
association [0..1] to C_PurCatPurchRespValueHelp as _PurCatPurchRespValueHelp on _PurCatPurchRespValueHelp.UserID = $projection.PurchaserResponsible
association [0..1] to C_PurCatCreaByValueHelp as _PurCatCreaByValueHelp on _PurCatCreaByValueHelp.CreatedByUser = $projection.CreatedByUser
association [0..1] to C_PurCatLastChByValueHelp as _PurCatLastChByValueHelp on _PurCatLastChByValueHelp.LastChangedByUser = $projection.LastChangedByUser
association [0..1] to C_PurgCatTranslStsValueHelp as _PurgCatTranslStsValueHelp on _PurgCatTranslStsValueHelp.SLCTranslationStatus = $projection.PurgCatTranslationOvrlStatus
association [0..1] to P_DisplayCurrency as _DisplayCurrency on $projection.PurgCatUUID = _DisplayCurrency.PurgCatUUID
association [0..1] to I_User as _CreatedByUser on _CreatedByUser.UserID = $projection.CreatedByUser
association [0..1] to I_User as _LastChangedByUser on _LastChangedByUser.UserID = $projection.LastChangedByUser
{
@UI.hidden: true
key PurgCatUUID,
@UI.lineItem: [ {position: 10, importance: #HIGH } ]
@UI.selectionField.position:10
@Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 1 }
@ObjectModel.text.element: [ 'PurgCatDescription' ]
@ObjectModel: { foreignKey.association: '_PurchasingCategoryValueHelp' }
@Consumption.valueHelp: '_PurchasingCategoryValueHelp'
// @Consumption.semanticObject: 'PurchasingCategory'
cast( PurchasingCategory as /srmsmc/purchasing_category_id preserving type ) as PurchasingCategory,
@Semantics.text: true
@UI.hidden: true
@Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.7 }
cast( PurgCatName as /srmsmc/purchasing_cat_name preserving type ) as PurgCatName,
@UI.hidden: true
case
when _PurchasingCategoryDesc[1: Language = $session.system_language].PurgCatDescription = ''
then cast( PurgCatName as /srmsmc/purchasing_cat_name preserving type)
when _PurchasingCategoryDesc[1: Language = $session.system_language].PurgCatDescription is null
then cast( PurgCatName as /srmsmc/purchasing_cat_name preserving type )
else _PurchasingCategoryDesc[1: Language = $session.system_language].PurgCatDescription
end as PurgCatDescription,
@UI.hidden: true
@Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.7 }
_PurchasingCategoryDesc[1: Language = $session.system_language].PurgCatDescription as Name,
@Consumption.filter.selectionType: #INTERVAL
CreationDateTime,
@UI.textArrangement: #TEXT_ONLY
@ObjectModel: { foreignKey.association: '_PurCatCreaByValueHelp' }
@ObjectModel.text.element: ['CreatedByUserFullName']
cast( I_PurchasingCategory.CreatedByUser as vdm_createdbyuserid preserving type) as CreatedByUser,
//Used for search only
@UI.hidden: true
@Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.7 }
cast( _CreatedByUser.UserDescription as /srmsmc/created_by_user_desc preserving type) as CreatedByUserFullName,
@UI.lineItem: [{ position: 50, importance: #HIGH }]
@Consumption.filter.selectionType: #INTERVAL
LastChangeDateTime,
@UI.lineItem: [{ position: 40, importance: #HIGH }]
@UI.textArrangement: #TEXT_ONLY
@UI.selectionField.position:50
@Consumption.valueHelpDefinition:[{entity:{name:'C_PurCatLastChByValueHelp', element:'LastChangedByUser'} }]
@ObjectModel: { foreignKey.association: '_PurCatLastChByValueHelp' }
@ObjectModel.text.element: ['LastChangedByUserFullName']
cast( I_PurchasingCategory.LastChangedByUser as vdm_lastchangedbyuserid preserving type ) as LastChangedByUser,
//Used for search only
@UI.hidden: true
@Search: { defaultSearchElement: true, ranking: #LOW, fuzzinessThreshold: 0.7 }
cast( _LastChangedByUser.UserDescription as /srmsmc/last_changed_by_desc preserving type) as LastChangedByUserFullName,
@UI.hidden: true
cast(
case
when _PurchasingCategoryDesc[1: Language = $session.system_language].PurgCatDescription = ''
then PurgCatName
when _PurchasingCategoryDesc[1: Language = $session.system_language].PurgCatDescription is null
then PurgCatName
else concat_with_space( _PurchasingCategoryDesc[1: Language = $session.system_language].PurgCatDescription,concat('(',concat(I_PurchasingCategory.PurgCatName,')')),1) end as /srmsmc/puc_title ) as PurgCatTitle,
@UI.selectionField.position:80
@UI.textArrangement: #TEXT_ONLY
@UI.lineItem: [{ position: 60, importance: #HIGH }]
@Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.7 }
@ObjectModel: { foreignKey.association: '_PurgCatTranslStsValueHelp' }
I_PurchasingCategory.PurgCatTranslationOvrlStatus,
@UI.hidden: true
cast(
case when PurgCatIsInactive = ''
then 20
else 1 end as int1 ) as CriticalityCode,
@UI: {
selectionField.position:30,
identification: [{ position: 20, importance: #HIGH }],
lineItem: [{ position: 30, importance: #HIGH, criticality: 'CriticalityCode'}] }
@Search: { defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.7 }
@ObjectModel.text.association: '_InactiveStatus'
PurgCatIsInactive,
@UI: {
textArrangement: #TEXT_ONLY,
selectionField.position:20,
identification: [{ position: 10, importance: #HIGH }],
lineItem: [{ position: 20, importance: #HIGH}] }
@Consumption.semanticObject: 'PurchaserResponsible'
@Consumption.valueHelp: '_PurCatPurchRespValueHelp'
@ObjectModel: { foreignKey.association: '_PurCatPurchRespValueHelp' }
@ObjectModel.text.element: 'PurchaserRespFullName'
cast( I_PurchasingCategory._PurchaserResponsible.UserID as /srmsmc/purresponsiblename ) as PurchaserResponsible,
@UI.hidden: true
I_PurchasingCategory._PurchaserResponsible._BusinessUser.PersonFullName as PurchaserRespFullName,
@Consumption.filter.hidden: true
@UI.fieldGroup: [{
qualifier: 'Supplier Information',
groupLabel: 'Supplier Information',
position: 10,
exclude: false,
importance: #HIGH }]
cast( _PurgCatSupplierInfo.SupplierCount as /srmsmc/total_number ) as SupplierCount,
@Consumption.filter.hidden: true
@UI.fieldGroup: [{
qualifier: 'Supplier Information',
groupLabel: 'Supplier Information',
position: 20,
exclude: false,
importance: #HIGH }]
// @Consumption.groupWithElement: 'PurgCatTotalSpendInDspCrcy'
cast( _PurgCatSupplierInfo.PreferredSupplierCount as /srmsmc/preferred_suplr_count ) as PreferredSupplierCount,
@Consumption.filter.hidden: true
@UI.fieldGroup: [{
qualifier: 'Supplier Information',
groupLabel: 'Supplier Information',
position: 30,
exclude: false,
importance: #HIGH }]
cast( _PurgCatSupplierInfo.BlockedSupplierCount as /srmsmc/blocked_suplr_count ) as BlockedSupplierCount,
@Consumption.filter.hidden: true
@Semantics.amount.currencyCode: 'DisplayCurrency'
@DefaultAggregation:#NONE
@UI.dataPoint: { title: 'Total Order Value' }
@ObjectModel: {
readOnly: true,
virtualElement,
virtualElementCalculatedBy: 'cl_slc_puc_ttl_spend_calc_exit',
sort.transformedBy: 'ABAP:CL_SLC_PUC_TTL_SPEND_CALC_EXIT',
filter.transformedBy: 'ABAP:CL_SLC_PUC_TTL_SPEND_CALC_EXIT'
}
cast( 0 as /srmsmc/year_to_date_spend_lng ) as PurgCatTotalSpendInDspCrcy,
@Consumption.filter.hidden: true
@Semantics.currencyCode:true
cast( _DisplayCurrency.DisplayCurrency as waers preserving type ) as DisplayCurrency,
@UI.hidden: true
@Consumption.hidden: true
@Semantics.amount.currencyCode: 'DisplayCurrency'
//coalesce because if no value is returned from the currency conversion then this value is null which is causing problems with the ui filtering
//Cast to cut of expensive caluclations if value is 0 anyway
// cast( COALESCE( _TotalOrderValue( P_KeyDate : $parameters.P_KeyDate ).PurgCatTotalSpendInDspCrcy, 0 ) as /srmsmc/year_to_date_spend_lng preserving type ) as SupplierTotalNetAmtInDspCrcy,
// cast( _TotalOrderValue( P_KeyDate : $parameters.P_KeyDate )[1: SupplierCount > 0 ].PurgCatTotalSpendInDspCrcy as /srmsmc/year_to_date_spend_lng preserving type ) as SupplierTotalNetAmtInDspCrcy,
cast( case when _PurgCatSupplierInfo.SupplierCount = 0
then 0
else coalesce( _TotalOrderValue( P_KeyDate : $parameters.P_KeyDate ).PurgCatTotalSpendInDspCrcy, 0 ) end as /srmsmc/year_to_date_spend_lng ) as SupplierTotalNetAmtInDspCrcy,
@UI.hidden: true
@ObjectModel: {
readOnly: true,
virtualElement,
virtualElementCalculatedBy: 'cl_slc_puc_acty_vsblty_clc_ext' }
@Semantics.booleanIndicator: true
cast( '' as abap.char( 1 ) ) as UICT_CrteActyButtonIsHidden,
@UI.hidden: true
@ObjectModel: {
readOnly: true,
virtualElement,
virtualElementCalculatedBy: 'cl_slc_puc_acty_vsblty_clc_ext' }
@Semantics.booleanIndicator: true
cast( '' as abap.char( 1 ) ) as UICT_ActyFacetIsHidden,
@UI.hidden: true
@ObjectModel: {
readOnly: true,
virtualElement,
virtualElementCalculatedBy: 'cl_slc_puc_calc_ext' }
@Semantics.booleanIndicator: true
cast( '' as abap.char( 1 ) ) as UICT_IsReadOnly,
/* Associations */
@Consumption.filter.hidden: true
_InactiveStatus,
@Consumption.filter.hidden: true
_InactiveStatusText,
/* ####### Facets ####### */
_SupplierByPurchasingCat,
_SupplierActivity,
_PurgCatMatlGroup,
_PurgCatPlanSpend,
/* ####### Value Helps ####### */
@Consumption.filter.hidden: true
_PurchasingCategoryValueHelp,
@Consumption.filter.hidden: true
_PurCatPurchRespValueHelp,
@Consumption.filter.hidden: true
_PurCatCreaByValueHelp,
@Consumption.filter.hidden: true
_PurCatLastChByValueHelp,
@Consumption.filter.hidden: true
_PurgCatTranslStsValueHelp,
@Consumption.filter.hidden: true
_PurgCatTranslationOvrlStatus
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BUSINESSUSER",
"I_PURCHASINGCATEGORY",
"I_PURCHASINGCATEGORYDESC",
"I_PURCHASINGCATEGORYPURCHRESP",
"I_USER",
"P_DISPLAYCURRENCY",
"P_PURGCATSUPPLIERINFO",
"P_TOTALORDERVALUE"
],
"ASSOCIATED":
[
"C_ACTIVITIESBYPURGCAT",
"C_PURCATCREABYVALUEHELP",
"C_PURCATLASTCHBYVALUEHELP",
"C_PURCATPURCHRESPVALUEHELP",
"C_PURGCATMATLGROUP",
"C_PURGCATPLANSPEND",
"C_PURGCATTRANSLSTSVALUEHELP",
"C_SUPPLIERBYPURCHASINGCAT",
"I_INACTIVESTATUS",
"I_INACTIVESTATUSTEXT",
"I_PURCHASINGCATEGORYVALUEHELP",
"I_SLCTRANSLATIONSTATUS",
"I_USER",
"P_DISPLAYCURRENCY",
"P_PURGCATSUPPLIERINFO",
"P_TOTALORDERVALUE"
],
"BASE":
[
"I_PURCHASINGCATEGORY"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/