This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
SAP BW 7.0 and will also work on BW 3.5. For more information, visit the EDW homepage.
Summary
This article explains step by step process about how to use Customer Exit Variables in SAP BW/BI reports.
Author: Prakash Kumar Sahu
Company: Tata Technologies Limited (Pune/India)
Created on: 07 April 2011
Author Bio
Prakash Kumar Sahu is a SAP BI consultant with more than 2 years of SAP BI/BW experience and currently working with Tata Technologies Limited (Pune/India). He has got rich experience and worked on various BW/BI implementation/Support projects.
Business Scenario: ............................................................................................................................................. 3
Testing of Code: ................................................................................................................................................. 9
Execute the Report: .......................................................................................................................................... 13
See the Report Result: ..................................................................................................................................... 13
Related Content ................................................................................................................................................ 14
Disclaimer and Liability Notice .......................................................................................................................... 15
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous Month
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
This article explains requirement of Customer Exit Variables in BW/BI reports. We will learn how to use characteristic Customer Exit variables in our BI reports.
Customer Exit Variable: In BI project, consultant often come across the situation when they need to use a processing type other than manual entry / default value, replacement path, SAP exit, or authorization to fulfill the requirement of the customer, then a customer exit gives you the option of setting up a processing type for variables, tailor-made to your specific needs.
Business Scenario:
In many BI reports (For example Sales Report) user want to see the MTD (Month-To-Date) sales data. For example if user runs the sales report on 7
th April, 2011 then report should give the sales data from 1
st April,
2011 to 6th April, 2011. Similarly if user runs the sales report on 1
st day of any month then report should give
the sales data of all the days of last month. For example, if user runs the report on 1st April, 2011 then report
should give the sales data from 1st March, 2011 to 31
st March, 2011.
In order to reflect the data in our BI report as per above requirement, we need to use the Customer Exit
Variable on Calendar Day (0CALDAY)
Steps:
1.Create Customer Exit Variable on Calendar Day (0CALDAY)
Create Z_FDCPM (First Day of Current\Previous Month). The properties of the variable are as below:-
Type of Variable : Characteristic
Variable Name : Z_FDCPM
Processing By : Customer Exit
Characteristic : Calendar Day
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous Month
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
We will test our codes to check if our customer exit variable works as per the given requirement or not. We will provide the date manually and will check for its return value. Following are some test cases.
Input Date Expected output date
01.01.2011 ( 20110101 ) 01.12.2010 ( 20101201 )
01.02.2011 ( 20110201 ) 01.01.2011 ( 20110101 )
07.02.2011 ( 20110207 ) 01.02.2011 ( 20110201 )
In data type declaration declare temporary variable curdt as below.
curdt LIKE sy-datum,
For testing purpose only, temporarily modify your codes as below.
Set the External Breakpoint as below.
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous Month
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
Double click on the variable during the debugging to get the current value of the variable at that instant. After debugging is complete we get the values of variables as below.
We can see that, we are getting the output date as expected.
Following are screenshots for other two cases after debugging.
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous Month
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
In Report Rows: Drag and Drop Calendar Day and Factory Characteristics.
In Report Columns: Drag and Drop Quantity key figure.
In Report Fitter: Restrict the 0CALDAY(Calendar day) with a range whose lower limit is Customer Exit Variable Z_FDCPM(First Day of Current\Previous month) and upper limit is 0DAT (Current Calendar Day) with offset -1. Please note that 0DAT gives today’s date so 0DAT-1 will give yesterday’s date.
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous Month
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
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.