2.1 KiB
2.1 KiB
1. Goal
A print shop prices print jobs. The order desk calls one pricing module for each print job. The pricing module must have the same interface as the sample pricing module, because the order desk calls all pricing modules in the same way.
2. Open questions
None.
3. Context
- Function group {{P}}FG_PRT exists in package $TMP.
- Function module {{P}}PRT_SAMPLE exists in this group. It is the sample pricing module. Its interface is the interface that all pricing modules must use.
4. Contract
- Create the function module {{P}}PRT_PRICE in function group {{P}}FG_PRT.
- Use exactly the interface of {{P}}PRT_SAMPLE: the same parameter names, kinds, types, and exceptions.
5. Business rules
- If the quantity is less than 1, raise the exception INVALID_QUANTITY.
- Set the skip flag to false and the note to an empty string, except in rule 7.
- Job type FL (flyers): the price is the quantity multiplied by 0.05, rounded half up to 2 decimals. If the price is less than 10.00, the price is 10.00.
- Job type BC (business cards): the price is the quantity multiplied by 0.08, rounded half up to 2 decimals. If the price is less than 5.00, the price is 5.00.
- Job type PO (posters): the price is the quantity multiplied by 1.15, rounded half up to 2 decimals. If the quantity is greater than 100, the price is reduced by 10 %. The reduced price is rounded half up to 2 decimals.
- Express: if the express flag is true and the price is greater than 0, the price is increased by 25 %. The increased price is rounded half up to 2 decimals.
- Any other job type: the price is 0, the skip flag is true, and the note is MANUAL QUOTE. Rule 6 does not apply to these job types.
- The changing parameter always contains the final price.
6. Constraints
- Release target: ABAP Platform 2025 (SAP_BASIS 816).
- Coding standards: Clean ABAP.
- Out of scope: do not change {{P}}PRT_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.