ABAP Keyword Documentation → ABAP - Reference → Processing External Data → ABAP Database Accesses → Native SQL → AMDP - ABAP Managed Database Procedures → AMDP - Examples
AMDP, Implementation of an L Procedure
This example demonstrates the implementation of a procedure in the programming language L using AMDP.
Other versions:
7.31 | 7.40 | 7.54
Source Code
IF cl_db_sys=>is_in_memory_db = abap_false.
cl_demo_output=>display(
`Example can be executed on SAP HANA Database only` ).
LEAVE PROGRAM.
ENDIF.
DATA(text) = `World`.
cl_demo_input=>request( CHANGING field = text ).
IF text IS INITIAL.
RETURN.
ENDIF.
TRY.
NEW cl_demo_amdp_l_hello_world(
)->hello_world( EXPORTING text = text
IMPORTING texts = DATA(texts) ).
CATCH cx_amdp_error INTO DATA(amdp_error).
cl_demo_output=>display( amdp_error->get_text( ) ).
RETURN.
ENDTRY.
cl_demo_output=>display( texts ).
Description
The following L procedure is implemented in the AMDP method HELLO_WORLD of the AMDP class CL_DEMO_AMDP_L_HELLO_WORLD:
FOR HDB LANGUAGE LLANG
OPTIONS READ-ONLY.
* Hello World in L
typedef Table <String "TEXT"> TT_TABLE; /* Type definition
repeated */
//Main entry point
export Void main(String text, TT_TABLE & texts)
{ String hello = String("Hello ");
texts."TEXT"[0z] = hello.append( text ).append( "!" ); }
ENDMETHOD.
The tabular output parameter is created from a predefined text and an interactive input made in the ABAP program.