@AbapCatalog.sqlViewName: 'IPAOCHARCTXT'
@AbapCatalog.compiler.compareFilter: true
@EndUserText.label: 'Product allocation characteristic text'
@VDM.viewType: #COMPOSITE
@VDM.lifecycle.contract.type: #SAP_INTERNAL_API
@VDM.private: false
@AccessControl.authorizationCheck: #NOT_REQUIRED //or #NOT_REQUIRED #CHECK
@ObjectModel.usageType.sizeCategory: #L
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.dataClass:#MIXED
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.dataCategory: #TEXT
@ObjectModel.representativeKey: 'ProdAllocCharcCtlgPathIntID'
define view I_ProdAllocCharcText
as select from I_ProdAllocCharcCtlgPathTP as PATH
left outer join I_Language as LANG on LANG.Language is not null
left outer join I_PartnerFunctionText as PFTEXT on PFTEXT.PartnerFunction = PATH.ProdAllocCharcCtlgPathSel
and PFTEXT.Language = LANG.Language
left outer join I_DataElementLabelText as DETEXT on DETEXT.ABAPDataElement = PATH.ABAPDataElement
and DETEXT.Language = LANG.Language
left outer join I_ProdAllocCharcCtlgPathTP as PARENT_PATH on PARENT_PATH.ProdAllocCharcCtlgPathIntID = PATH.ProdAllocCharcCtlgParPathIntID
left outer join I_DataElementLabelText as PARENT_DETEXT on PARENT_DETEXT.ABAPDataElement = PARENT_PATH.ABAPDataElement
and PARENT_DETEXT.Language = LANG.Language
left outer join I_AllocCharcCtlgPathTTP as TEXT on TEXT.ProdAllocCharcCtlgPathUUID = PATH.ProdAllocCharcCtlgPathUUID
and TEXT.Language = LANG.Language
left outer join I_ProdAllocCharcCtlgPathRef as PATHREF on PATHREF.ProdAllocCharcCtlgPathUUID = PATH.ProdAllocCharcCtlgPathUUID
and PATHREF.ProdAllocCharcCatalogIsMain = 'X'
left outer join I_ProdAllocCharcCtlgPathTP as BASEPATH on BASEPATH.ProdAllocCharcCtlgPathUUID = PATHREF.BaseCharcCatalogPathUUID
left outer join I_PartnerFunctionText as BASEPATH_PFTEXT on BASEPATH_PFTEXT.PartnerFunction = BASEPATH.ProdAllocCharcCtlgPathSel
and BASEPATH_PFTEXT.Language = LANG.Language
left outer join I_AllocCharcCtlgPathTTP as BASEPATH_TEXT on BASEPATH_TEXT.ProdAllocCharcCtlgPathUUID = PATHREF.BaseCharcCatalogPathUUID
and BASEPATH_TEXT.Language = LANG.Language
left outer join I_DataElementLabelText as BASEPATH_DETEXT on BASEPATH_DETEXT.ABAPDataElement = BASEPATH.ABAPDataElement
and BASEPATH_DETEXT.Language = LANG.Language
left outer join I_ProdAllocCharcCtlgPathTP as BASEPATH_PARENT_PATH on BASEPATH_PARENT_PATH.ProdAllocCharcCtlgPathIntID = PATH.ProdAllocCharcCtlgParPathIntID
left outer join I_DataElementLabelText as BASEPATH_PARENT_DETEXT on BASEPATH_PARENT_DETEXT.ABAPDataElement = BASEPATH_PARENT_PATH.ABAPDataElement
and BASEPATH_PARENT_DETEXT.Language = LANG.Language
left outer join P_CharcCtlgClfnCForDateDesc(P_KeyDate: $session.system_date) as CLFN_CHAR_TEXT on CLFN_CHAR_TEXT.CharcInternalID = PATH.CharcInternalID
{
key PATH.ProdAllocCharcCtlgPathIntID as ProdAllocCharcCtlgPathIntID,
@Semantics.language: true
key LANG.Language as Language,
@Semantics.text: true
case
//Characteristic with text table instance (normal characteristics with/without alias, value group or mixed characteristic)
when PATH.ProdAllocCharcCatalogPathType = '02' and //IF_PACHARCCATALOGPATHTYPE_C=>SC_CHARCACTERISTIC
TEXT.ProdAllocCharcCtlgPathDesc is not initial
then TEXT.ProdAllocCharcCtlgPathDesc
//Value group characteristic without a text:
// - the ID (path) of the value group is returned
when PATH.ProdAllocCharcCatalogPathType = '02' and //IF_PACHARCCATALOGPATHTYPE_C=>SC_CHARCACTERISTIC
PATH.ProdAllocCharcCatalogCharcType = '02' and //IF_PACHARCCATALOGCHARCTYPE_C=>SC_CHARC_VALUE_GROUP
( TEXT.ProdAllocCharcCtlgPathDesc is null or
TEXT.ProdAllocCharcCtlgPathDesc is initial )
then PATH.ProdAllocCharcCatalogPath
//Mixed catalog characteristics without a text and without a data element
// - the main base characteristic text is returned
when PATH.ProdAllocCharcCatalogPathType = '02' and //IF_PACHARCCATALOGPATHTYPE_C=>SC_CHARCACTERISTIC
PATH.ProdAllocCharcCatalogType = '99' and //IF_PRODALLOCCHARCCATALOGTYPE_C=>SC_MIXED
PATH.ABAPDataElement is initial
then
case
// Base characteristic with text table instance (normal characteristics with/without alias, value group or mixed characteristic)
when BASEPATH_TEXT.ProdAllocCharcCtlgPathDesc is not initial
then BASEPATH_TEXT.ProdAllocCharcCtlgPathDesc
// Base value group characteristic without a text:
// - the ID (path) of the value group is returned
when BASEPATH.ProdAllocCharcCatalogPathType = '02' and //IF_PACHARCCATALOGPATHTYPE_C=>SC_CHARCACTERISTIC
BASEPATH.ProdAllocCharcCatalogCharcType = '02' //IF_PACHARCCATALOGCHARCTYPE_C=>SC_CHARC_VALUE_GROUP
then BASEPATH.ProdAllocCharcCatalogPath
//Base path partner functions in general
when BASEPATH.ProdAllocCharcCtlgPathSelName = 'PARTNERFUNCTION'
then
case
when BASEPATH_PFTEXT.PartnerFunctionName <> ''
then concat_with_space( BASEPATH_PFTEXT.PartnerFunctionName, concat_with_space( '-', BASEPATH_DETEXT.ABAPDataElementDescription, 1 ), 1 )
else BASEPATH_DETEXT.ABAPDataElementDescription
end
// STO ship to party
when BASEPATH_PARENT_PATH.ProdAllocCharcCatalogType = '02' and //IF_PACHARCCATALOGPATHTYPE_C=>SC_CHARCACTERISTIC
BASEPATH_PARENT_PATH.ProdAllocCharcCtlgPathSelName = '' and
BASEPATH_PARENT_PATH.ProdAllocCharcCtlgPathSel = '' and
BASEPATH_PARENT_PATH.ProdAllocCharcCatalogPath = concat( '\_STOCKTRANSPORTORDERITEM' , '\_STOCKTRANSPORTSHIPPING\_SHIPTOPARTY' )
then
concat_with_space(BASEPATH_PARENT_DETEXT.ABAPDataElementDescription, concat_with_space( '-', BASEPATH_DETEXT.ABAPDataElementDescription, 1), 1)
else BASEPATH_DETEXT.ABAPDataElementDescription
end
//Partner functions in general
when PATH.ProdAllocCharcCtlgPathSelName = 'PARTNERFUNCTION' then
case
when PFTEXT.PartnerFunctionName <> ''
then concat_with_space( PFTEXT.PartnerFunctionName, concat_with_space( '-', DETEXT.ABAPDataElementDescription, 1 ), 1 )
else DETEXT.ABAPDataElementDescription
end
// STO ship to party
when PARENT_PATH.ProdAllocCharcCatalogType = '02' //IF_PACHARCCATALOGPATHTYPE_C=>SC_CHARCACTERISTIC
and PARENT_PATH.ProdAllocCharcCtlgPathSelName = ''
and PARENT_PATH.ProdAllocCharcCtlgPathSel = ''
and PARENT_PATH.ProdAllocCharcCatalogPath = concat( '\_STOCKTRANSPORTORDERITEM' , '\_STOCKTRANSPORTSHIPPING\_SHIPTOPARTY' ) then
concat_with_space(PARENT_DETEXT.ABAPDataElementDescription, concat_with_space( '-', DETEXT.ABAPDataElementDescription, 1), 1)
// Classification Characteristics
when PATH.ProdAllocCharcCatalogPathType = '02' //IF_PACHARCCATALOGPATHTYPE_C=>SC_CHARCACTERISTIC
and PATH.ClfnCharacteristicUseType <>'' then //IF_CLFNCHARACTERISTICUSETYPE_C=>SC_DOMAINVALUES-noclassification
CLFN_CHAR_TEXT.CharcDescription
else DETEXT.ABAPDataElementDescription
end as ProdAllocCharcCtlgPathDesc
}