Saturday, 30 October 2021

How to assign one Selection screen input field value into another field [ Not input ready] in SAP analytics report [ BW Query] using SAP HANA Exit

Prerequisite

During the development of any SAP analytical report, we may required to access one 

selection screen variable value to be assigned to another selection screen variable.

So that the second variable will bring all the relevant information from the database.

Out of many, there is one scenario where users enter the value one selection screen field in the SAP analytics report. After input same value gets assigned into another selection screen field [ Not input ready]. See the below flow shows how the “ZVAR_WBS_HIER” value gets assigned into the “ZHE_WBS” variable.

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills
Variable Details

Report Background

The Analytics report is built on top of the HANA CDS composite view using BW Query perspective as a report development tool.

CDS Composite View –

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills
CDS Composite View

Report that builds on top of CDS view using SQL name as Transient Provider –

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills
BW Report Use CDS SQL Name

Below is the list of simple steps with screenshots for batter understating with the help of the HANA Exit variable, we can easily assign one selection screen field value after inputting get assigned into another screen field by writing a few lines of code in Class / Methods and with one HANA Exit variable.

This is the sample report selection screen where the user enters a value in “Project Group” and in the backend, the same value gets assigned in “Hierarchy ID” [ not input ready]

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

Step 1»

First, in the report build one SAP HANA Exit variable under the required field in query designer and add the HANA Exit variable ZHE_WBS in the filter tab.

SAP HANA Exit Variable details

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

Assign the variable in the respective object

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

Step 2»

The first variable technical details [ display on selection screen] and value enter this will get assigned into SAP HANA Exit variable “ZHE_WBS”

Selection Screen Variable Details

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

Add the variable in the Query Filter Tab area

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

Step 3»

Open the BAdI “RSROA_VARIABLE_HANA_EXIT” in ABAP Perspective

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

and the respective Class interface ZXX_CL_VARIABLE_HANA

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

Open BAdI In ABAP Perspective

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

Step 4»

Go to the method “GET_PROPERTICES”

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

Add below lines of code for SAP HANA Exit variable –

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

Step 5»

Go to the method “PROCESS” mention below –

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

Add below lines of code for SAP HANA Exit –

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

Step 6»
 
Open the Function Module – RRS_VAR_HANAEXIT in ABAP Perspective and add below 1st Set of code in the prescribed are

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

Add 2nd set of code as mentioned below

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

The 2nd set of code should be in the correct place as mentioned above or refer to the below snapshot. Else the SAP HANA Exit variable will not get the assigned value from the selection screen field.

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

Now save and activate the Function Module.

Step 7»

Again, come back to the Report selection screen and enter the relevant value in all the fields. [ using t-code RSRT  for report execution ]

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

Step 8»

In Report Output under Variable Value Tab see the “Hierarchy ID” [ SAP HANA Exit Variable ] get assigned from selection screen value

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

Step 9» 

In some more details how the selection screen field value gets assigned with technical detail.

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

Step 10»

Same report selection screen and respective output in Fiori tiles

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

SAP BW Query, SAP HANA Exit, SAP HANA Career, SAP HANA Prep, SAP HANA Certification, SAP HANA Jobs, SAP HANA Skills

No comments:

Post a Comment