P_JP_ARDocumentItemList

DDL: P_JP_ARDOCUMENTITEMLIST SQL: PJPARDOCIT Type: view COMPOSITE

P_JP_ARDocumentItemList is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (I_GLAccountLineItem, P_JP_ARDocumentHeaderList) and exposes 40 fields with key fields Customer, SourceLedger, CompanyCode, FiscalYear, AccountingDocument. It has 3 associations to related views.

Data Sources (2)

SourceAliasJoin Type
I_GLAccountLineItem I_GLAccountLineItem from
P_JP_ARDocumentHeaderList JP_ARHeader inner

Associations (3)

CardinalityTargetAliasCondition
[0..1] I_BillingDocumentItemBasic _BillingDocItem $projection.ReferenceDocument = _BillingDocItem.BillingDocument and $projection.ReferenceDocumentItem = _BillingDocItem.BillingDocumentItem
[0..1] I_Customer _BillToParty JP_ARHeader.Customer = _BillToParty.Customer
[0..1] I_SalesDocumentItem _SOItem $projection.salesdocument = _SOItem.SalesDocument and $projection.salesdocumentitem = _SOItem.SalesDocumentItem

Annotations (7)

NameValueLevelField
AbapCatalog.sqlViewName PJPARDOCIT view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.private true view
VDM.viewType #COMPOSITE view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (40)

KeyFieldSource TableSource FieldDescription
KEY Customer P_JP_ARDocumentHeaderList Customer
_BillToParty _BillToParty
KEY SourceLedger I_GLAccountLineItem SourceLedger
KEY CompanyCode I_GLAccountLineItem CompanyCode
_CompanyCode I_GLAccountLineItem _CompanyCode
KEY FiscalYear I_GLAccountLineItem FiscalYear
KEY AccountingDocument I_GLAccountLineItem AccountingDocument
KEY LedgerGLLineItem I_GLAccountLineItem LedgerGLLineItem
KEY Ledger I_GLAccountLineItem Ledger
_Ledger I_GLAccountLineItem _Ledger
FiscalPeriod I_GLAccountLineItem FiscalPeriod
PostingDate I_GLAccountLineItem PostingDate
DocumentDate I_GLAccountLineItem DocumentDate
ClearingDate I_GLAccountLineItem ClearingDate
DocumentItemText I_GLAccountLineItem DocumentItemText
AccountingDocumentType I_GLAccountLineItem AccountingDocumentType
DebitCreditCodeName
DebitCreditCode I_GLAccountLineItem DebitCreditCode
_DebitCreditCode I_GLAccountLineItem _DebitCreditCode
ChartOfAccounts I_GLAccountLineItem ChartOfAccounts
_ChartOfAccounts I_GLAccountLineItem _ChartOfAccounts
GLAccount I_GLAccountLineItem GLAccount
_GLAccountInChartOfAccounts I_GLAccountLineItem _GLAccountInChartOfAccounts
SalesDocument _BillingDocItem SalesDocument
SalesDocumentItem _BillingDocItem SalesDocumentItem
ReferenceDocument I_GLAccountLineItem ReferenceDocument
ReferenceDocumentItem I_GLAccountLineItem ReferenceDocumentItem
Product I_GLAccountLineItem Product
_Product I_GLAccountLineItem _Product
TransactionCurrency I_GLAccountLineItem TransactionCurrency
_TransactionCurrency I_GLAccountLineItem _TransactionCurrency
AmountInTransactionCurrency
CompanyCodeCurrency I_GLAccountLineItem CompanyCodeCurrency
_CompanyCodeCurrency I_GLAccountLineItem _CompanyCodeCurrency
AmountInCompanyCodeCurrency
BaseUnitendasBaseUnit
Quantityasfkimgasmenge_dendasQuantity
_SOItem _SOItem
_AccountingDocumentType I_GLAccountLineItem _AccountingDocumentType
_AccountingDocumentTypeText I_GLAccountLineItem _AccountingDocumentTypeText
@AbapCatalog.sqlViewName: 'PJPARDOCIT'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private: true
@VDM.viewType: #COMPOSITE
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_JP_ARDocumentItemList
  as select from I_GLAccountLineItem       as I_GLAccountLineItem
    inner join   P_JP_ARDocumentHeaderList as JP_ARHeader on  I_GLAccountLineItem.SourceLedger       = JP_ARHeader.SourceLedger
                                                          and I_GLAccountLineItem.CompanyCode        = JP_ARHeader.CompanyCode
                                                          and I_GLAccountLineItem.FiscalYear         = JP_ARHeader.FiscalYear
                                                          and I_GLAccountLineItem.AccountingDocument = JP_ARHeader.AccountingDocument
                                                          and I_GLAccountLineItem.Ledger             = JP_ARHeader.Ledger

  association [0..1] to I_BillingDocumentItemBasic as _BillingDocItem on  $projection.ReferenceDocument     = _BillingDocItem.BillingDocument
                                                                      and $projection.ReferenceDocumentItem = _BillingDocItem.BillingDocumentItem
  association [0..1] to I_Customer                 as _BillToParty    on  JP_ARHeader.Customer = _BillToParty.Customer
  association [0..1] to I_SalesDocumentItem        as _SOItem         on  $projection.salesdocument     = _SOItem.SalesDocument
                                                                      and $projection.salesdocumentitem = _SOItem.SalesDocumentItem
{

  key JP_ARHeader.Customer                                                as Customer,
      _BillToParty,
  key I_GLAccountLineItem.SourceLedger,
  key I_GLAccountLineItem.CompanyCode,
      I_GLAccountLineItem._CompanyCode,
  key I_GLAccountLineItem.FiscalYear,
  key I_GLAccountLineItem.AccountingDocument,
  key I_GLAccountLineItem.LedgerGLLineItem,
  key I_GLAccountLineItem.Ledger,
      I_GLAccountLineItem._Ledger,
      I_GLAccountLineItem.FiscalPeriod,
      I_GLAccountLineItem.PostingDate,
      I_GLAccountLineItem.DocumentDate,
      I_GLAccountLineItem.ClearingDate,
      I_GLAccountLineItem.DocumentItemText,
      I_GLAccountLineItem.AccountingDocumentType,
      I_GLAccountLineItem._DebitCreditCode._Text[1: Language = $session.system_language].DebitCreditCodeName as DebitCreditCodeName,
      I_GLAccountLineItem.DebitCreditCode,
      I_GLAccountLineItem._DebitCreditCode,
      I_GLAccountLineItem.ChartOfAccounts,
      I_GLAccountLineItem._ChartOfAccounts,
      I_GLAccountLineItem.GLAccount,
      I_GLAccountLineItem._GLAccountInChartOfAccounts,
      _BillingDocItem.SalesDocument,
      _BillingDocItem.SalesDocumentItem,
      I_GLAccountLineItem.ReferenceDocument,
      I_GLAccountLineItem.ReferenceDocumentItem,
      I_GLAccountLineItem.Product,
      I_GLAccountLineItem._Product,
      @Semantics.currencyCode:true
      I_GLAccountLineItem.TransactionCurrency,
      I_GLAccountLineItem._TransactionCurrency,
      @Semantics: { amount : {currencyCode: 'TransactionCurrency'} }
      cast( I_GLAccountLineItem.AmountInTransactionCurrency as fis_wsl preserving type ) as AmountInTransactionCurrency,
      I_GLAccountLineItem.CompanyCodeCurrency,
      I_GLAccountLineItem._CompanyCodeCurrency,
      cast(I_GLAccountLineItem.AmountInCompanyCodeCurrency as fis_hsl preserving type )  as AmountInCompanyCodeCurrency,

      //Get AR Amount

      case I_GLAccountLineItem.FinancialAccountType
      when 'D' then cast( I_GLAccountLineItem.AmountInCompanyCodeCurrency as  fins_cfs_accrec preserving type )
      else cast ( cast (0 as abap.curr( 23,2))   as fins_cfs_accrec preserving type )
      end                                                                 as AcctsRblAmtInCCCrcy,

      //Get billing Unit

      @Semantics.unitOfMeasure: true
      case when I_GLAccountLineItem.BaseUnit is initial and not I_GLAccountLineItem.ReferenceDocument is initial and not I_GLAccountLineItem.ReferenceDocumentItem is initial
      then _BillingDocItem.BillingQuantityUnit
      else I_GLAccountLineItem.BaseUnit
      end                                                                 as BaseUnit,

      //Get billing Quantity

      @Semantics.quantity.unitOfMeasure: 'BaseUnit'
      case  when I_GLAccountLineItem.Quantity = 0 and not I_GLAccountLineItem.ReferenceDocument is initial and not I_GLAccountLineItem.ReferenceDocumentItem is initial
      then cast(abs( cast (_BillingDocItem.BillingQuantity as fkimg ) ) as fkimg )
          else cast( abs( cast ( I_GLAccountLineItem.Quantity as fkimg ) ) as menge_d ) 
       end                                                                as Quantity,

      // Pricing information for Billing

      @Semantics: { amount : {currencyCode: 'TransactionCurrency'} }
      case _BillingDocItem.BillingQuantityInBaseUnit
      when 0 then cast ( cast ( 0 as abap.curr( 23,2) ) as netpr   )
      else cast ( abs( division(_BillingDocItem.NetAmount , _BillingDocItem.BillingQuantityInBaseUnit, 2) ) as netpr  )
      end                                                                 as NetPriceAmount,

      // Get SO Item information from Billing Document

      _SOItem,
      I_GLAccountLineItem._AccountingDocumentType as _AccountingDocumentType ,
      I_GLAccountLineItem._AccountingDocumentTypeText
      
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BILLINGDOCUMENTITEMBASIC",
"I_DEBITCREDITCODE",
"I_DEBITCREDITCODETEXT",
"I_GLACCOUNTLINEITEM",
"P_JP_ARDOCUMENTHEADERLIST"
],
"ASSOCIATED":
[
"I_ACCOUNTINGDOCUMENTTYPE",
"I_ACCOUNTINGDOCUMENTTYPETEXT",
"I_BILLINGDOCUMENTITEMBASIC",
"I_CHARTOFACCOUNTS",
"I_COMPANYCODE",
"I_CURRENCY",
"I_CUSTOMER",
"I_DEBITCREDITCODE",
"I_GLACCOUNTINCHARTOFACCOUNTS",
"I_LEDGER",
"I_PRODUCT",
"I_SALESDOCUMENTITEM"
],
"BASE":
[
"I_GLACCOUNTLINEITEM"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/