2023 Dec 27 11:16 AM
hi all,
I am trying to call Scalar or Tabular function in AMDP Method. but when i try to use it is giving syntax error.
may i know what is the way to call in AMDP method.
Here is the sample code which i tried.
CLASS z10102_cl_scalar_test DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_amdp_marker_hdb.
CLASS-METHODS: scalar_function_test
FOR SCALAR FUNCTION z10102_scalar_fun.
CLASS-METHODS amdp_test
AMDP OPTIONS CLIENT INDEPENDENT
EXPORTING
VALUE(res) TYPE s_smax_b.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z10102_cl_scalar_test IMPLEMENTATION.
METHOD scalar_function_test BY DATABASE FUNCTION FOR HDB LANGUAGE SQLSCRIPT
OPTIONS READ-ONLY.
result = seatsmax_b + seatsocc_b + seatsmax_f + seatsocc_f ;
ENDMETHOD.
METHOD amdp_test BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT
OPTIONS READ-ONLY.
DECLARE s char(2);
SELECT Z10102_SCALAR_FUN( res=>res ) as abc from dummy;
s = 'A';
ENDMETHOD.
ENDCLASS.
Getting following error
The syntax check detected a use of the database object "Z10102_SCALAR_FUN".
If a database object managed by ABAP or DDIC is to be used here, its use must be declared in the USING clause of the METHOD statement.
If instead a parameter or variable is addressed in this position, it must be prefixed with the character ":".
I tried these ways but getting different errors
another try
METHOD amdp_test1 BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT
OPTIONS READ-ONLY.
DECLARE s char(2);
SELECT "Z10102_SCALAR_FUN"( res=>res ) as abc from dummy;
s = 'A';
ENDMETHOD.
another try
DECLARE s char(2);
SELECT "Z10102_SCALAR_FUN"( res=>res ) as abc from dummy;
s = 'A';
Regards,
kiran rachamalla.
2023 Dec 27 12:16 PM