Technical Articles
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 structure
Creating a class
fetching the details of customer in implementation
Now save and activate the class and now create an ABAP program.
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 AMDP
now save and active and execute the program and give input select options ranges country and sale order as shown below.
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
now go to open perspective in eclipse and select Hana development.
Hana perspective
procedure gets created
double click on the procedure to see the procedure that created on Hana database when the AMDP is called.
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
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.
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.
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).
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.
This blog really sets the tone for ABAP on HANA...really informative! Thanks a ton!