Files
abap-llm/tasks_gen/train/G1038/spec.md

58 lines
2.4 KiB
Markdown

# 1. Goal
A market operator hires out stalls to traders at its weekly market. For each
booking the operator charges a stall fee. The booking program calls one
function module for each booking. The function module calculates the fee from
the stall size, the number of market days, and whether the trader needs an
electricity supply.
# 2. Open questions
None.
# 3. Context
- Function group {{P}}FG_MKT exists in package $TMP.
- Function module {{P}}MKT_SAMPLE exists in this group. It is the sample
module. Its interface is the interface that the booking program uses.
- The booking program calls {{P}}MKT_STALL_FEE for each booking and reads the
exported fee.
# 4. Contract
Create the function module {{P}}MKT_STALL_FEE in function group {{P}}FG_MKT.
Use exactly the interface of {{P}}MKT_SAMPLE.
| Parameter | Kind | Type | Meaning |
| --- | --- | --- | --- |
| iv_stall_size | importing | string | Stall size: 'S', 'M' or 'L' |
| iv_days | importing | i | Number of market days |
| iv_power | importing | abap_bool | Electricity supply is wanted |
| ev_fee | exporting | decfloat34 | Calculated stall fee |
| invalid_days | exception | - | iv_days is less than 1 |
| invalid_size | exception | - | iv_stall_size is not 'S', 'M' or 'L' |
# 5. Business rules
1. If iv_days is less than 1, raise the exception INVALID_DAYS and do not
calculate a fee. Check this rule before rule 2.
2. The daily fee depends on iv_stall_size:
- 'S': 12.00
- 'M': 20.00
- 'L': 35.00
Any other value of iv_stall_size raises the exception INVALID_SIZE and no
fee is calculated.
3. If iv_power is abap_true, add 2.50 to the daily fee.
4. The total fee is the daily fee multiplied by iv_days.
5. If iv_days is 5 or more, the total fee is reduced by 15 %. Calculate the
reduction from the total fee, round the reduction half up to 2 decimals,
and subtract the rounded reduction from the total fee.
6. If iv_days is less than 5, the fee is the total fee without a reduction.
# 6. Constraints
- Release target: 7.40 SP05. Use only syntax that is available in this release.
Do not use the new ABAP SQL syntax with @ host variables or comma separated
field lists.
- Coding standards: Clean ABAP. Keep every method below 40 statements.
- Out of scope: do not change the function module {{P}}MKT_SAMPLE.
# 7. Acceptance
- The function module is active and has no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests for the function module in a global test class.