Files
Kral 5de5e2851c Generator: pilot analysis and fixes; G0002-G0021 tasks; handover notes merged
- 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>
2026-10-03 05:04:23 +02:00

49 lines
2.2 KiB
Markdown

# 1. Goal
The function module {{P}}REPL_QTY_OLD calculates the replenishment order quantity for a material. Users report two defects:
- When the required quantity is exactly a multiple of the lot size, the module orders one lot too many.
- The module accepts a negative minimum order quantity. It must report an error instead.
The module {{P}}REPL_QTY_OLD is used by a released interface and must not change. Deliver the corrected calculation in the new function module {{P}}REPL_QTY.
# 2. Open questions
None.
# 3. Context
- Function group {{P}}FG_REPL exists in package $TMP.
- Function module {{P}}REPL_QTY_OLD exists in this group. It is the module in production. It has the two defects above.
- The replenishment program will call {{P}}REPL_QTY.
# 4. Contract
Create the function module {{P}}REPL_QTY in function group {{P}}FG_REPL with this interface:
IMPORTING
iv_stock TYPE decfloat34
iv_safety TYPE decfloat34
iv_lot_size TYPE decfloat34
iv_min_order TYPE decfloat34
EXPORTING
ev_order_qty TYPE decfloat34
ev_action TYPE string
EXCEPTIONS
invalid_input
ev_action contains the value 'ORDER' or the value 'NONE'.
# 5. Business rules
1. If iv_lot_size is less than 0, or if iv_min_order is less than 0, raise the exception INVALID_INPUT.
2. The required quantity is iv_safety minus iv_stock.
3. If the required quantity is less than or equal to 0, ev_order_qty is 0 and ev_action is 'NONE'. Rules 4 to 6 do not apply then.
4. If iv_lot_size is greater than 0, round the required quantity up to the next multiple of iv_lot_size. A required quantity that is already a multiple of iv_lot_size does not change.
5. If iv_lot_size is 0, do not round.
6. If ev_order_qty is less than iv_min_order, set ev_order_qty to iv_min_order.
7. If ev_order_qty is greater than 0, ev_action is 'ORDER'. Otherwise ev_action is 'NONE'.
# 6. Constraints
- Release target: 8.16.
- Coding standards: Clean ABAP. Keep methods below 40 statements.
- Out of scope: do not change the function group {{P}}FG_REPL. Do not change {{P}}REPL_QTY_OLD.
# 7. Acceptance
- The function module {{P}}REPL_QTY is active and has no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests for the function module in a global test class.