P_APCshDiscUtilizationA1

DDL: P_APCSHDISCUTILIZATIONA1 SQL: PFIAPCSHDISUTIA1 Type: view COMPOSITE

P_APCshDiscUtilizationA1 is a Composite CDS View in SAP S/4HANA. It reads from 1 data source (I_ReceivablesPayablesItem) and exposes 17 fields with key fields CompanyCode, AccountingDocument, FiscalYear, AccountingDocumentItem. It has 1 association to related views.

Data Sources (1)

SourceAliasJoin Type
I_ReceivablesPayablesItem I_ReceivablesPayablesItem from

Parameters (2)

NameTypeDefault
P_KeyDate abap.dats
P_StartDate vdm_v_start_date

Associations (1)

CardinalityTargetAliasCondition
[1..1] I_AccountingDocument _AccountingDocument $projection.AccountingDocument = _AccountingDocument.AccountingDocument and $projection.CompanyCode = _AccountingDocument.CompanyCode and $projection.FiscalYear = _AccountingDocument.FiscalYear

Annotations (6)

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

Fields (17)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode CompanyCode
KEY AccountingDocument AccountingDocument
KEY FiscalYear FiscalYear
KEY AccountingDocumentItem AccountingDocumentItem
FixedCashDiscount FixedCashDiscount
DueCalculationBaseDate DueCalculationBaseDate
CashDiscountBaseAmount
CashDiscount1Percent CashDiscount1Percent
CashDiscount2Percent CashDiscount2Percent
TakenCshDiscInTransacCrcy
Supplier Creditor
ClearingDate ClearingDate
PaymentTerms PaymentTerms
CashDiscount1Days CashDiscount1Days
CashDiscount2Days CashDiscount2Days
KeyDate
TransactionCurrency TransactionCurrency
@AbapCatalog.sqlViewName: 'PFIAPCSHDISUTIA1'
@VDM.private: true
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.ignorePropagatedAnnotations: true
define view P_APCshDiscUtilizationA1 //Refer to P_APCshDiscUtilization1

  with parameters
    P_KeyDate   : abap.dats,
    P_StartDate : vdm_v_start_date
  as select from I_ReceivablesPayablesItem //P_APCshDiscDocument2(P_KeyDate : :P_KeyDate)

association [1..1] to I_AccountingDocument as _AccountingDocument on $projection.AccountingDocument = _AccountingDocument.AccountingDocument
                                                                 and $projection.CompanyCode        = _AccountingDocument.CompanyCode
                                                                 and $projection.FiscalYear         = _AccountingDocument.FiscalYear    
{
  key CompanyCode,
  key AccountingDocument,
  key FiscalYear,
  key AccountingDocumentItem,
      FixedCashDiscount, //t043g.sktre is not covered

      DueCalculationBaseDate,
//      case when DebitCreditCode = 'S' then

//          CashDiscountBaseAmount

//      else

//          - 1 * CashDiscountBaseAmount

//      end as CashDiscountBaseAmount,

      - 1 * CashDiscountBaseAmount as CashDiscountBaseAmount,
      CashDiscount1Percent,
      CashDiscount2Percent,
//      case when DebitCreditCode = 'S' then

//          CashDiscountAmount

//      else

//          - 1 * CashDiscountAmount

//      end as TakenCshDiscInTransacCrcy,

      - 1 * CashDiscountAmount as TakenCshDiscInTransacCrcy,
      Creditor as Supplier, //Supplier,

      ClearingDate,
      PaymentTerms,
      CashDiscount1Days,
      CashDiscount2Days,
      :P_KeyDate as KeyDate, //KeyDate,

      TransactionCurrency
}
where
      FinancialAccountType                =  'K'
  and AccountingDocumentCategory          =  ''
  and SpecialGLCode                       =  ''
  and IsSalesRelated                      =  'X'
  and _AccountingDocument.ReverseDocument =  ''
  and ClearingAccountingDocument          != ''
  and AccountingDocument                  != ClearingAccountingDocument
  and ClearingDate                        >= :P_StartDate
  and ClearingDate                        <= :P_KeyDate;          
 /*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ACCOUNTINGDOCUMENT",
"I_RECEIVABLESPAYABLESITEM"
],
"ASSOCIATED":
[
"I_ACCOUNTINGDOCUMENT"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/