Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Generate DB Procedure Proxies

0 Kudos

Hello colleagues,

is it possible to generate/create DB procedure proxies dynamically within ABAP?

So we know the DB procedure name and want to create a DB procedure proxy dynamically in ABAP.

Regards

André

1 ACCEPTED SOLUTION

jasmin_gruschke
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi André,

the answer can be found here:

I just copied my answer below:

Please have a look at the ABAP Keyword Documentation (F1 help in the ABAP System). You will find for "CALL DATABASE PROCEDURE" a paragraph:

Example

The example Database Procedure Call uses a
database procedure proxy created in the program to call a database procedure
created using ADBC.

Navigating to "Database Procedure Call" you will find the example for creating a proxy programatically, i.e.

DATA(api) = cl_dbproc_proxy_factory=>get_proxy_public_api( if_proxy_name = prox_name ).

api->create_proxy( EXPORTING  if_proc_schema    = '_SYS_BIC'

                                                      it_param_override = params

                                                      if_proc_name        = proc_name ).

Hope this example suits your needs.

Cheers,

  Jasmin

25 REPLIES 25

jasmin_gruschke
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi André,

the answer can be found here:

I just copied my answer below:

Please have a look at the ABAP Keyword Documentation (F1 help in the ABAP System). You will find for "CALL DATABASE PROCEDURE" a paragraph:

Example

The example Database Procedure Call uses a
database procedure proxy created in the program to call a database procedure
created using ADBC.

Navigating to "Database Procedure Call" you will find the example for creating a proxy programatically, i.e.

DATA(api) = cl_dbproc_proxy_factory=>get_proxy_public_api( if_proxy_name = prox_name ).

api->create_proxy( EXPORTING  if_proc_schema    = '_SYS_BIC'

                                                      it_param_override = params

                                                      if_proc_name        = proc_name ).

Hope this example suits your needs.

Cheers,

  Jasmin

0 Kudos

Hello Jasmin,

the generated procedure proxy I can't find in the DDIC using ABAP Development Tools. Will this proxy be generated in the DDIC, if yes in which package? Can this proxy be transported?

If I generate a procedure proxy also an interface is created with the correct datatypes for this procedure. How can I generate also this interface? Do I have to do this by my own?

Regards

André

0 Kudos

Hi Andre,

1. the interface is automatically generated. The name of the generated interface can be given to the method or, if not given, is automatically generated.

2. the generated proxy is not transported, can not be transported and should not be transported.

If you want a transportable object, please use the ADT. The use case for the generation is really a local scenario, where you have to generate a proxy, say, in a productive system.

Best regards,

Kilian.

0 Kudos

Hello Kilian,

I do not really understand your first answer:

If I use the methods to generate a procedure proxy, will in this case an interface created?

For the second answer:

Why we shall not transport this? If I understand you correctly there is no way to generate a procedure proxy and transport it?

And one more question: How can we check if a proxy is already created if we do not find it in the DDIC?

Perhaps a little more to our usecase:

We develop a solution Fraud Management. Here the customer defines some rules, which are used to scan the customer data for some irregularity. For this rules the customer defines at least two HANA procedures, one for selecting the data and one for scanning the selected data.

We generate a HANA procedure around this two customer procedures and need to call this generated procedure from ABAP.

For this ABAP call we want to have a procedure proxy, we also need to generate, because we do not want that the customer has to generate the proxy manually.

Regards

André

0 Kudos

Hi André,

> I do not really understand your first answer:

> If I use the methods to generate a procedure proxy, will in this case an interface created?

Yes. There is no proxy without interface, ever. If you have a proxy, you have an interface.

> Why we shall not transport this? If I understand you correctly there is no way to generate a

> procedure proxy and transport it?

Yes. You could try to generate the corresponding TADIR entries and transport requests manually. But we do not support this. There is functionality from the workbench, which does this already, which is used by ABAP in Eclipse.

> And one more question: How can we check if a proxy is already created if we do not find it in the

> DDIC?

What do you mean with: "finding in the DDIC"? ... The workbench tools only show proxies which have a corresponding TADIR entry, which programmatically created proxies do not have. If you want to do a programmatic search, there is a search API for this, see the interface documentation for IF_DBPROC_PROXY_QUERY_API. Alternatively you can search the table DDSQLSCSRC.

Best regards,

Kilian.

0 Kudos

Hi Jasmin,

I am using the SAP HANA database as a secondary database, When i login in SAP HANA studio and open ABAP Perpestive window and create ABAP Project.

Now When i right click to create the DATABASE PROCEDURE PROXY i am NOT able to see the this option under "Dictonary".

Gone through your blog and abserve that you mention the usage of  "cl_dbproc_proxy_factory"

however I am NOT able to find the class (SE24) in SAP ECC "cl_dbproc_proxy_factory"

Can you please help to resloved the my above issues.

Thanks

Pravin

0 Kudos

Hi Pravin,

which Netweaver Version are you using ? Which version of the ABAP Development Tools for Eclipse are you using?

Best Regards,

Kilian.

0 Kudos

Hi Kilian,

ABAP Development Tools for SAP HANA is 2.24.0.

SAP GUI 7.31

SAP_BASIS 731 0007 SAPKB73107 SAP Basis Component

Regards,

Pravin

0 Kudos

Hi Pravin,

Database Procedure Proxies exist from SAP Netweaver 740 and are fully usable from SAP Netweaver 740 SP02.

Best Regards,

Kilian.

0 Kudos


Hi Kilian,

You mean SAP_BASIS 731 0007 SAPKB73107 SAP Basis Component Should be

SAP_BASIS 740 0007 SAPKB73107 SAP Basis Component.

Regards,

Pravin

0 Kudos

Hi Kilian,

Please update waiting for your reply in detail.

Regards,

Pravin

0 Kudos

Hi Pravin,
yes, Kilian refers to SAP_BASIS 740 0002 or higher.

Before this release and thus with the SAP_BASIS 731 in your case, the consumption of the DB procedure is only possible via ADBC (native SQL).

Let me know if you need asssitance how to call the procedure via the corresponding ADBC classes/methods.


Cheers,

  Jasmin

0 Kudos

Hi Pravin,

yes, it only exists from 740 0000 (with restricted functionality) and from 740 0002 with full functionality. So SAP_BASIS should be something greater than:

SAP_BASIS 740 0002 SAPKB74002

Best Regards,

Kilian.

0 Kudos

Thanks Kilian..

0 Kudos

Hi Jasmin,

Shall i go with SAP_BASIS 740 0002 or higher or with

via ADBC (native SQL).

What is your suggestion.

Regards,

Pravin

0 Kudos

Hi Pravin,
that depends on your development usecase. If you have the chance/possibility to use a higher SAP_BASIS version, I'd suggest to use SAP_BASIS 740 0005 and use all the new features (see ). You then don't have to use proxy objects at all but create an ABAP managed DB procedure directly in the ABAP.
We recommend 740 for usage with SAP HANA, there are a bunch of features specially tailored for SAP HANA (not only the proxies), so I'd definitively vote for an update .

Cheers,

  Jasmin

0 Kudos

Hi Jasmin,

Thanks for the update.

I will go ahead with SAP_BASIS 740 0002. however can i see and use the --

1. The SAP HANA as a secondary database in statement

     Call database procedure connection...... (ZPROXY Name)...

2. Does the DATABASE PROCEDURE PROXY option is visible under "Dictonary" while creating  

    the ABAP Project in ABAP Perpective.

Regards,

Pravin

0 Kudos

Hi Pravin,
you can create DB procedure proxies from the ABAP development tools only if the SAP HANA is you primary database.

If HANA is your secondary database, you can only create the proxy programatically (as described in my reply on Feb, 7th). And since this programatical approach leads to a DB procedure proxy which cannot be transported by means of the standard CTS, you have to use a dynamic call of the DB procedure proxy for the consumption of the DB procedure. So yes, a CALL DATABASE PROCEDURE... (proxyname) is possible using the CONNECTION statement.

Cheers,

  Jasmin

0 Kudos

Hi Jasmin,

Yes- We have HANA Database as a secondary database. SO i cannot create Data Base Proxy Manually.

To Create the Data base Proxy programatically using HANA Database as a secondary database, However I am NOT able to find the class (SE24) in SAP ECC "cl_dbproc_proxy_factory" as current version is SAP_BASIS 731 0007.

Please suggest.

Regards,

Pravin

0 Kudos

Hi Pravin,
the class is also only available from SAP_BASIS 740 0002 onwards, that's what Kilian meant in his reply above.

Cheers,

  Jasmin

0 Kudos

Thanks Jasmin for the information.

if any thing i needed will again get in touch with you.

Regards,

Pravin

0 Kudos

Hi Jasmin and Kilian,

Can anyone tell me how the SELECT-OPTIONS data can be used in WHERE clause

of STORED PROCEDURE

below is the sample code


/********* Begin Procedure Script ************/


SELECT   p.vbeln as vbeln ,

as lfdat,

as kunnr,

as bolnr,

as posnr,

as vgbel,

as vgpos,

as wadat_ist,
as kunag

FROM likp as P

INNER JOIN lips as q

ON q.vbeln = p.vbeln

WHERE p.wadat_ist = '00000000' AND


IN :L_R_VKORG.VKORG--> This is my INPUT parameter (NOT a Scalar Parameter)


/********* End Procedure Script ************/

Regards,

Pravin

0 Kudos

Hi Pravin,

HANA is not ABAP and this is an ABAP specific feature.

As far a I know, there is no possiblity to do that. But it may be wise to ask the HANA collegues, if they implemented something.

Best Regards,

Kilian.

0 Kudos

Hi Jamin.

I have SAP_BASIS 731 0007.

How to call the Stored procedure of HANA via the corresponding ADBC classes/methods using HANA as a secondary database.

Can you please give example.

Please also confirm using ADBC will improve the performance.

Regards,

Pravin


0 Kudos

Hi Pravin,
how to call the procedure depends on on the number of output parameters. If you by chance have access to a 7.40 SP5 system, you can have a look at report ADBC_DEMO_PROC_CALLS_HDB.

I can send you a mail with the details (please send me a mail or maintain your contact information on SCN).

If ADBC will improve the performance depens on your application logic and usecase. A very bold example: if you use ADBC to perform a simple SELECT statemtement, which could have been as well performed via OpenSQL, you will not gain (rather you would loose) performance by using ADBC due to some overhead in the ADBC framework. However, if you are e.g. doing a lot of application logic directly on the database (in your procedures), you then aggregate all results to one resulting number - let's say all gross_amount by a company from their 5M customers, and you finally only transport this number to the AS ABAP, then you definitively gain performance with ADBC. But the performance gain is not due to ADBC but because of using the "code to data" paradigm as explained in .

Cheers,

  Jasmin