C_TrsyValueAtRiskQuery
Treasury Value At Risk Query
C_TrsyValueAtRiskQuery (Consumption)
Package: Explore, extend and adapt the SAP S/4HANA Cloud Private Edition with built-in and side-by-side extension capabilities.
Financial Operations
C_TrsyValueAtRiskQuery is a Consumption CDS View that provides data about "Treasury Value At Risk Query" in SAP S/4HANA. It reads from 1 data source (I_TrsyValueAtRiskCube) and exposes 22 fields with key fields ValidityDate, TreasuryFinancialObject, MarketRiskKeyFigureSet.
SAP Help Documentation
| Category | Risk Management |
|---|---|
| Data Category | Query |
| Status | Releases |
| Corresponding DataSource | 2CCTRVARQ |
Purpose
This CDS query view calculates the market risk key figures for value at risk and mean excess loss based on the parameters of the market risk key figure sets. This CDS view provides the prerequisites for answering the following business questions: What is the overall value at risk for all company codes? What is the value at risk for a specific company code of lower aggregation levels? For market risk key figure sets with VaR calculation using simulation methods: What is the mean excess loss? Note The query calls the Treasury Value at Risk Cube ( I_TrsyValueAtRiskCube ), which delegates the calculation of the value-at-risk key figures to an analytical exit class. The value at risk is a non-additive key figure. Therefore, the value at risk on aggregated level differs from the aggregation of the single transaction value at risks. The value at risk is calculated on the dimensions selected by the query user. For market risk key figure sets with VaR calculation using simulation methods, the mean excess loss is also calculated. The VaR is only calculated taking into account all the risk factors defined in the risk factor set. VaR at individual risk factor level is not supported. The query enables the concurrent reporting of several market risk key figure sets to enable you to compare calculations of value at risk based on different calculation methods. As different key figure sets can have different evaluation currencies, the query converts the data into the display currency. For performance reasons, this happens after VaR calculation. The query also calculates the unconverted amounts. Note If you build your own evaluations using this query and you know that all market risk key figure sets use the same currency, you can optimize performance by accessing the fields in evaluation currency.
Prerequisites
Authorization object for Market Risk Key Figures ( T_MRM_KF ) Company Code Portfolio Users who want to run reports using this CDS query view must have executed the Calculate Market Risk Key Figures report at the specific key date. The report calculates the profits and losses/delta positions and saves the values in the database table. The VaR calculations of the query are based on these profits and losses/delta positions.
Integration
Process Overview This image is interactive. Hover over each area for a description. Click highlighted areas for more information.
Structure
Main CDS parameters and filters The main CDS parameters are: Confidence level used for value-at-risk calculation. Validity date Display currency Exchange rate type The main filters are: Market risk key figure set Company code Product category Product type Measures and attributes Some important measures and attributes are: Validity date Treasury financial object Market risk key figure set Company code Treasury contract type Product category Product type Portfolio Financial transaction Exposure Position Loan ID Security class Securities account Futures account Business partner Market risk characteristic currency Country Financial instrument characteristic (not relevant) Value at risk in evaluation currency Mean excess loss in evalaution currency Evaluation currency
Example of the Consumption of this Query View
This query view is consumed in the Treasury Executive Dashboard story, which is predefined as example content in the SAP Analytics Cloud application.
This CDS query view calculates the market risk key figures for value at risk and mean excess loss based on the parameters of the market risk key figure sets. This CDS view provides the prerequisites for answering the following business questions: What is the overall value at risk for all company codes? What is the value at risk for a specific company code of lower aggregation levels? For market risk key figure sets with VaR calculation using simulation methods: What is the mean excess loss? Note The query calls the Treasury Value at Risk Cube ( I_TrsyValueAtRiskCube ), which delegates the calculation of the value-at-risk key figures to an analytical exit class. The value at risk is a non-additive key figure. Therefore, the value at risk on aggregated level differs from the aggregation of the single transaction value at risks. The value at risk is calculated on the dimensions selected by the query user. For market risk key figure sets with VaR calculation using simulation methods, the mean excess loss is also calculated. The VaR is only calculated taking into account all the risk factors defined in the risk factor set. VaR at individual risk factor level is not supported. The query enables the concurrent reporting of several market risk key figure sets to enable you to compare calculations of value at risk based on different calculation methods. As different key figure sets can have different evaluation currencies, the query converts the data into the display currency. For performance reasons, this happens after VaR calculation. The query also calculates the unconverted amounts. Note If you build your own evaluations using this query and you know that all market risk key figure sets use the same currency, you can optimize performance by accessing the fields in evaluation currency.
Prerequisites
Authorization object for Market Risk Key Figures ( T_MRM_KF ) Company Code Portfolio Users who want to run reports using this CDS query view must have executed the Calculate Market Risk Key Figures report at the specific key date. The report calculates the profits and losses/delta positions and saves the values in the database table. The VaR calculations of the query are based on these profits and losses/delta positions.
Integration
Process Overview This image is interactive. Hover over each area for a description. Click highlighted areas for more information.
Structure
Main CDS parameters and filters The main CDS parameters are: Confidence level used for value-at-risk calculation. Validity date Display currency Exchange rate type The main filters are: Market risk key figure set Company code Product category Product type Measures and attributes Some important measures and attributes are: Validity date Treasury financial object Market risk key figure set Company code Treasury contract type Product category Product type Portfolio Financial transaction Exposure Position Loan ID Security class Securities account Futures account Business partner Market risk characteristic currency Country Financial instrument characteristic (not relevant) Value at risk in evaluation currency Mean excess loss in evalaution currency Evaluation currency
Example of the Consumption of this Query View
This query view is consumed in the Treasury Executive Dashboard story, which is predefined as example content in the SAP Analytics Cloud application.
SAP API Hub
| State | C1 |
|---|---|
| Line of Business | Financial Operations |
| Application Component | FIN-FSCM-TRM-MR |
| Capabilities | Analytical Query |
| Package | Financial Operations for SAP S/4HANA Cloud Private Edition |
| Description | <p>This CDS query view calculates the market risk key figures for value at risk and mean excess loss based on the parameters of the market risk key figure sets.</p> <p>This CDS view provides the prerequisites for answering the following business questions:</p> <ul> <li><p>What is the overall value at risk for all company codes?</p></li> <li><p>What is the value at risk for a specific company code of lower aggregation levels?</p></li> <li><p>For market risk key figure sets with VaR calculation using simulation methods: What is the mean excess loss?</p></li> </ul> |
Documentation
- Analytics with CDS Views — Build Analytics for S/4HANA Cloud Private Edition ABAP CDS views replicated to SAP Cloud Platform
- CDS Views on SAP Business Accelerator Hub — Explore SAP S/4HANA Cloud Private Edition Private Edition CDS Views on SAP Business Accelerator Hub
- Create CDS View as API — Create CDS views in SAP S/4HANA Cloud Private Edition and consume them as APIs
- Custom CDS Views — Access data using a Custom Core Data Service view (Custom CDS view)
- Key User Extensibility Tools — The Key User Extensibility Tools of S/4HANA
- SAP Extensibility Explorer for SAP S/4HANA Cloud Private Edition — Explore SAP S/4HANA Cloud Private Edition Extensibility options by leveraging the sample scenarios from SAP
- SAP S/4HANA Extensibility — SAP S/4HANA Extensibility Tutorial
- VDM View Types — The Virtual Data Model in SAP S/4HANA Cloud Private Edition
- View Browser — Search, browse and tag CDS Views
Data Sources (1)
| Source | Alias | Join Type |
|---|---|---|
| I_TrsyValueAtRiskCube | I_TrsyValueAtRiskCube | from |
Parameters (4)
| Name | Type | Default |
|---|---|---|
| P_ConfidenceLevelInPercent | ftr_mra_confidence_level | |
| P_ValidityDate | vdm_v_key_date | |
| P_DisplayCurrency | vdm_v_display_currency | |
| P_ExchangeRateType | kurst |
Annotations (17)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | CTRVARQ | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AbapCatalog.preserveKey | true | view | |
| AccessControl.authorizationCheck | #PRIVILEGED_ONLY | view | |
| AccessControl.personalData.blocking | #NOT_REQUIRED | view | |
| Analytics.query | true | view | |
| Analytics.internalName | #LOCAL | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view | |
| Metadata.allowExtensions | false | view | |
| Metadata.ignorePropagatedAnnotations | true | view | |
| ObjectModel.usageType.dataClass | #MIXED | view | |
| ObjectModel.usageType.serviceQuality | #D | view | |
| ObjectModel.usageType.sizeCategory | #XL | view | |
| ObjectModel.modelingPattern | #ANALYTICAL_QUERY | view | |
| OData.publish | true | view | |
| VDM.viewType | #CONSUMPTION | view | |
| EndUserText.label | Treasury Value At Risk Query | view |
Fields (22)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | ValidityDate | ValidityDate | Key Date in Results Databases | |
| KEY | TreasuryFinancialObject | TreasuryFinancialObject | Object Number for Financial Transactions | |
| KEY | MarketRiskKeyFigureSet | MarketRiskKeyFigureSet | Market Risk Key Figure Set | |
| CompanyCode | CompanyCode | Receiver Company Code | ||
| TreasuryContractType | TreasuryContractType | Treasury Contract Type | ||
| FinancialInstrProductCategory | FinancialInstrProductCategory | Product Category | ||
| FinancialInstrumentProductType | FinancialInstrumentProductType | Product Type | ||
| Portfolio | Portfolio | Portfolio | ||
| FinancialTransaction | FinancialTransaction | Financial Transaction | ||
| SecurityClass | SecurityClass | Security Class ID Number | ||
| SecurityAccount | SecurityAccount | Securities Account | ||
| TreasuryPositionAccount | TreasuryPositionAccount | Futures Account for Listed Options and Futures | ||
| FinancialExposurePosition | FinancialExposurePosition | Exposure Position ID | ||
| LoanContract | LoanContract | Contract Number | ||
| BusinessPartner | BusinessPartner | Business Partner Number | ||
| MktRiskCharacteristicCurrency | MktRiskCharacteristicCurrency | Analytic Characteristic Currency | ||
| Country | Country | Country/Region Key | ||
| FinancialInstrCharacteristic | FinancialInstrCharacteristic | Characteristics | ||
| DisplayCurrency | Display Currency | |||
| ValueAtRiskInEvaluationCrcy | Value at Risk in Evaluation Currency | |||
| MeanExcessLossAmtInEvalCrcy | Mean Excess Loss in Evaluation Currency | |||
| EvaluationCurrency | EvaluationCurrency | Evaluation Currency |
Derived SQL interpretation, reconstructed from the parsed view metadata (data sources, associations, and field mappings). SAP annotations are omitted and the structure is reformulated as SQL — this is a functional approximation, not the verbatim SAP source.
-- Derived SQL interpretation of CDS view C_TrsyValueAtRiskQuery.
-- Reconstructed from parsed metadata (data sources, associations, fields).
-- SAP annotations are omitted and the structure is reformulated as SQL;
-- this is a functional approximation, not the verbatim SAP source. Some join
-- conditions may be unavailable and a few CDS constructs are kept as-is.
-- Parameters: P_ConfidenceLevelInPercent : ftr_mra_confidence_level, P_ValidityDate : vdm_v_key_date, P_DisplayCurrency : vdm_v_display_currency, P_ExchangeRateType : kurst
CREATE VIEW C_TrsyValueAtRiskQuery AS
SELECT
ValidityDate,
TreasuryFinancialObject,
MarketRiskKeyFigureSet,
CompanyCode,
TreasuryContractType,
FinancialInstrProductCategory,
FinancialInstrumentProductType,
Portfolio,
FinancialTransaction,
SecurityClass,
SecurityAccount,
TreasuryPositionAccount,
FinancialExposurePosition,
LoanContract,
BusinessPartner,
MktRiskCharacteristicCurrency,
Country,
FinancialInstrCharacteristic,
cast( $parameters.P_DisplayCurrency as vdm_v_display_currency preserving type ) AS DisplayCurrency,
cast( ValueAtRiskInEvaluationCrcy as ftr_mra_var_in_evalcrcy preserving type ) AS ValueAtRiskInEvaluationCrcy,
cast( MeanExcessLossAmtInEvalCrcy as ftr_mra_mel_in_evalcrcy preserving type ) AS MeanExcessLossAmtInEvalCrcy,
EvaluationCurrency
FROM I_TrsyValueAtRiskCube
;
Learn More
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- CDS View Annotations — A Complete Guide
- What Is a CDS View in SAP S/4HANA?
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- CDS View Field Mapping and Associations
- Understanding the SAP S/4HANA Data Model
- CDS View Extensions and Custom Fields in SAP S/4HANA
- Released APIs and Stability Contracts in SAP S/4HANA
- BSEG to ACDOCA: The Universal Journal Migration
- Business Partner Migration: KNA1/LFA1 to BUT000
- Material Document Migration: MSEG/MKPF to MATDOC
- How to Find the Right CDS View for an SAP Table
- BW Extractor to CDS View Migration Guide
- S/4HANA CDS View Deprecation: What You Need to Know
- ABAP CDS View Tutorial — From Basics to Real-World Examples
- RAP and CDS Views — Building Transactional Apps in SAP S/4HANA
- Sales Document Status Migration: VBUP/VBUK Removal in S/4HANA
- CO Tables in S/4HANA: COEP, COBK, COSS, COSP to ACDOCA