Files

1.7 KiB

1. Goal

A security company bills its clients for guard shifts. The billing program calls one function module for each shift. The function module calculates the fee of the shift.

2. Open questions

None.

3. Context

  • Function group {{P}}FG_GUARD exists in package $TMP.
  • Function module {{P}}GUARD_SAMPLE exists in this function group. It is the sample module. The billing program calls all shift modules with the same interface.

4. Contract

  • Create the function module {{P}}GUARD_FEE in function group {{P}}FG_GUARD.
  • Use exactly the interface of {{P}}GUARD_SAMPLE: the same parameter names, parameter kinds, types and exceptions.

5. Business rules

  1. If iv_hours is less than or equal to 0, raise the exception INVALID_HOURS. Do not change cv_fee.
  2. Set ev_surcharge to false.
  3. Shift type DAY: the fee is iv_hours multiplied by 25.50.
  4. Shift type NIGHT: the fee is iv_hours multiplied by 25.50 multiplied by 1.25. Set ev_surcharge to true.
  5. Shift type HOLIDAY: the fee is iv_hours multiplied by 25.50 multiplied by 2.00. Set ev_surcharge to true.
  6. Any other shift type: the fee is 0. Rules 7 and 8 do not apply.
  7. For the shift types DAY, NIGHT and HOLIDAY, round the fee half up to 2 decimal places.
  8. If the fee of rule 7 is less than 50.00, set the fee to 50.00.

6. Constraints

  • Release target: 7.02. Use only syntax that release 7.02 supports.
  • Package $TMP. Do not use transports.
  • Out of scope: do not change {{P}}GUARD_SAMPLE.
  • Do not use application tables.

7. Acceptance

  • The function module {{P}}GUARD_FEE is active and has no syntax error.
  • The hidden tests pass.
  • Write ABAP Unit tests for the function module in a global test class.