1.9 KiB
1.9 KiB
1. Goal
A wind farm operator needs the revenue of each wind turbine. The revenue is the yield of the turbine multiplied by the feed-in tariff of the wind park of the turbine. A report and an OData service read the revenue, so the calculation must be in the database, in a CDS view.
2. Open questions
None.
3. Context
- Table {{P}}WPARK (wind park), package $TMP. Key: PARK_ID (CHAR 10). Fields: PARK_NAME (CHAR 40), COUNTRY (CHAR 3), TARIFF (DEC 15,2). TARIFF is the feed-in tariff in euro for one MWh.
- Table {{P}}TURBINE (wind turbine), package $TMP. Key: TURBINE_ID (CHAR 10). Fields: PARK_ID (CHAR 10), NOMINAL_KW (INT4), YIELD_MWH (DEC 15,2). YIELD_MWH is the yield of the turbine in MWh.
4. Contract
- Create the CDS view entity {{P}}I_TURBINE in package $TMP.
- Elements, with these names: TURBINE_ID (key), PARK_ID, NOMINAL_KW, YIELD_MWH, REVENUE.
- The view exposes an association with the name _PARK. The target of _PARK is the wind park of the turbine.
- A caller reads the data of the wind park from the view with a path expression, for example _PARK-PARK_NAME or _PARK-COUNTRY.
- No authorization check (#NOT_REQUIRED).
5. Business rules
- The view shows one row for each turbine in {{P}}TURBINE.
- PARK_ID is the park of the turbine.
- NOMINAL_KW is the nominal power of the turbine.
- YIELD_MWH is the yield of the turbine.
- REVENUE is YIELD_MWH multiplied by the TARIFF of the wind park of the turbine. REVENUE has 2 decimals.
- _PARK points to the row of {{P}}WPARK that has the same PARK_ID as the turbine.
- PARK_NAME, COUNTRY and TARIFF of the wind park are available through _PARK.
6. Constraints
- Release target: 8.16.
- Coding standards: Clean ABAP.
- Out of scope: do not change {{P}}WPARK and {{P}}TURBINE.
7. Acceptance
- The view is active and has no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests with CL_CDS_TEST_ENVIRONMENT in a global test class.