@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.sqlViewName: 'CCUSTRETURNFS'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@AccessControl.privilegedAssociations: [ '_SDDocumentPartnerCard', '_EmployeeResponsible', '_ShipToParty' ]
@AccessControl.personalData.blocking: #NOT_REQUIRED
@VDM.viewType: #CONSUMPTION
@EndUserText.label: 'Returns Order Fact Sheet'
@ObjectModel: {
compositionRoot: true, //Necessary to mark the root node in a consumption view
semanticKey: ['CustomerReturn'],
usageType.dataClass: #MIXED,
usageType.serviceQuality: #C,
usageType.sizeCategory: #XXL
}
@Search.searchable: true
@UI.headerInfo: {
typeName: 'Customer Return',
typeNamePlural: 'Customer Returns',
title: { type: #STANDARD,
value: 'SalesDocumentTypeName' }
}
define view C_Customerreturnfs
as select from I_CustomerReturn as Return
//Associations
association [0..1] to C_Q2CCustomerQuickView as _SoldToPartyVH on $projection.SoldToParty = _SoldToPartyVH.Customer
association [0..*] to C_Customerreturnitemfs as _Item on $projection.CustomerReturn = _Item.CustomerReturn
association [0..*] to C_SDDocumentPartnerCard as _SDDocumentPartnerCard on $projection.CustomerReturn = _SDDocumentPartnerCard.SDDocument
and _SDDocumentPartnerCard.SDDocumentItem = '000000'
association [0..*] to C_SlsDocPaymentPlanItem as _SlsDocPaymentPlanItem on $projection.CustomerReturn = _SlsDocPaymentPlanItem.SalesDocument
association [0..1] to I_SDDocumentCustomer as _ShipToParty on $projection.CustomerReturn = _ShipToParty.SDDocument
and _ShipToParty.PartnerFunction = 'WE'
association [0..1] to I_SDDocumentPersonnel as _EmployeeResponsible on $projection.CustomerReturn = _EmployeeResponsible.SDDocument
and _EmployeeResponsible.PartnerFunction = 'ZM'
//Current workaround as I_SDDocumentPersonnel is not exposing PARNR
association [0..1] to I_SalesDocumentPartner as _ResponsibleEmployee on $projection.CustomerReturn = _ResponsibleEmployee.SalesDocument
and _ResponsibleEmployee.PartnerFunction = 'ZM'
//Extension Association
association [0..1] to E_SalesDocumentBasic as _Extension on $projection.CustomerReturn = _Extension.SalesDocument
{
//Header Information
@Search.defaultSearchElement: true
@Search.ranking: #HIGH
@Consumption.semanticObject: 'CustomerReturn'
@UI.lineItem:[{ position: 10, label: 'Customer Return' }]
@UI.fieldGroup:{ qualifier: 'SoldToParty', position: 10 ,importance: #HIGH }
key Return.CustomerReturn,
@EndUserText.label: 'Sales Document Type Name'
concat_with_space(_CustomerReturnType._Text[1: Language=$session.system_language].SalesDocumentTypeName, ltrim(CustomerReturn, '0'), 1) as SalesDocumentTypeName,
Return.CustomerReturnType,
@UI:{
fieldGroup:{ qualifier: 'SoldToParty', position: 20 ,importance: #HIGH },
textArrangement: #TEXT_FIRST
}
@Consumption: {
semanticObject: 'Customer',
valueHelpDefinition: [{ entity: { name: 'D_Q2CCustomerCVH',
element: 'Customer' } }]
}
@ObjectModel: {
foreignKey.association: '_SoldToPartyVH',
text.element: ['SoldToPartyName']
}
Return.SoldToParty,
@Semantics.text:true
@Consumption.filter.hidden: true
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_CUSTRET_UI_PARTNER_UTIL'
cast('' as ad_namtext ) as SoldToPartyName,
@UI:{
fieldGroup:{ qualifier: 'Status1', position: 10 ,importance: #HIGH },
textArrangement: #TEXT_ONLY
}
Return.OverallSDProcessStatus,
@UI:{
fieldGroup:{ qualifier: 'Status1', position: 20, importance: #HIGH },
textArrangement: #TEXT_ONLY
}
Return.OverallSDDocumentRejectionSts,
@UI:{
fieldGroup:{ qualifier: 'Status2', position: 10, importance: #HIGH },
textArrangement: #TEXT_ONLY
}
Return.OverallTotalDeliveryStatus,
@UI:{
fieldGroup:{ qualifier: 'Status2', position: 20, importance: #HIGH, label: 'Billing Status' },
textArrangement: #TEXT_ONLY
}
Return.OverallOrdReltdBillgStatus,
@UI:{
fieldGroup:{ qualifier: 'Approval', position: 10, importance: #HIGH, criticality: 'CustRetApprvlStsCriticality' },
textArrangement: #TEXT_ONLY
}
Return.SalesDocApprovalStatus,
@UI.hidden: true
cast(
case
when Return.SalesDocApprovalStatus = 'A' then 2 -- | 2: yellow colour
when Return.SalesDocApprovalStatus = 'B' then 3 -- | 3: green colour
when Return.SalesDocApprovalStatus = 'C' then 1 -- | 1: red colour
when Return.SalesDocApprovalStatus = 'D' then 2 -- | 2: yellow colour
else 0 -- | 0: neutral
end as abap.int1 ) as CustRetApprvlStsCriticality,
@UI:{
fieldGroup:{ qualifier: 'Approval', position: 20, importance: #HIGH },
textArrangement: #TEXT_FIRST
}
@ObjectModel.text.element: ['SDApprovalReasonName']
@EndUserText.label: 'Approval Request Reason'
Return.CustomerReturnApprovalReason,
@UI.hidden: true
_CustRetApprovalReason._SDApprovalReasonT[1: Language=$session.system_language].SDApprovalReasonName,
@DefaultAggregation: #NONE
@Semantics.amount.currencyCode: 'TransactionCurrency'
@UI:{
dataPoint:{ title: 'Net Value' }
}
Return.TotalNetAmount,
@Semantics.currencyCode: true
Return.TransactionCurrency,
//First Block - General Information
@UI:{
identification:{ position:10, importance: #HIGH }
}
cast( concat_with_space(
concat(
concat(
Return._SalesOrganization._Text[1: Language=$session.system_language].SalesOrganizationName,
concat_with_space(',',Return._DistributionChannel._Text[1: Language=$session.system_language].DistributionChannelName,1)
),
','
),
Return._OrganizationDivision._Text[1: Language=$session.system_language].DivisionName
,1) as txt_vtrber) as SalesAreaDesc,
Return.SalesOrganization,
Return.DistributionChannel,
Return.OrganizationDivision,
// @UI.identification: { position: 20 }
// @EndUserText.label: 'City'
// _ShipToParty._DfltAddrRprstn.CityName,
//
// _ShipToParty._DfltAddrRprstn._Country._Text[1: Language=$session.system_language ].CountryName,
// @UI.identification: { position: 30 }
// @EndUserText.label: 'Country or Region'
// @ObjectModel.text.element: [ 'CountryName' ]
// _ShipToParty._DfltAddrRprstn.Country as Country,
@ObjectModel.text.element: ['ResponsibleEmployeeName']
@UI:{
identification:{ position: 40, importance: #HIGH, label: 'Employee Responsible' }
}
@Search.defaultSearchElement: false
@EndUserText.label: 'Responsible Employee'
cast(_ResponsibleEmployee.Personnel as resp_empl preserving type ) as ResponsibleEmployee,
@Search.defaultSearchElement: false // without this annotation the search does not work (needed for local testing and START)
@Consumption.filter.hidden: true
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_CUSTRET_UI_PARTNER_UTIL'
cast('' as ad_namtext ) as ResponsibleEmployeeName,
@UI.identification: {position:50, importance: #HIGH}
Return.SDDocumentReason,
//Second Block - Reference Information
@Semantics.systemDate.createdAt: true
@UI:{
fieldGroup:{ qualifier: 'ReferenceDocument', position: 10, importance: #HIGH }
}
Return.CustomerReturnDate,
@UI:{
fieldGroup:{ qualifier: 'ReferenceDocument', position: 20, importance: #HIGH }
}
Return.PurchaseOrderByCustomer,
@Semantics.businessDate.at: true
@UI:{
fieldGroup:{ qualifier: 'ReferenceDocument', position: 30, importance: #HIGH }
}
Return.CustomerPurchaseOrderDate,
//Thrid Block - Return Information
//Administrative Data fields
@UI:{fieldGroup: [{qualifier: 'ReturnData', position: 10, importance: #HIGH}],
textArrangement: #TEXT_FIRST
}
@ObjectModel.text.element: ['CreatedByUserDescription']
Return.CreatedByUser,
@UI.hidden: true
Return._CreatedByUser.UserDescription as CreatedByUserDescription,
@UI: { fieldGroup: [{qualifier: 'ReturnData', position: 20, importance: #HIGH} ] }
@Semantics.systemDate.createdAt: true
Return.CreationDate,
@UI: {
fieldGroup: [{qualifier: 'ReturnData', position: 30, importance: #HIGH} ],
textArrangement: #TEXT_FIRST
}
@ObjectModel.text.element: ['LastChangedByUserDescription']
Return.LastChangedByUser,
@UI.hidden: true
Return._LastChangedByUser.UserDescription as LastChangedByUserDescription,
@UI: { fieldGroup: [{ qualifier: 'ReturnData', position: 40, importance: #HIGH } ] }
case tstmp_is_valid(cast(Return.LastChangeDateTime as abap.dec(15,0)))
when 0 then cast( dats_tims_to_tstmp( Return.CreationDate, Return.CreationTime, 'UTC', $session.client, 'NULL' ) as last_changed_date_time )
else cast( Return.LastChangeDateTime as last_changed_date_time )
end as LastChangeDateTime,
@UI:{
fieldGroup:{ qualifier: 'SoldToParty', position: 30, importance: #HIGH, label: 'Ship-To Party' }
}
@ObjectModel.text.element: ['ShipToPartyName']
@Consumption.semanticObject: 'Customer'
_ShipToParty.Customer as ShipToParty,
@Semantics.text:true
@Consumption.filter.hidden: true
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_CUSTRET_UI_PARTNER_UTIL'
cast('' as ad_namtext ) as ShipToPartyName,
//Do not remove! This is required for setting UI display payment card
@Consumption.filter.hidden: true
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_CUSTOMER_RETURN_VE'
cast( '' as boolean preserving type ) as IsValid,
//Associations
_Item,
_SDDocumentPartnerCard,
_SlsDocPaymentPlanItem,
_SoldToPartyVH,
_OverallSDProcessStatus,
_OverallTotalDeliveryStatus,
_OverallOrdReltdBillgStatus,
_OverallSDDocumentRejectionSts,
_SalesDocApprovalStatus,
_CustRetApprovalReason,
_ShipToParty,
_EmployeeResponsible,
_SDDocumentReason
}