Files
2026-10-05 22:08:59 +02:00

3.3 KiB

1. Goal

A mobile piano tuning service visits its customers at home. The booking desk and the technician app must use the same contract when they check a tuning visit. The contract is one interface. It fixes the result codes, the visit structure and the check methods that both consumers use.

2. Open questions

None.

3. Context

  • Package $TMP.
  • The interface {{P}}IF_PIANO_TUNING does not exist yet. Create it.
  • The booking desk checks one visit with CHECK_VISIT. The technician app checks a whole round with CHECK_VISITS. The month report calls SUMMARISE and COUNT_BLOCKED for a round. The appointment form calls IS_TUNING_MODEL.
  • A result code tells the consumer why a visit is not planned: NO_VISIT for a missing visit id, MODEL for a piano model that the service does not tune, PITCH for a pitch deviation outside the tolerance, DISTANCE for a distance above the maximum, and COUNT for a number of pianos above the maximum.

4. Contract

  • Create the interface {{P}}IF_PIANO_TUNING in package $TMP.
  • Public types: TY_CODE, TY_MODEL, TY_VISIT_ID, TY_VISIT, TT_VISITS, TY_SUMMARY.
  • Public constants: C_CODE, C_MAX_PITCH, C_MAX_DISTANCE, C_MAX_PIANOS.
  • Public methods: CHECK_VISIT, CHECK_VISITS, SUMMARISE, COUNT_BLOCKED, IS_TUNING_MODEL.
  • Do not add other public components.

5. Business rules

  1. TY_CODE is a character type of length 10.
  2. TY_MODEL is a character type of length 4.
  3. TY_VISIT_ID is a character type of length 8.
  4. TY_VISIT is a structure type with exactly these components, in this order: VISIT_ID (type ty_visit_id), MODEL (type ty_model), PITCH_DEV (type i, the deviation from concert pitch in cents), DISTANCE_KM (type i, the distance from the depot in kilometres), PIANO_COUNT (type i).
  5. TT_VISITS is a table type with the line type TY_VISIT.
  6. TY_SUMMARY is a structure type with exactly these components, in this order: ACCEPTED (type i), REJECTED (type i), FIRST_CODE (type ty_code).
  7. C_CODE is a constant structure with exactly these components, all of type ty_code: OK = 'OK', NO_VISIT = 'NO_VISIT', MODEL = 'MODEL', PITCH = 'PITCH', DISTANCE = 'DISTANCE', TOO_MANY = 'COUNT'.
  8. C_MAX_PITCH is a constant of type i with the value 25.
  9. C_MAX_DISTANCE is a constant of type i with the value 60.
  10. C_MAX_PIANOS is a constant of type i with the value 3.
  11. CHECK_VISIT has the importing parameter IS_VISIT of type ty_visit and the returning parameter RV_CODE of type ty_code.
  12. CHECK_VISITS has the importing parameter IT_VISITS of type tt_visits and the returning parameter RV_CODE of type ty_code.
  13. SUMMARISE has the importing parameter IT_VISITS of type tt_visits and the returning parameter RS_SUMMARY of type ty_summary.
  14. COUNT_BLOCKED has the importing parameter IT_VISITS of type tt_visits and the exporting parameters EV_COUNT of type i and EV_CODE of type ty_code.
  15. IS_TUNING_MODEL has the importing parameter IV_MODEL of type ty_model and the returning parameter RV_TUNING of type abap_bool.

6. Constraints

  • Release target: SAP_BASIS 816.
  • Coding standards: Clean ABAP. No comment that restates the code.
  • Out of scope: do not change other objects in package $TMP.

7. Acceptance

  • The interface {{P}}IF_PIANO_TUNING is active and has no syntax error.
  • The hidden tests pass.
  • Write your own ABAP Unit tests for the interface.