P_AR_LengthOfRefDoc

DDL: P_AR_LENGTHOFREFDOC SQL: PLENREFDOC Type: view COMPOSITE

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)

SourceAliasJoin 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)

NameValueLevelField
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)

KeyFieldSource TableSource FieldDescription
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
;