How To Use Text Variables in BW Reports Part - 1 PDF
How To Use Text Variables in BW Reports Part - 1 PDF
Reports Part - 1
Applies to:
SAP NetWeaver Business Warehouse (Formerly BI), Will also work on SAP BI 3.5. For more information,
visit the EDW homepage
Summary
This article gives clear picture about how to use Text Variables in BW/BI reports headings.
Author:
Author Bio
Surendra Kumar Reddy Koduru is a SAP BI Lead Consultant currently working with ITC Infotech
India Ltd (Bangalore/INDIA). He has got rich experience and worked on various BW/BI
Implementation/Support Projects and he is the author for various Articles and Blogs (SAP-BW/BI) in
SAP Community Network.
Table of Contents
Introduction: ........................................................................................................................................................ 3
Live Scenario: ................................................................................................................................................. 3
Steps: .............................................................................................................................................................. 3
Creating Text Variables:.................................................................................................................................. 6
Code: ............................................................................................................................................................... 9
Code Explanation: ......................................................................................................................................... 12
Report Designer: ........................................................................................................................................... 12
Selection Screen: .......................................................................................................................................... 14
Report Result: ............................................................................................................................................... 15
Related Content ................................................................................................................................................ 16
Disclaimer and Liability Notice .......................................................................................................................... 18
Introduction:
This article addresses the requirement of Text Variables in BW/BI Reports, in this article Im explaining the
following scenario
How to use the Text Variable in BW/BI Reports, and how to display the data for Fiscal Year Period based on
User Input Date.
Live Scenario:
Users want to see the Sales revenue data for Financial Year Period based on Users Input date and they
want to know for what Financial Year Period the report is displaying the result, i.e. they want to see the
Financial Year Period in Report heading.
Steps:
Create User Entry Variable ZDATE_M on 0CALDAY.
For reference look into the following screens.
Once you create Text Variable and close the Variable creation window, after that you can see the Text
Variable in below screen.
After that, we need to write the code for that Text Variable to populate the Fiscal Year Period based on user
input.
Code:
Goto CMOD TCode in SAP-BW/BI and then give your Project Name and click on Change button.
Click on Components
CASE i_vnam.
* The Below is to calculate the Fiscal Year Period based on User Input Date.
*
*
*
*
*
*
*
WHEN 'ZFYP_CE'.
IF i_step = 2.
LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDATE_M'.
CLEAR: l_s_range.
ZDT = loc_var_range-low.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
I_DATE
= ZDT
I_MONMIT
= 00
I_PERIV
= 'V3'
IMPORTING
E_BUPER
= ZBUPER
E_GJAHR
= ZGJAHR
EXCEPTIONS
INPUT_FALSE
= 1
T009_NOTFOUND
= 2
T009B_NOTFOUND
= 3
OTHERS
= 4
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CONCATENATE ZGJAHR ZBUPER into l_s_range-low.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
The Below is to calculate the Fiscal Year Period based on User Input Date and display the same value in
Text Variable.
WHEN 'ZT_FYPERIOD'.
IF i_step = 2.
LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDATE_M'.
CLEAR: l_s_range.
ZDT = loc_var_range-low.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
I_DATE
= ZDT
*
I_MONMIT
= 00
I_PERIV
= 'V3'
IMPORTING
E_BUPER
= ZBUPER
E_GJAHR
= ZGJAHR
*
EXCEPTIONS
*
*
*
*
*
*
INPUT_FALSE
= 1
T009_NOTFOUND
= 2
T009B_NOTFOUND
= 3
OTHERS
= 4
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CONCATENATE ZBUPER '.' ZGJAHR into l_s_range-low.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ENDLOOP.
ENDIF.
In Filters:
Drag & Drop 0FISCVARNT, 0CALDAY and restrict 0FISCVARNT with V3 (as per India) and 0CALDAY with
User Input Variable.
In Rows:
Drag and Drop Material and Plant.
In Columns:
Create New Selection and Drag and Drop Amount and 0FISCPER, restrict 0FISCPER with ZFYP_CE
Variable like above.
Save and Execute the Report :
Selection Screen:
Once you execute the report you can see the following selection screen:
Once you execute the report, it will ask Date, in above screen I given 06/01/2011, i.e. MM/DD/YYY format
and executed.
Report Result:
See the following Report Result:
Here the result is displayed for 003.2011 period, because 01.06.2011 (DD.MM.YYYY) means 003.2011.
Related Content
For all Articles and Blogs by Surendra Kumar Reddy, Please visit this URL
Using Customer Exit Variables in BW Reports Part - 1
Using Customer Exit Variables in BW Reports Part - 2
Using Customer Exit Variables in BW Reports Part - 3
Using Customer Exit Variables in BW Reports Part - 4
Using Customer Exit Variables in BW Reports Part - 5
Using Customer Exit Variables in BW Reports Part - 6
Using Customer Exit Variables in BW Reports: Part - 8
Using Customer Exit Variables in BW Reports: Part - 9
Using Customer Exit Variables in BW Reports: Part - 10
Using Customer Exit Variables in BW Reports: Part - 11
Using Customer Exit Variables in BW Reports: Part - 12
Using Customer Exit Variables in BW Reports: Part - 13
Using Customer Exit Variables in BW Reports: Part - 14
Using Customer Exit Variables in BW Reports: Part - 15
Using Customer Exit Variables in BW Reports: Part - 16
Using Customer Exit Variables in BW Reports: Part - 17
Using Customer Exit Variables in BW Reports: Part - 18
Inventory Management (0IC_C03) Part - 1
Inventory Management (0IC_C03) Part - 2
Inventory Management (0IC_C03) Part - 3
To Check the Files/Reports in Application Server and trigger mail alerts
Calculating the Ageing of the Materials
Using Selective Deletion in Process Chains
Triggering the Process Chains at Particular Date using Events
Analysis Process Designer (APD) Part - 1
Analysis Process Designer (APD) Part - 2
Analysis Process Designer (APD): Part - 3
Open Hub Destination: Part 1
Open Hub Destination: Part 2
InfoSpoke Part 1
InfoSpoke Part 2
Using Rule Group in SAP-BI Part - 1
Data Flow from LBWQ/SMQ1 to RSA7 in ECC and Delta Extraction in BI
Checking the Data using Extractor Checker (RSA3) in ECC Delta Repeat Delta etc...
Data Flow from LBWQ SMQ1 to RSA7 in ECC (Records Comparison)
How to Correct Routines in Transformations
How to Use Text Variables in BW Reports Part - 2
For more information, visit the EDW homepage