64 lines
3.0 KiB
Markdown
64 lines
3.0 KiB
Markdown
# 1. Goal
|
|
Define the interface {{P}}IF_LOG_PLAN in package $TMP. The sawmill office and the
|
|
sawyer's terminal use this interface to plan the cutting of a log. The interface
|
|
is the contract. It fixes the reason codes, the limits and the two method
|
|
signatures.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- A sawmill cuts logs into boards. A log has a diameter in millimetres and a
|
|
length in centimetres. A board has a thickness in millimetres and a width in
|
|
millimetres.
|
|
- The office checks an order before the sawyer starts. The reason codes name the
|
|
first check that fails:
|
|
SIZE - a value is zero or negative.
|
|
THICK - the board thickness is outside the limits.
|
|
WIDTH - the board is wider than the log.
|
|
LEN - the log is shorter than the minimum length.
|
|
OK - the order is valid.
|
|
- If the check returns OK, the office asks for the number of boards. The number
|
|
of boards is the log diameter in millimetres divided by the board thickness in
|
|
millimetres, rounded down.
|
|
- The interface is the only object of this task. No class implements it here.
|
|
|
|
# 4. Contract
|
|
- Create the interface {{P}}IF_LOG_PLAN in package $TMP.
|
|
- The interface has exactly two methods: check and board_count.
|
|
- Do not add other methods.
|
|
|
|
# 5. Business rules
|
|
1. The interface defines the type ty_reason. ty_reason is a character type of
|
|
length 10.
|
|
2. The interface defines the type ty_count. ty_count is an integer type.
|
|
3. The interface defines the structure type ty_log. ty_log has exactly the two
|
|
components dia and len. dia is an integer, the log diameter in millimetres.
|
|
len is an integer, the log length in centimetres.
|
|
4. The interface defines the structure type ty_board. ty_board has exactly the
|
|
two components thick and width. thick is an integer, the board thickness in
|
|
millimetres. width is an integer, the board width in millimetres.
|
|
5. The interface defines the constant structure c_reason. c_reason has exactly
|
|
the five components ok, size, thick, width and len. All five components have
|
|
the type ty_reason. The values are 'OK', 'SIZE', 'THICK', 'WIDTH' and 'LEN'.
|
|
6. The interface defines the constant c_min_thick with the value 20, the constant
|
|
c_max_thick with the value 100 and the constant c_min_len with the value 100.
|
|
All three constants have the type i.
|
|
7. The interface defines the method check. check has the importing parameters
|
|
is_log (TYPE ty_log) and is_board (TYPE ty_board). check has the returning
|
|
parameter rv_reason (TYPE ty_reason).
|
|
8. The interface defines the method board_count. board_count has the importing
|
|
parameters is_log (TYPE ty_log) and is_board (TYPE ty_board). board_count has
|
|
the returning parameter rv_count (TYPE ty_count).
|
|
|
|
# 6. Constraints
|
|
- Release target: SAP_BASIS 8.16.
|
|
- Coding standards: Clean ABAP. No comment that restates the code.
|
|
- Out of scope: do not create a class that implements {{P}}IF_LOG_PLAN. Do not
|
|
create database tables or CDS views.
|
|
|
|
# 7. Acceptance
|
|
- The interface is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write your own ABAP Unit tests for the interface.
|