Sei sulla pagina 1di 12

Using Customer Exit Variables in BW/BI Reports Part - 3

Applies to:
SAP BW 3.5, Will also work on SAP BI 7 visit the Business Intelligence homepage.

Summary
This article gives clear picture about how to use Characteristic Customer Exit Variables in SAP-BW/BI Reports. Author(s): Company: Surendra Kumar Reddy Koduru ITC Infotech India Ltd. (Bangalore/INDIA)

Created on: 23 October 2009

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.

SAP COMMUNITY NETWORK 2009 SAP AG

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

Using Customer Exit Variables in BW/BI Reports Part - 3

Table of Contents
Introduction: ........................................................................................................................................................ 3 Live Scenario: ................................................................................................................................................. 3
Steps: ........................................................................................................................................................................... 3 Code: ........................................................................................................................................................................... 6 Code Explanation:........................................................................................................................................................ 9 Report Designer: .......................................................................................................................................................... 9

Related Content ................................................................................................................................................ 11 Disclaimer and Liability Notice .......................................................................................................................... 12

SAP COMMUNITY NETWORK 2009 SAP AG

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

Using Customer Exit Variables in BW/BI Reports Part - 3

Introduction: This article addresses the requirement of Customer Exit variables in BW/BI Reports, in this article Im explaining the following scenario How to use the Characteristic Customer Exit Variables in BW/BI Reports based on 0CALDAY. Live Scenario: In most of the SAP-BI/BW reports (Here I taken Sales example) users want to see the Sales revenue data for entire Financial Year Period. Whenever the User will executes the report he/she dont want to enter the from Date and To Date, but they want to see the Starting Date and Ending Date of the Financial Year Period based on System/Current Date. Eg: Suppose user will execute this report on 23.10.2009, and he want to the data from 01.04.2009 to 31.03.2010 (This is as per INDIA Financial Year Period). To display the data in report as per above example, we need to use the Customer Exit Variable on Date (0CALDAY). Steps: Create Customer Exit Variable on Calendar Day (0CALDAY) Create ZC_FYFD variable on 0CALDAY, the properties are.. Type of Variable Variable Name Processing by Characteristic Variable Represents Variable Entry Check ready for input For reference look into the following screens. = Characteristic = ZC_FYFD = Customer Exit = Calendar Day = Interval = Mandatory

SAP COMMUNITY NETWORK 2009 SAP AG

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

Using Customer Exit Variables in BW/BI Reports Part - 3

SAP COMMUNITY NETWORK 2009 SAP AG

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

Using Customer Exit Variables in BW/BI Reports Part - 3

SAP COMMUNITY NETWORK 2009 SAP AG

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

Using Customer Exit Variables in BW/BI Reports Part - 3

Code: Goto CMOD TCode in SAP-BW/BI and then give your Project Name and click on Change button.

Click on Components

Double Click on EXIT_SAPLRRS0_001

SAP COMMUNITY NETWORK 2009 SAP AG

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

Using Customer Exit Variables in BW/BI Reports Part - 3

Double Click on INCLUDE ZXRSRU01.

SAP COMMUNITY NETWORK 2009 SAP AG

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

Using Customer Exit Variables in BW/BI Reports Part - 3

Write the following Code in the ABAP Editor in ECC:


********************Begin of Data Type Declaration********************************* DATA: L_S_RANGE TYPE RSR_S_RANGESID, LOC_VAR_RANGE LIKE RRRANGEEXIT, zbuper LIKE t009b-poper, zbdatj LIKE t009b-bdatj, ZDT1 TYPE SY-DATUM, ZFDT TYPE SY-DATUM, ZLDT TYPE SY-DATUM. ********************End of Data Type Declaration************************************ ****************************************Begin*************************************** ********To get the Financial Year From and To dates based on System/Current Date**** ********************Surendra Kumar Reddy Koduru***23-10-2009************************ CASE i_vnam. WHEN 'ZC_FYFD'. IF i_step = 1. ZDT1 = SY-DATUM. CALL FUNCTION 'DATE_TO_PERIOD_CONVERT' EXPORTING I_DATE = ZDT1 * I_MONMIT = 00 I_PERIV = 'V3' IMPORTING E_BUPER = zbuper E_GJAHR = zbdatj 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. CALL FUNCTION 'FIRST_AND_LAST_DAY_IN_YEAR_GET' EXPORTING I_GJAHR = zbdatj I_PERIV = 'V3' IMPORTING E_FIRST_DAY = ZFDT E_LAST_DAY = ZLDT 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. l_s_range-low = ZFDT. l_s_range-high = ZLDT. l_s_range-sign = 'I'.

SAP COMMUNITY NETWORK 2009 SAP AG

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

Using Customer Exit Variables in BW/BI Reports Part - 3

l_s_range-opt = 'BT'. APPEND l_s_range TO e_t_range. ENDIF. ENDCASE. *****************************************End***************************************** ****

Save and Activate the above code and project. Code Explanation: The Function Module 'DATE_TO_PERIOD_CONVERT' will take System date and Fiscal year Variant and it will give Fiscal Year period and Year. Take the Year and Fiscal year Variant than pass to 'FIRST_AND_LAST_DAY_IN_YEAR_GET' Function Module, so it will give First and Last Day of the Fiscal Year. Report Designer:

In Report Rows: Drag and Drop Material. In Report Columns: Create New Selection and Drag and Drop 0AMOUNT Key figure and 0CALDAY and restrict 0CALDAY with ZC_FYFD Customer Exit variable.

SAP COMMUNITY NETWORK 2009 SAP AG

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

Using Customer Exit Variables in BW/BI Reports Part - 3

Save and Execute the Report : You can see the following selection screen with Starting and Ending Financial year period dates.

See the Report Result:

SAP COMMUNITY NETWORK 2009 SAP AG

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

Using Customer Exit Variables in BW/BI Reports Part - 3

Related Content
Using Customer Exit Variables in BW or BI Reports Part - 1 How to use Customer Exit Variables in BW Reports: Part - 2 Using Text Variables with Customer Exits in Report Headings Using Text Variables with Customer Exits in Report Headings For more information, visit the Business Intelligence homepage.

SAP COMMUNITY NETWORK 2009 SAP AG

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

Using Customer Exit Variables in BW/BI Reports Part - 3

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 2009 SAP AG

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

Potrebbero piacerti anche