@EndUserText.label: 'Invoicing Document Cube'
@Analytics.dataCategory: #CUBE
@VDM.viewType: #COMPOSITE
@AbapCatalog.sqlViewName: 'IEINVCGDOCC'
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #('TRANSACTIONAL_DATA')
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #XL
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.representativeKey: 'UtilitiesInvoicingDocument'
@AccessControl.privilegedAssociations: [ '_CreatedByUser', '_LastChangedByUser' ]
@Metadata.allowExtensions: true
@AbapCatalog.compiler.compareFilter:true
@AbapCatalog.preserveKey:true
define view I_UtilitiesInvoicingDocumentC
with parameters
@Consumption.valueHelp: '_ExchangeRateType'
P_ExchangeRateType : kurst_curr,
P_DisplayCurrency : e_tcurr_curr_vdm
as select from I_UtilitiesInvoicingDocument
association [0..1] to I_ExchangeRateType as _ExchangeRateType on $projection.ExchangeRateType = _ExchangeRateType.ExchangeRateType
{
key UtilitiesInvoicingDocument,
UtilitiesInvoicingDocPrintDate,
NetDueDate,
CashDiscountDueDate,
@DefaultAggregation: #NONE
CashDiscountPercent,
PostingDate,
DocumentDate,
@DefaultAggregation: #SUM
@Semantics.amount.currencyCode: 'TransactionCurrency'
TotalAmountInTransactionCrcy,
// Commented because of ATC error POC_ANNOTA-SHFT
// cast ( decimal_shift(
// amount => TotalAmountInTransactionCrcy,
// currency => TransactionCurrency,
// error_handling => 'SET_TO_NULL'
// ) as e_total_amount_trans_crcy_vdm) as TotalAmountInTransactionCrcy,
@Semantics.currencyCode: true
TransactionCurrency,
@DefaultAggregation: #SUM
@Semantics.amount.currencyCode: 'DisplayCurrency'
cast (currency_conversion(
amount => TotalAmountInTransactionCrcy,
source_currency => TransactionCurrency,
target_currency => $parameters.P_DisplayCurrency,
exchange_rate_date => UtilsInvcgDocCreationDate,
exchange_rate_type => $parameters.P_ExchangeRateType,
round => #cdsboolean.TRUE,
// decimal_shift => #cdsboolean.TRUE, // Commented because of ATC error POC_ANNOTA-SHFT
// decimal_shift_back => #cdsboolean.TRUE,
error_handling => 'SET_TO_NULL'
) as e_total_amount_disp_crcy_vdm ) as TotalAmountInDisplayCrcy,
@Semantics.currencyCode: true
cast ($parameters.P_DisplayCurrency as e_tcurr_curr_vdm) as DisplayCurrency,
@Consumption.valueHelp: '_ExchangeRateType' //value help for parameter
cast ($parameters.P_ExchangeRateType as kurst_curr) as ExchangeRateType,
PaymentMethod,
@ObjectModel.foreignKey.association: '_UtilitiesInvoicingReason'
UtilitiesInvoicingReason,
UtilsInvcgDocIsReversed,
@ObjectModel.foreignKey.association: '_UtilsInvcgDocReversalRsn'
UtilsInvcgDocReversalRsn,
ReversalUtilsInvcgDocument,
UtilsInvcgDocIsNotReleased,
UtilsInvcgDocIsSimulated,
UtilsInvcgDocumentIsPosted,
BusinessPartner,
//@ObjectModel.foreignKey.association: '_ContractAccount'
ContractAccount,
@ObjectModel.foreignKey.association: '_UtilitiesPortion'
UtilitiesPortion,
@ObjectModel.foreignKey.association: '_UtilitiesBillingReason'
UtilitiesBillingReason,
UtilitiesInvoicingParty,
UtilsInvcgDocCreationDate,
UtilsInvcgDocCreatedByUser,
UtilsInvcgDocLastChangeDate,
UtilsInvcgDocLastChangedByUser,
OriginalUtilsInvcgDocRvslDate,
OriginalUtilsInvcgDocument,
AuthorizationGroup,
@ObjectModel.foreignKey.association: '_UtilsInvcgPrntBlockRsn'
UtilsInvcgDocPrintBlockRsn,
@DefaultAggregation: #SUM
cast (1 as e_invoicingdoc_vdm) as NmbrOfUtilsInvoicingDocuments,
@DefaultAggregation: #SUM
case when UtilsInvcgDocumentIsPosted = 'X' and //Field active
UtilsInvcgDocIsReversed = '' //Field inactive
then cast(1 as e_postedinvcgdoc_vdm)
else cast(0 as e_postedinvcgdoc_vdm)
end as NmbrOfPostedUtilsInvcgDocs,
@DefaultAggregation: #SUM
case when UtilsInvcgDocIsReversed = 'X' //Field active
then cast(1 as e_reversedinvcgdoc_vdm)
else cast(0 as e_reversedinvcgdoc_vdm)
end as NmbrOfReversedUtilsInvcgDocs,
@DefaultAggregation: #SUM
case when UtilsInvcgDocIsNotReleased = 'X' //Field active
then cast(1 as e_outsortedinvcgdoc_vdm)
else cast(0 as e_outsortedinvcgdoc_vdm)
end as NmbrOfOutsortedUtilsInvcgDocs,
@DefaultAggregation: #SUM
case when UtilitiesInvoicingDocPrintDate != '00000000' //No date
then cast(1 as e_printedinvcgdoc_vdm)
else cast(0 as e_printedinvcgdoc_vdm)
end as NmbrOfPrintedUtilsInvcgDocs,
@DefaultAggregation: #SUM
case when UtilsInvcgDocIsSimulated = 'X' //Field active
then cast(1 as e_simulatedinvcgdoc_vdm)
else cast(0 as e_simulatedinvcgdoc_vdm)
end as NmbrOfSimulatedUtilsInvcgDocs,
_UtilitiesInvoicingReason,
_UtilsInvcgDocReversalRsn,
_UtilsInvcgPrntBlockRsn,
_UtilitiesPortion,
_UtilitiesBillingReason,
_BusinessPartner,
//_ContractAccount,
_Currency,
_ExchangeRateType,
_CreatedByUser,
_LastChangedByUser
};
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_UTILITIESINVOICINGDOCUMENT"
],
"ASSOCIATED":
[
"I_BUSINESSPARTNER",
"I_CURRENCY",
"I_EXCHANGERATETYPE",
"I_USER",
"I_UTILITIESBILLINGREASON",
"I_UTILITIESINVOICINGREASON",
"I_UTILITIESPORTION",
"I_UTILSINVCGDOCREVERSALRSN",
"I_UTILSINVCGPRNTBLOCKRSN"
],
"BASE":
[
"I_UTILITIESINVOICINGDOCUMENT"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/