Using Customer Exit Variables in SAP BI
Using Customer Exit Variables in SAP BI
Using Customer Exit Variables in SAP BI
Applies to:
SAP BI 7.0. For more information, visit the
Summary
This Article gives you a brief idea on how to create Various Customer exit variables in SAP BI 7.0 Author: Company:
Author Bio
Jagadeesh Ambati is an SAP BI/BO consultant currently working with Tata Consultancy Services (Bangalore/INDIA). He has got rich experience and worked on various BI/BO implementation/Support projects.
Table of Contents
Introduction: ........................................................................................................................................................ 3 Business Scenario: ............................................................................................................................................. 3 Steps: .............................................................................................................................................................. 3
1. Create User Entry Variable on Calendar Month (0CALMONTH) ........................................................................... 3 2. Drag and Drop a keyfigure and restrict with the above created variable for make it available in the selection screen.(Use the screenshot below for reference). ....................................................................................................... 5 3. Hide the keyfigure Quantity for not to display it. .................................................................................................... 5 4. Create 2 text variables of type customer exit with below mentioned properties. .................................................... 5 5. Since we have to display 12 months forecast, Create 12 Customer exit variables of Characteristic type with below mentioned properties. ........................................................................................................................................ 7 6. Create 12 selections in the Columns panel as shown below. ................................................................................ 9 7. Drag and Drop Forecast keyfigure in the details of the selection panel and Restrict the Jan Selection with the created Customer exit variable as shown below. ......................................................................................................... 9 8. Do the same for all the Remaining 11 month selections with the appropriate customer exit variables as shown in below screen shots. ................................................................................................................................................... 10 9. From July to Dec selections select the text variable ZTCEYEAR1 as shown below. ........................................... 11 10. Write the code as per the instructions below. ...................................................................................................... 12 11. Go to Tcode CMOD. And enter your project name. ............................................................................................. 12 12. Double click on EXIT_SAPLRRS0_001. .............................................................................................................. 12 13. Double click on zxrsru01 ...................................................................................................................................... 13
The code ........................................................................................................................................................... 13 Related Content ................................................................................................................................................ 23 Disclaimer and Liability Notice .......................................................................................................................... 24
Introduction:
This article addresses the requirement of Customer Exit variables in BW/BI Reports; in this article Im explaining the following two types of variables. 1. How to use the Characteristic Customer Exit Variables in BI Reports. 2. How to use the Text Variables in BI Reports.
Business Scenario:
In Most of the APO reports, Users want to see the Sales actuals and forecasted data for the future and as st well as in the past. i.e. for example, if the user enters a month which is in 1 half(Jan-Jun), then the report nd has to show the data for the entire year. If the entered month is in 2 half of the year then the report has to nd st show the 2 half of the entered year and the 1 half of the next year. Eg: If the user gives 03/2010 then the report has to show all the months of 2010 starting from Jan to Dec. if nd st the user gives 08/2010 then the report has to show 2 half of 2010(Jul-Dec) and 1 Half of 2011(Jan-Jun). To display the data as per above example we need to use Customer exit variables on 0CALMONTH. Along with the Forecast information, Users want to display the Month and year details in the Columns headings. To display these values in columns headings, we need to use the Text Variables. Steps: Create a Characteristic value variable on Calendar month with below properties 1. Create User Entry Variable on Calendar Month (0CALMONTH) Create ZUSICALM variable on 0CALMONTH, the properties are. Type of Variable = Characteristic Variable Name = ZUSICALM Processing by = User Entry/Default Value Characteristic =Calendar Month Variable Represents = Single Value Variable Entry = Mandatory Check ready for input.
The screenshots below show us how to create the variable (ZUSICALM) which we can use it for giving input.
2. Drag and Drop a keyfigure and restrict with the above created variable for make it available in the selection screen.(Use the screenshot below for reference).
3. Hide the keyfigure Quantity for not to display it. 4. Create 2 text variables of type customer exit with below mentioned properties. Create Two Text variables like below... Create ZTCEYEAR variable, the properties are.. Variable Name = ZTCEYEAR Description = Entered year Processing by = Customer Exit Characteristic = Text Variable Variable Entry = Mandatory
Create ZTCEYEAR1 variable, the properties are.. Variable Name = ZTCEYEAR1 Description = Entered year 1 Processing by = Customer Exit Characteristic = Text Variable Variable Entry = Mandatory
5. Since we have to display 12 months forecast, Create 12 Customer exit variables of Characteristic type with below mentioned properties. Create Customer exit Variable on Calendar Month (0CALMONTH) Create ZMICEJANMNTH variable on 0CALMONTH, the properties are. Type of Variable = Characteristic Variable Name = ZMICEJANMNTH Processing by = Customer Exit Characteristic =Calendar Month Variable Represents = Single Value
Create another 11 variables for each month as above. 6. Create 12 selections in the Columns panel as shown below.
1. Enter description as Jan and Next to it, select the Text variable ZTCEYEAR as shown below.
7. Drag and Drop Forecast keyfigure in the details of the selection panel and Restrict the Jan Selection with the created Customer exit variable as shown below.
8. Do the same for all the Remaining 11 month selections with the appropriate customer exit variables as shown in below screen shots.
9. From July to Dec selections select the text variable ZTCEYEAR1 as shown below.
10. Write the code as per the instructions below. 11. Go to Tcode CMOD. And enter your project name.
The code
For text variables please write the code as below. when 'ZTCEYEAR2'. if i_step = '2'.
lv_var1 = 1. Loop at I_T_VAR_RANGE INTO LOC_VAR_RANGE where VNAM = 'ZUSICALM'.
clear l_s_range.
lv_year = sy-datum+0(4). lv_year1 = lv_year - lv_var1. l_s_range-low = lv_year1. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year1.
clear l_s_range.
lv_year = sy-datum+0(4). month = sy-datum+4(2).
else.
lv_year1 = lv_year + lv_var1. l_s_range-low = lv_year1. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year1,month. endif.
endloop. endif.
Please write below code for the Customer exit variables.
fper(6) type n,
lper(6) type n. lv_var1 = 1. Loop at I_T_VAR_RANGE INTO LOC_VAR_RANGE where VNAM = 'ZUSICALM'.
clear l_s_range.
lv_year = loc_var_range-low+0(4). month = loc_var_range-low+4(2).
if month <= 06. fmonth = 01. concatenate lv_year fmonth into fper.
l_s_range-low = fper. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year,month,fper. else. fmonth = 01. lv_year1 = lv_year + lv_var1. concatenate lv_year1 fmonth into fper. l_s_range-low = fper. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year,month,fper. endif.
ENDLOOP. endif.
clear l_s_range.
lv_year = loc_var_range-low+0(4). month = loc_var_range-low+4(2).
clear l_s_range.
lv_year = loc_var_range-low+0(4). month = loc_var_range-low+4(2).
if month <= 06. fmonth = 03. concatenate lv_year fmonth into fper.
l_s_range-low = fper. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year,month,fper. else. fmonth = 03. lv_year1 = lv_year + lv_var1. concatenate lv_year1 fmonth into fper. l_s_range-low = fper. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year,month,fper.
clear l_s_range.
lv_year = loc_var_range-low+0(4). month = loc_var_range-low+4(2).
if month <= 06. fmonth = 04. concatenate lv_year fmonth into fper.
l_s_range-low = fper. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year,month,fper. else. fmonth = 04. lv_year1 = lv_year + lv_var1. concatenate lv_year1 fmonth into fper. l_s_range-low = fper. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year,month,fper.
clear l_s_range.
lv_year = loc_var_range-low+0(4). month = loc_var_range-low+4(2).
clear l_s_range.
lv_year = loc_var_range-low+0(4). month = loc_var_range-low+4(2).
if month <= 06. fmonth = 06. concatenate lv_year fmonth into fper.
l_s_range-low = fper. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year,month,fper. else. fmonth = 06. lv_year1 = lv_year + lv_var1. concatenate lv_year1 fmonth into fper. l_s_range-low = fper. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year,month,fper.
endif.
ENDLOOP. endif.
clear l_s_range.
lv_year = loc_var_range-low+0(4). month = loc_var_range-low+4(2).
if month <= 06. fmonth = 07. concatenate lv_year fmonth into fper.
l_s_range-low = fper. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year,month,fper. else. fmonth = 07. lv_year1 = lv_year + lv_var1. concatenate lv_year1 fmonth into fper. l_s_range-low = fper. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year,month,fper.
clear l_s_range.
lv_year = loc_var_range-low+0(4). month = loc_var_range-low+4(2).
clear l_s_range.
lv_year = loc_var_range-low+0(4). month = loc_var_range-low+4(2).
if month <= 06. fmonth = 09. concatenate lv_year fmonth into fper.
l_s_range-low = fper. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year,month,fper. else. fmonth = 09. lv_year1 = lv_year + lv_var1. concatenate lv_year1 fmonth into fper. l_s_range-low = fper. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year,month,fper.
clear l_s_range.
lv_year = loc_var_range-low+0(4). month = loc_var_range-low+4(2).
if month <= 06. fmonth = 10. concatenate lv_year fmonth into fper.
l_s_range-low = fper. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year,month,fper. else. fmonth = 10. lv_year1 = lv_year + lv_var1. concatenate lv_year1 fmonth into fper. l_s_range-low = fper. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year,month,fper.
clear l_s_range.
lv_year = loc_var_range-low+0(4). month = loc_var_range-low+4(2).
clear l_s_range.
lv_year = loc_var_range-low+0(4). month = loc_var_range-low+4(2).
if month <= 06. fmonth = 12. concatenate lv_year fmonth into fper.
l_s_range-low = fper. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year,month,fper. else. fmonth = 12. lv_year1 = lv_year + lv_var1. concatenate lv_year1 fmonth into fper. l_s_range-low = fper. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year,month,fper.
endif.
ENDLOOP. endif. Executing the query will result in the below screen.
If the entered month is in 1 half of the year(Jan-Jun) report displays all the 12 months(Jan-Dec) data of the nd nd entered year. If the entered month is in 2 half then the report displays 2 half of the entered year(Jul-Dec) st and the 1 half(Jan-Jun) of the next year.
st
Related Content
Reference 1 https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/su/Using%20Customer%20Exit%20Variables%20in%20BW%20or%20BI%20Reports%20Part%20-%201.pdf Reference 2 https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/gi/How%20to%20use%20Customer%20Exit%20Variables%20in%20BW%20Reports%3a%20Part%202.pdf Reference 3 http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/10fc4382-afa6-2c10-1380fa224fe4324f&overridelayout=true Reference 4 For more information, visit the Business Intelligence homepage.