Skip to Content
0

CL_SQL_RESULT_SET~EXECUTE_QUERY

Apr 16 at 07:25 PM

28

avatar image

I am trying to access a HANA Procedure using the execute query method from CL_SQL_RESULT_SET. This call raises an exception. Can someone thrown some light on what is incorrect?

PROCEDURE "_SYS_BIC"."system-local.private.vikram::ZSCALAR_IO_HDBPROC" (
IN I_MANDT NVARCHAR(03),
IN I_ID    NVARCHAR(03),
OUT O_NAME NVARCHAR(20)) 
	LANGUAGE SQLSCRIPT
	SQL SECURITY INVOKER 
	--DEFAULT SCHEMA <default_schema_name>
	READS SQL DATA AS
BEGIN
/***************************** 
	Write your procedure logic 
 *****************************/
 SELECT CARRNAME INTO O_NAME FROM "SAPA4H"."SCARR" WHERE MANDT = :I_MANDT AND CARRID = :I_ID;
END;

CALL "_SYS_BIC"."system-local.private.vikram::ZSCALAR_IO_HDBPROC"('001','AA',?);

With the above call from SQL console, I get the desired result.

While calling from ABAP:

TRY.
    DATA(lo_con) = cl_sql_connection=>get_connection( lv_con ).
    DATA(lo_stmt) = lo_con->create_statement( ).

    DATA(lv_stmt) = |CALL "_SYS_BIC"."system-local.private.vikram::ZSCALAR_IO_HDBPROC"('001','AA',NULL)|.

    DATA(lo_res_set) = lo_stmt->execute_query( statement = lv_stmt ).
-->EXCEPTION IS RAISED FROM THE ABOVE STATEMENT<--
    lo_res_set->set_param( data_ref = ref_var ).
    lo_res_set->next( ).
    lo_res_set->close( ).

  CATCH cx_root INTO DATA(lo_exp).
    DATA(msg) = lo_exp->get_text( ).
ENDTRY.

If I change my statement to below, I get the below exception

DATA(lv_stmt) = |CALL "_SYS_BIC"."system-local.private.vikram::ZSCALAR_IO_HDBPROC"('001','AA',?)|.

capture.jpg (41.1 kB)
capture.jpg (41.1 kB)
capture.jpg (57.2 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers