P_AR_LengthOfRefDoc
P_AR_LengthOfRefDoc is a Composite CDS View in SAP S/4HANA. It reads from 7 data sources and exposes 27 fields with key fields CompanyCode, AccountingDocument, DocumentReferenceID, FiscalYear, AccountingDocument.
Data Sources (7)
| Source | Alias | Join Type |
|---|---|---|
| I_AccountingDocument | I_AccountingDocument | from |
| I_AR_DocumentTypeClass | I_AR_DocumentTypeClass | inner |
| I_BillingDocumentBasic | I_BillingDocumentBasic | union_all |
| I_BillingDocumentType | I_BillingDocumentType | inner |
| I_DeliveryDocument | I_DeliveryDocument | union_all |
| I_DeliveryDocumentType | I_DeliveryDocumentType | inner |
| I_SalesOrganization | I_SalesOrganization | inner |
Annotations (10)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | PLENREFDOC | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| VDM.viewType | #COMPOSITE | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view | |
| ObjectModel.usageType.sizeCategory | #XL | view | |
| ObjectModel.usageType.serviceQuality | #D | view | |
| ObjectModel.usageType.dataClass | #MIXED | view | |
| AccessControl.personalData.blocking | #NOT_REQUIRED | view | |
| VDM.private | true | view |
Fields (27)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | CompanyCode | I_AccountingDocument | CompanyCode | Receiver Company Code |
| KEY | AccountingDocument | I_AccountingDocument | AccountingDocument | SD Document |
| KEY | DocumentReferenceID | I_AccountingDocument | DocumentReferenceID | Reference |
| KEY | FiscalYear | I_AccountingDocument | FiscalYear | G/L Fiscal Year |
| AccountingDocumentType | I_AR_DocumentTypeClass | AccountingDocumentType | Journal Entry Type | |
| DocumentClass | I_AR_DocumentTypeClass | DocumentClass | Series Doc. Class | |
| refdoc | ||||
| subsbl | ||||
| CompanyCodeasCompanyCode | ||||
| KEY | AccountingDocument | I_DeliveryDocument | DeliveryDocument | SD Document |
| KEY | DocumentReferenceID | I_DeliveryDocument | ReferenceDocumentNumber | Reference |
| KEY | CreationDate14endendasFiscalyear | |||
| AccountingDocumentType | Journal Entry Type | |||
| CreationDateendendasReportingDate | ||||
| DocumentClass | Series Doc. Class | |||
| refdoc | ||||
| subsbl | ||||
| CompanyCodeasCompanyCode | ||||
| KEY | AccountingDocument | I_BillingDocumentBasic | BillingDocument | SD Document |
| KEY | DocumentReferenceID | I_BillingDocumentBasic | DocumentReferenceID | Reference |
| KEY | Fiscalyear | |||
| AccountingDocumentType | Journal Entry Type | |||
| ReportingDate | I_BillingDocumentBasic | BillingDocumentDate | Billing Date | |
| DocumentClass | Series Doc. Class | |||
| refdoc | ||||
| subsbl | ||||
| subsbl1 |
Derived SQL interpretation, reconstructed from the parsed view metadata (data sources, associations, and field mappings). SAP annotations are omitted and the structure is reformulated as SQL — this is a functional approximation, not the verbatim SAP source.
-- Derived SQL interpretation of CDS view P_AR_LengthOfRefDoc.
-- Reconstructed from parsed metadata (data sources, associations, fields).
-- SAP annotations are omitted and the structure is reformulated as SQL;
-- this is a functional approximation, not the verbatim SAP source. Some join
-- conditions may be unavailable and a few CDS constructs are kept as-is.
-- SQL view name: PLENREFDOC
CREATE VIEW P_AR_LengthOfRefDoc AS
SELECT
I_AccountingDocument.CompanyCode AS CompanyCode,
I_AccountingDocument.AccountingDocument AS AccountingDocument,
I_AccountingDocument.DocumentReferenceID AS DocumentReferenceID,
I_AccountingDocument.FiscalYear AS FiscalYear,
I_AR_DocumentTypeClass.AccountingDocumentType AS AccountingDocumentType,
I_AR_DocumentTypeClass.DocumentClass AS DocumentClass,
length (I_AccountingDocument.DocumentReferenceID ) AS refdoc,
substring(I_AccountingDocument.DocumentReferenceID,2,4) AS subsbl,
substring(I_AccountingDocument.DocumentReferenceID,1,4) as subsbl1 AS CompanyCodeasCompanyCode,
case when I_SalesOrganization.ArgentinaDeliveryDateEvent = '1' then substring(I_DeliveryDocument.ActualGoodsMovementDate,1,4) else case when I_SalesOrganization.ArgentinaDeliveryDateEvent = '3' then substring(I_DeliveryDocument.CreationDate,1,4) end end as Fiscalyear AS CreationDate14endendasFiscalyear,
case when I_SalesOrganization.ArgentinaDeliveryDateEvent = '1' then I_DeliveryDocument.ActualGoodsMovementDate else case when I_SalesOrganization.ArgentinaDeliveryDateEvent = '3' then I_DeliveryDocument.CreationDate end end as ReportingDate AS CreationDateendendasReportingDate,
I_BillingDocumentBasic.BillingDocumentDate AS ReportingDate,
substring(I_BillingDocumentBasic.DocumentReferenceID,1,4) AS subsbl1
FROM I_AccountingDocument
INNER JOIN I_AR_DocumentTypeClass ON /* join condition not captured in parsed metadata */
INNER JOIN I_SalesOrganization ON /* join condition not captured in parsed metadata */
INNER JOIN I_DeliveryDocumentType ON /* join condition not captured in parsed metadata */
INNER JOIN I_BillingDocumentType ON /* join condition not captured in parsed metadata */
-- UNION ALL with additional select branch(es): I_DeliveryDocument, I_BillingDocumentBasic
;
Learn More
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- CDS View Annotations — A Complete Guide
- What Is a CDS View in SAP S/4HANA?
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- 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
- BSEG to ACDOCA: The Universal Journal Migration
- Business Partner Migration: KNA1/LFA1 to BUT000
- Material Document Migration: MSEG/MKPF to MATDOC
- How to Find the Right CDS View for an SAP Table
- BW Extractor to CDS View Migration Guide
- S/4HANA CDS View Deprecation: What You Need to Know
- ABAP CDS View Tutorial — From Basics to Real-World Examples
- RAP and CDS Views — Building Transactional Apps in SAP S/4HANA
- Sales Document Status Migration: VBUP/VBUK Removal in S/4HANA
- CO Tables in S/4HANA: COEP, COBK, COSS, COSP to ACDOCA