Skip to Content
Technical Articles
Author's profile photo harish kotyada

ABAP Managed Database procedures with SELECT OPTIONS

The ABAP ON HANA Technology provides a great advantage to developers to push down the logic at database level. ABAP Managed Database Procedures (AMDP)  was introduced in Release 7.40, SP05.since its introduction by sap there is huge progress in the development of objects in Hana as well as in ABAP platform.

ABAP ON HANA Technology increases  the performance  with its code to data paradigm and provides the much capabilities at HANA Level .The introduction of  CDS view and AMDP are  major concepts that uses the SQL script capabilities which the database understands.

AMDP with select-options parameters can be done in two Steps:

1.create a class in eclipse using ADT tool and define the interface as IF_AMDP_MARKER_HDB. This interface provides special power to the class which we can use SQL script code in the implementation of a Class. In the method implementation use the Apply Filter function on result dataset. Apply Filter function takes two arguments one is string parameters and other parameter is result dataset.

2.Create an ABAP program in ADT Tool  and use the new syntax value operator to convert the select options of AMDP into a string. Use the class CL_SHDB_SELTAB=>COMBINE_SELTABS. The method COMBINE_SELTABS takes two parameters one is name and other parameter is DREF. Fill the method parameters and pass the value while calling the AMDP method in the ABAP program. when the AMDP is called then it creates a procedure at HANA database inside the schema which is mapped to ABAP.

now I will show the steps to create AMDP and calling the AMDP in more practical way:

Here  we are taking VBAK and kna1 tables and displaying customer sale order for a particular country using AMDP .

create the structure and table type in se11 for the above scenario and use this structure in AMDP class.

abap%20structure

ABAP structure

 

 

Creating%20a%20class

Creating a class

 

click on finish and create the class definition and implementation with the interface and using apply filter function for customer sale details shown as below.

fetching%20the%20details%20of%20customer%20in%20implementation

fetching the details of customer in implementation

 

Now save and activate the class and now create an ABAP program.

 

creating%20abap%20program

creating ABAP program

click on next and give the name of program and click on finish as shown below.

 

Now pass the select option parameters inside the class CL_SHDB_SELTAB under the method COMBINE_SELTABS  and handle the client as shown below and call the AMDP method and fill the importing and exporting parameters as shown below.

 

calling%20amdp

calling AMDP

 

now save and active and execute the program and give input select options ranges country and sale order as shown below.

 

giving%20input%20values

giving input values

 

now we can see the output for country from India to us and sale order number from 1 to 31 ranges.

output

output

now go to open perspective in eclipse and select Hana development.

hana%20perspective

Hana perspective

click on open and connect to database and go to schema which is mapped to ABAP and go to procedure and click on filter option and give AMDP class and method name to check at the database.

procedure%20gets%20created

procedure gets created

double click on the procedure to see the procedure that created on Hana database when the AMDP is called.

procedure

procedure

 

Thankyou!

I believe this article helps to learn AMDP  from basic and helps to know how select options passed in AMDP.

Happy learning!

Refer this documentation to know more about AMDP:

https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenamdp.htm?file=abenamdp.htm

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Sandra Rossi
      Sandra Rossi

      There is another blog post on this exact same topic (Handling of SELECT-OPTIONS parameters within AMDP | SAP Blogs) but it was with less step-by-step procedure/screenshots.

      Author's profile photo harish kotyada
      harish kotyada
      Blog Post Author

      Thanks Sandra!

      But my intention here  is  not to convey the topic with less screen shot.I want to show end to end from ADT to hana db .so it will be easy for anyone who is new to this topic.

      Author's profile photo Sandra Rossi
      Sandra Rossi

      Yes it's what I meant, good point that your blog post has many screenshots ("less step-by-step procedure/screenshots" was concerning the other blog post I was referring to).

      Author's profile photo Matthew Billingham
      Matthew Billingham

      Do you think you might edit your blog so that you're not using screen shots for the ABAP code. Instead use the {;} button in the blog editors.

      Then you get it like this.

      DATA: sample TYPE string.
      sample = 'An example of how things look with {;}'.
      Author's profile photo Aravind Rajendran
      Aravind Rajendran

      This blog really sets the tone for ABAP on HANA...really informative! Thanks a ton!