C_Customerreturnfs

DDL: C_CUSTOMERRETURNFS SQL: CCUSTRETURNFS Type: view CONSUMPTION Package: ODATA_SD_RETURN

Returns Order Fact Sheet

C_Customerreturnfs is a Consumption CDS View that provides data about "Returns Order Fact Sheet" in SAP S/4HANA. It reads from 1 data source (I_CustomerReturn) and exposes 46 fields with key field CustomerReturn. It has 8 associations to related views. Part of development package ODATA_SD_RETURN.

Data Sources (1)

SourceAliasJoin Type
I_CustomerReturn Return from

Associations (8)

CardinalityTargetAliasCondition
[0..1] C_Q2CCustomerQuickView _SoldToPartyVH $projection.SoldToParty = _SoldToPartyVH.Customer
[0..*] C_Customerreturnitemfs _Item $projection.CustomerReturn = _Item.CustomerReturn
[0..*] C_SDDocumentPartnerCard _SDDocumentPartnerCard $projection.CustomerReturn = _SDDocumentPartnerCard.SDDocument and _SDDocumentPartnerCard.SDDocumentItem = '000000'
[0..*] C_SlsDocPaymentPlanItem _SlsDocPaymentPlanItem $projection.CustomerReturn = _SlsDocPaymentPlanItem.SalesDocument
[0..1] I_SDDocumentCustomer _ShipToParty $projection.CustomerReturn = _ShipToParty.SDDocument and _ShipToParty.PartnerFunction = 'WE'
[0..1] I_SDDocumentPersonnel _EmployeeResponsible $projection.CustomerReturn = _EmployeeResponsible.SDDocument and _EmployeeResponsible.PartnerFunction = 'ZM'
[0..1] I_SalesDocumentPartner _ResponsibleEmployee $projection.CustomerReturn = _ResponsibleEmployee.SalesDocument and _ResponsibleEmployee.PartnerFunction = 'ZM'
[0..1] E_SalesDocumentBasic _Extension $projection.CustomerReturn = _Extension.SalesDocument

Annotations (16)

NameValueLevelField
ClientHandling.algorithm #SESSION_VARIABLE view
AbapCatalog.sqlViewName CCUSTRETURNFS view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #CHECK view
AccessControl.personalData.blocking #NOT_REQUIRED view
VDM.viewType #CONSUMPTION view
EndUserText.label Returns Order Fact Sheet view
ObjectModel.compositionRoot true view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #XXL view
Search.searchable true view
UI.headerInfo.typeName Customer Return view
UI.headerInfo.typeNamePlural Customer Returns view
UI.headerInfo.title.type #STANDARD view
UI.headerInfo.title.value SalesDocumentTypeName view

Fields (46)

KeyFieldSource TableSource FieldDescription
KEY CustomerReturn I_CustomerReturn CustomerReturn
SalesDocumentTypeName Sales Document Type Name
CustomerReturnType I_CustomerReturn CustomerReturnType
SoldToParty I_CustomerReturn SoldToParty
SoldToPartyName
OverallSDProcessStatus I_CustomerReturn OverallSDProcessStatus
OverallSDDocumentRejectionSts I_CustomerReturn OverallSDDocumentRejectionSts
OverallTotalDeliveryStatus I_CustomerReturn OverallTotalDeliveryStatus
OverallOrdReltdBillgStatus I_CustomerReturn OverallOrdReltdBillgStatus
SalesDocApprovalStatus I_CustomerReturn SalesDocApprovalStatus
int1asCustRetApprvlStsCriticality
CustomerReturnApprovalReason I_CustomerReturn CustomerReturnApprovalReason Approval Request Reason
SDApprovalReasonName
TotalNetAmount I_CustomerReturn TotalNetAmount
TransactionCurrency I_CustomerReturn TransactionCurrency
DivisionName1astxt_vtrberasSalesAreaDesc
SalesOrganization I_CustomerReturn SalesOrganization
DistributionChannel I_CustomerReturn DistributionChannel
OrganizationDivision I_CustomerReturn OrganizationDivision
ResponsibleEmployee Responsible Employee
ResponsibleEmployeeName
SDDocumentReason I_CustomerReturn SDDocumentReason
CustomerReturnDate I_CustomerReturn CustomerReturnDate
PurchaseOrderByCustomer I_CustomerReturn PurchaseOrderByCustomer
CustomerPurchaseOrderDate I_CustomerReturn CustomerPurchaseOrderDate
CreatedByUser I_CustomerReturn CreatedByUser
CreatedByUserDescription
CreationDate I_CustomerReturn CreationDate
LastChangedByUser I_CustomerReturn LastChangedByUser
LastChangedByUserDescription
ShipToParty _ShipToParty Customer
ShipToPartyName
IsValid
_Item _Item
_SDDocumentPartnerCard _SDDocumentPartnerCard
_SlsDocPaymentPlanItem _SlsDocPaymentPlanItem
_SoldToPartyVH _SoldToPartyVH
_OverallSDProcessStatus _OverallSDProcessStatus
_OverallTotalDeliveryStatus _OverallTotalDeliveryStatus
_OverallOrdReltdBillgStatus _OverallOrdReltdBillgStatus
_OverallSDDocumentRejectionSts _OverallSDDocumentRejectionSts
_SalesDocApprovalStatus _SalesDocApprovalStatus
_CustRetApprovalReason _CustRetApprovalReason
_ShipToParty _ShipToParty
_EmployeeResponsible _EmployeeResponsible
_SDDocumentReason _SDDocumentReason
@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
      @UI.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)

      @UI.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
      @UI.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
}