共计 1634 个字符,预计需要花费 5 分钟才能阅读完成。
CLASS zcl_demo_007_amdp DEFINITION PUBLIC FINAL CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES: if_amdp_marker_hdb.
METHODS: get_spfli_details_dp IMPORTING VALUE(iv_mandt) TYPE mandt
VALUE(iv_carrid) TYPE spfli-carrid
EXPORTING VALUE(et_spfli) TYPE spfli_tab.
METHODS: get_spfli_details_df IMPORTING VALUE(iv_mandt) TYPE mandt
VALUE(iv_carrid) TYPE spfli-carrid
RETURNING VALUE(rt_spfli) TYPE spfli_tab.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_demo_007_amdp IMPLEMENTATION.
METHOD get_spfli_details_dp BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT OPTIONS READ-ONLY
USING zcl_demo_007_amdp=>get_spfli_details_df.
et_spfli = SELECT * FROM "ZCL_DEMO_007_AMDP=>GET_SPFLI_DETAILS_DF"(IV_MANDT => IV_MANDT, IV_CARRID => IV_CARRID);
ENDMETHOD.
METHOD get_spfli_details_df BY DATABASE FUNCTION FOR HDB LANGUAGE SQLSCRIPT OPTIONS READ-ONLY USING spfli.
RETURN SELECT * FROM spfli WHERE mandt = :iv_mandt AND carrid = :iv_carrid;
ENDMETHOD.
ENDCLASS.
*&---------------------------------------------------------------------*
*& Report ztest_amdp4
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ztest_amdp4.
CLASS lcl_test_amdp DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: run.
ENDCLASS.
CLASS lcl_test_amdp IMPLEMENTATION.
METHOD run.
* AMDP Method call
TRY.
IF cl_abap_dbfeatures=>use_features(requested_features = VALUE #( ( cl_abap_dbfeatures=>call_amdp_method)
(cl_abap_dbfeatures=>amdp_table_function) ) ) = abap_true.
NEW zcl_demo_007_amdp( )->get_spfli_details_dp( EXPORTING iv_mandt = sy-mandt iv_carrid = 'AA'
IMPORTING et_spfli = DATA(lt_spfli) ).
BREAK-POINT.
ENDIF.
CATCH cx_abap_invalid_param_value.
ENDTRY.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
lcl_test_amdp=>run().
正文完