Files
abap-llm/tasks_gen/eval/G0161/spec.md

64 lines
2.4 KiB
Markdown

# 1. Goal
A hospital wants a report about the bed days of its wards. The report shows,
for each ward, the number of admissions in a period, the bed days, and the cost
of these bed days. The hospital management compares the wards with this report.
# 2. Open questions
None.
# 3. Context
- The table {{P}}ADMIT exists in package $TMP. The table contains data. The
fields are:
- ADM_ID: INT4, key. The admission ID.
- WARD: CHAR 4. The ward.
- ADMIT_DATE: DATS. The admission date.
- DISCHARGE_DATE: DATS. The discharge date. The field is initial while the
patient is still in the ward.
- DAILY_RATE: DEC 15,2. The cost of one bed day in this ward.
# 4. Contract
- Create the executable program {{P}}WARD_STAY in package $TMP.
- Selection screen:
- Parameter P_FROM, type DATS, mandatory. The first admission date to include.
- Parameter P_TO, type DATS, mandatory. The last admission date to include.
- Select-option S_WARD for the ward.
- Show the result with CL_SALV_TABLE. The output table has exactly these columns
with these names and types:
- WARD: type {{P}}ADMIT-WARD.
- ADMISSIONS: type I.
- BED_DAYS: type I.
- TOTAL_COST: type {{P}}ADMIT-DAILY_RATE.
# 5. Business rules
1. Include an admission only if ADMIT_DATE is on or after P_FROM, ADMIT_DATE is
on or before P_TO, and WARD is in S_WARD.
2. The bed days of one admission are DISCHARGE_DATE minus ADMIT_DATE.
3. If DISCHARGE_DATE of an admission is initial, use P_TO as the discharge date
of this admission.
4. The cost of one admission is the bed days of the admission multiplied by
DAILY_RATE.
5. Show one line for each ward that has at least one included admission.
6. ADMISSIONS is the number of included admissions of the ward.
7. BED_DAYS is the sum of the bed days of the included admissions of the ward.
8. TOTAL_COST is the sum of the costs of the included admissions of the ward.
9. Sort the lines by TOTAL_COST, the highest total first.
# 6. Constraints
- Release target: 7.40 SP05. Do not use ABAP syntax that is newer than
7.40 SP05. Examples of newer syntax are table expressions, FOR or REDUCE in
constructor expressions, string aggregation, UNION, and WITH.
- Coding standards: Clean ABAP. Read the admissions with one database access.
- Out of scope: do not change the table {{P}}ADMIT.
# 7. Acceptance
- The program is active and has no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests as local test classes in the program.