Files

1.3 KiB

1. Goal

Give the charge of each phone call. A billing program will read the charges, so the calculation must be in the database, in a CDS view.

2. Open questions

None.

3. Context

  • Table {{P}}CALLS (phone calls), package $TMP. Key: CALL_ID (CHAR 10). Fields: CUSTOMER (CHAR 10), CALL_DATE (DATS), START_TIME (TIMS), DURATION_SEC (INT4), DEST_TYPE (CHAR 1).

4. Contract

  • Create the CDS view entity {{P}}I_CALL_CHARGE in package $TMP.
  • Elements, with these names: CALL_ID (key), CUSTOMER, BILLABLE_MIN, RATE, CHARGE.
  • No authorization check (#NOT_REQUIRED).

5. Business rules

  1. Show one row for each call.
  2. BILLABLE_MIN is the duration in minutes, rounded up to the next full minute. A call of 1 second counts as 1 minute.
  3. RATE is the price per minute for the destination type:
    • 'N' (national): 0.09
    • 'I' (international): 0.25
    • any other value: 0.15
  4. Calls longer than 1800 seconds get a 10% discount on the charge.
  5. CHARGE is BILLABLE_MIN multiplied by RATE, with the discount applied, rounded to 2 decimals.

6. Constraints

  • Release target: 8.16.
  • Out of scope: do not change {{P}}CALLS.

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.