Stage 2 summary at 50 accepted trajectories

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 18:02:52 +02:00
parent 332fb4601d
commit 5bcd1bf9cd
1230 changed files with 77563 additions and 33 deletions

View File

@@ -0,0 +1,57 @@
FUNCTION {{P}}MIX_PRICE
IMPORTING
it_tints TYPE {{P}}PAINT_MIX=>TY_TINTS
EXPORTING
ev_volume TYPE decfloat34
ev_price TYPE decfloat34
EXCEPTIONS
no_components
invalid_quantity
unknown_tint.
CONSTANTS c_mix_fee TYPE decfloat34 VALUE '1.5'.
TYPES: ty_id TYPE c LENGTH 4,
ty_ids TYPE SORTED TABLE OF ty_id WITH UNIQUE KEY table_line,
BEGIN OF ty_price,
tint_id TYPE c LENGTH 4,
price_ml TYPE p LENGTH 13 DECIMALS 3,
END OF ty_price,
ty_prices TYPE SORTED TABLE OF ty_price WITH UNIQUE KEY tint_id.
IF it_tints IS INITIAL.
RAISE no_components.
ENDIF.
DATA lt_ids TYPE ty_ids.
LOOP AT it_tints INTO DATA(ls_tint).
IF ls_tint-quantity_ml <= 0.
RAISE invalid_quantity.
ENDIF.
INSERT VALUE #( table_line = ls_tint-tint_id ) INTO TABLE lt_ids.
ENDLOOP.
DATA lt_prices TYPE ty_prices.
SELECT tint_id, price_ml FROM {{P}}TINTPR
WHERE tint_id IN @lt_ids
ORDER BY tint_id
INTO TABLE @lt_prices.
LOOP AT lt_ids INTO DATA(lv_id).
READ TABLE lt_prices WITH TABLE KEY tint_id = lv_id TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
RAISE unknown_tint.
ENDIF.
ENDLOOP.
DATA lv_material TYPE decfloat34.
LOOP AT it_tints INTO DATA(ls_item).
READ TABLE lt_prices INTO DATA(ls_price) WITH TABLE KEY tint_id = ls_item-tint_id.
ev_volume = ev_volume + ls_item-quantity_ml.
lv_material = lv_material + ls_item-quantity_ml * ls_price-price_ml.
ENDLOOP.
ev_price = round( val = lv_material + lines( lt_ids ) * c_mix_fee
dec = 2 mode = cl_abap_math=>round_half_up ).
ENDFUNCTION.