cancel
Showing results for 
Search instead for 
Did you mean: 

Call HANA Procedure via AMDP

former_member185511
Active Participant

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 ?

Accepted Solutions (1)

Accepted Solutions (1)

JensWeiler
Advisor
Advisor
0 Kudos

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

former_member185511
Active Participant
0 Kudos

I am getting a Z_SP_TEST is unknown error.

Should i include anything at the beggining like a prefix ? mybe call :Z_SP_TEST like that ?

Because on SQL i can run via call Z_SP_TEST but on AMDP i get error .

Using database proxy is only way ? i dont want to use database proxy .

I want to call my procedure via AMDP only, because on the backend what proxy method do is using native sql.

JensWeiler
Advisor
Advisor
0 Kudos

You have to use the full path of the location of the procedure - it is probably not in the SAP<SID> schema. And also using quotes will help:


e.g.

call "_SYS_BIC"."system-local.private.TEST_DEMO_A4H/PAID_ON_DATE"(:iv_payment_date, :et_invoice_header, :et_invoice_item, :et_customer_info );


Cheers


Jens

former_member185511
Active Participant
0 Kudos

If i drag from the CATALOG direcity (under SAP<SID> ) it creates like this;

CALL "SAPUHP"."Z_SP_TEST"

but system gives error "you can not set default schema SAPUHP excplicitily for this object:Z_SP_TEST"

if i remove SAPUHP, it says objct not found.

If i add SAPUHP here (normally i removed "using" section );

  METHOD RUN_PACKAGE BY DATABASE PROCEDURE FOR HDB

                        LANGUAGE SQLSCRIPT using "SAPUHP".

   CALL "Z_SP_TEST"('PARAM1','PARAM2', :ET_DATA )

  ENDMETHOD.

ENDCLASS.

call doesnt give error but now it gives "source code is incomplte"

aaaaaaaaaah i will jump from the window there i s a small problem i coulnt see.

JensWeiler
Advisor
Advisor
0 Kudos

Just use the statement as the "drag and drop" generates, add the required paramters and end the line with a semicolon.

Do not add the schema name to the using clause.

After that it should work.

former_member185511
Active Participant
0 Kudos

trying all posibilities i will update my ADT and try again.

former_member185511
Active Participant
0 Kudos

ahaaaaaaaaa

broooooooo

yea

i moved my procedure from SAP<SID> to SYS_BIC content now looks working

i tested also saw the result.

thank you.

have a nice weekend with bottles of champagne and whisky

Answers (2)

Answers (2)

former_member191161
Participant
0 Kudos

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

jasmin_gruschke
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

former_member185511
Active Participant
0 Kudos

hi jasmin hi princess

number 1-2 helpmed me actually i needed this information but couldn't find in any tutorial, i tried as a last chance and it worked

here it is full of tutorials but all contains simple select statements, i dunno why ppl post tutorials about it but SAP already has this simple classes and you can find it in se24.

But as far as i know, if you creade procedures via hana they are not stored in HANA repository ?

Thanks anyway

jasmin_gruschke
Product and Topic Expert
Product and Topic Expert
0 Kudos

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