Calculations on customer exit using input variable

hi,
suppose i have a date input variable on my query, and i want to use the input value as an input for a calculation to be done in a different characteristic variable whose value is derived via a customer exit. how could this be done?
as an example - i have an input date field, and say, the user enters 1/15/2005. the other characteristic variable is, for example, sales for a given date, restricted against a characteristic variable (customer exit) which should restrict the KF to say, the start of the month of the input date up to the input date (in this case, 1/1/2005 - 1/15/2005).
thanks in advance. =)
ryan.

Hi Ryan,
you have to use parameter I_STEP = 2 in your exit (IF I_STEP = 2. (...))
This second step is called after the processing of the variable pop-up and only for those variables that are not marked as “ready for input” and are set to “mandatory variable entry”.
Build your second variable in this way and then you can use this step to see first (pop-up) variable value.
For details see www.service.sap.com/bw -> SAP BW InfoIndex -> Variables -> How to... Derive a Variable value from another variable 2.x (pdf).
Hope it helps (and please don't forget to assign some points by clickin'on the yellow star to the contributors that help you !!!)
Bye,
Roberto

Similar Messages

  • How to Write a CUstomer Exit for a variable in BEx

    Hi,
    How to write a customer exit variable in bex Query designer
    Do i need developers key for this (If so what type of key do i need so that i can ask basis tean to generate)
    Info Object: ZEXP_DTE (Expiry Date)
    Variable on ZEXP_DTE :
    ZEDTE
    Type: Customer Exit
    Can any one please tell me how to write a code in CMOD from this (Step-by Step)
    Expiry Date > Current Cal Day
    As arun said
    'l_s_range-low = SY-DATUM.
    l_s_range-opt = 'I'.
    l_s_range-sign = 'GT'.
    APPEND l_s_range TO e_t_range.'
    I want to insert the above code for the above customer exit but as i am new to BW as  ABAP please explain me what are the steps involved in CMOD
    Thanks

    Hi,
    To write customer exit for a variable, you require Access key.
    Contact your BASIS to get that.
    Access Key,BASIS?
    To write Customer exit,
    User Exits
    User Exit for Variable
    /thread/809285 [original link is broken]
    Hope these helps u...
    Regards,
    KK.

  • How to create customer exit for characteristic variables and for text vars.

    hi friends,
      can anybody tell me how to create customer exit for characteristic variables and for text variables in bw ides system.
    thanks,
    sree

    Hi,
    Please have a look at:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f1a7e790-0201-0010-0a8d-f08a4662562d
    Krzys

  • Text Variable through Customer Exit  using FM MONTH_NAMES_GET

    Hi Friends,
    I have a query which runs through a variable Key date(ZPDATE). (Key date may also be changed by the user).
    I have another customer exit variable(ZVNDATE1) where it reads  from the Keydate variable and it represents one month less than the key date and it holds two dates first day of month and last day of month.
    Let say: Key date(ZPDATE) = 12.03.2008
                 ZVNDATE1 = 01.02.2008 and 28.02.2008
    I have created  RKF Overdues-1 ristricted with ZVNDATE1.
    My requirement is I wan to represent this RKF Overdues-1 as Feb 2008 . In order to do that I want to create a Text variable(ZTEXT1) using customer exit .
    As I am not very good in ABAP please can anybody provide me the code for text variable:
    I am writing in the below.. but I dont know how to represent FM..etc..
    WHEN 'ZTEXT1'.
            READ TABLE i_t_var_range INTO w_var_range WITH KEY vnam = 'ZVNDATE1'.
            IF SY-SUBRC = 0.
              CLEAR l_s_range.
              l_date = w_var_range-low.
                       CALL FUNCTION MONTH_NAMES_GET'
    Please can you provide me the remaing code..
    Thanks
    Sudhakar..

    Hi Sudhakar,
    Instead what you can do is, add few more lines of code instead of calling fm.
    case 'month'.
    If month = '1'.
      desc = 'jan'.
    elseif month = '2'.
      desC = 'feb'.
    endcase.
    concatenate desc year into w_v_range-low.
    Hope that helps.
    Thanks

  • Variable multiple single value filled with customer exit used in FOX form.

    Hi guys, I definitly need your help in the following scenario:
    I have variable (multiple single value) filled in a customer exit and use it in web template. There it is used in the drop down box for selecting a special date in the analysis item. And there comes the first question:Why the results from the customer exit are written in the way "date1; date2; date3" in one line? They should appear line by line in rows. How can I influence that? I tried both data binding types, "variable" and "characteristic".
    Now a button raises a planning function with a fox formula which should write the selected date (from the drop down box) in a customer table using "call function".
    I always get the error, that I need to restrict the variable to "single value". Why do I have to do that and if necessary how can I do that? Other planning functions without the fox formula also work properly with using the selection from the drop down box.
    I appreciate you help.
    Kind regards, Anja.

    Hi Vamsi.,
    Try this code.
    WHEN 'PREVIOUS_YEAR_1'.
    IF I_STEP = 2. "after the popup of user entry
    LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
    WHERE VNAM = 'ZCURRENT_YEAR_PERIOD'.
    break-point.
    IF SY-SUBRC EQ 0.
    WA_YEAR = LOC_VAR_RANGE-LOW+0(4). "Year
    WA_MONTH = LOC_VAR_RANGE-LOW+5(3). "Period
    WA_YEAR = WA_YEAR - 1.
    CONCATENATE WA_YEAR wa_month INTO WA_FISC_PERD .
    CONCATENATE WA_YEAR WA_MONTH1 INTO L_S_RANGE-HIGH .
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'EQ'.
    APPEND L_S_RANGE TO E_T_RANGE.
    ENDIF.
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'BT'.
    APPEND L_S_RANGE TO E_T_RANGE.
    ENDIF.
    ENDIF.
    ENDLOOP.
    endif.
    Assing points if it helps you.
    -- Selva

  • Give me details about  customer exit, sap exit using characterstics variabl

    give me details about  customer exit, sap exit using characterstics variable

    Hi,
    Customer Exit:
    http://help.sap.com/saphelp_nw04/helpdata/en/f1/0a56f5e09411d2acb90000e829fbfe/content.htm
    SAP Exit:
    http://help.sap.com/saphelp_nw04/helpdata/en/f1/0a56f5e09411d2acb90000e829fbfe/frameset.htm
    Characteristic Variables:
    http://help.sap.com/saphelp_nw04/helpdata/en/5c/8db07d555411d189660000e829fbbd/frameset.htm
    SAP and Customer Exit:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f1a7e790-0201-0010-0a8d-f08a4662562d
    Some Imp Docs:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/650ee690-0201-0010-4bb7-83c3e2a74039
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/009819ab-c96e-2910-bbb2-c85f7bdec04a
    Assign points if these are helpful.
    Rgs,
    I.R.K

  • Customer exit for query variable to calculate amount since 1998

    Hi Experts,
    I am trying to fetch the expenses since 1998 till last fiscal year in Bex Query.
    I have created a variable ZFYRVAR1, processing type customer exit, Interval, Mandatory. I unchecked 'Variable is ready for input' box. There is no 0CALYEAR in the infocube. We have 0FISCYEAR and 0FISCPER in the InfoCube.
    We wrote following code to populate the variable. It is throwing a warning message.
    Value " is too long for variable ZFYRVAR1.
    The column remains empty and nothing is populated. Can somebody tell me whats wrong with the code. I also defined another variable instead of l_year. like
    zyear like /bi0/pfiscyear-fiscyear.  but same error.
    Any help is appreciated.
    data: l_s_range type rsr_s_rangesid.
    data: l_year(4)     type n.
    case i_vnam.
    l_year = sy-datum+0(4).
      l_s_range-high = l_year - 1.
       l_year = 1998.
      l_s_range-low = l_year.
      clear e_t_range.
      l_s_range-sign = 'I'.
      l_s_range-opt  = 'BT'.
      append l_s_range to e_t_range.
    endcase.

    Hi Sheo,
    Hope the sample code below helps you. You can debug it in RSRT to be sure.
    DATA: L_S_RANGE TYPE rsr_r_rrrangesid.
    DATA: l_yearh(4) type c,
          l_yearl(4) type c.
    IF I_STEP = '2'.
      if i_vnam = 'ZFYRVAR1'.
         *Please check your user profile to make sure l_year is in the format YYYYMMDD.
         l_yearh = sy-datum(4).
         l_yearh = l_yearh - 1.
         l_yearl = '1998'.
         l_s_range-high = l_yearh.
         l_s_range-low = l_yearl.
         l_s_range-sign = 'I'.
         l_s_range-opt = 'BT'.
        APPEND L_S_RANGE TO E_T_RANGE.
        exit.
      endif.
    ENDIF.

  • How to write customer exit for the variable

    Hi Experts,
    I have a requirement to create the variable, the scenaria is like this..
    I need to create the variable which gives the period/year values,if yours enters the values 05.2007 then the variable should return the first monthe the year i.e.01.2007.
    I hope it can be done by writing the customer exit..but iam unware how to achieve this.
    Please explain me step by step and cope for customer exit to done this.
    Points will be awarded
    Suraj.

    hi Suraj,
    there should variable sap exit for first month,
    for customer exit, check this how to doc for steps
    https://websmp210.sap-ag.de/~sapdownload/011000358700002762582003E/HowToDeriveVariableValue.pdf
    your code may look like
      INCLUDE ZXRSRU01                                                   *
      DATA: L_S_RANGE TYPE RSR_S_RANGESID.
      DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.
      CASE I_VNAM.
      WHEN 'your 1st month variable'.
        IF I_STEP = 2.                                  "after the popup
          LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
                  WHERE VNAM = 'your user input variable'.
            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-SIGN     = 'I'.
            L_S_RANGE-OPT      = 'EQ'.
            APPEND L_S_RANGE TO E_T_RANGE.
            EXIT.
          ENDLOOP.
        ENDIF.
      ENDCASE.
    hope this helps.

  • Migrating Customer exit  for BEX variables to BADI's

    Hi All,
    I am new to ABAP In the context of BW.
    I am  using exit RSR00001 to populate variables in BEX reports.
    I want to migrate this customer exit RSR00001 to BADI.
    Can any one please tell me how to migrate the same and how it will fire in place of exit?
    Thanks In Advance
    Dhananjay

    Hi,
    Please have a look at:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f1a7e790-0201-0010-0a8d-f08a4662562d
    Krzys

  • Customer exit - code for variable

    Hi Friends,
    I have created a variable "CUST_EXIT_YEST" and defined the processing type as customer exit. Now would like to add code in CMOD.
    Requirement: The variable should allow take yesterday's date. Please help me with the code.
    Already there are some codes defined for other customer exit variables in CMOD. Can I add my code below that. If so please explain.
    Regards,
    Surjit

    If i'm not wrong you want to show previous day in the variable.
    At the bottom of the existing code before EndCase, u can write the below code
    Data: loc_var_range      LIKE rrrangeexit, (must be there this kind of declaration in ur existing code)
    WHEN 'CUST_EXIT_YEST'.
        IF I_STEP = '1'.
          Read Table I_T_VAR_RANGE into LOC_VAR_RANGE WITH KEY VNAM = 'CUST_EXIT_YEST'.
          myrange-SIGN = 'I'.
          myrange-OPT = 'EQ'.
          myrange-LOW = sy-datum - 1.
          APPEND myrange TO e_t_range.
        ENDIF.

  • Need help in writing code Customer Exit for reporting Variable

    Hello Gurus,
           I have a requirement.When a authorized user logins to view the report, he should see only customers available in the value help screen.In the value help screen it is displaying all the customers, but data is displayed perfectly fine for the authorized sales rep. By default, Value help screen displaying all the customer numbers.
    How can I restrict in the value help screen?
    Any help appreciated with points.
    Regards,
    PNK

    Hello PNK,
    You can use a variable with Process type Authorization. This enables variables to be filled with values automatically from the user authorization.
    http://help.sap.com/saphelp_sem40bw/helpdata/EN/44/599b3c494d8e15e10000000a114084/content.htm
    Thanks
    Chandran

  • How and where to create SAP Exit or Customer Exit in query variable

    Hi,
    I have to create a date variable in BEx and it should always contain default value as SY-DATUM i.e. current date.
    I dont have 0CalDay in any of my data flow,also I am not supposed to add 0CALDAY.
    If so,where i can write that exit.
    Thanx in advance.

    Actually,what my requirement is...
    I will not filter any characteristic based on this sy-datum instead I will use that variable value in formulae.
    For ex: in my selection,i mention As of date = today's date..then inside the quer designer,a formula will calculate No.of days=As of date-Due date,where "As of Date" is nothing but the date which i have enterd in my selections.
    please let me know any solution

  • BPS Variable Exit issue - input variable is not hardcoded

    Hi SDNer
    I have a problem in derivation of 3 variables from one variable. The scenario is like this..
    Curr Year - Hard coded in one Pl Area and all other Area get the same value by using a FM
    Planning for year : User Input variable in Layout
    We are planning for Projection ( Ver - p) Budget ( Ver - B) and 3 Forecast (Ver - F)
    Now based on the planning for year and current year variable,system should calculate these three versions.Curr Ver  Next Ver Prev Ver which are in layout at present and entered by user manually
    Example:
    For  Curr Year 2008 and Plan Year 2008
    Curr Ver - P Next Ver - B and Prev Ver - A
    For  Curr Year 2008 and Plan Year 2009
    Curr Ver - B Next Ver - F and Prev Ver - P
    Thanks
    Saurabh

    Hi Kirill
    Still no luck...here is my code
    I am populating Variable ZVAR which is based on 0VERSION. With help of plan year ZFISCYEAR and Current year ZPLYEAR
    I assigned this FM to ZVAR variable in plan area.
    Also i am using this variable along with these 2 time variable in the planning folder......
    I am getting error ZVER can't be computed ????
    FUNCTION VERSION_AUTOMATION_TEST_KAMAL.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(I_AREA) LIKE  UPC_AREA-AREA OPTIONAL
    *"     VALUE(I_VARIABLE) LIKE  UPC_VAR-VAR OPTIONAL
    *"  EXPORTING
    *"     REFERENCE(ETO_CHARSEL) TYPE  UPC_YTO_CHARSEL
    Data: lp_subrc type sysubrc.
    Data: lc_subrc type sysubrc.
    Data: lpt_varsel type table of upc_ys_api_varsel.
    Data: lps_varsel type upc_ys_api_varsel.
    *Data: l_plan_year type upc_ys_api_varsel.
    Data: ls_chasel type upc_ys_charsel.
    Data: l_VERSION TYPE C.
    Data: l_plan_year type i.
    Data: l_curr_year type i.
    data: lcto_varsel   TYPE upc_yto_charsel.
    DATA: lcs_varsel TYPE upc_ys_charsel.
    Data: DIFF TYPE i.
    Data: l_area type upc_y_area.
    Data: l_variable type upc_y_variable.
    if i_variable = 'ZFISCYR'.
    *Read Planning For Year Variable.
    call function 'API_SEMBPS_VARIABLE_GETDETAIL'
          Exporting
           i_area = i_area
           i_variable = i_variable
          Importing
           e_subrc = lp_subrc
           tables
           etk_varsel = lpt_varsel.
        if lp_subrc = 0.
          clear lps_varsel.
          read table lpt_varsel into lps_varsel index 1.
          l_plan_year = lps_varsel-low.
        endif.
    Read Current Year Variable.
    *data: l_buffer_call TYPE boole-boole           VALUE 'X'.
        Fix value of current year from below FM
      CALL FUNCTION 'Z_VAR_GET_DETAIL'
            EXPORTING
              i_area     = 'ZPLBSCF1'
              i_variable = 'ZPLYEAR'
            IMPORTING
              e_subrc    = lc_subrc
              eto_varsel = lcto_varsel.
          if lc_subrc = 0.
            clear lcs_varsel.
            read table lcto_varsel into lcs_varsel index 1.
            l_curr_year = lcs_varsel-low.
          endif.
    DIFF = l_plan_year - l_Curr_year.
            IF l_plan_year = l_Curr_year.
                 l_VERSION = 'P'.
                 ELSEIF ( DIFF = 1 ).
                      l_VERSION = 'B'.
                      ELSEIF ( DIFF = 2 ).
                           l_version = 'F'.
                           ELSE.
                                l_VERSION = 'F'.
         ENDIF.
    ls_chasel-chanm = '0VERSION'.
    ls_chasel-opt = 'EQ'.
    ls_chasel-low = l_VERSION.
    insert ls_chasel into table eto_charsel.
    Endif.
    ENDFUNCTION.
    Thanks alot
    Saurabh

  • Code for Customer exit in a variable is required

    Hi Guys,
      Document numbers are flowing in to two OD's. These doc numbers are available in 'X' and 'Y' ODS's.
    We are missing some doc nos both the ODS's. we want to display those doc nos in a report.
    We Created an infoset on these two ODS's.We want to write a Code for the Ccustome exit on this document number.
    Can anybody suggest how to get these doc nos in areport.
    Can anybody help me in writing a code on customer exit.
    Pleas give suggestions how to display rhes doc nos in areport.
    Thanks,
    Nela

    Hi,
    case I_VNAM.
    when 'ZPRYRPER'.
    if I_STEP = '2'.
    loop at i_t_var_range into temp.
    append temp.
    endloop.
    read table temp with key vnam = '0S_FPER'.
    if sy-subrc eq 0.
    move temp-low to l1_period.
    move temp-high to l_period.
    endif.
    if l_period-gjahr = 0000.
    l_period-gjahr = 2020.
    endif.
    if l1_period-gjahr = 0001.
    l1_period-gjahr = 1990.
    endif.
    CLEAR E_T_RANGE_WA.
    l1_period-buper = '001'.
    l_period-gjahr = l_period-gjahr - 1.
    l1_period-gjahr = l_period-gjahr.
    E_T_RANGE_WA-SIGN = 'I'.
    E_T_RANGE_WA-OPT = 'BT'.
    E_T_RANGE_WA-HIGH = L_PERIOD.
    E_T_RANGE_WA-LOW = L1_PERIOD.
    APPEND E_T_RANGE_WA TO E_T_RANGE.
    endif.
    Regards,
    Marasa.

  • Customer Exit for BW Variables

    Dear all,
    I am a BW Consultant and have a very limited knowledge in ABAP. I have the following scenario:
    My BW query has the following input variables:
    0P_FYEAR      Fiscal Year (Single Value Entry)
    0P_PER3      Posting Period (Single Value Entry)
    and the following text variables:
    ZT_FYEAR     (Text variable for Year)
    ZT_PER3     (Text variable for Period)
    ZT_CQTR   (Text variable for Comparative Quarter)
    Now, I need guidance to write ABAP code in CMOD that will achieve the following results:
    1.     Display last date of Period., e.g.:
    -     Return 31 to ZT_PER3, if January (Period 1) is selected from 0P_PER3.
    -     Return 28/29 to ZT_PER3,  if February (Period 2) is selected from 0P_PER3.
    2.     Display as Period 12.
    Display Period 13, Period 14, Period 15 & Period 16 as Period 12, e.g.:
    -       Return 12 to ZT_PER3, if Period 13 is selected from 0P_PER3.  The same goes for Period 14, 15, & 16.
    -       Otherwise, return the same period to the text variable.
    3.     Quarter-to-date Comparison
    -     If Quarter 1 periods (Period 1, 2 or 3) and Year 2012 is selected from 0P_PER3 and 0P_FYEAR, return Quarter 4 to ZT_CQTR and Year 2011 to ZT_FYEAR.
    -      Otherwise, return previous quarter and same fiscal year to the text variables.
    Would really appreciate your assistance.
    Thanks!

    Hi Fulham,
    For point 3:
    case 0P_PER3.
    when '1' or '2' or '3'.
    ZT_CQTR = '4'.
    ZT_FYEAR = 0P_FYEAR - 1.
    when '4' or '5' or '6'.
    ZT_CQTR = '1'.
    ZT_FYEAR = 0P_FYEAR.
    when '7' or '8' or '9'.
    ZT_CQTR = '2'.
    ZT_FYEAR = 0P_FYEAR.
    when '10' or '11' or '12'.
    ZT_CQTR = '3'.
    ZT_FYEAR = 0P_FYEAR.
    endcase.
    Hope This Helps.
    Ernesto.

Maybe you are looking for

  • Can't access my apple lossless files on external hard drive after reinstalling windows 8.1

    Hi guys New to this. I reinstalled windows 8.1 after windows continually asking me to change my password after not recognising it despite it being the right one. All my apple lossless tunes are on my external hard drive. Windows keeps saying 'I don't

  • Dns error when trying to start ssgd 4.4

    Hi, I get the following error when trying to start a fresh install of SSGD 4.4 on sun solaris 10 sparc machine bash-3.00# /opt/tarantella/bin/tarantella start Starting Secure Global Desktop server (version 4.40.917). Please wait... 2008/05/12 18:34:4

  • Cursor in select query

    how i use cursor in select query ? I have 2 table 1. emp 2. dept i want output like Manager a b c Clark d e f HOD g h i by using cursor

  • "Add link" doesn't work in Mail 7.1

    When I copy and paste a URL into a Mail message, then select it and Add Link (command+K), then passte the URL into the resulting text box, the disabled "OK" button, should become enabled, but  doesn't. I've used this feature many many times over the

  • Users Users Users ... Who needs them

    Hi Gurus I have about 15 users who will be using my application. I have been advised by my DBA to create them as HTMLDB users without developer privs. I have read on the forum that this is not advisable but as we dont have single signon or LDAP and w