1.8 KiB
1.8 KiB
1. Goal
Show the treatment fee of each animal in an ALV list. The practice manager uses the list to compare the animals for a period.
2. Open questions
None.
3. Context
- The table {{P}}TREAT exists in package $TMP. It contains data. Fields: TREAT_ID (INT4, key), TREAT_DATE (DATS), ANIMAL (CHAR 10), FEE (DEC 15,2).
- The practice writes one row for each treatment.
4. Contract
- Create the executable program {{P}}VET_SUM in package $TMP.
- Selection screen:
- Parameter P_FROM, type DATS, mandatory: the first treatment date to include.
- Select-option S_ANIM for the animal.
- Show the result with CL_SALV_TABLE. The output table has these columns with
these names:
- ANIMAL: the animal.
- TOTAL: the sum of the fees.
- CNT: the number of the treatments.
- FREQUENT: 'X' if CNT is 3 or more, otherwise empty.
5. Business rules
- Include a treatment only if TREAT_DATE is on or after P_FROM and ANIMAL is in S_ANIM.
- Show one line for each animal that has at least one included treatment.
- TOTAL is the sum of the FEE of the included treatments of the animal.
- CNT is the number of the included treatments of the animal.
- FREQUENT is 'X' if CNT is 3 or more. Otherwise FREQUENT is empty.
- Sort the lines by TOTAL, the highest total first.
6. Constraints
- Release target: 7.02. Use only ABAP syntax that release 7.02 supports. Do not use inline declarations, constructor expressions, string templates, table expressions, the NEW operator, or the character '@' in ABAP SQL.
- Coding standards: Clean ABAP. Read the table with one database access.
- Out of scope: do not change the table {{P}}TREAT.
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.