Files
abap-llm/tasks_gen/train/G1101/seed/seed_banquet.clas.abap
2026-10-05 18:02:52 +02:00

37 lines
1.6 KiB
ABAP

CLASS {{p}}seed_banquet DEFINITION PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
ENDCLASS.
CLASS {{p}}seed_banquet IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
DELETE FROM {{p}}pos WHERE client = @sy-mandt.
DELETE FROM {{p}}dish WHERE client = @sy-mandt.
DATA lt_dishes TYPE STANDARD TABLE OF {{p}}dish.
lt_dishes = VALUE #(
( client = sy-mandt dish_id = 'D001' dish_name = 'Tomato soup' price = '4.50' )
( client = sy-mandt dish_id = 'D002' dish_name = 'Roast beef' price = '18.00' )
( client = sy-mandt dish_id = 'D003' dish_name = 'Apple pie' price = '5.25' )
( client = sy-mandt dish_id = 'D004' dish_name = 'Sparkling water' price = '2.00' )
( client = sy-mandt dish_id = 'D005' dish_name = 'Bread basket' price = '2.05' )
).
INSERT {{p}}dish FROM TABLE @lt_dishes.
DATA lt_positions TYPE STANDARD TABLE OF {{p}}pos.
lt_positions = VALUE #(
( client = sy-mandt order_id = 'ORD1' pos_no = 1 dish_id = 'D001' qty = 12 )
( client = sy-mandt order_id = 'ORD1' pos_no = 2 dish_id = 'D002' qty = 8 )
( client = sy-mandt order_id = 'ORD1' pos_no = 3 dish_id = 'D004' qty = 30 )
( client = sy-mandt order_id = 'ORD2' pos_no = 1 dish_id = 'D003' qty = 4 )
( client = sy-mandt order_id = 'ORD3' pos_no = 1 dish_id = 'D001' qty = 0 )
( client = sy-mandt order_id = 'ORD4' pos_no = 1 dish_id = 'X999' qty = 2 )
).
INSERT {{p}}pos FROM TABLE @lt_positions.
out->write( |Dishes: { lines( lt_dishes ) }| ).
out->write( |Positions: { lines( lt_positions ) }| ).
ENDMETHOD.
ENDCLASS.