P_APCshDiscDocument1

DDL: P_APCSHDISCDOCUMENT1 SQL: PFIAPCSHDISDOC1 Type: view COMPOSITE

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

Data Sources (1)

SourceAliasJoin Type
I_ReceivablesPayablesItem I_ReceivablesPayablesItem from

Parameters (1)

NameTypeDefault
P_KeyDate abap.dats

Associations (3)

CardinalityTargetAliasCondition
[1..1] I_AccountingDocument _AccountingDocument $projection.AccountingDocument = _AccountingDocument.AccountingDocument and $projection.CompanyCode = _AccountingDocument.CompanyCode and $projection.FiscalYear = _AccountingDocument.FiscalYear
[1..1] I_SupplierCompany _SupplierCompany $projection.Supplier = _SupplierCompany.Supplier and $projection.CompanyCode = _SupplierCompany.CompanyCode
[1..1] I_CustomerPaymentTerms _CustomerPaymentTerms $projection.PaymentTerms = _CustomerPaymentTerms.CustomerPaymentTerms

Annotations (6)

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

Fields (36)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode CompanyCode
KEY AccountingDocument AccountingDocument
KEY FiscalYear FiscalYear
KEY AccountingDocumentItem AccountingDocumentItem
FixedCashDiscount FixedCashDiscount
DueCalculationBaseDate DueCalculationBaseDate
CashDiscount1Percent CashDiscount1Percent
CashDiscount2Percent CashDiscount2Percent
IsSalesRelated IsSalesRelated
DebitCreditCode DebitCreditCode
CashDiscountBaseAmount CashDiscountBaseAmount
CashDiscountAmount CashDiscountAmount
Supplier Creditor
ClearingDate ClearingDate
FinancialAccountType FinancialAccountType
ClearingAccountingDocument ClearingAccountingDocument
PaymentTerms PaymentTerms
PaymentBlockingReason PaymentBlockingReason
ClearingDocFiscalYear ClearingDocFiscalYear
CashDiscount1Days CashDiscount1Days
CashDiscount2Days CashDiscount2Days
DocumentDate DocumentDate
ValueDate ValueDate
PostingDate PostingDate
NetPaymentDays NetPaymentDays
AmountInTransactionCurrency AmountInTransactionCurrency
TransactionCurrency TransactionCurrency
KeyDate
AccountingDocumentCategory AccountingDocumentCategory
SpecialGLCode SpecialGLCode
APARToleranceGroup _SupplierCompany APARToleranceGroup
_Supplier _Supplier
_CompanyCode _CompanyCode
_AccountingDocument _AccountingDocument
_CustomerPaymentTerms _CustomerPaymentTerms
_SupplierCompany _SupplierCompany
@AbapCatalog.sqlViewName: 'PFIAPCSHDISDOC1'
@VDM.private: true
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.ignorePropagatedAnnotations: true
define view P_APCshDiscDocument1
with parameters
    P_KeyDate : abap.dats   
as select from
I_ReceivablesPayablesItem
association [1..1] to I_AccountingDocument as _AccountingDocument on $projection.AccountingDocument = _AccountingDocument.AccountingDocument
                                                                 and $projection.CompanyCode = _AccountingDocument.CompanyCode
                                                                 and $projection.FiscalYear = _AccountingDocument.FiscalYear   
association [1..1] to I_SupplierCompany as _SupplierCompany on $projection.Supplier = _SupplierCompany.Supplier and
                                                                           $projection.CompanyCode = _SupplierCompany.CompanyCode                                                                           
association [1..1] to I_CustomerPaymentTerms as _CustomerPaymentTerms on $projection.PaymentTerms = _CustomerPaymentTerms.CustomerPaymentTerms                                                                                                                                         
{
    key CompanyCode,
    key AccountingDocument,
    key FiscalYear,
    key AccountingDocumentItem,
    FixedCashDiscount,
    DueCalculationBaseDate,
    CashDiscount1Percent, 
    CashDiscount2Percent, 
    IsSalesRelated,
    DebitCreditCode,
//    cast (CashDiscountBaseAmount as abap.curr(18,2)) as CashDiscountBaseAmount,

//    cast (CashDiscountAmount as abap.curr(18,2)) as CashDiscountAmount,

    CashDiscountBaseAmount,
    CashDiscountAmount,
    Creditor as Supplier, 
    ClearingDate,
    FinancialAccountType,
    ClearingAccountingDocument,
    PaymentTerms,
    PaymentBlockingReason,
    ClearingDocFiscalYear,
    CashDiscount1Days,
    CashDiscount2Days,
    DocumentDate,
    ValueDate,
    PostingDate,
    NetPaymentDays,
    AmountInTransactionCurrency,
    TransactionCurrency,
    :P_KeyDate as KeyDate,
    DATS_DAYS_BETWEEN(
        ClearingDate,
        :P_KeyDate 
    ) as DaysDifference,
    AccountingDocumentCategory,
    SpecialGLCode,
    _SupplierCompany.APARToleranceGroup as APARToleranceGroup,
    _Supplier,
    _CompanyCode,
    _AccountingDocument,
    _CustomerPaymentTerms,
    _SupplierCompany
};
                                                                           
  
  
  
  
  
  
  
  
  
  
  
  
 /*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_RECEIVABLESPAYABLESITEM",
"I_SUPPLIERCOMPANY"
],
"ASSOCIATED":
[
"I_ACCOUNTINGDOCUMENT",
"I_COMPANYCODE",
"I_CUSTOMERPAYMENTTERMS",
"I_SUPPLIER",
"I_SUPPLIERCOMPANY"
],
"BASE":
[
"I_RECEIVABLESPAYABLESITEM"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/