CUS EXIT 10

Embed Size (px)

Citation preview

  • 8/3/2019 CUS EXIT 10

    1/15

    SAP COMMUNITY NETWOR SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Using Customer Exit Variables inBW/BI Reports: Part - 16

    Applies to:

    SAP NetWeaver Business Warehouse (Formerly BI), Will also work on SAP BI 3.5.EDW homepage.

    Summary

    This article gives clear picture about how to use Characteristic Customer Exit Variables in SAP-BW/BIReports.

    Author: Surendra Kumar Reddy Koduru

    Company: ITC Infotech India Ltd. (Bangalore/INDIA)

    Created on: 03 June 2011

    Author Bio

    Surendra Kumar Reddy Koduru is a SAP BI Lead Consultant currently working with ITCInfotech India Ltd (Bangalore/INDIA). He has got rich experience and worked on variousBW/BI Implementation/Support Projects and he is the author for various Articles and Blogs(SAP-BW/BI) in SAP Community Network.

    http://help.sap.com/saphelp_nw70/helpdata/en/b2/e50138fede083de10000009b38f8cf/content.htmhttp://help.sap.com/saphelp_nw70/helpdata/en/b2/e50138fede083de10000009b38f8cf/content.htmhttp://help.sap.com/saphelp_nw70/helpdata/en/b2/e50138fede083de10000009b38f8cf/content.htmhttp://help.sap.com/saphelp_nw70/helpdata/en/b2/e50138fede083de10000009b38f8cf/content.htm
  • 8/3/2019 CUS EXIT 10

    2/15

    Using Customer Exit Variables in BW/BI Reports: Part- 16

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Table of Contents

    Introduction: ........................................................................................................................................................ 3Live Scenario: ................................................................................................................................................. 3

    Steps: ........................................................................................................................................................................... 3Code: ........................................................................................................................................................................... 5Code Explanation: ........................................................................................................................................................ 9Report Designer: .......................................................................................................................................................... 9Selection Screen: ....................................................................................................................................................... 11Report Result: ............................................................................................................................................................ 12

    Related Content ................................................................................................................................................ 14Disclaimer and Liability Notice .......................................................................................................................... 15

  • 8/3/2019 CUS EXIT 10

    3/15

    Using Customer Exit Variables in BW/BI Reports: Part- 16

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Introduction:

    This article addresses the requirement of Customer Exit variables in BW/BI Reports; in this article Imexplaining the following scenarioNeed to display the report result like belowCalculate the Last Day of the of the Current Fiscal Year Period 5 (Minus5) based on Current Fiscal YearPeriod, dont hard code, first calculate the Current Fiscal Year Period and then using that calculate First Day

    & Last Day in that Fiscal Year Period and display the result for Last day of the Current Fiscal Year Period 5(Minus5).

    Live Scenario:

    In some of the SAP-BI/BW reports, users want to see the Sales revenue data for Last Day of the CurrentFiscal Year Period 5 (Minus5) based on Current Fiscal Year Period, dont hard code, first calculate theCurrent Fiscal Year Period and then using that calculate First Day & Last Day in that Fiscal Year Period anddisplay the result for Last day of the Current Fiscal Year Period 5 (Minus5).This Logic is useful in some kind of special requirements.

    Steps:

    Create Customer Exit Variable ZDT_5MLD on 0CALDAY.For reference look into the following screens.

  • 8/3/2019 CUS EXIT 10

    4/15

    Using Customer Exit Variables in BW/BI Reports: Part- 16

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

  • 8/3/2019 CUS EXIT 10

    5/15

    Using Customer Exit Variables in BW/BI Reports: Part- 16

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Code:

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

    Click on Components

  • 8/3/2019 CUS EXIT 10

    6/15

    Using Customer Exit Variables in BW/BI Reports: Part- 16

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Double Click on EXIT_SAPLRRS0_001

    Double Click on INCLUDE ZXRSRU01.

  • 8/3/2019 CUS EXIT 10

    7/15

    Using Customer Exit Variables in BW/BI Reports: Part- 16

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Write the following Code in the ABAP Editor in ECC:

    *&---------------------------------------------------------------------* *& Include ZXRSRU01*&---------------------------------------------------------------------*

    DATA : l_s_range TYPE rsr_s_rangesid,loc_var_range LIKE rrrangeexit.

    DATA: ZFISCPER TYPE /BI0/OIFISCPER,zsfyprd TYPE /bi0/oifiscper,

    DATA: ZGJAHR LIKE T009B-BDATJ,ZBUPER LIKE T009B-POPER.

    DATA: ZCM_FD TYPE SY-DATUM,ZCM_LD TYPE SY-DATUM.

    CASE i_vnam.

    WHEN'ZDT_5MLD'.REFRESH E_T_RANGE.

    IF i_step = 1 .CLEAR l_s_range.ZDT1 = SY-DATUM.

    CALLFUNCTION'UMB_GET_CURRENT_FISCPER'EXPORTINGI_PERIV = 'V3'

    IMPORTINGE_FISCPER = zsfyprd.

    CALLFUNCTION'UMB_SERVICE_FISCPER_CALC'EXPORTINGV_FISCPER = zsfyprd

    * V_ADD = 0V_MINUS = 5V_PERIV = 'V3'

    IMPORTINGE_FISCPER = zefyprd5

    * CHANGING

    * U_OVERFLOW =* D_OVERFLOW =* EXCEPTIONS* PERIV_NOT_FOUND = 1* OTHERS = 2

    .IF SY-SUBRC 0.

    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • 8/3/2019 CUS EXIT 10

    8/15

    Using Customer Exit Variables in BW/BI Reports: Part- 16

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    ENDIF.

    ZBUPER = zefyprd5+4(3).ZGJAHR = zefyprd5+0(4).

    CALLFUNCTION'FIRST_DAY_IN_PERIOD_GET'

    EXPORTINGI_GJAHR = ZGJAHR

    * I_MONMIT = 00I_PERIV = 'V3'I_POPER = ZBUPER

    IMPORTINGE_DATE = ZCM_FD

    * 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.

    CALLFUNCTION'LAST_DAY_IN_PERIOD_GET'EXPORTINGI_GJAHR = ZGJAHR

    * I_MONMIT = 00I_PERIV = 'V3'I_POPER = ZBUPER

    IMPORTINGE_DATE = ZCM_LD

    * 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 = ZCM_LD.l_s_range-opt = 'EQ'.l_s_range-sign = 'I'.APPEND l_s_range TO e_t_range.

    ENDIF.

    ENDCASE.

    Save and Activate the above code and project.

  • 8/3/2019 CUS EXIT 10

    9/15

    Using Customer Exit Variables in BW/BI Reports: Part- 16

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Code Explanation:

    The Function Module 'UMB_GET_CURRENT_FISCPER'will take Fiscal Year Variant as input, andit will give current Fiscal Year Period. FIRST_DAY_IN_PERIOD_GET will use this value as aInput and it will calculate the First Day of the Current Fiscal Year Period.

    The Function Module UMB_SERVICE_FISCPER_CALC will take Fiscal Year Period and FiscalYear Variant as input, and it will minus/subtract 1 , because if you see above code wegiven V_MINUS = 5, and give the Input Fiscal Year Period - 5.

    The Function Module 'UMB_GET_CURRENT_FISCPER'will take Fiscal Year Variant as input, andit will give current Fiscal Year Period. LAST_DAY_IN_PERIOD_GET will use this value as aInput and it will calculate the Last Day of the Current Fiscal Year Period.

    Report Designer:

  • 8/3/2019 CUS EXIT 10

    10/15

    Using Customer Exit Variables in BW/BI Reports: Part- 16

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

  • 8/3/2019 CUS EXIT 10

    11/15

    Using Customer Exit Variables in BW/BI Reports: Part- 16

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    In Filters:

    Nothing.In Rows:

    Drag and Drop Material and Plant.

    In Columns:

    Create New Selection and Drag and Drop Amount, 0CALDAY and restrict 0CALDAY with ZDT_5MLDVariable like above.

    Save and Execute the Report :

    Selection Screen:

    Once you execute the report you cant see any selection screen, because we used Customer Exit

    Variable on 0CALDAY.

  • 8/3/2019 CUS EXIT 10

    12/15

    Using Customer Exit Variables in BW/BI Reports: Part- 16

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Report Result:

    See the following Report Result:

    Here the result is displayed for 31.01.201 date.

  • 8/3/2019 CUS EXIT 10

    13/15

    Using Customer Exit Variables in BW/BI Reports: Part- 16

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    See the below Image from RSRT, i.e. execute the report in RSRT then see Input and Output like below.

  • 8/3/2019 CUS EXIT 10

    14/15

    Using Customer Exit Variables in BW/BI Reports: Part- 16

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG

    Related Content

    Using Customer Exit Variables in BW Reports Part - 4

    Using Customer Exit Variables in BW Reports Part - 3

    How to use Customer Exit Variables in BW Reports: Part - 2

    Using Customer Exit Variables in BW or BI Reports Part - 1

    Using Text Variables with Customer Exits in Report Headings

    Using Text Variables with Customer Exits in Report Headings

    Variables of Type Customer Exit

    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/f0fefc77-40e3-2c10-8da3-d4bfcb013387http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/f0fefc77-40e3-2c10-8da3-d4bfcb013387http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/f0fefc77-40e3-2c10-8da3-d4bfcb013387https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/g-i/How%20to%20use%20Customer%20Exit%20Variables%20in%20BW%20Reports%3a%20Part%202.pdfhttps://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/g-i/How%20to%20use%20Customer%20Exit%20Variables%20in%20BW%20Reports%3a%20Part%202.pdfhttps://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/s-u/Using%20Customer%20Exit%20Variables%20in%20BW%20or%20BI%20Reports%20Part%20-%201.pdfhttps://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/s-u/Using%20Customer%20Exit%20Variables%20in%20BW%20or%20BI%20Reports%20Part%20-%201.pdfhttp://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/13221http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/13221http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/13221http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/13221http://help.sap.com/saphelp_nw70/helpdata/en/1d/ca10d858c2e949ba4a152c44f8128a/content.htmhttp://help.sap.com/saphelp_nw70/helpdata/en/1d/ca10d858c2e949ba4a152c44f8128a/content.htmhttp://help.sap.com/saphelp_nw70/helpdata/en/1d/ca10d858c2e949ba4a152c44f8128a/content.htmhttp://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/13221http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/13221https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/s-u/Using%20Customer%20Exit%20Variables%20in%20BW%20or%20BI%20Reports%20Part%20-%201.pdfhttps://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/g-i/How%20to%20use%20Customer%20Exit%20Variables%20in%20BW%20Reports%3a%20Part%202.pdfhttp://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/f0fefc77-40e3-2c10-8da3-d4bfcb013387http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/f0fefc77-40e3-2c10-8da3-d4bfcb013387
  • 8/3/2019 CUS EXIT 10

    15/15

    Using Customer Exit Variables in BW/BI Reports: Part- 16

    SAP COMMUNITY NETWORK SDN sdn sap com | BPX bpx sap com | BOC boc sap com | UAC uac sap com

    Disclaimer and Liability Notice

    This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is notsupported 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 orcode sample, including any liability resulting from incompatibility between the content within this document and the materials andservices offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of thisdocument.