2.2 KiB
2.2 KiB
1. Goal
Show a comparison of the planned and the actual visitor numbers of the exhibitions of a museum. The museum director uses the list to see which exhibitions reached their plan and how many visitors are still missing.
2. Open questions
None.
3. Context
- Table {{P}}EXHIB exists in package $TMP. It contains the plan of the exhibitions. It contains data. Fields: EXHIB_ID (CHAR 6, key), EXHIB_NAME (CHAR 30), PLAN_VIS (INT4).
- Table {{P}}VISIT exists in package $TMP. It contains the daily visitor numbers. It contains data. Fields: VISIT_ID (INT4, key), EXHIB_ID (CHAR 6), VISIT_DATE (DATS), VISITORS (INT4).
4. Contract
- Create the executable program {{P}}EXHIB_CMP in package $TMP.
- Selection screen:
- Parameter P_FROM, type DATS, mandatory: the first visit date to include.
- Parameter P_TO, type DATS, mandatory: the last visit date to include.
- Select-option S_EXHIB for the exhibition ID.
- Show the result with CL_SALV_TABLE. The output table has these columns, with these names: EXHIB_ID, EXHIB_NAME, PLAN_VIS, ACT_VIS, GAP. PLAN_VIS, ACT_VIS and GAP are integers.
5. Business rules
- Include an exhibition only if its EXHIB_ID is in S_EXHIB.
- Include a visit only if its EXHIB_ID is in S_EXHIB and its VISIT_DATE is on or after P_FROM and on or before P_TO.
- Show one line for each exhibition that has a plan row or at least one included visit.
- ACT_VIS is the sum of the VISITORS of the included visits of the exhibition. If the exhibition has no included visit, ACT_VIS is 0.
- PLAN_VIS is the planned number of the exhibition. If the exhibition has no plan row, PLAN_VIS is 0 and EXHIB_NAME is empty.
- GAP is PLAN_VIS minus ACT_VIS if ACT_VIS is less than PLAN_VIS. In all other cases GAP is 0.
- Sort the lines by ACT_VIS, the highest first. If two lines have the same ACT_VIS, sort them by EXHIB_ID in ascending order.
6. Constraints
- Release target: 8.16.
- Coding standards: Clean ABAP. Read each table with one database access.
- Out of scope: do not change {{P}}EXHIB and {{P}}VISIT.
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.