AMDP Method Call from Program and Calling an AMDP method from another AMDP method
Here we have a single AMDP method.
The call of an AMDP method is same as normal ABAP method called from a program.
Output:
This time 2 AMDP methods are introduced and the actual DB SQL script query lies in the private AMDP method and the public AMDP method just calls the private AMDP one.
Below we have 2 AMDP methods and one AMDP method(public) calls another AMDP method (private method) and the call of the private AMDP method is not as how a normal private method is called from a normal public method.
The public AMDP method must include the private AMDP method in the USING option .
It must not a call method but CALL and AMPD method must be called inside double quotes and capital letters.
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: get_flight_detail IMPORTING VALUE(iv_mandt) TYPE sy-mandt VALUE(iv_carrid) TYPE sflight-carrid EXPORTING VALUE(et_flight) TYPE flighttab. PRIVATE SECTION. METHODS: get_flight_detail_db IMPORTING VALUE(iv_mandt) TYPE sy-mandt VALUE(iv_carrid) TYPE sflight-carrid EXPORTING VALUE(et_flight) TYPE flighttab. ENDCLASS. CLASS zcl_flight_calc IMPLEMENTATION. METHOD get_flight_detail BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT USING ZCL_FLIGHT_CALC=>GET_FLIGHT_DETAIL_DB. * CALLING ANOTHER AMDP METHOD INSIDE AN AMDP METHOD CALL "ZCL_FLIGHT_CALC=>GET_FLIGHT_DETAIL_DB"( iv_mandt => iv_mandt, iv_carrid => iv_carrid, et_flight => et_flight ); ENDMETHOD. METHOD get_flight_detail_db 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 = iv_mandt AND carrid = iv_carrid; ENDMETHOD. ENDCLASS.
The call of AMDP method in a program.
Output:
How can I call FUNCTION MODULE in AMDP Method
LikeLike