1.
implementation of the interface Report Z_interface_demo. Interface status. Methods write. Endinterface. "Status class counter definition. Public section. Interfaces status. Methods Increment. Private section. Data count Type I. Endclass. "Counter definition class counter implementation. Method Status~write. Write:/' count in counter is ', count. EndMethod. "Status~write method increment. Add 1 to count. EndMethod. "Increment endclass." Counter implementation class bicycle definition. Public section. Interfaces status. Methods Drive. Private section. Data speed Type I. Endclass. "Bicycle definition class bicycle implementation. Method Status~write. Write:/' speed of bicycle are ', speed. EndMethod. "Status~write Method Drive. Add ten to speed. EndMethod. "Drive Endclass." Bicycle implementation Data:count type ref to counter, bike type ref to bicycle, status type ref to status, "interface reference as workspace Status_tab type table of ref to status. Start-of-selection. Create Object:count, bike. Do 5 times. Call Method:count->incremENT, bike->drive. Enddo. Append:count to Status_tab, bike to status_tab. Loops at Status_tab into status. Call method Status->write. Endloop.
2.
triggering and handling of events Report Z_class_counter_event. CLASS vehicle DEFINITION inheriting from object. Public section. Events:too_fast. Methods:accelerate, Show_speed. PROTECTED section. DATA speed TYPE I. Endclass. "Vehicle DEFINITION CLASS vehicle implementation. METHOD accelerate. Speed = speed + 1. IF Speed > 5. RAISE EVENT Too_fast. Speed = 5. ENDIF. EndMethod. "Accelerate METHOD show_speed. WRITE:/' Speed: ', speed. EndMethod. "Show_speed Endclass." Vehicle implementation CLASS Handler DEFINITION. Public section. METHODS handle_excess for EVENT too_fast of vehicle. Endclass. "Handler DEFINITION CLASS handler implementation. METHOD handle_excess. WRITE:/' speed can is not too fast. ' * Speed = 10. EndMethod. "Handle_excess Endclass." Handler implementation Data:o_vehicle type ref to vehicle, O_handle type ref to handler. Start-of-selection. CREATE object:o_vehicle, O_handle. SET HANDLER o_handle->handle_excess for all INSTANCES. Do one times. Call METHOD o_vehicle->accelerate. Call METHOD o_vehicle->show_speed. Enddo.
3.
Select the data to the inner table (
multiple lines)Data:begin of Tab_type, Carrid type Spfli-carrid, Connid type Spfli-connid, END of Tab_type. DATA:SPFLI_TAB1 TYPE Table of Spfli, spfli_tab2 like Table of Tab_type. SELECT * from Spfli to TABLE spfli_tab1 WHERE cityfrom = ' NEW YORK ' and Cityto = ' LONDON '. SELECT Carrid Connid from Spfli to corresponding fields of TABLE spfli_tab2 WHERE cityfrom = ' NEW YORK ' and Cityto = ' FR Ankfurt '. LOOP at Spfli_tab2 to Tab_type. WRITE:/Tab_type-carrid, Tab_type-connid. Endloop.
4.
dynamically specifying query criteriaData:cond TYPE C, itab like TABLE of Cond, City1 (Ten) value ' FRANKFURT ', City2 (Ten) value ' NEW YORK ', Itab_spfli like T ABLE of Spfli with HEADER line. Concatenate ' Cityfrom = ' city1 ' into cond. APPEND cond to Itab. Concatenate ' OR cityfrom = ' city2 ' into cond. APPEND cond to Itab. SELECT * from Spfli to TABLE Itab_spfli WHERE (itab). LOOP at Itab_spfli. WRITE:/Itab_spfli-cityfrom, Itab_spfli-cityto. Endloop.
5.
Multi-table combined query-select
Statement NestingData:wa_carrid type Spfli-carrid, Wa_connid type Spfli-connid, Wa_carrname type Scarr-carrname. SELECT Carrid Connid from Spfli into (Wa_carrid, wa_connid) WHERE cityfrom = ' NEW YORK '. SELECT Carrname from Scarr to wa_carrname WHERE Carrid = Wa_carrid. Write/wa_carrname. Endselect. "Inner loop ends Endselect." Outer Loop End each time you query a Spfli carrid value in the table, the system re-queries the Scarr
6.
Multi-table combined query-for all entriesData:begin of Wa_spfli, Carrid type Spfli-carrid, Connid type Spfli-connid, END of Wa_spfli, BEGIN of Wa_scarr, Carrid TY PE Scarr-carrid, Carrname TYPE scarr-carrname, END of Wa_scarr, spfli_tab like TABLE of Wa_spfli. SELECT Carrid Connid from Spfli to TABLE spfli_tab WHERE cityfrom = ' newyork '. Select Carrid carrname from Scarr to Wa_scarr for all ENTRIES in Spfli_tab "than for each tuple in spfli_tab WHERE Carrid = Spfli_ta B-carrid. Write/wa_scarr-carrname. Endselect.
7.
Combination QueryReport Z_select_join. Data:wa_carrid type Spfli-carrid, Wa_connid type Spfli-connid, Wa_carrname type Scarr-carrname. Select Spfli~carrid scarr~carrname spfli~connid from Spfli inner joins Scarr on scarr~carrid = Spfli~carrid into (wa_carrid , Wa_carrname, Wa_connid) where Spfli~cityfrom = ' NEW YORK '. Write:/Wa_carrid, Wa_carrname, Wa_connid. Endselect.
8.
Group Totals QueryData:carrid type Sflight-carrid, minimum type P decimals 2, maximum type P decimals 2. Write:/' Carrier ID ', at "Minimum Price" at-' Maximum price '. Select Carrid min (price) MAX (price) to (Carrid, minimum, maximum) from Sflight GROUP by Carrid have MIN (price) & Gt Order by Carrid Descending. Write:/Carrid, Minimum, maximum. Endselect.