@ClientHandling.algorithm: #SESSION_VARIABLE
@EndUserText.label: 'Returns Order Object Page'
@VDM.viewType: #CONSUMPTION
@AccessControl: {
authorizationCheck: #CHECK,
personalData.blocking: #NOT_REQUIRED,
privilegedAssociations: [ '_IncompletionLog' ]
}
@AbapCatalog: {
sqlViewName: 'CCUSTRETOPG',
preserveKey: true,
compiler.compareFilter: true
}
@ObjectModel: {
compositionRoot: true,
semanticKey: ['CustomerReturn'],
createEnabled,
updateEnabled,
usageType: {
dataClass: #MIXED,
serviceQuality: #C,
sizeCategory: #XXL
}
}
@Consumption.semanticObject: 'CustomerReturn'
@Search.searchable: false
@UI.headerInfo: {
typeName: 'Customer Return',
typeNamePlural: 'Customer Returns',
title: {
type: #STANDARD,
value: 'CustomerReturn'
}
}
define view C_CustomerReturnOPg
as select
//distinct
from I_CustomerReturn as CustomerReturn
// left outer to one join C_CustomerReturnShipToParty as ShipToPartyComplete on ShipToPartyComplete.CustomerReturn = CustomerReturn.CustomerReturn
// left outer to one join C_SalesDocEmployeeResponsible as EmployeeResponsible on EmployeeResponsible.CustomerReturn = CustomerReturn.CustomerReturn
//Associations
association [0..*] to C_CustomerReturnItemOPg as _CustomerReturnItem on $projection.CustomerReturn = _CustomerReturnItem.CustomerReturn
association [0..*] to C_CustomerReturnRefDoc as _ReturnRefDoc on $projection.CustomerReturn = _ReturnRefDoc.CustomerReturn
and $projection.SalesOrganization = _ReturnRefDoc.SalesOrganization
and $projection.DistributionChannel = _ReturnRefDoc.DistributionChannel
and $projection.OrganizationDivision = _ReturnRefDoc.OrganizationDivision
association [0..*] to C_CustomerReturnRefDocItem as _ReturnRefDocItem on $projection.CustomerReturn = _ReturnRefDocItem.CustomerReturn
and $projection.SalesOrganization = _ReturnRefDocItem.SalesOrganization
and $projection.DistributionChannel = _ReturnRefDocItem.DistributionChannel
and $projection.OrganizationDivision = _ReturnRefDocItem.OrganizationDivision
//Refund
association [0..*] to C_CustomerReturnItemRefund as _CustRetItemRefund on $projection.CustomerReturn = _CustRetItemRefund.CustomerReturn
//Contacts
association [0..*] to C_InternalContacts as _InternalContacts on $projection.CustomerReturn = _InternalContacts.SDDocument
association [0..*] to C_ExternalContacts as _ExternalContacts on $projection.CustomerReturn = _ExternalContacts.SDDocument
//Business Partners
//association [0..1] to I_Customer as _SoldToParty on $projection.SoldToParty = _SoldToParty.Customer
//association [0..1] to I_Customer as _Customer on $projection.ShipToParty = _Customer.Customer
association [0..*] to C_SDDocumentCustomer as _BusinessPartners on $projection.CustomerReturn = _BusinessPartners.SDDocument
association [0..1] to I_CustReturnSubsqntProcgSts as _ReldForSubsqntProcgSts on $projection.CustomerReturn = _ReldForSubsqntProcgSts.CustomerReturn
//Electronic Payment
association [0..*] to C_SlsDocPaymentPlanItem as _PaymentPlanItemDetails on $projection.CustomerReturn = _PaymentPlanItemDetails.SalesDocument
//Value Helps
association [0..1] to C_SDDocumentCustomerVH as _ShipToPartyVH on $projection.ShipToParty = _ShipToPartyVH.Customer
and $projection.addressid = _ShipToPartyVH.AddressID
association [0..1] to C_EmployeeValueHelp as _EmplResp_VH on $projection.ResponsibleEmployee = _EmplResp_VH.PersonnelNumber
//Text Associations
association [0..*] to I_SDDocumentCategoryText as _SDDocumentCategoryText on $projection.ReferenceSDDocumentCategory = _SDDocumentCategoryText.SDDocumentCategory
association [0..*] to I_SalesDocumentTypeText as _SalesDocumentTypeText on $projection.CustomerReturnType = _SalesDocumentTypeText.SalesDocumentType
association [0..*] to I_OverallSDDocumentRjcnStatusT as _OverallSDDocumentRejectionSts on $projection.OverallSDDocumentRejectionSts = _OverallSDDocumentRejectionSts.OverallSDDocumentRejectionSts
association [0..*] to I_ShippingConditionText as _ShippingConditionText on $projection.ShippingCondition = _ShippingConditionText.ShippingCondition
//Extensibility
association [0..1] to E_SalesDocumentBasic as _Extension on $projection.CustomerReturn = _Extension.SalesDocument
//Incompletion log
association [0..*] to I_SDDocumentIncompletionLog as _IncompletionLog on $projection.CustomerReturn = _IncompletionLog.SDDocument
{
@Consumption.semanticObject: 'CustomerReturn'
key CustomerReturn.CustomerReturn,
@ObjectModel.text.association: '_SalesDocumentTypeText'
CustomerReturn.CustomerReturnType,
@UI.hidden: true
_CustomerReturnType.RetsMgmtIsActive as RetsMgmtIsActive,
@ObjectModel.text.element: ['SDDocumentCategoryName']
@Consumption.semanticObject: 'SalesOrder'
case when CustomerReturn.ReferenceSDDocumentCategory = 'C'
then CustomerReturn.ReferenceSDDocument
end as SalesDocument,
@ObjectModel.text.element: ['SDDocumentCategoryName']
@Consumption.semanticObject: 'BillingDocument'
case when CustomerReturn.ReferenceSDDocumentCategory = 'M'
then CustomerReturn.ReferenceSDDocument
end as BillingDocument,
@ObjectModel.text.element: ['SDDocumentCategoryName']
@Consumption.semanticObject: 'SalesOrderWithoutCharge'
case when CustomerReturn.ReferenceSDDocumentCategory = 'I'
then CustomerReturn.ReferenceSDDocument
end as SalesOrderWithoutCharge,
//@ObjectModel.text.association: '_SDDocumentCategoryText'
CustomerReturn.ReferenceSDDocumentCategory,
//Logistical Status
@ObjectModel.readOnly
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_CUSTOMER_RETURN_OPG_VE'
cast('' as return_log_procg_status) as RetsMgmtLogProcgStatus,
@ObjectModel.readOnly
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_CUSTOMER_RETURN_OPG_VE'
cast('' as val_text) as RetsMgmtLogProcgStatusDesc,
//Refund Status
@ObjectModel.readOnly
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_CUSTOMER_RETURN_OPG_VE'
cast('' as msr_fin_status) as RetsMgmtCompnProcgStatus,
@ObjectModel.readOnly
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_CUSTOMER_RETURN_OPG_VE'
cast('' as val_text) as RetsMgmtCompnProcgStatusDesc,
//Processing Status
@ObjectModel.readOnly
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_CUSTOMER_RETURN_OPG_VE'
cast('' as msr_proc_status) as RetsMgmtProcessingStatus,
@ObjectModel.readOnly
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_CUSTOMER_RETURN_OPG_VE'
cast('' as val_text) as RetsMgmtProcessingStatusDesc,
//Approval Status
CustomerReturn.SalesDocApprovalStatus,
CustomerReturn._SalesDocApprovalStatus._Text[1: Language=$session.system_language].SalesDocApprovalStatusDesc,
//Customer
@Consumption.semanticObject: 'Customer'
@ObjectModel.text.element: [ 'SoldToPartyName' ]
SoldToParty,
@UI.hidden: true
@Semantics.text:true
@ObjectModel.readOnly
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_CUSTRET_UI_PARTNER_UTIL'
cast('' as ad_namtext ) as SoldToPartyName,
//_Partner[PartnerFunction='AG'].FullName as SoldToPartyName,
@Consumption.valueHelp: '_ShipToPartyVH'
@ObjectModel.text.element: [ 'ShipToPartyName' ]
@ObjectModel.mandatory: true
cast(_Partner[PartnerFunction='WE'].Customer as kunwe) as ShipToParty,
@ObjectModel.text.association: '_ShippingConditionText'
CustomerReturn.ShippingCondition as ShippingCondition,
@UI.hidden: true
_Partner[PartnerFunction='WE'].AddressID,
@UI.hidden: true
_Partner[PartnerFunction='WE'].AddressPersonID,
@UI.hidden: true
@Semantics.text:true
@ObjectModel.readOnly
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_CUSTRET_UI_PARTNER_UTIL'
cast('' as ad_namtext ) as ShipToPartyName,
//_Partner[PartnerFunction='WE'].FullName as ShipToPartyName,
_Partner[PartnerFunction='WE']._OrgNamePostalAddress.PostalCode as DeliveryAddressPostalCode,
_Partner[PartnerFunction='WE']._OrgNamePostalAddress.CityName as ShipToPartyCityName,
_Partner[PartnerFunction='WE']._OrgNamePostalAddress.Country as ShipToPartyCountry,
_Partner[PartnerFunction='WE']._OrgNamePostalAddress.StreetName as DeliveryAddressStreetName,
_Partner[PartnerFunction='WE']._OrgNamePostalAddress.HouseNumber as DeliveryAddressHouseNumber,
_Partner[PartnerFunction='WE']._OrgNamePostalAddress.HouseNumberSupplementText as ShipToPtyHouseNmbrSuplmntText,
//Return Data
//Only date is available, Name is still missing!
CustomerReturn.LastChangeDate,
CustomerReturn.LastChangeDateTime,
CustomerReturn.CreatedByUser,
CustomerReturn.CustomerReturnDate,
CustomerReturn.PricingDate,
// @Consumption.valueHelpDefinition: [{
// entity: { name: 'C_ReturnsOrderReasonVH',
// element: 'ReturnsOrderReason' }
// }]
@Consumption.valueHelpDefinition: [
{ entity : { name :'C_SlsDocAllowedOrderReasonVH',
element :'SDDocumentReason' },
additionalBinding : [{ localElement: 'SalesOrganization', element: 'SalesOrganization', usage: #FILTER },
{ localElement: 'CustomerReturnType', element: 'SalesDocumentType', usage: #FILTER }],
useForValidation: true,
label: 'Order Reason'
}]
@Consumption.filter.hidden: true
@ObjectModel.text.element: ['SDDocumentReasonText']
@UI.textArrangement: #TEXT_FIRST
cast (CustomerReturn.SDDocumentReason as returns_order_reason) as ReturnsOrderReason,
@UI.hidden: true
_SDDocumentReason._Text[1: Language=$session.system_language].SDDocumentReasonText,
CustomerReturn.PurchaseOrderByCustomer,
@UI.hidden: true
_SDDocumentCategoryText[1: Language=$session.system_language].SDDocumentCategoryName,
@ObjectModel.text.element: ['SDDocumentCategoryName']
CustomerReturn.ReferenceSDDocument,
//Sales Area
cast(concat_with_space(
concat(
concat(
CustomerReturn._SalesOrganization._Text[1: Language=$session.system_language].SalesOrganizationName,
concat_with_space(',',CustomerReturn._DistributionChannel._Text[1: Language=$session.system_language].DistributionChannelName,1)
),
','
),
CustomerReturn._OrganizationDivision._Text[1: Language=$session.system_language].DivisionName
,1) as txt_vtrber) as SalesAreaDesc,
CustomerReturn.SalesOrganization,
CustomerReturn.DistributionChannel,
CustomerReturn.OrganizationDivision,
CustomerReturn.SalesOffice,
CustomerReturn.SalesGroup,
// @Consumption.valueHelp: '_EmplResp_VH'
// @ObjectModel.text.element: [ 'EmployeeFullName' ]
// cast(EmployeeResponsible.EmploymentInternalID as resp_empl) as ResponsibleEmployee,
// EmployeeResponsible.EmployeeFullName,
@Consumption.valueHelp: '_EmplResp_VH'
@ObjectModel.text.element: [ 'ResponsibleEmployeeName' ]
cast(_Partner[PartnerFunction='ZM'].Personnel as resp_empl preserving type ) as ResponsibleEmployee,
@UI.hidden: true
@Semantics.text:true
@ObjectModel.readOnly
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_CUSTRET_UI_PARTNER_UTIL'
cast('' as ad_namtext ) as ResponsibleEmployeeName,
@ObjectModel.text.association: '_OverallSDDocumentRejectionSts'
CustomerReturn.OverallSDDocumentRejectionSts,
@Semantics.amount.currencyCode: 'TransactionCurrency'
CustomerReturn.TotalNetAmount,
@Semantics.currencyCode: true
CustomerReturn.TransactionCurrency,
// Placeholder for DocumentObjectKey
cast('' as objky) as LinkedSAPObjectKey,
_ReldForSubsqntProcgSts.OvrlReldForSubsqntProcgSts,
// Do not remove. This is required for setting the UI ReturnEntireDocument flag.
'' as ReturnActionIsEnabled,
// Do not remove. This is required for setting UI Display Payment Card
// cast(case when _PaymentPlanItemDetails.SalesDocument is null
// then ''
// else 'X'
// end
// as boolean preserving type) as IsValid,
@ObjectModel.readOnly
@ObjectModel.virtualElement: true
@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_CUSTOMER_RETURN_OPG_VE'
cast('' as boolean preserving type) as IsValid,
//Association
_CustomerReturnItem,
_ShipToPartyVH,
_EmplResp_VH,
//_Customer,
//_SoldToParty,
_SDDocumentCategoryText,
_InternalContacts,
_ExternalContacts,
_BusinessPartners,
_CustRetItemRefund,
_ReldForSubsqntProcgSts,
_SalesDocumentTypeText,
_OverallSDDocumentRejectionSts,
_PaymentPlanItemDetails,
CustomerReturn._TransactionCurrency,
_ReturnRefDoc,
_ReturnRefDocItem,
_IncompletionLog,
_ShippingConditionText
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ADDRORGNAMEPOSTALADDRESS",
"I_CUSTOMERRETURN",
"I_CUSTRETURNSUBSQNTPROCGSTS",
"I_DISTRIBUTIONCHANNEL",
"I_DISTRIBUTIONCHANNELTEXT",
"I_DIVISION",
"I_DIVISIONTEXT",
"I_SALESDOCAPPROVALSTATUS",
"I_SALESDOCAPPROVALSTATUST",
"I_SALESDOCUMENTPARTNER",
"I_SALESDOCUMENTTYPE",
"I_SALESORGANIZATION",
"I_SALESORGANIZATIONTEXT",
"I_SDDOCUMENTCATEGORYTEXT",
"I_SDDOCUMENTREASON",
"I_SDDOCUMENTREASONTEXT"
],
"ASSOCIATED":
[
"C_CUSTOMERRETURNITEMOPG",
"C_CUSTOMERRETURNITEMREFUND",
"C_CUSTOMERRETURNREFDOC",
"C_CUSTOMERRETURNREFDOCITEM",
"C_EMPLOYEEVALUEHELP",
"C_EXTERNALCONTACTS",
"C_INTERNALCONTACTS",
"C_SDDOCUMENTCUSTOMER",
"C_SDDOCUMENTCUSTOMERVH",
"C_SLSDOCPAYMENTPLANITEM",
"E_SALESDOCUMENTBASIC",
"I_CURRENCY",
"I_CUSTRETURNSUBSQNTPROCGSTS",
"I_OVERALLSDDOCUMENTRJCNSTATUST",
"I_SALESDOCUMENTTYPETEXT",
"I_SDDOCUMENTCATEGORYTEXT",
"I_SDDOCUMENTINCOMPLETIONLOG",
"I_SHIPPINGCONDITIONTEXT"
],
"BASE":
[
"I_CUSTOMERRETURN"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/