C_CustRetRefSDDocumentVH

DDL: C_CUSTRETREFSDDOCUMENTVH Type: view_entity CONSUMPTION Package: ODATA_SD_RETURN_V2

Customer Return Reference SD Document

C_CustRetRefSDDocumentVH is a Consumption CDS View that provides data about "Customer Return Reference SD Document" in SAP S/4HANA. It reads from 2 data sources (I_CustRetCpyCtrlSrceDocType, I_CustRetCpyCtrlSrceDocType) and exposes 22 fields with key fields ReferenceSDDocument, DeliveryDocument, DeliveryDocument. It has 2 associations to related views. Part of development package ODATA_SD_RETURN_V2.

Data Sources (2)

SourceAliasJoin Type
I_CustRetCpyCtrlSrceDocType CustRetCpyCtrlSrceDocTyp inner
I_CustRetCpyCtrlSrceDocType CustRetCpyCtrlSrceDocTyp inner

Associations (2)

CardinalityTargetAliasCondition
[0..*] I_SDDocumentCategoryText _SDDocCategoryText SalesDocument.SDDocumentCategory = _SDDocCategoryText.SDDocumentCategory
[0..1] I_SalesDocumentPartner _SalesDocumentPartner _SalesDocumentPartner.SalesDocument = SalesDocument.SalesDocument and _SalesDocumentPartner.PartnerFunction = 'AG'

Annotations (12)

NameValueLevelField
Metadata.ignorePropagatedAnnotations true view
AccessControl.authorizationCheck #MANDATORY view
AccessControl.personalData.blocking #NOT_REQUIRED view
VDM.viewType #CONSUMPTION view
ObjectModel.dataCategory #VALUE_HELP view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.representativeKey ReferenceSDDocument view
EndUserText.label Customer Return Reference SD Document view
Search.searchable true view
Consumption.valueHelpDefault.fetchValues #ON_EXPLICIT_REQUEST view

Fields (22)

KeyFieldSource TableSource FieldDescription
KEY ReferenceSDDocument
KEY DeliveryDocument DeliveryDocument DeliveryDocument
SDDocumentCategory SalesDocument SDDocumentCategory
SDDocumentCategoryName
DocumentDate SalesDocument SalesDocumentDate
SoldToParty SalesDocument SoldToParty
SoldToPartyName _SalesDocumentPartner FullName Sold-to Party Name
ShippingPoint DeliveryDocument ShippingPoint
SDDocumentType
SalesOrganization SalesDocument SalesOrganization
DistributionChannel SalesDocument DistributionChannel
KEY DeliveryDocument DeliveryDocument DeliveryDocument
SDDocumentCategory BillingDocument SDDocumentCategory
SDDocumentCategoryName
DocumentDate BillingDocument BillingDocumentDate
SoldToParty BillingDocument SoldToParty
SoldToPartyName _SalesDocumentPartner FullName
ShippingPoint DeliveryDocument ShippingPoint
SDDocumentType
SalesOrganization BillingDocument SalesOrganization
DistributionChannel BillingDocument DistributionChannel
Division BillingDocument Division
@Metadata: {
  ignorePropagatedAnnotations: true
}
@AccessControl.authorizationCheck: #MANDATORY
@AccessControl.personalData.blocking: #NOT_REQUIRED
@VDM.viewType: #CONSUMPTION
@ObjectModel.dataCategory: #VALUE_HELP
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.representativeKey: 'ReferenceSDDocument'
@EndUserText.label: 'Customer Return Reference SD Document'
@Search.searchable: true
@Consumption.valueHelpDefault.fetchValues: #ON_EXPLICIT_REQUEST

define view entity C_CustRetRefSDDocumentVH
  as select distinct from I_SalesDocumentBasic         as SalesDocument
  inner join              I_CustRetCpyCtrlSrceDocType  as CustRetCpyCtrlSrceDocTyp      on CustRetCpyCtrlSrceDocTyp.SourceSalesDocumentType = SalesDocument.SalesDocumentType
  left outer to many join P_ReturnsReferenceDocument   as DeliveryDocument              on DeliveryDocument.SDDocument = SalesDocument.SalesDocument
  
  association [0..*] to I_SDDocumentCategoryText       as _SDDocCategoryText            on SalesDocument.SDDocumentCategory = _SDDocCategoryText.SDDocumentCategory
  association [0..1] to I_SalesDocumentPartner         as _SalesDocumentPartner         on _SalesDocumentPartner.SalesDocument = SalesDocument.SalesDocument and
                                                                                           _SalesDocumentPartner.PartnerFunction = 'AG'
{
      @Search.ranking: #HIGH
      @Search.fuzzinessThreshold: 0.9
      @Search.defaultSearchElement: true
  key cast(SalesDocument.SalesDocument as vgbel preserving type)                    as ReferenceSDDocument,
      @Search.fuzzinessThreshold: 0.9
      @Search.defaultSearchElement: true
  key DeliveryDocument.DeliveryDocument,

      @Consumption: {valueHelpDefinition: [{ entity: {  name:  'C_RetsRefDocCategoryValueHelp',
                                                      element: 'SDDocumentCategory' }
                                        }],
                     valueHelpDefault.initialValueIsSignificant: true}
      @UI.textArrangement: #TEXT_FIRST
      @ObjectModel.text.element: ['SDDocumentCategoryName']
      SalesDocument.SDDocumentCategory,
      @UI.hidden: true
      @Semantics.text: true
      _SDDocCategoryText[1: Language=$session.system_language].SDDocumentCategoryName,

      @Consumption.filter: { selectionType: #INTERVAL, multipleSelections: false }
      SalesDocument.SalesDocumentDate                                               as DocumentDate,

      @Consumption: {
       valueHelpDefinition:[{
         entity            : { name:    'C_SoldToSalesAreaVH', element: 'Customer' } },
       { qualifier         : 'SalesAreaSpecificSoldToVH' ,
         label             : 'Sold-to Party By Sales Area',
         entity            : { name: 'C_SoldToSlsOrgDistrChnlDivVH', element: 'Customer' } },
       { qualifier         : 'SoldToMultiAddrVH' ,
         label             : 'Sold-to Party by All Addresses',
         entity            : { name: 'C_SoldToMultipleAddressVH', element: 'SoldToParty' } }]}
      @UI.textArrangement: #TEXT_FIRST
      @ObjectModel.text.element: ['SoldToPartyName']
      SalesDocument.SoldToParty,
      
      @Semantics.text: true
      @UI.hidden: true
      @EndUserText.label : 'Sold-to Party Name'
      _SalesDocumentPartner.FullName                                                as SoldToPartyName,
      
      @Consumption.hidden: true
      DeliveryDocument.ShippingPoint                                                as ShippingPoint,
     
      // For Access control

      @Consumption.hidden: true
      cast(SalesDocument.SalesDocumentType as vbart preserving type)                as SDDocumentType,
      @Consumption.hidden: true
      SalesDocument.SalesOrganization                                               as SalesOrganization,
      @Consumption.hidden: true
      SalesDocument.DistributionChannel                                             as DistributionChannel,
      @Consumption.hidden: true
      SalesDocument.OrganizationDivision                                            as Division
}
where
  //Get rid of incomplete sales order in reference document

      SalesDocument.HdrGeneralIncompletionStatus       = 'C'
  and SalesDocument.OvrlItmGeneralIncompletionSts      = 'C'

union all

select distinct from      I_BillingDocument           as BillingDocument
  inner join              I_CustRetCpyCtrlSrceDocType as CustRetCpyCtrlSrceDocTyp      on CustRetCpyCtrlSrceDocTyp.SourceBillingDocumentType = BillingDocument.BillingDocumentType
  left outer to many join P_ReturnsReferenceDocument  as DeliveryDocument              on DeliveryDocument.SDDocument = BillingDocument.BillingDocument

  association [0..*] to   I_SDDocumentCategoryText    as _SDDocCategoryText            on BillingDocument.SDDocumentCategory = _SDDocCategoryText.SDDocumentCategory
  association [0..1] to   I_SalesDocumentPartner      as _SalesDocumentPartner         on _SalesDocumentPartner.SalesDocument = BillingDocument.BillingDocument and
                                                                                          _SalesDocumentPartner.PartnerFunction = 'AG'
{
  key  cast(BillingDocument.BillingDocument as vgbel preserving type)                               as ReferenceSDDocument,
  key  DeliveryDocument.DeliveryDocument,

       BillingDocument.SDDocumentCategory, 
       _SDDocCategoryText[1: Language=$session.system_language].SDDocumentCategoryName,

       BillingDocument.BillingDocumentDate                                                          as DocumentDate,

       BillingDocument.SoldToParty,
       
       _SalesDocumentPartner.FullName                                                               as SoldToPartyName,
       
       DeliveryDocument.ShippingPoint                                                               as ShippingPoint,

       // For Access control

       cast(BillingDocument.BillingDocumentType as vbart preserving type)                           as SDDocumentType,
       BillingDocument.SalesOrganization                                                            as SalesOrganization,
       BillingDocument.DistributionChannel                                                          as DistributionChannel,
       BillingDocument.Division                                                                     as Division
}
where
  //Add is draft filter to get rid of temporary billing in reference document

      BillingDocument.BillingDocumentIsTemporary       =  ''
  and BillingDocument.BillingDocumentIsCancelled       <> 'X'