Wednesday 18 October 2017

AMDP based BEx Customer HANA Exit

With the release of the AS ABAP 7.4 many new capabilities were introduced, one of them is the AMDP methodology. This methodology is transformational as developers can leverage the best of both ABAP and SQL programming language to build models and applications. SAP BW on HANA, S/4 HANA embedded BW and BW/4 HANA can also take benefit from this framework.

Traditionally, BW developers process the BEx variable processing through Customer Exit within the ABAP layer; with the introduction of HANA Exit, the Customer Exit Variable can be processed in HANA layer (Code Push-down).

Please follow the step-by-step process illustrated below to achieve the same.

1. ZFP_C11_Q0001 Financial Planning Commitments

Version: Manual Input Entry – Single Value – Mandatory.

Fiscal Year: HANA Customer Exit – Single Value –Mandatory initial.

SAP HANA Tutorials and Materials, SAP HANA Certifications, SAP HANA Learning, SAP HANA Guides

2. Target Composite Provider ZFP_C11 - Financial Planning – Commitments

SAP HANA Tutorials and Materials, SAP HANA Certifications, SAP HANA Learning, SAP HANA Guides

3. Source Calculation View ZS4_GL_COMMTMNTS  - Financial Planning Commitments

SAP HANA Tutorials and Materials, SAP HANA Certifications, SAP HANA Learning, SAP HANA Guides

4. Parameters Calculation View - ZS4_GL_COMMTMNTS

SAP HANA Tutorials and Materials, SAP HANA Certifications, SAP HANA Learning, SAP HANA Guides

The Filter Parameter defined is Single Value, this filter value will be passed from BEx variable into the Calculation View for filtering the records based on the Fiscal Year value.

SAP HANA Tutorials and Materials, SAP HANA Certifications, SAP HANA Learning, SAP HANA Guides

SAP HANA Tutorials and Materials, SAP HANA Certifications, SAP HANA Learning, SAP HANA Guides

5. Enhancement Spot RSROA_VARIABLES_HANA_EXIT

Enhancement Implementation - ZBPC_POPX_HANA_CSVAR01

BADI Implementation - ZRSROA_VAR_HANA_EXIT_BADI

Class Implementation - ZCL_BPC_CL_RSROA_HANA_EXIT

SAP HANA Tutorials and Materials, SAP HANA Certifications, SAP HANA Learning, SAP HANA Guides

1. Class Implementation   ZCL_BPC_CL_RSROA_HANA_EXIT

SAP HANA Tutorials and Materials, SAP HANA Certifications, SAP HANA Learning, SAP HANA Guides

1. Method IF_RSROA_VAR_HANA_EXIT~GET_PROPERTIES

Variable that needs to be processed is “ZFISCYEAR_PCC_01”, the c_ts_vnam_index is the temporary/internal table to hold all the relevant variables and their values for further processing of “ZFISCYEAR_PCC_01” in the IF_RSROA_VAR_HANA_EXIT~PROCESS method.

SAP HANA Tutorials and Materials, SAP HANA Certifications, SAP HANA Learning, SAP HANA Guides

Here, I_VAR_VALUE_1 is index 1 record, I_VAR_VALUE_2 is index 2 record and so on.This value in I_VAR_VALUE_2 will be passed to the where condition in the IF_RSROA_VAR_HANA_EXIT~PROCESS method.

SAP HANA Tutorials and Materials, SAP HANA Certifications, SAP HANA Learning, SAP HANA Guides

1. Method IF_RSROA_VAR_HANA_EXIT~PROCESS

Prompt Screen

SAP HANA Tutorials and Materials, SAP HANA Certifications, SAP HANA Learning, SAP HANA Guides

In this method, we are selecting the first fiscal year value from the master data of the selected Version on the prompt selection screen( attached above -Prompt Screen). Also, the AMDP method is exposing the master data view on Version (this is a CDS-view on Version Master Data) after the Using statement. One can also directly refer the P-table of the Version Master Data or any ABAP tables/Views.

SAP HANA Tutorials and Materials, SAP HANA Certifications, SAP HANA Learning, SAP HANA Guides

Debug-mode : I_VAR_VALUE_2 is populated based on the Version manual input variable.

SAP HANA Tutorials and Materials, SAP HANA Certifications, SAP HANA Learning, SAP HANA Guides

C_VALUE  = ‘2017’ the first fiscal year of the Version ‘LTF_17-21_R1’

SAP HANA Tutorials and Materials, SAP HANA Certifications, SAP HANA Learning, SAP HANA Guides

CDS – View

SAP HANA Tutorials and Materials, SAP HANA Certifications, SAP HANA Learning, SAP HANA Guides

Few pointers:

◉ Currently there is no concept of I_STEP in this exit processing.

◉ A variable with processing type SAP HANA Exit always represents a single value. The moment when the enhancement implementation is called depends on whether the variable is input-enabled:

◉ If the variable is input-enabled, the SAP HANA exit procedure is called exactly once before the variable screen. The variable is then automatically given the default values of the other variables in the procedure.

◉ If the variable is not input-enabled, the SAP HANA exit procedure is called exactly once after the variable screen. The variable is then given the values from the variable screen in the procedure.

◉ The system can contain no more than one BADI implementation with the value ‘X for the query/variable name combination.

Source Code

class ZCL_BPC_CL_RSROA_HANA_EXIT definition
public
final
create public .
public section.
interfaces IF_BADI_INTERFACE .
interfaces IF_AMDP_MARKER_HDB .
interfaces IF_RSROA_VAR_HANA_EXIT .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.

CLASS ZCL_BPC_CL_RSROA_HANA_EXIT IMPLEMENTATION.

* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_BPC_CL_RSROA_HANA_EXIT->IF_RSROA_VAR_HANA_EXIT~GET_PROPERTIES
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_VNAM                         TYPE        RSZVNAM
* | [--->] I_VARTYP                       TYPE        RSZVARTYP
* | [--->] I_IOBJNM                       TYPE        RSIOBJNM
* | [--->] I_INFOPROV                     TYPE        RSINFOPROV
* | [--->] I_COMPID                       TYPE        RSZCOMPID
* | [<-->] C_IS_ACTIVE                    TYPE        RS_BOOL
* | [<-->] C_TS_VNAM_INDEX                TYPE        NT_TS_VNAM_INDEX
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD IF_RSROA_VAR_HANA_EXIT~GET_PROPERTIES by database procedure for hdb language SQLSCRIPT.

c_is_active := 'X';
IF :i_vnam = 'ZFISCYEAR_PCC_01' THEN
c_ts_vnam_index = select 'ZFISCYEAR_PCC_01' as vnam, 1 as index from dummy
union select 'ZVERSION_PCU_01' as vnam, 2 as index from dummy;
END IF;
ENDMETHOD.

* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_BPC_CL_RSROA_HANA_EXIT->IF_RSROA_VAR_HANA_EXIT~PROCESS
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_VNAM                         TYPE        RSZVNAM
* | [--->] I_VARTYP                       TYPE        RSZVARTYP
* | [--->] I_IOBJNM                       TYPE        RSIOBJNM
* | [--->] I_INFOPROV                     TYPE        RSINFOPROV
* | [--->] I_COMPID                       TYPE        RSZCOMPID
* | [--->] I_VAR_VALUE_1                  TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_2                  TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_3                  TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_4                  TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_5                  TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_6                  TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_7                  TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_8                  TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_9                  TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_10                 TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_11                 TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_12                 TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_13                 TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_14                 TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_15                 TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_16                 TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_17                 TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_18                 TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_19                 TYPE        RSCHAVL
* | [--->] I_VAR_VALUE_20                 TYPE        RSCHAVL
* | [<-->] C_VALUE                        TYPE        RSCHAVL
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD IF_RSROA_VAR_HANA_EXIT~PROCESS by database procedure for hdb language SQLSCRIPT
using ZBPCZVERSION.

DECLARE LV_LTF_FFY     NVARCHAR (4);

SELECT
ZFIRSTFY
INTO LV_LTF_FFY
FROM ZBPCZVERSION
WHERE ZVERSION =:i_var_value_2
AND OBJVERS = 'A';

c_value:= '';
IF :i_vnam = 'ZFISCYEAR_PCC_01' THEN
c_value:= :LV_LTF_FFY;

ELSE
END IF;

No comments:

Post a Comment