Files
abap-llm/tasks_gen/eval/G0122/seed/seed_bike.clas.abap

40 lines
1.2 KiB
ABAP

CLASS {{p}}seed_bike DEFINITION
PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
ENDCLASS.
CLASS {{p}}seed_bike IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
DATA lt_stations TYPE STANDARD TABLE OF {{p}}station.
DATA lt_moves TYPE STANDARD TABLE OF {{p}}move.
lt_stations = VALUE #(
( station_id = 'S001' station_name = 'Central Square' capacity = 20 bikes = 12 )
( station_id = 'S002' station_name = 'Harbour' capacity = 15 bikes = 3 )
( station_id = 'S003' station_name = 'Main Station' capacity = 10 bikes = 10 ) ).
lt_moves = VALUE #(
( move_no = 1 source_id = 'S001' target_id = 'S002' quantity = 4 )
( move_no = 2 source_id = 'S002' target_id = 'S003' quantity = 2 ) ).
LOOP AT lt_stations ASSIGNING FIELD-SYMBOL(<ls_station>).
<ls_station>-client = sy-mandt.
ENDLOOP.
LOOP AT lt_moves ASSIGNING FIELD-SYMBOL(<ls_move>).
<ls_move>-client = sy-mandt.
ENDLOOP.
DELETE FROM {{p}}station.
INSERT {{p}}station FROM TABLE @lt_stations.
DELETE FROM {{p}}move.
INSERT {{p}}move FROM TABLE @lt_moves.
out->write( 'Bike sharing sample data inserted.' ).
ENDMETHOD.
ENDCLASS.