@AccessControl.authorizationCheck: #CHECK
@ObjectModel: {
// representativeKey: 'SoldToParty',
usageType: {
dataClass: #TRANSACTIONAL,
serviceQuality: #C,
sizeCategory: #XL
}
}
@EndUserText.label: 'Customer 360 Sales Order'
@Metadata.allowExtensions: true
@VDM.viewType: #CONSUMPTION
@Search.searchable: true
define view entity C_Customer360SalesOrder
as select from I_SalesOrder as SalesOrder
inner join I_Customer360BusDocSetting as Customer360BusDocSetting on Customer360BusDocSetting.Cust360BusDocCategory = 'C'
and Customer360BusDocSetting.BusinessDocumentIsEnabled = 'X'
association [0..1] to C_SoldToValueHelp as _SoldToPartyVH on $projection.SoldToParty = _SoldToPartyVH.Customer
association [0..1] to C_Dischannelvaluehelp as _DistributionChannel on $projection.SalesOrganization = _DistributionChannel.SalesOrganization
and $projection.DistributionChannel = _DistributionChannel.DistributionChannel
association [0..1] to C_OrgDivisionValueHelp as _Division on $projection.SalesOrganization = _Division.SalesOrganization
and $projection.DistributionChannel = _Division.DistributionChannel
and $projection.OrganizationDivision = _Division.Division
association [0..1] to C_SalesOfficeValueHelp as _SalesOffice on $projection.SalesOrganization = _SalesOffice.SalesOrganization
and $projection.DistributionChannel = _SalesOffice.DistributionChannel
and $projection.OrganizationDivision = _SalesOffice.OrganizationDivision
and $projection.SalesOffice = _SalesOffice.SalesOffice
association [0..1] to C_SalesGroupValueHelp as _SalesGroup on $projection.SalesOffice = _SalesGroup.SalesOffice
and $projection.SalesGroup = _SalesGroup.SalesGroup
association [0..1] to C_SalesOrderTypeVH_F1873 as _SalesDocumentType on $projection.SalesOrderType = _SalesDocumentType.SalesOrderType
//association [0..1] to I_SalesDocumentRjcnReason as _SalesDocumentRjcnReason on $projection.SalesDocumentRjcnReason = _SalesDocumentRjcnReason.SalesDocumentRjcnReason
association [0..1] to C_SalesDocumentUserVH as _CreatedByUser on $projection.CreatedByUser = _CreatedByUser.UserID
association [0..1] to C_SalesDocumentUserVH as _LastChangedByUser on $projection.LastChangedByUser = _LastChangedByUser.UserID
// association [0..*] to C_SalesDocumentItemWl as _SalesDocumentItemWl on $projection.SalesOrder = _SalesDocumentItemWl.SalesDocument
//Extension Association
association [1] to E_SalesDocumentBasic as _Extension on $projection.SalesOrder = _Extension.SalesDocument
{
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.8
@Search.ranking: #HIGH
@Consumption.semanticObject: 'SalesOrder'
key SalesOrder.SalesOrder as SalesOrder,
// @Search.defaultSearchElement: true
// @Search.fuzzinessThreshold: 0.8
@ObjectModel: {
foreignKey.association: '_SoldToPartyVH',
text.element: ['SoldToPartyName']
}
SalesOrder.SoldToParty,
@Semantics.text:true
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_SLSORD_UI_PARTNER_UTIL'
cast('' as ad_namtext ) as SoldToPartyName,
@ObjectModel: {
text.element: ['ShipToPartyName']
}
@Consumption.semanticObject: 'Customer'
cast( SalesOrder._Partner[ PartnerFunction = 'WE' ].Customer as kunwe preserving type ) as ShipToParty,
@Semantics.text:true
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_SLSORD_UI_PARTNER_UTIL'
cast('' as ad_namtext ) as ShipToPartyName,
@Consumption.semanticObject: 'Customer'
@ObjectModel: {
text.element: ['PayerPartyName']
}
cast( SalesOrder._Partner[ PartnerFunction = 'RG' ].Customer as kunrg preserving type ) as PayerParty,
@Semantics.text:true
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_SLSORD_UI_PARTNER_UTIL'
cast('' as ad_namtext ) as PayerPartyName,
@ObjectModel: {
text.element: ['BillToPartyName']
}
@Consumption.semanticObject: 'Customer'
cast( SalesOrder._Partner[ PartnerFunction = 'RE' ].Customer as kunre preserving type ) as BillToParty,
@Semantics.text:true
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_SLSORD_UI_PARTNER_UTIL'
cast('' as ad_namtext ) as BillToPartyName,
@ObjectModel: {
text.element: ['SalesEmployeeName']
}
@Consumption.semanticObject: 'Employee'
cast( SalesOrder._Partner[ PartnerFunction = 'VE' ].Personnel as sales_empl preserving type ) as SalesEmployee,
@Semantics.text:true
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_SLSORD_UI_PARTNER_UTIL'
cast('' as ad_namtext ) as SalesEmployeeName,
@Consumption.semanticObject: 'Employee'
@ObjectModel: {
text.element: ['ResponsibleEmployeeName']
}
cast( SalesOrder._Partner[ PartnerFunction = 'ZM' ].Personnel as resp_empl preserving type ) as ResponsibleEmployee,
@Semantics.text: true
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_SLSORD_UI_PARTNER_UTIL'
cast('' as ad_namtext ) as ResponsibleEmployeeName,
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.8
// @ObjectModel.text.element: []
SalesOrder.PurchaseOrderByCustomer,
// SalesOrder._Purcha
@Semantics.businessDate.at: true
SalesOrder.RequestedDeliveryDate,
@ObjectModel.text.element: ['OverallSDProcessStatusDesc']
SalesOrder.OverallSDProcessStatus,
SalesOrder._OverallSDProcessStatus._Text[1:Language = $session.system_language].OverallSDProcessStatusDesc as OverallSDProcessStatusDesc,
@ObjectModel.text.element: ['OvrlSDDocumentRejectionStsDesc']
SalesOrder.OverallSDDocumentRejectionSts,
SalesOrder._OverallSDDocumentRejectionSts._Text[1:Language = $session.system_language].OvrlSDDocumentRejectionStsDesc as OvrlSDDocumentRejectionStsDesc,
@ObjectModel.text.element: ['ContractDownPaymentStatusDesc']
SalesOrder.SalesOrderDownPaymentStatus,
@UI.hidden: true
SalesOrder._DownPaymentStatus._Text[1:Language = $session.system_language].ContractDownPaymentStatusDesc as ContractDownPaymentStatusDesc,
@ObjectModel.text.element: ['OverallBillingBlockStatusDesc']
SalesOrder.OverallBillingBlockStatus,
SalesOrder._OverallBillingBlockStatus._Text[1:Language = $session.system_language].OverallBillingBlockStatusDesc as OverallBillingBlockStatusDesc,
@ObjectModel.text.element: ['SalesDocApprovalStatusDesc']
SalesOrder.SalesDocApprovalStatus,
SalesOrder._SalesDocApprovalStatus._Text[1:Language = $session.system_language].SalesDocApprovalStatusDesc as SalesDocApprovalStatusDesc,
@ObjectModel.foreignKey.association: '_OverallChmlCmplncStatus'
@ObjectModel.text.element: ['OverallChmlCmplncStatusDesc']
SalesOrder.OverallChmlCmplncStatus,
SalesOrder._OverallChmlCmplncStatus._Text[1:Language = $session.system_language].OverallChmlCmplncStatusDesc as OverallChmlCmplncStatusDesc,
@ObjectModel.foreignKey.association: '_OverallDangerousGoodsStatus'
@ObjectModel.text.element: ['OverallDangerousGoodsStsDesc']
SalesOrder.OverallDangerousGoodsStatus,
SalesOrder._OverallDangerousGoodsStatus._Text[1:Language = $session.system_language].OverallDangerousGoodsStsDesc as OverallDangerousGoodsStsDesc,
@ObjectModel.foreignKey.association: '_OvrlSftyDataSheetSts'
@ObjectModel.text.element: ['OverallSafetyDataSheetStsDesc']
SalesOrder.OverallSafetyDataSheetStatus,
SalesOrder._OvrlSftyDataSheetSts._Text[1:Language = $session.system_language].OverallSafetyDataSheetStsDesc as OverallSafetyDataSheetStsDesc,
@ObjectModel.foreignKey.association: '_OvrlTradeCmplncEmbargoStatus'
@ObjectModel.text.element: ['OverallTrdCmplncEmbargoStsDesc']
cast(SalesOrder.OverallTrdCmplncEmbargoSts as totembargochksts preserving type) as OverallTrdCmplncEmbargoSts,
SalesOrder._OvrlTradeCmplncEmbargoStatus._Text[1: Language=$session.system_language].OverallTrdCmplncEmbargoStsDesc,
@ObjectModel.foreignKey.association: '_OvTrdCmplncSnctndListChkSts'
@ObjectModel.text.element: ['OvrlTrdCmplncSnctndListStsDesc']
cast(SalesOrder.OvrlTrdCmplncSnctndListChkSts as totwatchlistscrngchksts preserving type) as OvrlTrdCmplncSnctndListChkSts,
SalesOrder._OvTrdCmplncSnctndListChkSts._Text[1: Language=$session.system_language].OvrlTrdCmplncSnctndListStsDesc,
@ObjectModel.foreignKey.association: '_OvrlTrdCmplncLegalCtrlChkSts'
@ObjectModel.text.element: ['OvrlTrdCmplncLglCtrlChkStsDesc']
cast(SalesOrder.OvrlTrdCmplncLegalCtrlChkSts as totlglctrlchksts preserving type) as OvrlTrdCmplncLegalCtrlChkSts,
SalesOrder._OvrlTrdCmplncLegalCtrlChkSts._Text[1: Language=$session.system_language].OvrlTrdCmplncLglCtrlChkStsDesc,
@ObjectModel.foreignKey.association: '_SolutionOrder'
cast(SalesOrder.BusinessSolutionOrder as crms4_solo_object_id preserving type ) as BusinessSolutionOrder,
//@Semantics.currencyCode: true
@ObjectModel.text.element: ['CurrencyName']
SalesOrder.TransactionCurrency,
SalesOrder._TransactionCurrency._Text[1:Language = $session.system_language].CurrencyName as CurrencyName,
@Semantics.amount.currencyCode: 'TransactionCurrency'
SalesOrder.TotalNetAmount,
SalesOrder.SalesOrderDate,
@ObjectModel.foreignKey.association: '_SalesDocumentType'
@ObjectModel.text.element: ['SalesDocumentTypeName']
SalesOrder.SalesOrderType,
SalesOrder._SalesOrderType._Text[1:Language = $session.system_language].SalesDocumentTypeName as SalesDocumentTypeName,
SalesOrder.CreationDate,
SalesOrder.LastChangeDate,
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.9
@Search.ranking: #HIGH
@ObjectModel.foreignKey.association: '_CreatedByUser'
@ObjectModel.text.element: ['CreatedByUserDescription']
SalesOrder.CreatedByUser,
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.9
@Search.ranking: #HIGH
SalesOrder._CreatedByUser.UserDescription as CreatedByUserDescription,
@ObjectModel.foreignKey.association: '_LastChangedByUser'
@ObjectModel.text.element: ['LastChangedByUserDescription']
SalesOrder.LastChangedByUser,
SalesOrder._LastChangedByUser.UserDescription as LastChangedByUserDescription,
@ObjectModel.text.element: ['SalesOrganizationName']
SalesOrder.SalesOrganization,
SalesOrder._SalesOrganization._Text[1:Language = $session.system_language].SalesOrganizationName as SalesOrganizationName,
@ObjectModel.text.element: ['DistributionChannelName']
SalesOrder.DistributionChannel,
SalesOrder._DistributionChannel._Text[1:Language = $session.system_language].DistributionChannelName as DistributionChannelName,
@ObjectModel.text.element: ['DivisionName']
SalesOrder.OrganizationDivision,
SalesOrder._OrganizationDivision._Text[1:Language = $session.system_language].DivisionName as DivisionName,
@ObjectModel.text.element: ['SalesOfficeName']
SalesOrder.SalesOffice,
SalesOrder._SalesOffice._Text[1:Language = $session.system_language].SalesOfficeName as SalesOfficeName,
@ObjectModel.text.element: ['SalesGroupName']
SalesOrder.SalesGroup,
SalesOrder._SalesGroup._Text[1:Language = $session.system_language].SalesGroupName as SalesGroupName,
SalesOrder.ReferenceSDDocument,
@ObjectModel.text.element: ['SDDocumentReasonText']
SalesOrder.SDDocumentReason,
SalesOrder._SDDocumentReason._Text[1:Language = $session.system_language].SDDocumentReasonText as SDDocumentReasonText,
@ObjectModel.text.element: ['DeliveryBlockReasonText']
SalesOrder.DeliveryBlockReason,
SalesOrder._DeliveryBlockReason._Text[1:Language = $session.system_language].DeliveryBlockReasonText as DeliveryBlockReasonText,
@ObjectModel.text.element: ['BillingBlockReasonDescription']
SalesOrder.HeaderBillingBlockReason,
SalesOrder._HeaderBillingBlockReason._Text[1:Language = $session.system_language].BillingBlockReasonDescription as BillingBlockReasonDescription,
// @ObjectModel.foreignKey.association: '_SalesDocumentRjcnReason'
// //@ObjectModel.text.element: ['SalesDocumentRjcnReasonName']
// cast( ' ' as abgru_va) as SalesDocumentRjcnReason,
// // SalesOrder._SalesDocumentRjcnReason._Text[1:Language = $session.system_language].SalesDocumentRjcnReasonName,
cast(
case
when SalesOrder.SalesDocApprovalStatus = 'A' then 2 -- | 2: yellow colour
when SalesOrder.SalesDocApprovalStatus = 'B' then 3 -- | 3: green colour
when SalesOrder.SalesDocApprovalStatus = 'C' then 1 -- | 1: red colour
when SalesOrder.SalesDocApprovalStatus = 'D' then 2 -- | 2: yellow colour
else 0 -- | 0: neutral
end as abap.int1
) as SlsOrdApprovalStsCriticality,
@ObjectModel.foreignKey.association: '_OmniChnlSalesPromotionStatus'
@Feature: 'SW:Q2C_OMNICHANNEL_SALESPROMOTION'
@ObjectModel.text.element: ['OmniChnlSalesPromotionStsText']
cast ( SalesOrder.OmniChnlSalesPromotionStatus as sd_so_bob_status preserving type ) as OmniChnlSalesPromotionStatus,
SalesOrder._OmniChnlSalesPromotionStatus._Text[1:Language = $session.system_language].OmniChnlSalesPromotionStsText as OmniChnlSalesPromotionStsText,
SalesOrder._TransactionCurrency,
SalesOrder._OverallSDProcessStatus,
SalesOrder._OverallSDDocumentRejectionSts,
SalesOrder._DownPaymentStatus,
_SoldToPartyVH,
_SalesDocumentType,
SalesOrder._SalesOrganization,
_DistributionChannel,
_Division,
SalesOrder._OrganizationDivision,
_SalesOffice,
_SalesGroup,
SalesOrder._DeliveryBlockReason,
SalesOrder._HeaderBillingBlockReason,
_CreatedByUser,
_LastChangedByUser,
SalesOrder._SDDocumentReason,
SalesOrder._OverallBillingBlockStatus,
SalesOrder._SalesDocApprovalStatus,
SalesOrder._OverallChmlCmplncStatus,
SalesOrder._OverallDangerousGoodsStatus,
SalesOrder._OvrlSftyDataSheetSts,
SalesOrder._SolutionOrder,
SalesOrder._OvrlTradeCmplncEmbargoStatus,
SalesOrder._OvTrdCmplncSnctndListChkSts,
SalesOrder._OvrlTrdCmplncLegalCtrlChkSts,
@Feature: 'SW:Q2C_OMNICHANNEL_SALESPROMOTION'
SalesOrder._OmniChnlSalesPromotionStatus
}
where
SalesOrder.CreationDate > dats_add_days( tstmp_to_dats(tstmp_current_utctimestamp(), abap_system_timezone( $session.client,'NULL' ), $session.client, 'NULL'), -Customer360BusDocSetting.BusDocumentDurationInDays, 'INITIAL')
and SalesOrder.CreationDate <= $session.system_date