P_APVendorOpenItems6

DDL: P_APVENDOROPENITEMS6 SQL: PFIAPVNDROPITM6 Type: view COMPOSITE

P_APVendorOpenItems6 is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (I_ReceivablesPayablesItem, P_APVendorOpenItems0) and exposes 11 fields with key fields CompanyCode, AccountingDocument, FiscalYear, AccountingDocumentItem.

Data Sources (2)

SourceAliasJoin Type
I_ReceivablesPayablesItem Clearings left_outer
P_APVendorOpenItems0 UnclrPayments from

Annotations (6)

NameValueLevelField
VDM.private true view
VDM.viewType #COMPOSITE view
AbapCatalog.sqlViewName PFIAPVNDROPITM6 view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
Metadata.ignorePropagatedAnnotations true view

Fields (11)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode P_APVendorOpenItems0 CompanyCode
KEY AccountingDocument P_APVendorOpenItems0 AccountingDocument
KEY FiscalYear P_APVendorOpenItems0 FiscalYear
KEY AccountingDocumentItem P_APVendorOpenItems0 AccountingDocumentItem
OpenAmount P_APVendorOpenItems0 AmountInCompanyCodeCurrency
ClearedAmount
DocumentCurrency P_APVendorOpenItems0 DocumentCurrency
Supplier P_APVendorOpenItems0 Supplier
SpecialGLTransactionType P_APVendorOpenItems0 SpecialGLTransactionType
CompanyCodeCurrency P_APVendorOpenItems0 CompanyCodeCurrency
_AccountingDocumentHeader _AccountingDocumentHeader
//@EndUserText.label: 'Technical view' 

@VDM.private: true
@VDM.viewType: #COMPOSITE
@AbapCatalog.sqlViewName: 'PFIAPVNDROPITM6'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.ignorePropagatedAnnotations: true
define view P_APVendorOpenItems6
as select from
P_APVendorOpenItems0 as UnclrPayments
left outer join
I_ReceivablesPayablesItem as Clearings
on 
    UnclrPayments.FiscalYear = Clearings.InvoiceReferenceFiscalYear
  and UnclrPayments.AccountingDocumentItem = Clearings.InvoiceItemReference
  and UnclrPayments.AccountingDocument = Clearings.InvoiceReference
  and UnclrPayments.CompanyCode = Clearings.CompanyCode
  and (Clearings.ClearingAccountingDocument = '') 
  and (Clearings.FinancialAccountType = 'K') 
  and ( not Clearings.InvoiceReference = '') 
  and ( not Clearings.FollowOnDocumentType = '')
{
  key UnclrPayments.CompanyCode,
  key UnclrPayments.AccountingDocument,
  key UnclrPayments.FiscalYear,
  key UnclrPayments.AccountingDocumentItem,
//    case UnclrPayments.DebitCreditCode

//      when 'S' then

//        UnclrPayments.AmountInCompanyCodeCurrency

//      else

//        - UnclrPayments.AmountInCompanyCodeCurrency

//    end

  UnclrPayments.AmountInCompanyCodeCurrency as OpenAmount,
//    case Clearings.DebitCreditCode

//      when 'S' then

//        coalesce(Clearings.AmountInCompanyCodeCurrency, 0)

//      else

//        - coalesce(Clearings.AmountInCompanyCodeCurrency, 0)

//    end

  coalesce(Clearings.AmountInCompanyCodeCurrency, 0) as ClearedAmount,
  UnclrPayments.DocumentCurrency,
  UnclrPayments.Supplier,
  UnclrPayments.SpecialGLTransactionType,
  UnclrPayments.CompanyCodeCurrency,
  _AccountingDocumentHeader
}
where 
  (UnclrPayments.ClearingAccountingDocument = '')
  and (UnclrPayments.FinancialAccountType = 'K')
  and (UnclrPayments.Supplier != '')
  and (UnclrPayments.AccountingDocumentCategory = '')
  and (
          (UnclrPayments.SpecialGLTransactionType = 'A')
        and (UnclrPayments.IsUsedInPaymentTransaction = '')
      or    (UnclrPayments.SpecialGLTransactionType != 'A')
        and (UnclrPayments.IsUsedInPaymentTransaction = 'X')
    )
  and (
          (UnclrPayments.InvoiceReference = '')
        and (UnclrPayments.FollowOnDocumentType = '')
      or    (UnclrPayments.InvoiceReference != '')
        and (UnclrPayments.FollowOnDocumentType = 'V')
    ) 
;                             
 /*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_RECEIVABLESPAYABLESITEM",
"P_APVENDOROPENITEMS0"
],
"ASSOCIATED":
[
"I_ACCOUNTINGDOCUMENT"
],
"BASE":
[
"P_APVENDOROPENITEMS0"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/