2.3 KiB
2.3 KiB
1. Goal
A car dealership group sells vehicles through several dealerships. The sales office needs a summary of the vehicle sales of one period. It uses the summary to compare the dealerships of the group.
2. Open questions
None.
3. Context
- Table {{P}}DEALER exists in package $TMP. It contains the dealerships. Fields: DEALER_ID (CHAR 4, key), DEALER_NAME (CHAR 30), CITY (CHAR 20).
- Table {{P}}VSALE exists in package $TMP. It contains the vehicle sales. Fields: SALE_ID (INT4, key), DEALER_ID (CHAR 4), SALE_DATE (DATS), MODEL_CODE (CHAR 10), PRICE (DEC 15,2).
4. Contract
- Create the executable program {{P}}DEALER_SUM in package $TMP.
- Selection screen:
- Parameter P_FROM, type DATS, mandatory: the first sale date to include.
- Parameter P_TO, type DATS, mandatory: the last sale date to include.
- Parameter P_CITY, type {{P}}DEALER-CITY, optional: the city of the dealership.
- Show the result with CL_SALV_TABLE. The output table has these columns with these names: DEALER, CITY, SALES, REVENUE, TOP_MODEL.
5. Business rules
- Include a sale only if its SALE_DATE is on or after P_FROM and on or before P_TO.
- If P_CITY is initial, include the sales of all dealerships. If P_CITY is not initial, include only the sales of dealerships whose CITY equals P_CITY.
- Show one line for each dealership that has at least one included sale.
- DEALER is the name of the dealership. CITY is the city of the dealership.
- SALES is the number of included sales of the dealership.
- REVENUE is the sum of the PRICE values of the included sales.
- TOP_MODEL is the model code with the highest total price in the dealership. If two model codes of the dealership have the same total price, TOP_MODEL is the code that comes first in ascending alphabetical order.
- Sort the lines by REVENUE, the highest revenue first. If two dealerships have the same revenue, sort them by DEALER in ascending order.
6. Constraints
- Release target: 8.16.
- Coding standards: Clean ABAP. A method has fewer than 40 statements. Do not access the database inside a loop.
- Out of scope: do not change {{P}}DEALER and {{P}}VSALE.
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.