Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Using Customer Exit Variables in SAP BI

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

Using Customer Exit Variables in SAP BI.

Applies to:
SAP BI 7.0. For more information, visit the

Business Intelligence homepage.

Summary
This Article gives you a brief idea on how to create Various Customer exit variables in SAP BI 7.0 Author: Company:

Jagadeesh Ambati Tata Consultancy Services Ltd


th

Created on: 16 Feb 2010

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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 1

Using Customer Exit Variables in SAP BI.

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

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 2

Using Customer Exit Variables in SAP BI.

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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 3

Using Customer Exit Variables in SAP BI.

The screenshots below show us how to create the variable (ZUSICALM) which we can use it for giving input.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 4

Using Customer Exit Variables in SAP BI.

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

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 5

Using Customer Exit Variables in SAP BI.

And uncheck the ready for input

Create ZTCEYEAR1 variable, the properties are.. Variable Name = ZTCEYEAR1 Description = Entered year 1 Processing by = Customer Exit Characteristic = Text Variable Variable Entry = Mandatory

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 6

Using Customer Exit Variables in SAP BI.

And uncheck the ready for input

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

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 7

Using Customer Exit Variables in SAP BI.

Variable Entry = Mandatory Un Check ready for input.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 8

Using Customer Exit Variables in SAP BI.

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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 9

Using Customer Exit Variables in SAP BI.

8. Do the same for all the Remaining 11 month selections with the appropriate customer exit variables as shown in below screen shots.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 10

Using Customer Exit Variables in SAP BI.

9. From July to Dec selections select the text variable ZTCEYEAR1 as shown below.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 11

Using Customer Exit Variables in SAP BI.

10. Write the code as per the instructions below. 11. Go to Tcode CMOD. And enter your project name.

12. Double click on EXIT_SAPLRRS0_001.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 12

Using Customer Exit Variables in SAP BI.

13. Double click on zxrsru01

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.

endloop. endif. when 'ZTCEYEAR'. 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). month = sy-datum+4(2).

if month <= 06.


l_s_range-low = lv_year. l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. append l_s_range to e_t_range. clear: lv_year,month.

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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 13

Using Customer Exit Variables in SAP BI.

when 'ZMICEJANMNTH'. if i_step = '2'. data:


fmonth(2) type n, lmonth(2) type n,

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.

when 'ZMICEFEBMNTH'. 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 = loc_var_range-low+0(4). month = loc_var_range-low+4(2).

if month <= 06. fmonth = 02.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 14

Using Customer Exit Variables in SAP BI.

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 = 02. 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. when 'ZMICEMARMNTH'. 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 = 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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 15

Using Customer Exit Variables in SAP BI.

endif. ENDLOOP. endif. when 'ZMICEAPRMNTH'. 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 = 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.

endif. ENDLOOP. endif. when 'ZMICEMAYMNTH'. 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 = loc_var_range-low+0(4). month = loc_var_range-low+4(2).

if month <= 06. fmonth = 05.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 16

Using Customer Exit Variables in SAP BI.

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 = 05. 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. when 'ZMICEJUNMNTH'. 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 = 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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 17

Using Customer Exit Variables in SAP BI.

ENDLOOP. endif.

when 'ZMICEJULMNTH'. 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 = 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.

endif. ENDLOOP. endif. when 'ZMICEAUGMNTH'. 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 = loc_var_range-low+0(4). month = loc_var_range-low+4(2).

if month <= 06. fmonth = 08.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 18

Using Customer Exit Variables in SAP BI.

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 = 08. 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. when 'ZMICESEPMNTH'. 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 = 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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 19

Using Customer Exit Variables in SAP BI.

endif. ENDLOOP. endif. when 'ZMICEOCTMNTH'. 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 = 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.

endif. ENDLOOP. endif. when 'ZMICENOVMNTH'. 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 = loc_var_range-low+0(4). month = loc_var_range-low+4(2).

if month <= 06. fmonth = 11.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 20

Using Customer Exit Variables in SAP BI.

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 = 11. 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. when 'ZMICEDECMNTH'. 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 = 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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 21

Using Customer Exit Variables in SAP BI.

ENDLOOP. endif. Executing the query will result in the below screen.

Enter value for Calmonth/Year(Eg:02/2010). And the report output would be

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

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 22

Using Customer Exit Variables in SAP BI.

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.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 23

Using Customer Exit Variables in SAP BI.

Disclaimer and Liability Notice


This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 24

You might also like