//@AbapCatalog.sqlViewName: 'CUST360SLSQUT'
//@AbapCatalog.compiler.compareFilter: true
//@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Sales Quotations for customer 360'
@ObjectModel: {
// compositionRoot: true,
// representativeKey: 'SalesDocument',
usageType: {
dataClass: #TRANSACTIONAL,
serviceQuality: #C,
sizeCategory: #L
}
}
@VDM.viewType: #CONSUMPTION
@Metadata.allowExtensions: true
@Search.searchable: true
define view entity C_Customer360SalesQuotation
as select from I_SalesQuotation as SalesQuotation
inner join I_Customer360BusDocSetting as Customer360BusDocSetting on Customer360BusDocSetting.Cust360BusDocCategory = 'B'
and Customer360BusDocSetting.BusinessDocumentIsEnabled = 'X'
association [1..1] to P_Quotationwl_Duedays as _SalesQuotationDueDays on $projection.SalesQuotation = _SalesQuotationDueDays.SalesQuotation
association [0..1] to C_SoldToValueHelp as _SoldToParty on $projection.SoldToParty = _SoldToParty.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_SalesQuotationTypeValueHelp as _SalesDocumentType on $projection.SalesQuotationType = _SalesDocumentType.SalesDocumentType
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_Quotation_SubsequentDocType as _SubsequentDocType on $projection.SalesQuotationType = _SubsequentDocType.SourceSalesDocumentType
// association [0..*] to C_SalesDocumentItemWl as _SalesDocumentItemWl on $projection.SalesQuotation = _SalesDocumentItemWl.SalesDocument
//Extension Association
association [1] to E_SalesDocumentBasic as _Extension on $projection.SalesQuotation = _Extension.SalesDocument
{
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold:0.8
@Search.ranking : #HIGH
key SalesQuotation.SalesQuotation as SalesQuotation,
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.8
@Search.ranking: #HIGH
SalesQuotation.PurchaseOrderByCustomer as PurchaseOrderByCustomer,
@ObjectModel.foreignKey.association: '_OverallSDProcessStatus'
@ObjectModel.text.element: ['OverallSDProcessStatusDesc']
SalesQuotation.OverallSDProcessStatus,
@UI.hidden: true
SalesQuotation._OverallSDProcessStatus._Text[1:Language = $session.system_language].OverallSDProcessStatusDesc as OverallSDProcessStatusDesc,
// SalesQuotation.DistributionChannel as DistributionChannel,
// SalesQuotation.OverallSDProcessStatus as OverallSDProcessStatus,
@ObjectModel: { text.element: ['SoldToPartyName'] }
SalesQuotation.SoldToParty as SoldToParty,
@Semantics.text:true
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_SLSQTAN_UI_PARTNER_UTIL'
cast('' as ad_namtext ) as SoldToPartyName,
SalesQuotation.BindingPeriodValidityStartDate as BindingPeriodValidityStartDate,
SalesQuotation.BindingPeriodValidityEndDate as BindingPeriodValidityEndDate,
@Semantics.amount.currencyCode: 'TransactionCurrency'
SalesQuotation.TotalNetAmount,
@ObjectModel.text.element: ['CurrencyName']
SalesQuotation.TransactionCurrency,
@UI.hidden: true
SalesQuotation._TransactionCurrency._Text[1:Language = $session.system_language].CurrencyName as CurrencyName,
// SalesQuotation.TransactionCurrency,
SalesQuotation.SalesQuotationDate as SalesQuotationDate,
SalesQuotation.CreationDate,
@ObjectModel.foreignKey.association: '_SalesDocumentType'
@ObjectModel.text.element: ['SalesDocumentTypeName']
SalesQuotation.SalesQuotationType as SalesQuotationType,
@UI.hidden: true
SalesQuotation._SalesQuotationType._Text[1:Language = $session.system_language].SalesDocumentTypeName as SalesDocumentTypeName,
// SalesQuotation.SalesQuotationType as SalesQuotationType,
@ObjectModel.text.element: ['SalesOrganizationName']
SalesQuotation.SalesOrganization,
@UI.hidden: true
SalesQuotation._SalesOrganization._Text[1:Language = $session.system_language].SalesOrganizationName as SalesOrganizationName,
// SalesQuotation.SalesOrganization as SalesOrganization,
@ObjectModel.foreignKey.association: '_OverallSDDocReferenceStatus'
@UI.textArrangement: #TEXT_ONLY
@ObjectModel.text.element: ['OverallSDDocRefStatusDesc']
SalesQuotation.OverallSDDocReferenceStatus,
@UI.hidden: true
SalesQuotation._OverallSDDocReferenceStatus._Text[1:Language = $session.system_language].OverallSDDocRefStatusDesc as OverallSDDocRefStatusDesc,
// SalesQuotation.OverallSDDocReferenceStatus as OverallSDDocReferenceStatus,
@ObjectModel.foreignKey.association: '_OverallSDDocumentRejectionSts'
@ObjectModel.text.element: ['OvrlSDDocumentRejectionStsDesc']
SalesQuotation.OverallSDDocumentRejectionSts,
@UI.hidden: true
SalesQuotation._OverallSDDocumentRejectionSts._Text[1:Language = $session.system_language].OvrlSDDocumentRejectionStsDesc as OvrlSDDocumentRejectionStsDesc,
// SalesQuotation.OverallSDDocumentRejectionSts as OverallSDDocumentRejectionSts,
@ObjectModel.foreignKey.association: '_SalesDocApprovalStatus'
@ObjectModel.text.element: ['SalesDocApprovalStatusDesc']
SalesQuotation.SalesDocApprovalStatus,
@UI.hidden: true
SalesQuotation._SalesDocApprovalStatus._Text[1:Language = $session.system_language].SalesDocApprovalStatusDesc as SalesDocApprovalStatusDesc,
// SalesQuotation.SalesDocApprovalStatus,
@ObjectModel.readOnly: true
// cast ( ( case TSTMP_IS_VALID(SalesQuotation.LastChangeDateTime)
// when 0 then cast( dats_tims_to_tstmp( SalesQuotation.CreationDate, SalesQuotation.CreationTime, 'UTC', $session.client, 'NULL' ) as last_changed_date_time )
// else SalesQuotation.LastChangeDateTime
// end ) as last_changed_date_time preserving type ) as LastChangeDateTime,
cast(
case
when _SalesQuotationDueDays.DueDays = -999999999 then 0 -- | 0: neutral (for unlimited or completed quotations)
when _SalesQuotationDueDays.DueDays > 7 then 3 -- | 3: green colour
when _SalesQuotationDueDays.DueDays > 0 and _SalesQuotationDueDays.DueDays <= 7 then 2 -- | 2: yellow colour
else 1 -- | 1: red colour
end
as abap.int1
) as SlsQtanDueDateCriticality,
cast(
case
when SalesQuotation.SalesDocApprovalStatus = 'A' then 2 -- | 2: yellow colour
when SalesQuotation.SalesDocApprovalStatus = 'B' then 3 -- | 3: green colour
when SalesQuotation.SalesDocApprovalStatus = 'C' then 1 -- | 1: red colour
when SalesQuotation.SalesDocApprovalStatus = 'D' then 2 -- | 2: yellow colour
else 0 -- | 0: neutral
end as abap.int1
) as SlsQtanApprovalStsCriticality,
@Consumption.valueHelp: '_DistributionChannel'
@ObjectModel.text.element: ['DistributionChannelName']
SalesQuotation.DistributionChannel,
@UI.hidden: true
SalesQuotation._DistributionChannel._Text[1:Language = $session.system_language].DistributionChannelName as DistributionChannelName,
// SalesQuotation.DistributionChannel as DistributionChannel,
@Consumption.valueHelp: '_Division'
@ObjectModel.text.element: ['DivisionName']
SalesQuotation.OrganizationDivision,
@UI.hidden: true
SalesQuotation._OrganizationDivision._Text[1:Language = $session.system_language].DivisionName as DivisionName,
// SalesQuotation.OrganizationDivision as OrganizationDivision,
@Consumption.valueHelp: '_SalesOffice'
@ObjectModel.text.element: ['SalesOfficeName']
SalesQuotation.SalesOffice,
@UI.hidden: true
SalesQuotation._SalesOffice._Text[1:Language = $session.system_language].SalesOfficeName as SalesOfficeName,
// SalesQuotation.SalesOffice as SalesOffice,
@Consumption.valueHelp: '_SalesGroup'
@ObjectModel.text.element: ['SalesGroupName']
SalesQuotation.SalesGroup,
@UI.hidden: true
SalesQuotation._SalesGroup._Text[1:Language = $session.system_language].SalesGroupName as SalesGroupName,
// SalesQuotation.SalesGroup as SalesGroup,
@UI.textArrangement: #TEXT_FIRST
SalesQuotation.LastChangeDate as LastChangeDate,
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.8
@UI.textArrangement: #TEXT_FIRST
@ObjectModel.foreignKey.association: '_CreatedByUser'
@ObjectModel.text.element: ['UserDescription']
SalesQuotation.CreatedByUser as CreatedByUser,
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.8
@Search.ranking: #HIGH
@UI.hidden: true
SalesQuotation._CreatedByUser.UserDescription as UserDescription,
// SalesQuotation.CreatedByUser as CreatedByUser,
@ObjectModel.foreignKey.association: '_LastChangedByUser'
@ObjectModel.text.element: ['LastChangedByUserDescription']
SalesQuotation.LastChangedByUser as LastChangedByUser,
@UI.hidden: true
SalesQuotation._LastChangedByUser.UserDescription as LastChangedByUserDescription,
// SalesQuotation.LastChangedByUser as LastChangedByUser,
@ObjectModel.text.element: ['SDDocumentReasonText']
SalesQuotation.SDDocumentReason,
@UI.hidden: true
SalesQuotation._SDDocumentReason._Text[1:Language = $session.system_language].SDDocumentReasonText as SDDocumentReasonText,
// SalesQuotation.SDDocumentReason as SDDocumentReason,
@Consumption.filter.hidden: true
SalesQuotation._TransactionCurrency,
@Consumption.filter.hidden: true
_SoldToParty,
@Consumption.filter.hidden: true
_SalesDocumentType,
@Consumption.filter.hidden: true
SalesQuotation._SalesOrganization,
@Consumption.filter.hidden: true
_DistributionChannel,
@Consumption.filter.hidden: true
_Division,
@Consumption.filter.hidden: true
SalesQuotation._OrganizationDivision,
@Consumption.filter.hidden: true
_SalesOffice,
@Consumption.filter.hidden: true
_SalesGroup,
@Consumption.filter.hidden: true
SalesQuotation._OverallSDProcessStatus,
@Consumption.filter.hidden: true
SalesQuotation._OverallSDDocReferenceStatus,
@Consumption.filter.hidden: true
SalesQuotation._OverallSDDocumentRejectionSts,
@Consumption.filter.hidden: true
SalesQuotation._SalesDocApprovalStatus,
@Consumption.filter.hidden: true
_CreatedByUser,
@UI.hidden: true
_SoldToParty.OrganizationBPName1,
@UI.hidden: true
_SoldToParty.OrganizationBPName2,
@Consumption.filter.hidden: true
_LastChangedByUser,
@Consumption.filter.hidden: true
SalesQuotation._SDDocumentReason,
@Consumption.filter.hidden: true
_SubsequentDocType,
@Consumption.filter.hidden: true
SalesQuotation._SalesQuotationType
// @Consumption.filter.hidden: true
// @Search.defaultSearchElement: true
// _SalesDocumentItemWl
}
where
SalesQuotation.CreationDate > dats_add_days( tstmp_to_dats(tstmp_current_utctimestamp(), abap_system_timezone( $session.client,'NULL' ), $session.client, 'NULL'), -Customer360BusDocSetting.BusDocumentDurationInDays, 'INITIAL')
and SalesQuotation.CreationDate <= $session.system_date
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"C_SOLDTOVALUEHELP",
"I_CURRENCY",
"I_CURRENCYTEXT",
"I_CUSTOMER360BUSDOCSETTING",
"I_DISTRIBUTIONCHANNEL",
"I_DISTRIBUTIONCHANNELTEXT",
"I_DIVISION",
"I_DIVISIONTEXT",
"I_OVERALLSDDOCREFERENCESTATUS",
"I_OVERALLSDDOCREFERENCESTATUST",
"I_OVERALLSDDOCUMENTRJCNSTATUS",
"I_OVERALLSDDOCUMENTRJCNSTATUST",
"I_OVERALLSDPROCESSSTATUS",
"I_OVERALLSDPROCESSSTATUSTEXT",
"I_SALESDOCAPPROVALSTATUS",
"I_SALESDOCAPPROVALSTATUST",
"I_SALESDOCUMENTTYPETEXT",
"I_SALESGROUP",
"I_SALESGROUPTEXT",
"I_SALESOFFICE",
"I_SALESOFFICETEXT",
"I_SALESORGANIZATION",
"I_SALESORGANIZATIONTEXT",
"I_SALESQUOTATION",
"I_SALESQUOTATIONTYPE",
"I_SDDOCUMENTREASON",
"I_SDDOCUMENTREASONTEXT",
"I_USER",
"P_QUOTATIONWL_DUEDAYS"
],
"ASSOCIATED":
[
"C_DISCHANNELVALUEHELP",
"C_ORGDIVISIONVALUEHELP",
"C_QUOTATION_SUBSEQUENTDOCTYPE",
"C_SALESDOCUMENTUSERVH",
"C_SALESGROUPVALUEHELP",
"C_SALESOFFICEVALUEHELP",
"C_SALESQUOTATIONTYPEVALUEHELP",
"C_SOLDTOVALUEHELP",
"I_CURRENCY",
"I_DIVISION",
"I_OVERALLSDDOCREFERENCESTATUS",
"I_OVERALLSDDOCUMENTRJCNSTATUS",
"I_OVERALLSDPROCESSSTATUS",
"I_SALESDOCAPPROVALSTATUS",
"I_SALESORGANIZATION",
"I_SALESQUOTATIONTYPE",
"I_SDDOCUMENTREASON"
],
"BASE":
[
"I_SALESQUOTATION"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/