- Static bundle checks (name length, seed type, reserved words, contract test classes, testclasses_file), local abaplint parser check before SAP, max_tokens, robust JSON parse - Runner: G2 for CDS views with parameters, contract_check detail in report - G0020 and G0013 fixed by review and revalidated (oracle 100, null 0) - Pilot results in docs/faz1-tasarim.md 11e; handover notes merged into CLAUDE.md and docs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
2.8 KiB
Markdown
62 lines
2.8 KiB
Markdown
# 1. Goal
|
|
A freight forwarder calculates the price of an outbound shipment. The
|
|
calculation service receives the gross weight, the volume, the transport
|
|
distance, and the current fuel index. It returns the freight components and a
|
|
reason code.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- The interface {{P}}IF_FREIGHT_CALC exists in package $TMP. It is active.
|
|
- The interface defines the types TY_REASON, TY_AMOUNT, TY_WEIGHT, TY_VOLUME,
|
|
TY_DISTANCE, TY_FUEL, and TY_RESULT.
|
|
- The interface defines the constant structure C_REASON with the components
|
|
OK, WEIGHT, VOLUME, DISTANCE, and FUEL.
|
|
- The interface defines the instance method CALCULATE with the importing
|
|
parameters IV_WEIGHT_KG, IV_VOLUME_M3, IV_DISTANCE_KM, IV_FUEL_INDEX and the
|
|
returning parameter RS_RESULT.
|
|
|
|
# 4. Contract
|
|
- Create the class {{P}}FREIGHT_CALC in package $TMP.
|
|
- The class is public, final, and has a public constructor without parameters.
|
|
- The class implements {{P}}IF_FREIGHT_CALC.
|
|
- Do not add other public methods.
|
|
|
|
# 5. Business rules
|
|
All amounts are in euro. Apply the rules in this sequence.
|
|
1. If IV_WEIGHT_KG is less than or equal to 0, return the reason WEIGHT. Set
|
|
all amounts and the chargeable weight to 0.
|
|
2. If IV_VOLUME_M3 is less than 0, return the reason VOLUME. Set all amounts
|
|
and the chargeable weight to 0.
|
|
3. If IV_DISTANCE_KM is less than or equal to 0, return the reason DISTANCE.
|
|
Set all amounts and the chargeable weight to 0.
|
|
4. If IV_FUEL_INDEX is less than 0 or greater than 100, return the reason FUEL.
|
|
Set all amounts and the chargeable weight to 0.
|
|
5. The volumetric weight is IV_VOLUME_M3 multiplied by 250.
|
|
6. The chargeable weight is the greater of IV_WEIGHT_KG and the volumetric
|
|
weight.
|
|
7. The base freight is 45.00. For each full or partial 100 kg by which the
|
|
chargeable weight is greater than 1000 kg, add 6.50.
|
|
8. The distance freight is 0.00 for a distance up to and including 100 km. For
|
|
each full or partial 100 km by which IV_DISTANCE_KM is greater than 100 km,
|
|
add 9.00.
|
|
9. The fuel freight is the sum of the base freight and the distance freight,
|
|
multiplied by IV_FUEL_INDEX, divided by 100. Round the result to 2 decimal
|
|
places. Round a half away from zero.
|
|
10. The total is the sum of the base freight, the distance freight, and the
|
|
fuel freight.
|
|
11. Return the reason OK.
|
|
|
|
# 6. Constraints
|
|
- Release target: 7.40 SP05. Do not use syntax that is newer than 7.40 SP05.
|
|
For example, do not use COND, SWITCH, REDUCE, FOR, or LET.
|
|
- Coding standards: Clean ABAP. Method length below 40 statements. No global
|
|
variables. No comment that restates the code.
|
|
- Out of scope: do not change {{P}}IF_FREIGHT_CALC.
|
|
|
|
# 7. Acceptance
|
|
- The class is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write your own ABAP Unit tests for the class.
|