IF_AMDP_MARKER_
+ suffix for database system):IF_AMDP_MARKER_HDB
for HANA databases
INTERFACE zif_flight_accessor
PUBLIC .
METHODS increase_price
IMPORTING
VALUE(clnt) TYPE sy-mandt
VALUE(carrid) TYPE s_carr_id
VALUE(connid) TYPE s_conn_id
VALUE(fldate) TYPE s_date
VALUE(increment) TYPE sflight-price.
ENDINTERFACE.
CLASS zflight_accessor DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES zif_flight_accessor .
INTERFACES if_amdp_marker_hdb.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zflight_accessor IMPLEMENTATION.
METHOD zif_flight_accessor~increase_price
BY DATABASE PROCEDURE FOR HDB
LANGUAGE SQLSCRIPT
USING sflight.
update sflight set price = price + :increment
where mandt = :clnt and carrid = :carrid
and connid = :connid and fldate = :fldate;
ENDMETHOD.
ENDCLASS.
INCREASE_PRICE
in class ZFLIGHT_ACCESSOR
is packed behind an interface. When an AMDP method can be called like any other method, it's possible to create a test-double with the ABAP Test Double Framework.INCREASE_PRICE
is created like this:
increase_price_test_double ?= cl_abap_testdouble=>create( object_name = 'ZIF_FLIGHT_ACCESSOR' ).
cl_abap_testdouble=>configure_call( increase_price_test_double )->and_expect( )->is_called_once( ).
increase_price_test_double->increase_price( clnt = sy-mandt increment = 10
carrid = 'TG' connid = 924 fldate = '20200420' ).
INCREASE_PRICE
is called once with the parameters:increment = 10
carrid = 'TG'
connid = 924
fldate = '20200420'
cl_abap_testdouble=>verify_expectations( increase_price_test_double )
.You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |