C_ReturnsReferenceDocVH
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. Part of development package ODATA_SD_RETURN_V2.
Data Sources (2)
| Source | Alias | Join Type |
|---|---|---|
| I_CustRetCpyCtrlSrceDocType | CustRetCpyCtrlSrceDocTyp | inner |
| I_CustRetCpyCtrlSrceDocType | CustRetCpyCtrlSrceDocType | inner |
Annotations (10)
| Name | Value | Level | Field |
|---|---|---|---|
| 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)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| 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'
Learn More
- What Is a CDS View in SAP S/4HANA?
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- CDS View Annotations — A Complete Guide
- CDS View Field Mapping and Associations
- Understanding the SAP S/4HANA Data Model
- CDS View Extensions and Custom Fields in SAP S/4HANA
- Released APIs and Stability Contracts in SAP S/4HANA