//@AbapCatalog.sqlViewName: 'CUST360SRVQTN'
//@AbapCatalog.compiler.compareFilter: true
//@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Service quotations for customer 360'
@Metadata.allowExtensions: true
@Search.searchable: true
@ObjectModel: {
usageType: {
dataClass: #MIXED,
serviceQuality: #C,
sizeCategory: #XXL
}
}
@VDM.viewType: #CONSUMPTION
define view entity C_Customer360ServiceQuotation
as select from I_ServiceDocumentEnhcd as ServiceQuotation
inner join I_Customer360BusDocSetting as Customer360BusDocSetting on Customer360BusDocSetting.Cust360BusDocCategory = 'SVQ'
and Customer360BusDocSetting.BusinessDocumentIsEnabled = 'X'
association [0..1] to C_ServiceEmployeeVH as _RespEmployeeVH on $projection.RespEmployeeBusinessPartnerId = _RespEmployeeVH.Employee
association [1..*] to C_ServiceDocObjPgNotes as _ServiceDocumentNotes on $projection.ServiceObjectType = _ServiceDocumentNotes.ServiceObjectType
and $projection.ServiceQuotation = _ServiceDocumentNotes.ServiceDocument
association [1..*] to C_SrvcDocObjPgTransHistory as _ServiceDocumentTransHistory on $projection.ServiceObjectType = _ServiceDocumentTransHistory.ServiceObjectType
and $projection.ServiceQuotation = _ServiceDocumentTransHistory.ServiceDocument
association [1..*] to C_ServiceDocObjPgErrorLog as _ServiceDocumentErrorLog on $projection.ServiceObjectType = _ServiceDocumentErrorLog.ServiceObjectType
and $projection.ServiceQuotation = _ServiceDocumentErrorLog.ServiceDocument
association [0..1] to E_ServiceDocument as _ServiceDocumentExt on $projection.ServiceObjectType = _ServiceDocumentExt.ServiceCategory
and $projection.ServiceQuotation = _ServiceDocumentExt.ServiceOrder
association [0..*] to C_ServiceDocumentPartner as _PartiesInvolved on $projection.ServiceObjectType = _PartiesInvolved.CustMgmtObjectType
and $projection.ServiceQuotation = _PartiesInvolved.CustMgmtDocument
and _PartiesInvolved.CustMgmtDocumentItem = '000000'
association [1..*] to C_SrvcOrderObjPgPricingDets as _ServiceQtanPriceDets on $projection.ServiceObjectType = _ServiceQtanPriceDets.ServiceObjectType
and $projection.ServiceQuotation = _ServiceQtanPriceDets.ServiceDocument
association [0..1] to I_CustMgmtExtRefID as _CustMgmtExtRef on $projection.ServiceQuotation = _CustMgmtExtRef.CustMgmtDocument
and $projection.ServiceObjectType = _CustMgmtExtRef.CustMgmtObjectType
and _CustMgmtExtRef.CustMgmtExtRefIDType = '0009'
association [1..1] to I_ServiceQuotationStatus as _ServiceQtanStatus on $projection.ServiceQuotationStatus = _ServiceQtanStatus.ServiceQuotationStatus
// association [0..1] to I_ServiceQuotationStatus as _ServiceQtanItemStatusdropdown on $projection.ServiceQuotationStatus = _ServiceQtanItemStatusdropdown.ServiceQuotationStatus
association [0..1] to I_ServiceDocumentSuccessor as _RefServiceOrder on $projection.ServiceDocumentUUID = _RefServiceOrder.ServiceDocumentUUID
and _RefServiceOrder.ServiceDocSuccessorBusObjType = 'BUS2000116'
association [0..*] to I_ServiceDocumentTypeText as _ServiceQtanType on $projection.ServiceDocumentType = _ServiceQtanType.ServiceDocumentType
association [0..*] to I_SalesDocumentRjcnReasonText as _SrvcDocRejectionReasonText on $projection.ServiceDocumentRejectionReason = _SrvcDocRejectionReasonText.SalesDocumentRjcnReason
association [1..*] to I_ServiceQuotationStatusText as _ServiceQuotationStatusText on $projection.ServiceQuotationStatus = _ServiceQuotationStatusText.ServiceQuotationStatus
// association [1..1] to I_ServiceQuotationStatus as _ServiceQuotationStatus on $projection.ServiceQuotationStatus = _ServiceQuotationStatus.ServiceQuotationStatus
association [1..*] to C_SrvcDocDateInformation as _SrvcDateInfo on (
$projection.ServiceQuotation = _SrvcDateInfo.ServiceDocument
and $projection.ServiceObjectType = _SrvcDateInfo.ServiceObjectType
and _SrvcDateInfo.ServiceDocumentItem = '000000'
)
or (
$projection.ServiceDocumentUUID = _SrvcDateInfo.SrvcMgmtObjectUUID
)
association [0..1] to I_StatusObjectUUIDStatus as _SrvcDocSystemStatus on $projection.ServiceDocumentUUID = _SrvcDocSystemStatus.StatusObjectUUID
and (
_SrvcDocSystemStatus.StatusCode = 'I1002' // open
or _SrvcDocSystemStatus.StatusCode = 'I1003' // under review
or _SrvcDocSystemStatus.StatusCode = 'I1004' // sent to customer
or _SrvcDocSystemStatus.StatusCode = 'I1005' // Rejected or accepted
)
and _SrvcDocSystemStatus.StatusIsActive = 'X'
association [1..1] to P_SrvcQuotation_DueDays as _SrvcQuotationDueDays on $projection.ServiceQuotation = _SrvcQuotationDueDays.ServiceQuotation
{
@ObjectModel.readOnly: true
@Consumption.semanticObject: 'ServiceQuotation'
key ServiceQuotation.ServiceDocument as ServiceQuotation,
@ObjectModel.text.element: ['ServiceDocumentTypeName']
@ObjectModel.foreignKey.association: '_ServiceDocumentType'
ServiceQuotation.ServiceDocumentType,
_ServiceQtanType[1:Language = $session.system_language].ServiceDocumentTypeName as ServiceDocumentTypeName,
ServiceQuotation.ServiceObjectType,
@EndUserText.label: 'Description'
ServiceQuotation.ServiceDocumentDescription as ServiceQuotationDescription,
ServiceQuotation.ServiceDocumentUUID,
ServiceQuotation.ServiceDocumentIsQuotation,
ServiceQuotation.SoldToParty,
@ObjectModel.foreignKey.association: '_ContactPerson'
@ObjectModel.text.element: ['ContactPersonFullName']
@UI.textArrangement: #TEXT_FIRST
ServiceQuotation.ContactPerson as ContactPersonBusinessPartnerId,
@UI.hidden: true
ServiceQuotation._ContactPerson.BusinessPartnerName as ContactPersonFullName,
@ObjectModel.text.element: ['UICT_ShipToParty']
@ObjectModel.foreignKey.association: '_ShipToParty'
@UI.textArrangement: #TEXT_FIRST
ServiceQuotation.ShipToParty,
@UI.hidden: true
@UI.lineItem: [{ hidden: true }]
ServiceQuotation._ShipToParty.BusinessPartnerName as UICT_ShipToParty,
ServiceQuotation.PostingDate,
@EndUserText.label: 'Requested Start'
ServiceQuotation.RequestedServiceStartDate,
@EndUserText.label: 'Requested End'
ServiceQuotation.RequestedServiceEndDate,
@EndUserText.label: 'Creation Date'
ServiceQuotation.ServiceDocCreationDateTime,
@EndUserText.label: 'Validity Start Date'
ServiceQuotation.SrvcQuotationValidityStartDate,
@EndUserText.label: 'Validity End Date'
ServiceQuotation.SrvcQuotationValidityEndDate,
//For Customer360 - criticality for Validation End Date
@UI.hidden: true
cast(
case
when _SrvcQuotationDueDays.DueDays = -999999999 then 0 -- | 0: neutral (for unlimited or completed quotations)
when _SrvcQuotationDueDays.DueDays > 7 then 3 -- | 3: green colour
when _SrvcQuotationDueDays.DueDays > 0 and _SrvcQuotationDueDays.DueDays <= 7 then 2 -- | 2: yellow colour
else 1 -- | 1: red colour
end
as abap.int1
) as DueDateCriticality,
// Price Overview related fields
@Semantics.amount.currencyCode: 'TransactionCurrency'
ServiceQuotation.ServiceDocGrossAmount as SrvcQtanGrossAmount,
@Semantics.amount.currencyCode: 'TransactionCurrency'
ServiceQuotation.ServiceDocNetAmount as SrvcQtanNetAmount,
@UI.textArrangement: #TEXT_ONLY
ServiceQuotation.ServiceDocTaxAmount
as SrvcQtanTaxAmount,
@ObjectModel.foreignKey.association: '_TransactionCurrency'
@UI.textArrangement: #TEXT_FIRST
@ObjectModel.text.element: ['CurrencyName']
ServiceQuotation.TransactionCurrency,
@UI.hidden: true
ServiceQuotation._TransactionCurrency._Text[1:Language = $session.system_language].CurrencyName as CurrencyName,
// ServiceQuotation.TransactionCurrency,
// @UI.hidden: true
// ServiceQuotation._TransactionCurrency._Text[1:Language = $session.system_language].CurrencyName as CurrencyName,
// ServiceQuotation.TransactionCurrency,
// Service Quotation Life cycle status related fields
@ObjectModel.foreignKey.association: '_ServiceDocumentStatus'
ServiceQuotation.ServiceDocumentStatus,
ServiceQuotation.ServiceDocumentIsRejected,
@ObjectModel.text.element: ['SalesDocumentRjcnReasonName']
@ObjectModel.foreignKey.association: '_SrvcDocumentRejectionReason'
ServiceQuotation.ServiceDocumentRejectionReason,
@UI.hidden: true
_SrvcDocRejectionReasonText[1:Language = $session.system_language].SalesDocumentRjcnReasonName,
//@UI.hidden: true
//@ObjectModel.text.association: '_ServiceQuotationStatusText'
@ObjectModel.text.element: ['ServiceQuotationStatusName']
cast(
case _SrvcDocSystemStatus.StatusCode
when 'I1002' then 'A' //open
when 'I1003' then 'B' //under review
when 'I1005' then case ServiceQuotation.ServiceDocumentIsRejected
when 'X' then 'E' // Rejected
when ' ' then 'D' // accepted
end
when 'I1004' then 'C' // sent to customer
else ' '
end as crms4_qtan_stat_lc) as ServiceQuotationStatus,
// @UI.hidden: true
// _SrvcDocSystemStatus._StatusCode._StatusCodeText[1:Language = $session.system_language].StatusName,
@UI.hidden: true
@Consumption.filter.hidden: true
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_ADVNCD_CUST360_UI_UTIL'
cast('' as crms4_qtan_stat_lc_name) as ServiceQuotationStatusName,
//_ServiceQuotationStatusText[1:Language = $session.system_language].ServiceQuotationStatusName as ServiceQuotationStatusName,
// Status Criticality determination logic
@UI.hidden: true
case _SrvcDocSystemStatus.StatusCode
when 'I1002' then 0 //open
when 'I1003' then 0 //under review
when 'I1005' then case ServiceQuotation.ServiceDocumentIsRejected
when 'X' then 1 // Rejected
when ' ' then 3 // accepted
end
when 'I1004' then 2 // sent to customer
else 3
end as SrvcQtanStatusCritlty,
ServiceQuotation.RespyMgmtServiceTeam,
ServiceQuotation._ServiceTeamHeader._TeamDescription.TeamDescription as RespyMgmtServiceTeamDesc,
@ObjectModel.text.element:['RespyMgmtServiceTeamDesc']
ServiceQuotation._ServiceTeamHeader.TeamName as RespyMgmtServiceTeamName,
// Organization Data Section
@ObjectModel.foreignKey.association: '_SalesOrganization'
@ObjectModel.text.element: ['SalesOrganizationName']
ServiceQuotation.SalesOrganization,
@UI.hidden: true
ServiceQuotation._SalesOrganization._Text[1:Language = $session.system_language].SalesOrganizationName as SalesOrganizationName,
// ServiceQuotation.SalesOrganization,
@ObjectModel.foreignKey.association: '_DistributionChannel'
@ObjectModel.text.element: ['DistributionChannelName']
ServiceQuotation.DistributionChannel,
@UI.hidden: true
ServiceQuotation._DistributionChannel._Text[1:Language = $session.system_language].DistributionChannelName as DistributionChannelName,
@ObjectModel.foreignKey.association: '_Division'
@ObjectModel.text.element: ['DivisionName']
ServiceQuotation.Division,
@UI.hidden: true
ServiceQuotation._Division._Text[1:Language = $session.system_language].DivisionName as DivisionName,
// ServiceQuotation.Division,
@ObjectModel.foreignKey.association: '_SalesOffice'
@ObjectModel.text.element: ['SalesOfficeName']
ServiceQuotation.SalesOffice,
@UI.hidden: true
ServiceQuotation._SalesOffice._Text[1:Language = $session.system_language].SalesOfficeName as SalesOfficeName,
@ObjectModel.foreignKey.association: '_SalesGroup'
@ObjectModel.text.element: ['SalesGroupName']
ServiceQuotation.SalesGroup,
@UI.hidden: true
ServiceQuotation._SalesGroup._Text[1:Language = $session.system_language].SalesGroupName as SalesGroupName,
// Reference Section
@ObjectModel.text.element: ['EquipmentName']
@ObjectModel.foreignKey.association: '_Equipment'
ServiceQuotation._ServiceDocRefObj[1:ServiceDocumentItem = '000000'].Equipment,
ServiceQuotation._ServiceDocRefObj[1:ServiceDocumentItem = '000000']._Equipment._EquipmentText[1: Language=$session.system_language].EquipmentName as EquipmentName,
@ObjectModel.text.element: ['MaterialName']
@ObjectModel.foreignKey.association: '_Material'
ServiceQuotation._ServiceDocRefObj[1:ServiceDocumentItem = '000000']._Equipment.Material as ReferenceProduct,
ServiceQuotation._ServiceDocRefObj[1:ServiceDocumentItem = '000000']._Equipment._Material._Text[1: Language=$session.system_language].MaterialName as MaterialName,
// @ObjectModel.text.element: ['FunctionalLocationName']
// @Consumption.semanticObject: 'MaintenanceObject'
// _ServiceDocRefObj.FunctionalLocation,
// For Equipment ID/Funcaiton location navigation
// case ServiceQuotation._ServiceDocRefObj[1:ServiceDocumentItem = '000000'].ServiceReferenceObjectType
// when 'B' then 'EAMS_FL'
// when 'C' then 'EAMS_EQUI'
// end as TechObjIsEquipOrFuncnlLoc,
case ServiceQuotation._ServiceDocRefObj[1:ServiceDocumentItem = '000000'].ServiceReferenceObjectType
when 'B' then cast (ServiceQuotation._ServiceDocRefObj[1:ServiceDocumentItem = '000000'].FunctionalLocation as eams_tec_obj)
when 'C' then cast (ServiceQuotation._ServiceDocRefObj[1:ServiceDocumentItem = '000000'].Equipment as eams_tec_obj)
end as TechnicalObject,
ServiceQuotation._ServiceDocRefObj[1:ServiceDocumentItem = '000000']._FunctionalLocation._FunctionalLocationText[1: Language=$session.system_language].FunctionalLocationName as FunctionalLocationName,
ServiceQuotation._ServiceDocRefObj[1:ServiceDocumentItem = '000000'].ProductID,
ServiceQuotation._ServiceDocRefObj[1:ServiceDocumentItem = '000000']._Product._Text[1: Language=$session.system_language].ProductName as ProductName,
@ObjectModel.text.element: ['ResponsibleEmployeeName']
@ObjectModel.foreignKey.association: '_RespEmployeeVH'
ServiceQuotation.ResponsibleEmployee as RespEmployeeBusinessPartnerId,
_RespEmployeeVH.FullName as ResponsibleEmployeeName,
ServiceQuotation.PurchaseOrderByCustomer,
//@UI.lineItem.position:120
@UI.hidden: true
_RefServiceOrder._ServiceDoc.ServiceDocument as ServiceOrder,
_CustMgmtExtRef.CustMgmtExtRefID,
// Notes Section
// _ServiceDocumentNotes.ServiceDocNoteText as ServiceQuotationNoteText,
@UI.hidden: true
@Consumption.filter.hidden: true
@ObjectModel.foreignKey.association: '_SalesOrganizationOrgUnit_2'
ServiceQuotation.SalesOrganizationOrgUnitID,
@UI.hidden: true
@Consumption.filter.hidden: true
@ObjectModel.foreignKey.association: '_SalesOfficeOrgUnit_2'
ServiceQuotation.SalesOfficeOrgUnitID,
@UI.hidden: true
@Consumption.filter.hidden: true
@ObjectModel.foreignKey.association: '_SalesGroupOrgUnit_2'
ServiceQuotation.SalesGroupOrgUnitID,
@UI.hidden: true
@Consumption.filter.hidden: true
@ObjectModel.foreignKey.association: '_ServiceOrganizationOrgUnit_2'
ServiceQuotation.ServiceOrganization,
@Consumption.filter.hidden: true
@ObjectModel.foreignKey.association: '_RespSrvcOrganizationOrgUnit_2'
ServiceQuotation.ResponsibleServiceOrganization,
// Associations
@Consumption.filter.hidden: true
ServiceQuotation._SoldToParty,
@Consumption.filter.hidden: true
_RespEmployeeVH,
@Consumption.filter.hidden: true
ServiceQuotation._ContactPerson,
@Consumption.filter.hidden: true
ServiceQuotation._ShipToParty,
@Consumption.filter.hidden: true
ServiceQuotation._ServiceDocumentType,
@Consumption.filter.hidden: true
ServiceQuotation._ServiceDocumentStatus,
@Consumption.filter.hidden: true
ServiceQuotation._SrvcDocumentRejectionReason,
@Consumption.filter.hidden: true
ServiceQuotation._ServiceDocRefObj,
@Consumption.filter.hidden: true
_ServiceDocumentNotes,
@Consumption.filter.hidden: true
@ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
_ServiceDocumentTransHistory,
@Consumption.filter.hidden: true
@ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
_ServiceDocumentErrorLog,
@Consumption.filter.hidden: true
ServiceQuotation._SalesOrganization,
@Consumption.filter.hidden: true
ServiceQuotation._SalesOffice,
@Consumption.filter.hidden: true
ServiceQuotation._SalesGroup,
@Consumption.filter.hidden: true
ServiceQuotation._Division,
@Consumption.filter.hidden: true
ServiceQuotation._DistributionChannel,
@Consumption.filter.hidden: true
@ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
_PartiesInvolved,
@Consumption.filter.hidden: true
_ServiceQtanPriceDets,
@Consumption.filter.hidden: true
_ServiceQtanStatus,
//@UI.hidden: true
@Consumption.filter.hidden: true
_ServiceQuotationStatusText,
@Consumption.filter.hidden: true
_ServiceQtanType,
@Consumption.filter.hidden: true
_SrvcDocRejectionReasonText,
@Consumption.filter.hidden: true
_SrvcDateInfo,
@Consumption.filter.hidden: true
_SrvcDocSystemStatus,
@Consumption.filter.hidden: true
ServiceQuotation._TransactionCurrency,
@Consumption.filter.hidden: true
ServiceQuotation._ServiceDocRefObj[1:ServiceDocumentItem = '000000']._Equipment,
ServiceQuotation._ServiceDocRefObj[1:ServiceDocumentItem = '000000']._Equipment._Material,
@Consumption.filter.hidden: true
ServiceQuotation._SalesOrganizationOrgUnit_2,
@Consumption.filter.hidden: true
ServiceQuotation._SalesOfficeOrgUnit_2,
@Consumption.filter.hidden: true
ServiceQuotation._SalesGroupOrgUnit_2,
@Consumption.filter.hidden: true
ServiceQuotation._ServiceOrganizationOrgUnit_2,
@Consumption.filter.hidden: true
ServiceQuotation._RespSrvcOrganizationOrgUnit_2,
@Consumption.filter.hidden: true
ServiceQuotation._ServiceObjType
}
where
ServiceQuotation.ServiceDocCreationDateTime > dats_tims_to_tstmp(dats_add_days( tstmp_to_dats(tstmp_current_utctimestamp(), abap_system_timezone( $session.client,'NULL' ), $session.client, 'NULL'), - Customer360BusDocSetting.BusDocumentDurationInDays, 'INITIAL'), tstmp_to_tims(tstmp_current_utctimestamp(), abap_system_timezone( $session.client,'NULL' ), $session.client, 'NULL'), abap_system_timezone( $session.client,'NULL' ), $session.client, 'NULL')
and ServiceQuotation.ServiceDocCreationDateTime <= tstmp_current_utctimestamp()
and ServiceQuotation.ServiceObjectType = 'BUS2000116'
and ServiceQuotation.ServiceDocumentIsQuotation = 'X'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"C_SERVICEEMPLOYEEVH",
"I_BUSINESSPARTNER",
"I_CURRENCY",
"I_CURRENCYTEXT",
"I_CUSTMGMTEXTREFID",
"I_CUSTOMER360BUSDOCSETTING",
"I_DISTRIBUTIONCHANNEL",
"I_DISTRIBUTIONCHANNELTEXT",
"I_DIVISION",
"I_DIVISIONTEXT",
"I_EQUIPMENT",
"I_EQUIPMENTTEXT",
"I_FUNCTIONALLOCATION",
"I_FUNCTIONALLOCATIONTEXT",
"I_MATERIAL",
"I_MATERIALTEXT",
"I_PRODUCT",
"I_PRODUCTTEXT",
"I_RESPYMGMTTEAMDESCRIPTION",
"I_RESPYMGMTTEAMHEADERDETAIL",
"I_SALESDOCUMENTRJCNREASONTEXT",
"I_SALESGROUP",
"I_SALESGROUPTEXT",
"I_SALESOFFICE",
"I_SALESOFFICETEXT",
"I_SALESORGANIZATION",
"I_SALESORGANIZATIONTEXT",
"I_SERVICEDOCUMENTENHCD",
"I_SERVICEDOCUMENTREFOBJECT",
"I_SERVICEDOCUMENTSUCCESSOR",
"I_SERVICEDOCUMENTTYPETEXT",
"I_STATUSOBJECTUUIDSTATUS",
"P_SRVCQUOTATION_DUEDAYS"
],
"ASSOCIATED":
[
"C_SERVICEDOCOBJPGERRORLOG",
"C_SERVICEDOCOBJPGNOTES",
"C_SERVICEDOCUMENTPARTNER",
"C_SERVICEEMPLOYEEVH",
"C_SRVCDOCDATEINFORMATION",
"C_SRVCDOCOBJPGTRANSHISTORY",
"C_SRVCORDEROBJPGPRICINGDETS",
"I_BUSINESSPARTNER",
"I_CURRENCY",
"I_CUSTMGMTBUSOBJTYPE",
"I_DISTRIBUTIONCHANNEL",
"I_DIVISION",
"I_EQUIPMENT",
"I_MATERIAL",
"I_SALESDOCUMENTRJCNREASON",
"I_SALESDOCUMENTRJCNREASONTEXT",
"I_SALESGROUP",
"I_SALESOFFICE",
"I_SALESORGANIZATION",
"I_SERVICEDOCUMENTREFOBJECT",
"I_SERVICEDOCUMENTSTATUS",
"I_SERVICEDOCUMENTTYPE",
"I_SERVICEDOCUMENTTYPETEXT",
"I_SERVICEQUOTATIONSTATUS",
"I_SERVICEQUOTATIONSTATUSTEXT",
"I_SRVCMGMTORGANIZATIONUNIT",
"I_STATUSOBJECTUUIDSTATUS"
],
"BASE":
[
"I_EQUIPMENT",
"I_SERVICEDOCUMENTENHCD",
"I_SERVICEDOCUMENTREFOBJECT"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/