共计 1170 个字符,预计需要花费 3 分钟才能阅读完成。
CLASS zcl_flight_calc DEFINITION PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
* Marker interface with SAP HANA DB as database type
INTERFACES: if_amdp_marker_hdb.
METHODS: update_flight IMPORTING VALUE(iv_carrid) TYPE spfli-carrid
VALUE(iv_occ) TYPE sflight-seatsocc
VALUE(iv_max) TYPE sflight-seatsmax.
METHODS: get_flight_withdetail
IMPORTING VALUE(iv_carrid) TYPE sflight-carrid
EXPORTING VALUE(et_flight) TYPE flighttab.
METHODS: get_flight_detail
IMPORTING VALUE(iv_carrid) TYPE sflight-carrid
EXPORTING VALUE(et_flight) TYPE flighttab.
ENDCLASS.
CLASS zcl_flight_calc IMPLEMENTATION.
METHOD update_flight BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT USING
sflight.
update sflight set seatsocc = iv_occ,
seatsmax = iv_max
where mandt = SESSION_context ('CLIENT')
and carrid = iv_carrid;
ENDMETHOD.
METHOD get_flight_withdetail BY DATABASE PROCEDURE FOR HDB LANGUAGE
SQLSCRIPT USING zcl_flight_calc=>get_flight_detail.
CALL "ZCL_FLIGHT_CALC=>GET_FLIGHT_DETAIL"( iv_carrid => iv_carrid,
et_flight => et_flight);
ENDMETHOD.
METHOD get_flight_detail
BY DATABASE PROCEDURE FOR HDB
LANGUAGE SQLSCRIPT
OPTIONS READ-ONLY
USING sflight.
* Implementation of the procedure in a DB-specific language
et_flight = SELECT * FROM sflight WHERE mandt = SESSION_CONtext ('CLIENT')
and carrid = iv_carrid;
ENDMETHOD.
ENDCLASS.
正文完