Review fixes G0019, G0108: added hidden tests; revalidated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
Kral
2026-10-03 16:35:20 +02:00
parent 7510131a7d
commit 0e96c6708e
31 changed files with 632 additions and 608 deletions

View File

@@ -0,0 +1,66 @@
FUNCTION {{p}}bot_plan
IMPORTING
iv_min_hl TYPE decfloat34
EXPORTING
ev_total_hl TYPE decfloat34
ev_plan_count TYPE int4.
TYPES: BEGIN OF ty_group,
beer_type TYPE {{p}}botord-beer_type,
total_hl TYPE {{p}}botpln-total_hl,
order_count TYPE {{p}}botpln-order_count,
END OF ty_group.
DATA lt_groups TYPE HASHED TABLE OF ty_group WITH UNIQUE KEY beer_type.
DATA ls_group TYPE ty_group.
DATA ls_row TYPE {{p}}botpln.
DATA lt_plan TYPE STANDARD TABLE OF {{p}}botpln WITH EMPTY KEY.
CLEAR: ev_total_hl, ev_plan_count.
SELECT beer_type, volume_hl
FROM {{p}}botord
INTO TABLE @DATA(lt_orders).
LOOP AT lt_orders INTO DATA(ls_order).
IF ls_order-volume_hl <= 0.
CONTINUE.
ENDIF.
READ TABLE lt_groups ASSIGNING FIELD-SYMBOL(<ls_group>)
WITH TABLE KEY beer_type = ls_order-beer_type.
IF sy-subrc = 0.
<ls_group>-total_hl = <ls_group>-total_hl + ls_order-volume_hl.
<ls_group>-order_count = <ls_group>-order_count + 1.
ELSE.
ls_group = VALUE #( beer_type = ls_order-beer_type
total_hl = ls_order-volume_hl
order_count = 1 ).
INSERT ls_group INTO TABLE lt_groups.
ENDIF.
ENDLOOP.
LOOP AT lt_groups ASSIGNING FIELD-SYMBOL(<ls_grp>).
IF <ls_grp>-total_hl < iv_min_hl.
CONTINUE.
ENDIF.
ls_row = VALUE #( client = sy-mandt
beer_type = <ls_grp>-beer_type
plan_pos = 0
total_hl = <ls_grp>-total_hl
order_count = <ls_grp>-order_count ).
APPEND ls_row TO lt_plan.
ev_total_hl = ev_total_hl + <ls_grp>-total_hl.
ENDLOOP.
SORT lt_plan BY total_hl DESCENDING beer_type ASCENDING.
LOOP AT lt_plan ASSIGNING FIELD-SYMBOL(<ls_row>).
<ls_row>-plan_pos = sy-tabix.
ENDLOOP.
ev_plan_count = lines( lt_plan ).
DELETE FROM {{p}}botpln.
IF lt_plan IS NOT INITIAL.
INSERT {{p}}botpln FROM TABLE @lt_plan.
ENDIF.
ENDFUNCTION.