Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
46 lines
1.8 KiB
Markdown
46 lines
1.8 KiB
Markdown
# 1. Goal
|
|
A beverage wholesaler takes back empty containers from its customers. The returns
|
|
program calls one function module for each return line. The function module
|
|
calculates the deposit that the wholesaler pays back to the customer.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Function group {{P}}FG_DEPOSIT exists in package $TMP.
|
|
- Function module {{P}}DEP_SAMPLE exists in this group. It is the sample deposit
|
|
module. The returns program calls all deposit modules with the interface of
|
|
{{P}}DEP_SAMPLE.
|
|
|
|
# 4. Contract
|
|
- Create the function module {{P}}DEP_CALC in function group {{P}}FG_DEPOSIT.
|
|
- Use exactly the interface of {{P}}DEP_SAMPLE:
|
|
- IMPORTING iv_code TYPE c
|
|
- IMPORTING iv_quantity TYPE i
|
|
- IMPORTING iv_damaged TYPE abap_bool
|
|
- EXPORTING ev_deposit TYPE decfloat34
|
|
- EXCEPTIONS invalid_quantity, invalid_container
|
|
|
|
# 5. Business rules
|
|
1. If the quantity is less than 1, raise the exception INVALID_QUANTITY.
|
|
2. The container code gives the deposit of one container:
|
|
- 'A': crate with 12 glass bottles, 1.50
|
|
- 'B': crate with 20 PET bottles, 3.00
|
|
- 'G': single glass bottle, 0.08
|
|
- 'P': single PET bottle, 0.25
|
|
3. Any other container code raises the exception INVALID_CONTAINER.
|
|
4. If the container is damaged, the deposit of one container is half of the value
|
|
in rule 2, rounded half up to 2 decimals.
|
|
5. The deposit of the return line is the deposit of one container multiplied by
|
|
the quantity, rounded half up to 2 decimals.
|
|
|
|
# 6. Constraints
|
|
- Release target: 7.40 SP05. Use only language elements that this release supports.
|
|
- Coding standards: Clean ABAP.
|
|
- Out of scope: do not change {{P}}DEP_SAMPLE.
|
|
|
|
# 7. Acceptance
|
|
- The function module {{P}}DEP_CALC is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write ABAP Unit tests for the function module in a global test class.
|