Skip to Content

ABAP Managed Database Procedures are new feature available in AS ABAP 7.40, SP05 which enables you to manage and call stored procedures or database procedure in AS ABAP. An ABAP Managed Database Procedure is a procedure written in its database-specific language (Native SQL, SQLScript, …) implemented in an AMDP method of an AMDP class.

I use a simple example to show how it works. In line 21 the check is done against database type. Since I will demonstrate to manage and call store procedure writtin in SQLScript in HANA, the sample must be running in HANA DB.

http://farm6.staticflickr.com/5473/11303408906_88f9f419c6_o.png

http://farm3.staticflickr.com/2809/11303432254_5a6ef6e018_o.png

Then in line 26 a pop up is displayed to allow user input how much price he would like to increase. In line 33, the price is increased by calling

HANA store procedure, with the help of AMDP class CL_DEMO_AMDP.

An AMDP class to handle with HANA stuff must inherit the tag interface IF_AMDP_MARKER_HDB

http://farm4.staticflickr.com/3832/11303376995_9ce72c0e7b_o.png

And AMDP method must specify the database type ( HDB ) and language type ( SQLSCRIPT ) using keyword shown below.

The “:” in line 4 and line 5 are specific syntax of SQLScript – the importing parameter should have it as prefix.

http://farm8.staticflickr.com/7372/11303376945_36b91f586f_o.png

The most important part is the AMDP class could not be developed in SAP GUI, but only possible in ABAP development Tools ( i.e ABAP in Eclipse)

http://farm6.staticflickr.com/5506/11303418906_be85370fe6_o.png

http://farm3.staticflickr.com/2844/11303408616_6ab2c8d047_o.png

Every AMDP method corresponds to a store procedure which you can find in HANA studio. Or you can also find it via ST05:

http://farm8.staticflickr.com/7314/11303432054_ff70a15540_o.png

Meanwhile this document Implement and consume your first ABAP Managed Database Procedure on HANA also introduces another good example.

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

  1. Shai Sinai

    Hi Jerry,

    Just out of curiosity (I don’t see myselfI using AMDP in the near future),

    What is the reason that AMDP class cannot be developed in SAP GUI?

    (0) 
    1. Uwe Gebhardt

      A couple of years ago, there was a decision to develop new ABAP features only for

      usage in ABAP in Eclipse. One reason being resources.

      At those times, we had a strong push towards Java, this was before Oracle aquired Sun.

      AMDP Classes are one example, there are others, e.g. if you are in BW development

      the new Composite Provides (successor of Multi Provider) require ABAP in Eclipse.

      Dont ask, what I personally thinks about this decision, but it was made, and I dont think

      we will ever return. The good thing at least is, that you can view the AMDP clases in SE80.

      With kind regards

      Uwe Gebhardt

      PS: Some features in ABAP in Eclipse are quite ok, but there also some disadvantages.

      (0) 
      1. Deborah Castle

        An obvious example is the presentation of the class in its component parts in the GUI as opposed to editing a monolithic chunk in Eclipse.

        I couldn’t save my AMDP until I had managed to get an error free version.  I ended up copying to a word document to keep work.

        (0) 
    2. RĂ¼diger Plantiko

      What is the reason that AMDP class cannot be developed in SAP GUI?

      If the editor would be open, an SQLScript syntax checker would necessarily have to be integrated into SE80 (if not, developers would cry for it with a flood of OSS tickets). Apparently, there was no time planned for this integration. Therefore, the editor is locked for input.

      Bro tip: If you know what you’re doing, change the source with INSERT REPORT FROM … Since the editor lock is only because of the missing the SQLScript syntax checker, and since there is no extra generation step in the workbench (the SQLScript source code will be transferred as-is into the HANA DB), you can succeed this way.

      P.S. (on 2014-04-27): The syntax check seems to be integrated in my test system (7.40, SP06). When forcing the editor to be open (by a modification in method class_implements_amdp_marker, class CL_OO_ABSTRACT_CLASS_TOOL), the syntax check is performed for language SQLScript, with the expected error messages coming from HANA. So there must be another reason why the editor has been closed for AMDP classes…

      (0) 
  2. Siva prasad Ramani

    Hi Wang,

    Thank you for sharing valuable info….

    But still I’m struggling with AMDPs when 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,

    (0) 

Leave a Reply