Custom COPY function using AMDP

In this blog, I will explain how to implement a custom COPY planning function using AMDP.

Background

Business requirement was to develop an AMDP script to copy data from source to target cube and also implement the additional features as below:

  1. While copying data from source to target, invert few key figures

e.g. source KF1 =100 -> target KF1 = -100

  1. Read customer master attributes for few fields, in case, value for the attribute is null in transactional data replace attribute value with the master data.

e.g. Master data -> Emp ID Attribute to be read -> Emp Location

Desired Output:

  1. Data should be copied from Source cube to target cube and source cube data will be unchanged (standard copy functionality achieved).
  2. Customer attributes to be populated in target from master data wherever source cube data is null
  3. Key figures(where inversion is implemented) should have a reverse sign in the target cube

Planning Class Creation

  • Create a new class in SE24 transaction
  • Logon to ABAP Modeller in SAP HANA Studio.
  • Navigate to Package -> Source Code Library -> Classes, open the new class.
  • Include the below interfaces in the public section of the class.
  • Create a structure adding all info-objects of the aggregation level and define a standard table. e.g:
  • In the public section, specify a suitable method name for the procedure and its import-export parameters.In AMDP,i_view : Refers to the source data set which is to be used for planningi_view_ref : Refers to the reference data to be used by the planning function(optional)e_view: Denotes the result of the planning function post all manipulationsOther than these parameters, if there is any additional parameter specific to the planning function type it can also be passed to the method.
  • Include the below code inside the class implementation to implement the standard methods inherited by the interfaces.
  • Implement the below method to set the reference data selection parameter (our reference data is actually the source data for copy).
  • Implement the TREX_EXECUTE method to call the AMDP procedure from the ABAP class.
  • Implement the AMDP procedure.
  • Select the master data (inside the method DAPLR_DATA_COPY).
  • Join reference data and master data to populate the output (e_view).

The planning function class is now ready!

Planning Function Creation and execution

  • Create a new planning function type in RSPLF1 and include the class created above in it.
  • Also, ensure that the below parameters are set in the function type.
  • Create a new planning function using the newly created Planning function type and use it in a planning sequence with relevant filters to implement the custom COPY functionality.
“TekLink’s team exceeded Kellogg Latin America’s expectations with the implementation of Anaplan. Not only their diligence and technical mastery were evident, but also provided critical and out-of-the-box solutions to meet the project’s criteria and expand its scope.”
Francisco Ibarra
Francisco Ibarra

Sr. Manager, Kellogg Company

“TekLink provided worry free BEx to AO Migration by analyzing and converting our 500+ BEx workbooks to Analysis for Office while also increasing adoption by running power user workshops.”
Lakshmi Thota
Lakshmi Thota

Sr. Manager, Rust-Oleum Company

"TekLink has exceeded our expectations and I strongly endorse their capabilities and would happily recommend them to other customers/prospects”
Assoc. Director, IT
Assoc. Director, IT

CSM Bakery Solutions

Have a Project to Discuss? Get in Touch