Skip to Content

From NetWeaver 740, AMDP( ABAP Managed Database Procedures ) has been supported. With AMDP, developers can write database procedures directly in ABAP. Using AMDP allows developers to create and execute those database procedures in the ABAP environment using ABAP methods and ABAP data types.

Today I’m going to show you how to invoke AMDP from Script Logic in BPC standard model.

Firstly as a starting point, you need to create a normal Custom Logic BAdi. This can be done in transaction SE18. In this example, we created a BAdi named ZBPC_CALL_AMDP.

Then we need to create a class as the implementation of this BAdi. The class need to implement 3 interfaces:

  • IF_BADI_INTERFACE
  • IF_UJ_CUSTOM_LOGIC
  • IF_AMDP_MARKER_HDB

Notice that because this class contains AMDP, it has to be developed in the ABAP Development Tools. Below is the full content of the code. As this article is not showing you how to develop ADMP, I used a very simple dummy SQL in the method.

class ZCL_BPC_AMDP definition
  public
  final
  create public .

public section.

  interfaces IF_BADI_INTERFACE .
  interfaces IF_UJ_CUSTOM_LOGIC .
  interfaces IF_AMDP_MARKER_HDB .

  methods call_amdp.

protected section.
private section.
ENDCLASS.

CLASS ZCL_BPC_AMDP IMPLEMENTATION.

  method IF_UJ_CUSTOM_LOGIC~CLEANUP.
  endmethod.

  method IF_UJ_CUSTOM_LOGIC~EXECUTE.
  call method call_amdp.
  endmethod.

  method IF_UJ_CUSTOM_LOGIC~INIT.
  endmethod.

  method call_amdp by DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT options READ-ONLY.

  select * from dummy;

  ENDMETHOD.
ENDCLASS.

Last step for BAdi creation is the Filter, to be simple I used “AMDP”.

Now the BAdi creation is completed. Let’s try to create a Script to invoke it. As the BAdi created above doesn’t rely on any structure. You can create the script in any model. Below is the sample Script:

*START_BADI AMDP
QUERY=OFF
WRITE=OFF
*END_BADI

Now you can run the script in Data Manager or UJKT.

To report this post you need to login first.

1 Comment

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

  1. Lucas Gabriel

    The only I’d change to let the parameter WRITE as ON, include a OUT parameter in the procedure type CT_DATA.

    The result of the procedure would be passed onto CT_DATA and then the standard write back will do its thing, therefore handling security, work status etc.

    (0) 

Leave a Reply