Files
abap-llm/tasks_gen/train/G1144/spec.md
2026-10-05 18:02:52 +02:00

2.6 KiB

1. Goal

Calculate the price of a house move for a removal company. The dispatch program calls one function module for each move order. The function module must reject bad input with the correct exception and must give a short message text.

2. Open questions

None.

3. Context

  • Function group {{P}}FG_MOVE exists in package $TMP.
  • Function module {{P}}MOVE_SAMPLE exists in this group. It is the interface template for all move fee modules. Its body is empty.

4. Contract

  • Create the function module {{P}}MOVE_FEE in function group {{P}}FG_MOVE.
  • Use exactly the interface of {{P}}MOVE_SAMPLE: the same parameter names, kinds, types and exceptions.
  • Importing parameters: iv_order_no (string), iv_move_date (date), iv_work_hours (decfloat34), iv_box_count (integer), iv_calc_mode (string).
  • Exporting parameters: ev_fee (decfloat34), ev_msg (string).
  • Exceptions: invalid_order, invalid_date, invalid_hours, invalid_count, unknown_mode.

5. Business rules

  1. Check the input in this order: order number, move date, work hours, box count, calculation mode. Raise only the first exception that applies.
  2. The order number is empty: raise invalid_order.
  3. The move date is empty: raise invalid_date.
  4. The work hours are zero or negative: raise invalid_hours.
  5. The box count is negative: raise invalid_count.
  6. The calculation mode is not ECO, STD or EXP: raise unknown_mode.
  7. The hourly rate is 45.00 for ECO, 60.00 for STD and 75.00 for EXP. The base fee is the work hours multiplied by the hourly rate.
  8. The box fee is 1.50 for each box.
  9. The subtotal is the base fee plus the box fee.
  10. For mode EXP, increase the subtotal by 20 %.
  11. The fee is the subtotal rounded half up to 2 decimals.
  12. ev_msg is 'OK' after a successful call. If the function module raises an exception, ev_msg holds the text of the failed check:
  • invalid_order: 'Order number is missing'
  • invalid_date: 'Move date is missing'
  • invalid_hours: 'Work hours are not positive'
  • invalid_count: 'Box count is negative'
  • unknown_mode: 'Calculation mode is unknown'

6. Constraints

  • Release target: SAP_BASIS 816 (ABAP Platform 2025).
  • Coding standards: Clean ABAP. Keep each method below 40 statements.
  • The business domain uses words that are reserved in ABAP or in ABAP SQL (hours, mode, order, date, count, group, value). Use the parameter names of the contract. Do not use a reserved word as the name of a parameter, a field or a data object.
  • Out of scope: do not change {{P}}MOVE_SAMPLE.

7. Acceptance

  • The function module {{P}}MOVE_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.