ABAP Keyword Documentation → ABAP − Reference → Processing External Data → ABAP Database Access → AMDP - ABAP Managed Database Procedures → AMDP - Examples
AMDP, Calling an AMDP Procedure from SQLScript
This example demonstrates how am AMDP procedure is called from an AMDP procedure.
Other versions:
7.31 | 7.40 | 7.54
Source Code
DATA incprice TYPE sflight-price.
IF NOT cl_abap_dbfeatures=>use_features(
EXPORTING
requested_features =
VALUE #( ( cl_abap_dbfeatures=>call_amdp_method ) ) ).
cl_demo_output=>display(
`Current database system does not support AMDP procedures` ).
RETURN.
ENDIF.
cl_demo_input=>request( CHANGING field = incprice ).
IF incprice IS INITIAL.
RETURN.
ENDIF.
SELECT price
FROM sflight
ORDER BY carrid, connid, fldate
INTO @DATA(price_before)
UP TO 1 ROWS.
ENDSELECT.
TRY.
cl_demo_amdp_call_amdp=>increase_price( clnt = sy-mandt
incprice = incprice ).
CATCH cx_amdp_error INTO DATA(amdp_error).
cl_demo_output=>display( amdp_error->get_text( ) ).
RETURN.
ENDTRY.
SELECT price
FROM sflight
ORDER BY carrid, connid, fldate
INTO @DATA(price_after)
UP TO 1 ROWS.
ENDSELECT.
IF price_after - price_before = incprice.
cl_demo_output=>display( `Price increased succesfully` ).
ENDIF.
Description
The SQLScript procedure of the AMDP method INCREASE_PRICE of the AMDP class CL_DEMO_AMDP_CALL_AMDP calls a different AMDP procedure that is implemented in the private AMDP method INCREASE_PRICE_AMDP of the same class:
The called database procedure must be specified after the addition USING
of the statement METHOD
. Compare the
executable example for calling a further database procedure not managed using AMDP.