Skip to Content

Call HANA Procedure via AMDP

Hi,

I wrote a procedure on HANA and i want to call via AMDP. As i saw from examples, developers generally writing the content of the procedure here but i wnt to call pre-written HANAprocedure via here.

Is it possible ?

My scenario is like that;

CLASS ZBPC_AMDP_TEST IMPLEMENTATION.
  METHOD RUN_PACKAGE BY DATABASE PROCEDURE FOR HDB
                        LANGUAGE SQLSCRIPT.

call Z_SP_TEST(:IN_A, :IN_B, :IN_C, ET_DATA  )  with overview;
                       
  ENDMETHOD.
ENDCLASS.

I dont want to put all my select statement here and also it doesnt support local temporary tables.

Is there a way ?

Add comment
10|10000 characters needed characters exceeded

3 Answers

  • Best Answer
    Posted on Apr 10, 2014 at 01:41 PM

    Hi Cekic,

    it is no problem calling an other DB Procedure inside AMDP. The only thing you need to take care for is, that the DB procedure is not natively part of the ABAP transport.

    So you manually have to take care, that the DB Procedure is available in the subsequent systems if you do a transport (e.g. use the HANA Transport Container).

    Cheers

    Jens

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 15, 2014 at 06:25 AM

    Hi Bilen,

    how was the procedure Z_SP_TEST created? If...

    1. you (or your colleague) created it via CREATE PROCEDURE..., e.g. from the SQL console or via native SQL in the ABAP, you only have a catalog object residing in SAP<SID>. In this case you can not simply write the CALL in your AMDP. The reason is that the AMDP runtime either allows
      a. the usage of procedures residing in another database schema like SYS_BIC or MY_SCHEMA with a full qualified path name (as mentioned by Jens in his response at Apr 10, 2014 4:05 PM) or
      b. the usage of other AMDPs, which reside in the SAP<SID> schema. In this case you have to mention the AMDP in the using clause and you have to omit the schema
    2. you (or your colleague) created the procedure as content object in the HANA database, you should have a catalog object already in the SYS_BIC schema and you can use this object in the AMDP.

    If the procedure is created via ADBC (or other native SQL tools), you rather create the procedure in a dedicated namespace like /1BCAMDP/ (namespace reserved for generated objects as in you example). However, as Jens already mentioned, you have to take care about the lifecycle of this generated object, i.e. you have to make sure that the generation is performed before you first call your AMDP (especially the target system), otherwise you'll get a runtime error when the AMDP is executed and you try to call the non-existing procedure Z_SP_TEST.

    Cheers,

    Jasmin

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Bilen,
      entirely correct. The ABAP managed database procedures only live in the HANA catalog (same if you use a "CREATE PROCEDURE" statement in the SQLConsole). If you'd like to have HANA content (which is deployed to the _SYS_BIC schema during activation/deployment) you need to do this e.g. via the HANA Studio Modeller perspective.

      Cheers,

      Jasmin

  • Posted on Nov 30, 2015 at 07:27 AM

    Hi Experts,

    Still I'm struggling with AMDP Call Database Procedure(SAP Database).

    I want to Call Database in my AMDP.

    Could you please provide me sample end to end code.

    Thanks in Advance...

    Regards,

    Siva R

    Add comment
    10|10000 characters needed characters exceeded