Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthApplies to:SAP BW 7.0 and will also ...
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthTable of ContentsIntroduction: ........
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthIntroduction:This article explains r...
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthVariable Represents: Single ValueVar...
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous Month1.5 Make the setting as below in Gen...
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthCode:Go to T-Code CMOD in BW and the...
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthDouble click on ZXRSRU01.Write the f...
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous Month         IF i_step = 2.           RE...
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthTesting of Code:We will test our cod...
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthEnter the t-code RSRT in BW, give th...
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthDouble click on the variable during ...
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthReport Designer:In Report Rows: Drag...
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthExecute the Report:See the Report Re...
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthRelated Contenthttps://www.sdn.sap.c...
Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthDisclaimer and Liability NoticeThis ...
Upcoming SlideShare
Loading in …5
×

Customer exit variables in sap

5,874 views
5,560 views

Published on

0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,874
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
177
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Customer exit variables in sap

  1. 1. Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthApplies to:SAP BW 7.0 and will also work on BW 3.5. For more information, visit the EDW homepage.SummaryThis article explains step by step process about how to use Customer Exit Variables in SAP BW/BI reports.Author: Prakash Kumar SahuCompany: Tata Technologies Limited (Pune/India)Created on: 07 April 2011Author 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.SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 1
  2. 2. Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthTable of ContentsIntroduction: ........................................................................................................................................................ 3Business Scenario: ............................................................................................................................................. 3Steps:………….. ................................................................................................................................................. 3Code:…………… ................................................................................................................................................ 6Testing of Code: ................................................................................................................................................. 9Report Designer: ............................................................................................................................................... 12Execute the Report: .......................................................................................................................................... 13See the Report Result: ..................................................................................................................................... 13Related Content ................................................................................................................................................ 14Disclaimer and Liability Notice .......................................................................................................................... 15SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 2
  3. 3. Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthIntroduction:This article explains requirement of Customer Exit Variables in BW/BI reports. We will learn how to usecharacteristic Customer Exit variables in our BI reports.Customer Exit Variable: In BI project, consultant often come across the situation when they need to use aprocessing type other than manual entry / default value, replacement path, SAP exit, or authorization to fulfillthe requirement of the customer, then a customer exit gives you the option of setting up a processing type forvariables, 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 th stexample if user runs the sales report on 7 April, 2011 then report should give the sales data from 1 April, th st2011 to 6 April, 2011. Similarly if user runs the sales report on 1 day of any month then report should give stthe sales data of all the days of last month. For example, if user runs the report on 1 April, 2011 then report st stshould give the sales data from 1 March, 2011 to 31 March, 2011.In order to reflect the data in our BI report as per above requirement, we need to use the Customer ExitVariable on Calendar Day (0CALDAY)Steps:1.Create Customer Exit Variable on Calendar Day (0CALDAY)Create Z_FDCPM (First Day of CurrentPrevious Month). The properties of the variable are as below:-Type of Variable : CharacteristicVariable Name : Z_FDCPMProcessing By : Customer ExitCharacteristic : Calendar DaySAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 3
  4. 4. Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthVariable Represents: Single ValueVariable Entry : MandatoryDo not check ready for input.Below are some screenshots for better understanding:-1.1 Double click on Calendar day InfoObject in your query or right click and select restrict.1.2 Select Variables from drop-down box.1.3 Select Characteristic Value Variable as a type from dropdown box.1.4 Click on “Create New Variable”.SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 4
  5. 5. Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous Month1.5 Make the setting as below in General tab.1.6 Make the settings as below in the Details Tab. Leave the other tabs in its default settings. Click OK.SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 5
  6. 6. Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthCode:Go to T-Code CMOD in BW and then give your Project Name and click on Change button.Click on Components.Double Click on EXIT_SAPLRRS0_001.SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 6
  7. 7. Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthDouble click on ZXRSRU01.Write the following code in the ABAP Editor. *---------------------------------------------------------- * * INCLUDE ZXRSRU01 * *---------------------------------------------------------- * * *************** Data Type Declaration ****************** * DATA : l_s_range TYPE RSR_S_RANGESID, loc_var_range LIKE RRRANGEEXIT, yyyy(4) TYPE n, mm(2) TYPE n, dd(2) TYPE n, fst_date LIKE sy-datum, begdt LIKE sy-datum. CASE i_vnam. * Below codes calculate first day of current/previous month * (If Date is first day of the month then it gives first day * of the previous month, If date is not the first date of the * month then it gives first day of the current month) WHEN Z_FDCPM.SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 7
  8. 8. Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous Month IF i_step = 2. REFRESH e_t_range. dd = sy-datum+6(2). mm = sy-datum+4(2). yyyy = sy-datum+0(4). IF dd = 01 AND mm = 01. mm = 12. yyyy = yyyy - 1. ELSEIF dd = 01 AND mm <> 01. mm = mm - 1. ELSEIF dd <> 01. mm = mm. ENDIF. CLEAR : fst_date. CONCATENATE yyyy mm 01 INTO fst_date. begdt = fst_date. CALL FUNCTION DATE_TO_PERIOD_CONVERT EXPORTING i_date = begdt * I_MONMIT = 00 i_periv = V3 IMPORTING e_buper = mmm e_gjahr = yyyy. CALL FUNCTION FIRST_DAY_IN_PERIOD_GET EXPORTING i_gjahr = yyyy * I_MONMIT = 00 i_periv = V3 i_poper = mmm IMPORTING e_date = firdt. CLEAR: ls_ra_sid. ls_ra_sid-sign = I. ls_ra_sid-opt = EQ. ls_ra_sid-low = firdt. CLEAR: ls_ra_sid-high. APPEND ls_ra_sid TO e_t_range. ENDIF. * Above codes calculate first day of current/previous month ENDCASE.SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 8
  9. 9. Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthTesting of Code:We will test our codes to check if our customer exit variable works as per the given requirement or not. Wewill 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.SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 9
  10. 10. Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthEnter the t-code RSRT in BW, give the query name and press enter. After this, click on Execute + Debug.Following are some function Keys for debugging.F5 Single StepF6 ExecuteF7 ReturnF8 ContinuePress F5 one by one till cursor points to ENDFUNCTION. When cursor points to ENDFUNCTION then clickF8 to continue.SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 10
  11. 11. Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthDouble click on the variable during the debugging to get the current value of the variable at that instant. Afterdebugging 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.SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 11
  12. 12. Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthReport Designer: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 ExitVariable Z_FDCPM(First Day of CurrentPrevious 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.SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 12
  13. 13. Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthExecute the Report:See the Report Result: th stSee the date ranges in the report. Report was executed on 7 April, 2011 so it is giving data from 1 April, th 2011 to 6 April, 2011.SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 13
  14. 14. Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthRelated Contenthttps://www.sdn.sap.com/irj/sdn/indexImplementing Customer Exit Reporting Variables as MethodsSAP Library - Customer ExitsSAP Library - BI Suite - Reporting Variables-Customer ExitsFor more information, visit the EDW homepageSAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 14
  15. 15. Customer Exit Variables in SAP BW/BI Reports – First day of the Current/Previous MonthDisclaimer and Liability NoticeThis document may discuss sample coding or other information that does not include SAP official interfacesand therefore is not supported by SAP. Changes made based on this information are not supported and canbe overwritten during an upgrade.SAP will not be held liable for any damages caused by using or misusing the information, code or methodssuggested 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 ofthis technical article or code sample, including any liability resulting from incompatibility between the contentwithin this document and the materials and services offered by SAP. You agree that you will not hold, orseek to hold, SAP responsible or liable with respect to the content of this document.SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com© 2011 SAP AG 15

×