ABAP code Help for Customer Exit variable

Hello All,
Can anyone provide ABAP code for a customer exit variable please?
Requirement:
0CALYEAR(InfoObject) - ZCALCYR (Variable) <b>Calender year with default value actual year</b>.
Proiperties of variable: single value,mandatory,ready for input,can'be changed in query navigation.
i have read some docs on customet exit variables which i got from SDN but i found it's difficult for me to get this as i am not that good in ABAP.
Thanks,
Rakesh.

Hi,
   Just check the below code. You just need to make slight changes I believe. Hope this helps you.
In CMOD………..
Sample code
  INCLUDE LXRSRF01                                                   *
data: l_s_range type rsr_s_rangesid.
case i_vnam.
  when 'ZCALCYR'.
    if i_step = 1.
     l_s_range-low = sy-datum+0(4).
        append l_s_range to e_t_range.
    Endif.
Endcase.

Similar Messages

  • Error in the ABAP Code for Customer Exit Variable

    Could you please update me what is the wrong with the below ABAP Code developed for Customer Exit Variable in BW
    i created a Variable (ZVWKNO) of Customer Exit,Single Value ,Mandatory and Variable is ready for input
    In CMOD i had written the below Code:
    When 'ZVWKNO'.
    DATA: WEEK(2) TYPE N,
    WEEKNO(2) TYPE N.
    IF i_step = 1.
    l_st_date = SY-DATUM.
    CALL FUNCTION 'DATE_GET_WEEK'
    EXPORTING
    DATE = l_st_date
    IMPORTING
    WEEK = l_fn_week.
    CHECK sy-subrc = 0.
    WEEK = l_fn_week+4(2).
    If WEEK 0.
    WEEKNO = WEEK - 1.
    l_s_range-low = WEEKNO.
    l_s_range-sign = k_sign_inclusive.
    l_s_range-opt = k_option_equals.
    APPEND l_s_range to e_t_range.
    ENDIF.
    ENDIF.
    But when i execute the query the default value is not populated with Week-1 No in the variable screen
    Please update me what went wrong
    Thanks

    Case ZVWKNO.                "write this with out comments
    When '1'.              "write the value that needs to equal with value in varaible ZVWKNO after when in sungle quotes
    DATA: WEEK(2) TYPE N,
    WEEKNO(2) TYPE N.
    IF i_step = 1.
    l_st_date = SY-DATUM.
    CALL FUNCTION 'DATE_GET_WEEK'
    EXPORTING
    DATE = l_st_date
    IMPORTING
    WEEK = l_fn_week.
    CHECK sy-subrc = 0.
    WEEK = l_fn_week+4(2).
    If WEEK 0.                                    "check this Week Minimum is '01' and Maximum '52'
    WEEKNO = WEEK - 1.
    l_s_range-low = WEEKNO.
    l_s_range-sign = k_sign_inclusive.
    l_s_range-opt = k_option_equals.
    APPEND l_s_range to e_t_range.
    ENDIF.
    ENDIF.
    Prabhudas

  • Where do I write the code for customer exit variable?

    Hi Gurus,
    Can anyone tell me where and the procedure that I have to follow to get to the include ZXRSRU01 where I can write customer exit variable code.
    I know its written in ZXRSRU01, but in my system it seems like its not active or does not exist. How do I get to start working in this include for customer exit variables?
    Any help is appreciated. Thank you.
    Regards
    Reddy

    hi Reddy,
    variable exit use enhancement RSR00001 not RSAP0001. EXIT_SAPLRRS0_001.
    try to follow some steps in 'how to' doc related to this, and sample code may useful for you
    https://websmp206.sap-ag.de/~sapdownload/011000358700002762582003E/HowToDeriveVariableValue.pdf
    https://websmp206.sap-ag.de/~sapdownload/011000358700002765042003E/HowToVerifyVariableInput.pdf
      INCLUDE ZXRSRU01                                                   *
      DATA: L_S_RANGE TYPE RSR_S_RANGESID.
      DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.
      CASE I_VNAM.
      WHEN 'CUMMONTH'.
        IF I_STEP = 2.                                  "after the popup
          LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
                  WHERE VNAM = 'MONTH'.
            CLEAR L_S_RANGE.
            L_S_RANGE-LOW      = LOC_VAR_RANGE-LOW(4)."low value, e.g.200001
            L_S_RANGE-LOW+4(2) = '01'.
            L_S_RANGE-HIGH     = LOC_VAR_RANGE-LOW.   "high value = input
            L_S_RANGE-SIGN     = 'I'.
            L_S_RANGE-OPT      = 'BT'.
            APPEND L_S_RANGE TO E_T_RANGE.
            EXIT.
          ENDLOOP.
        ENDIF.
      ENDCASE.
    hope this helps.

  • Coding for Customer-Exit Variables

    Hi experts,
    We have some variables in BEX with Customer-Exits.
    I want to see the codings and i do following.
    1- Tcode u201CCMODu201D and enter u201CProject Codeu201D go tou201DComponentsu201D.
    2- Double Click on EXIT_SAPLRRS0_001
    3- Double Click on INCLUDE ZXRSRU01
    But I dont see anycoding here.
    Where should be the codings for Variables with Customer-Exits hidden?
    Do you have any idea, thank you.

    Hi,
          The Include which you are seeing is for only the customer space. This is for Customer exit variables created  by Developers. So Here if there are any routines written by the Developers will be there. Initially it will be Blank.
    If you want to See the standard SAP Exits goto SMOD.
    Regards
    Karthik

  • ABAP Help for customer exit

    Hi All, I need help with ABAP code for customer exit for formula variable. I have ZVKDATE as formula var from customer exit. user enters date in ZVKEYDT(this is selection type var). I have the below code, I debugged it the l_var_range-low get the date but when I append it to e_t_range the table doesn't gets the date. The report shows the ZVKDATE has empty demarcation. kindly help.
    data l_var_range like rrrangeexit.
    data: l_s_range type RSR_s_RANGESID.
    data: w_day(2) type c,
          w_mth(2) type c,
          w_year(4) type c.
    define append_range_table.
    l_s_range-low = &1.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    append l_s_range to e_t_range.
    end-of-definition.
    *Activities performed before selection screen pop-up window
    if i_step = 2.
    Calculate the current date based on system date
      case i_vnam.
        when 'ZVKDATE'.
          read table i_t_var_range into l_var_range
                            with key vnam = 'ZVKEYDAT'.
          l_s_range-sign = 'I'.
          l_s_range-opt = 'EQ'.
          w_day = l_var_range-low+6(2).
          w_mth = l_var_range-low+4(2).
          w_year = l_var_range-low(4).
          concatenate w_year w_mth w_day into l_var_range-low.
          append l_s_range to e_t_range.
      endcase.
    endif.
    puneet

    Hi,
    Check your code again. You are not appending l_var_range but l_s_range. Also I think the concatenate statement should contain l_s_range-low instead of l_var_range-low.
    Hope this will help you.
    Regards,
    Vaibhav

  • Error Message : " No value could be determined for Customer Exit Variable "

    Hello BI Experts ,
    I have created a "ZYTD_PERIOD" Customer Exit Variable  Interval  Mandatory and ready for input check mark removed.
    The reference character is '0FISCPER' .
    I want to have YTD figures when the user enter single Fiscal Year Period for variable 0P_FPER.
    So I have written below code in SE37 : EXIT_SAPLRRS0_001 and include program : ZXRSRU01
    ==================================================================
      case i_vnam.
                  WHEN 'ZYTD_PERIOD'.
                  IF I_STEP = 2.
                  LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = '0P_FPER'.
                  CLEAR L_S_RANGE.
                  L_S_RANGE-LOW0(4) = LOC_VAR_RANGE-LOW0(4).
                  L_S_RANGE-LOW+4(3) = '001'.
                  L_S_RANGE-HIGH = LOC_VAR_RANGE-LOW.
                  L_S_RANGE-SIGN = 'I'.
                  L_S_RANGE-OPT = 'BT'.
                  APPEND L_S_RANGE TO E_T_RANGE.
                  EXIT.
                  ENDLOOP.
                  ENDIF.
    ===================================================================
    After that I use this 'ZYTD_PERIOD' variable in the query .
    Also I have used the variable 0P_FPER in another structure.
    When I execute the query by entering the value of 0P_FPER as 010.2009 or any other value ,
    I am getting below error message ,
    *No value could be determined for variable ZYTDPERIOD*_
    Below is details of this Error message ,
    Note that I have proper Master and Text data for 0CO_AREA and 0COMP_CODE loaded into BI.
    =======================================================================
    Diagnosis
    This error diagnosis is specific only to the variables 0P_FVAEX or 0P_CTPCA !
    Termination message BRAIN 632 appears:
    Could not determine value for variable 0P_FVAEX (or 0P_CTPCA).
    System Response
    1. Operation method of SAP-Exit-Variables 0P_FVAEX or 0P_CTPCA
    With queries from the CO application, both SAP-Exit-Variables look for an entry for 'controlling area'. With this controlling area from the selection screen, the SAP-Exit-Variables program reads the attributes for InfoObject 0CO_AREA (controlling area).
    With queries from the FI application, the SAP Exit Variable 0P_FVAEX looks for an entry for 'company code'. With this company code from the selection screen, the SAP Exit Variables program reads the attributes for InfoObject 0COMP_CODE (Company Code).
    0P_FVAEX determines the fiscal year variant (attribute 0FISCVARNT) from the attributes for 0CO_AREA (CO queries) or 0COMP_CODE (FI queries). 0P_CTPCA determines the currency type of the profit center local currency (attribute 0CURTP_PCA) from the attributes for 0CO_AREA.
    2. Cause of Error
    The attributes for the controlling area (InfoObject 0CO_AREA) or company code (InfoObject 0COMP_CODE) were not loaded into the BW system, or the attributes for the controlling area are not active in the BW system.
    Check whether this is the cause of the error in your BW system. Display the contents of table /bi0/mco_area or /bi0/mcomp_code using transaction se16.
    Application CO:
    Check whether the attributes 'fiscal year variant' (field FISCVARNT) and 'profit center local currency currency type' (field CURTP_PCA) are filled in the 'A' version (field OBJVERS) for the selected controlling area. If the fiscal year variant in the OBJVERS = 'A' is empty, then the error is with variable 0P_FVAEX. If the currency type of the profit center's local currency in OBJVERS = 'A' is empty, then the error is with variable 0P_CTPCA.
    Application FI:
    Check whether or not the attribute 'fiscal year variant' (field FISCVARNT) is filled in the 'A' version (field OBJVERS) for the selected controlling area. If the fiscal year variant is empty in OBJVERS= 'A', then the error is with variable 0P_FVAEX.
    Procedure
    Using InfoSource 0CO_AREA, load the attributes for the controlling area or company code into your BW system.
    Afterwards, activate the attribute changes in your BW system. To do this, use transaction rsa1, path 'Tools > Hierarchy/Attribute changes', functions button 'InfoObject list'. Choose InfoObject 0CO_AREA or 0COMP_CODE from this list, and activate the attribute changes.
    =====================================================================================
    Is there any special settings needed before writing BEx Customer Exit ?
    I have already created a project in CMOD and assinged a proper RSR00001
    and EXIT_SAPLRRS0_001 and project is active.
    Any help please ....
    Regards ,
    Amol

    My Code is as below ,
              case i_vnam.
                  WHEN 'ZYTD_PERIOD'.
                  IF I_STEP = 2.
                  LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = '0P_FPER'.
                  CLEAR L_S_RANGE.
                  L_S_RANGE-LOW0(4) = LOC_VAR_RANGE-LOW0(4).
                  L_S_RANGE-LOW+4(3) = '001'.
                  L_S_RANGE-HIGH = LOC_VAR_RANGE-LOW.
                  L_S_RANGE-SIGN = 'I'.
                  L_S_RANGE-OPT = 'BT'.
                  APPEND L_S_RANGE TO E_T_RANGE.
                  EXIT.
                  ENDLOOP.
                  ENDIF.
                  ENDCASE.

  • Need logic to find Year to Date for customer exit variable

    Hi to all,
    I am creating customer exit variable for query .
    query should display data according to current system year from jan till current system date.
    here senario is like that user never enter year and query will automatically will fetch the data according to current year starting from jan to current system date.
    example.
    current year 2010 and today is system date is sep 29 2010, so query will display data from jan 2010 to current data sep 29 2010.
    please can any one provide me logic for that.
    any code .
    regards
    pavneet rana

    Hi,
    You need to create the characteristic customer exit variable of type select-options. Restrict your keyfigure based on this variable.
    In the logic in CMOD,
    write as below
    i_step =2.
    case i_vnam.
    When 'exit variable'.
    temp = sy-datum+0(4).
    concatenate temp '0101' into temp1.
    l_s_range-low= temp1.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'BT'.
    l_s_range-high= sy-datum.
    append APPEND l_s_range TO e_t_range.
    endcase.
    For any further help on customer exit based variable, please refer below article.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/20f119d9-922d-2c10-88af-8c016638bd90?quicklink=index&overridelayout=true
    Edited by: Rahul K Rai on Sep 29, 2010 3:09 PM

  • BW Master Data for Customer Exit Variable Reference

    Good day Experts,
    I have several queries that I would like to remove the hard coding of values on to prevent yearly maintenance. In these queries there are two conditions each condition is on different key figures that is amount by year.  The query is only to report on data that for the two amounts (separated by year) is greater than the specified values. I want to change the condition so the value is no longer hard coded so the query will role automatically as the time period changes. The year amount values that the condition will need to reference are not currently stored in our BW system. I would like to create master data that is maintained directly in the BW system for the amounts that a variable for the condition in the query can then access.
    I know it can be set up as master data and then referenced through a customer exit variable but when I set up the master data if I do the Amount as a key figure I cannot maintain the key figure value for the master data manually in BW, if I set the Amount up as a numeric characteristic then I canu2019t directly use a decimal. Am I missing something in the key figure setup then referencing the key figure as an attribute of the year value or do I need to do it as a characteristic and use a conversion routine or something for data manipulation?
    Can someone please give me some guidance to what the best way to do this is?
    The data necessary master data for storage in BW is the YEAR and a single dollar value:
    For Example:     
    Year          Amount
    2009           101.50
    2008          207.80
    2007          807.40

    I figured out that I can use an amount in the master data and maintain the amount manually as long as I use the amount with a currency instead of setting the currency in the key figure.

  • Reg: ABAP code for customer exit variable

    Hi Team,
    I have a requirement to create a report  based on an multiprovider 'TEST'.
    Based on the input selection of Period; I need to define a Keyfigure X which will be a count of value available for that Period in one cube involved in the MProvider. E.g.: If for period 12, the value = 1 in the cube; then this keyfigure will give the count as 1 in the output of the report.
    The second KF Y values are available in the second infocube directly: ibut should be displayed based on the value of the KF 'X' with logic as if X > 0 ; then the values should be read from the second infocube in the report. & if X <= 0; no values should be displayed.
    Please help me with the ABAP code to be used in the query level.
    Thanks & Regards
    Sneha

    Hi Sneha,
       I would suggest the following
    1.Please change the design the cube and include a key figure Zcount that would be incremented for each record.
    Now as per the first requirement you need to get the count for a Input Period from First cube
    This would be very simple to implement , all you have to do is restrict this KF with the Input characteristic/variable and also the First Infocube.
    2.You can also use exception aggreation counter to address this requirement . Even in this case you need to include a dummy key figure in the cube and the exception characteristic would be the period in the Infocube.
    But performance would be on downside when compared to the first one.
    3.The second requirement is quite simple
    Create a formula KF as follows
      (KF1 > 0)*KF2 . 
      KF1 > 0 is a logical operation and it would always return 1 on success and 0 otherwise.
    Hope this helps,
    Regards,
    James Harold.

  • Function module needed for customer exit variable need to use in Bex report

    Hi Experts,
    I have a requirement where i need to get Cummulative result between two interval periods.
    If user gives single mandatory input value - 002-2009
    for one Scenario:-
    Project start Date   untill Pervious year i.e  December 2008
    Where project start date will get from one of the field in my BW CUBE
    can anyone help for the customer exit function code for this scenario. As i am into BI i dont have idea in ABAP.
    Please help sample cod for this .
    Thanks,
    Anil.

    I had created one customer exit which had fullfill my requirement.

  • Help with Customer exit variable

    Hi Guys,
         I need your urgent help. I have a requirement where I need to create a variable (on CALDAY) in a report which should use the input value given for another variable (created on CALMONTH). To put in words more clearly, CALMONTH is a variable that is mandatory for input but the CALDAY variable should not appear on the selection screen. I was told that I should write a customer exit to make this happen. So can someone please explain me the process of creating a customer exit and give me the code.
    WHEN CALMONTH values are selected to be 07/2006 - 08/2006... CALDAY values should be 07/01/2006 to 08/31/2006.
    CALMONTH is user entry, mandatory, range and multiple selection variable.
      Early reply is highly appreciated and duely rewarded. Please let me know if I am not clear about the requirement. Thanks a bunch in advance.

    Let us say, user enters multiple ranges for the month, you would want corresponding date ranges for the same, right?
    data : w_date like sy-datum.
    case I_VNAM.
    when 'ZCALDAY'. " Calday var
    loop at i_t_var_range into LOC_VAR_RANGE         
         where iobjnm = 'ZCALMONTH'.
      WA_RANGE-SIGN = 'I'.     
      wa_date+2(6) = loc_var_Range-low.
      wa_date+0(2) = '01'.
      wa_range-low = wa_date.
      if loc_var_range-high eq space.
        WA_RANGE-OPT = 'EQ'.     
      else.
        wa_range-opt = 'BT'.
        wa_date+2(6) = loc_var_range-high.
        wa_date+0(2) = '01'.
        wa_date = wa_date + 31.
        wa_date+0(2) = '01'.
        wa_date = wa_date - 1.
        wa_range-high = wa_date.
       endif.
       append wa_range to e_t_range. clear wa_range.
    endloop.
    endcase.
    This should do.

  • How to create an user input variable for customer exit variable? - BW3.5

    Hi Guru,
    I have a requirement for the selection period of my reports. There are 3 possible reporting periods which should be user selectable:
    1. Month: Current reporting month
    2. Fiscal Year to Date
    3. Project Year to Date
    Here I need 2 variable to do these, 1 customer exit and 1 user input variable. I have created a variable customer exit to calculate all these requirement. But can any1 tell on how to create the user input variable for my customer exit? I need a user input variable with drop down list like below.
    01-Current month
    02- Fiscal Year to Date
    03-Project Year to Date
    I have create a new master data for this variable, but it's not working. What I need now is a standalone master data which do not need to link to any exiting records. Can any1 tell me how to create this?

    Just go to the definition of the variable for which you have created a customer exit. There you will find a check box for "Ready for Input". Just tick that checkbox and the variable will be available as a selection variable in the reports selection screen.
    Regards,
    Yogesh

  • Abap Code help for retreiving user ID

    Hi All,
    I have a field N_BPIID(this field contains User IDs of Users) and variable on this field Z_PIID(Customer exit)...........
    My requirement is
    When i execute the report -
    this variable Z_PIID should automatically  retrive his ID frm BI/BW system..............
    Please suggest
    Edited by: Raj on Jan 12, 2010 4:59 AM

    Hi,
    A user that is signed on - system will populate field sy-uname - Not sure of your logic.In STEP 3 of your CMOD you could say :
    Eg : If user is not user "USERABC" then dont allow them into queries.
    Hope this helps    Colin
    IF sy-uname+0(7) <> 'USERABC'.
          L_AUTH = 0.
          EXIT.
        ENDIF.
      if sy-subrc <> 0.
        CALL FUNCTION 'RRMS_MESSAGE_HANDLING'
          EXPORTING
            I_CLASS  = 'RSBBS'
            I_TYPE   = 'E'
            I_NUMBER = '013'
            I_MSGV1  = 'Insufficient authorisation'.
        RAISE wrong_entry.
      endif.

  • ABAP code help for Bex broadcasting by event!

    Hello
    I'm trying to broadcast a report for a specific time period as per factory calendar. I tried using System Time Point :RSRD_BROADCAST_FOR_TIMEPOINT but its not showing when In the broadcaster when I put restriction of factory calendar so i followed below link: Broadcasting timepoint scheduled after an event and created a PC to start after event and created variant for RSRD_BROADCAST_STARTER setting ID as my Bes broadcast setting technical name.
    When I trigger the event its processed and report emailed to me as I expected. Now I want to run this (Trigger) this event every Wed day after fisc quarter close. I wrote the below logic in se38 PROGRAM. But Now I need little help on how to trigger /run only on wed days after fisc quarter close ? Please update the below code or guide me on how to achieve this.
        CALL FUNCTION 'BP_EVENT_RAISE'
          EXPORTING
            EVENTID = ZFISC
      endif.
    Thanks

    in your ABAP code try this,
    calculate whether current date falls after fiscal year quarter. If so then check whether its a Wednesday and call the event raise FM. You can schedule this program in background daily basis.
    Use this FM for day calculation DATE_TO_DAY.
    This FM for converting sy-datum to fiscal year/period - FI_PERIOD_DETERMINE,DATE_TO_PERIOD_CONVERT

  • Restriction of input help for BPS exit variables

    Hello,
    In BPS 3.0b, I created BPS variables with user exit in order to restrict the values in the <b>input help</b> of a characteristic (related to the value selected by user of another variable for example).
    In IP, I know that BPS variables are not used anymore and we have to create BI variables. But I don't know how to restrict the values of an input help in BI. I tried with the user exit RSR00001 but I didn't manage.
    may be is there a possibility to reuse BPS variables ?
    Thank you for your Help.
    Catherine Bellec.<b></b>

    Hi Catherine,
    could you please show me a sample how to restrict the input help for a variable in the user-exit?
    Thank you in advance.
    Best regards,
    Andreas

Maybe you are looking for

  • Safari fails to start and crashes

    Today I tried to open a link from an Apple ap-store email and Safari failed to open and reported a crash error message, It worked great yesterday? I searched through the forums and tried a few of the listed fixes but nothing has worked for me. So far

  • How to change the image of af:activeImage, in a Page Template, on click

    Hello, I am using jdeveloper 11g. I designed a page template that contains a <af:activeImage> component. I use this component with <af:showPopupBehaviour> to show a popup when it is clicked. I want to change the image of <af:avtiveImage> when it is c

  • Changing iTunes store country...

    Hey, My app store is currently set to the Canadian app store and I have made quite a few app purchases in the Canadian store with money not just free ones. Well I would like to switch to the US app store (I have an American source of payment) but I w

  • Does Sap automatically updates customer credit limit from Financial Doc?

    Hi Everyone Does the Sap automatically updates the customer credit limit from the Financial document(Letter of credit) assigned to particular sales order. I actually want to know that how can i configure the control at delivery order if i assigned th

  • Single business group Vs. multiple business groups

    Hi, I have a case where the user wants to implement Oracle HRMS (Core HR, Payroll, Self Service) in 4 countries. All countries have common procedures but there is some procedures like end of service, Taxation differ from country to another. There is