Fix coverage with several contract classes; table annotation and file path checks; clean task dir on write
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
45
tasks_gen/eval/G0121/reference/roast_sum.func.abap
Normal file
45
tasks_gen/eval/G0121/reference/roast_sum.func.abap
Normal file
@@ -0,0 +1,45 @@
|
||||
FUNCTION {{p}}roast_sum
|
||||
IMPORTING
|
||||
it_orders TYPE STANDARD TABLE OF {{p}}roasts
|
||||
EXPORTING
|
||||
et_totals TYPE STANDARD TABLE OF {{p}}blends
|
||||
ev_grand_total TYPE decfloat34.
|
||||
|
||||
TYPES: BEGIN OF ty_sum,
|
||||
blend TYPE {{p}}blends-blend,
|
||||
total_kg TYPE {{p}}blends-total_kg,
|
||||
END OF ty_sum.
|
||||
|
||||
DATA lt_sum TYPE HASHED TABLE OF ty_sum WITH UNIQUE KEY blend.
|
||||
DATA ls_ord TYPE {{p}}roasts.
|
||||
DATA ls_sum TYPE ty_sum.
|
||||
DATA ls_tot TYPE {{p}}blends.
|
||||
|
||||
CLEAR: et_totals, ev_grand_total.
|
||||
|
||||
LOOP AT it_orders INTO ls_ord.
|
||||
IF ls_ord-quantity_kg <= 0.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
|
||||
READ TABLE lt_sum INTO ls_sum WITH TABLE KEY blend = ls_ord-blend.
|
||||
IF sy-subrc = 0.
|
||||
ls_sum-total_kg = ls_sum-total_kg + ls_ord-quantity_kg.
|
||||
MODIFY TABLE lt_sum FROM ls_sum.
|
||||
ELSE.
|
||||
ls_sum-blend = ls_ord-blend.
|
||||
ls_sum-total_kg = ls_ord-quantity_kg.
|
||||
INSERT ls_sum INTO TABLE lt_sum.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
LOOP AT lt_sum INTO ls_sum.
|
||||
ls_tot-blend = ls_sum-blend.
|
||||
ls_tot-total_kg = ls_sum-total_kg.
|
||||
ev_grand_total = ev_grand_total + ls_sum-total_kg.
|
||||
APPEND ls_tot TO et_totals.
|
||||
ENDLOOP.
|
||||
|
||||
SORT et_totals BY total_kg DESCENDING blend ASCENDING.
|
||||
|
||||
ENDFUNCTION.
|
||||
Reference in New Issue
Block a user