C_ReturnsReferenceDocVH

DDL: C_RETURNSREFERENCEDOCVH Type: view_entity CONSUMPTION

Return Reference Document

C_ReturnsReferenceDocVH is a Consumption CDS View that provides data about "Return Reference Document" in SAP S/4HANA. It reads from 2 data sources (I_CustRetCpyCtrlSrceDocType, I_CustRetCpyCtrlSrceDocType) and exposes 24 fields with key fields ReferenceSDDocument, DeliveryDocument, DeliveryDocument.

Data Sources (2)

SourceAliasJoin Type
I_CustRetCpyCtrlSrceDocType CustRetCpyCtrlSrceDocTyp inner
I_CustRetCpyCtrlSrceDocType CustRetCpyCtrlSrceDocType inner

Annotations (10)

NameValueLevelField
Metadata.ignorePropagatedAnnotations true view
AccessControl.authorizationCheck #CHECK 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
EndUserText.label Return Reference Document view
Search.searchable true view

Fields (24)

KeyFieldSource TableSource FieldDescription
KEY ReferenceSDDocument
KEY DeliveryDocument DeliveryDocument DeliveryDocument
SDDocumentCategory SalesDocument SDDocumentCategory
SDDocumentCategoryName
DocumentDate SalesDocument SalesDocumentDate
SoldToParty SalesDocument SoldToParty
ShipToParty
ResponsibleEmployeeUserID Employee Responsible
SDDocumentType SalesDocument SalesDocumentType
ShippingPoint DeliveryDocument ShippingPoint
SalesOrganization SalesDocument SalesOrganization
DistributionChannel SalesDocument DistributionChannel
KEY DeliveryDocument DeliveryDocument DeliveryDocument
SDDocumentCategory BillingDocument SDDocumentCategory
SDDocumentCategoryName
DocumentDate BillingDocument BillingDocumentDate
SoldToParty BillingDocument SoldToParty
ShipToParty
ResponsibleEmployeeUserID
SDDocumentType BillingDocument BillingDocumentType
ShippingPoint DeliveryDocument ShippingPoint
SalesOrganization BillingDocument SalesOrganization
DistributionChannel BillingDocument DistributionChannel
Division BillingDocument Division
@Metadata: {
  ignorePropagatedAnnotations: true
}
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #NOT_REQUIRED
@VDM.viewType: #CONSUMPTION
@ObjectModel.dataCategory: #VALUE_HELP
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #XL
@EndUserText.label: 'Return Reference Document'
@Search.searchable: true

define view entity C_ReturnsReferenceDocVH
  as select distinct from I_SalesDocument             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
{
      @Search.ranking: #HIGH
      @Search.fuzzinessThreshold: 0.8
      @Search.defaultSearchElement: true
  key cast(SalesDocument.SalesDocument as vgbel)                                    as ReferenceSDDocument,
  key DeliveryDocument.DeliveryDocument,
      
      @UI.hidden: true
      SalesDocument.SDDocumentCategory,
      SalesDocument._SDDocumentCategory._Text[1: Language=$session.system_language].SDDocumentCategoryName,

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

      SalesDocument.SoldToParty,
      SalesDocument._StandardPartner.ShipToParty                                    as ShipToParty,
      @EndUserText.label: 'Employee Responsible'
      cast(SalesDocument._Partner[  PartnerFunction = 'ZM'].Personnel as resp_empl_userid)  as ResponsibleEmployeeUserID,
     
      // For Access control

      @Consumption.hidden: true
      @UI.hidden: true
      SalesDocument.SalesDocumentType                                               as SDDocumentType,

      @Consumption.hidden: true
      @UI.hidden: true
      DeliveryDocument.ShippingPoint                                                as ShippingPoint,

      SalesDocument.SalesOrganization                                               as SalesOrganization,

      SalesDocument.DistributionChannel                                             as DistributionChannel,

      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 CustRetCpyCtrlSrceDocType  on CustRetCpyCtrlSrceDocType.SourceBillingDocumentType = BillingDocument.BillingDocumentType
  left outer to many join P_ReturnsReferenceDocument  as DeliveryDocument           on  DeliveryDocument.SDDocument = BillingDocument.BillingDocument
{
  key  cast(BillingDocument.BillingDocument as vgbel)                                               as ReferenceSDDocument,
  key  DeliveryDocument.DeliveryDocument,

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

       BillingDocument.BillingDocumentDate                                                          as DocumentDate,

       BillingDocument.SoldToParty,
       cast(BillingDocument._Partner[  PartnerFunction = 'WE'].Customer as kunwe)                   as ShipToParty,
       cast(BillingDocument._Partner[  PartnerFunction = 'ZM'].Personnel as resp_empl_userid)      as ResponsibleEmployeeUserID,

       // For Access control

       BillingDocument.BillingDocumentType                                                          as SDDocumentType,

       DeliveryDocument.ShippingPoint                                                               as ShippingPoint,

       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'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BILLINGDOCUMENT",
"I_BILLINGDOCUMENTPARTNER",
"I_CUSTRETCPYCTRLSRCEDOCTYPE",
"I_SALESDOCUMENT",
"I_SALESDOCUMENTPARTNER",
"I_SALESDOCUMENTSTANDARDPARTNER",
"I_SDDOCUMENTCATEGORY",
"I_SDDOCUMENTCATEGORYTEXT",
"P_RETURNSREFERENCEDOCUMENT"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/