Change customer exit variable in selections over Dropdownbox

Hello Experts,
we are on NW2004s, SP12.
I have a customer exit variable (0CALYEAR) in two columns. In the first column the customer exit variable and in the second column the customer exit variable with an offset -1.
Now I want to change the year in a dropdownbox. Under <=BW3.5 that was not possible, only over a how to paper.
I can fill the dropdownbox in the web template but when I change the year, it jumps back to the year selected by the customer exit. How can I change the variable in the new web application designer (2004s) during the navigation? Has any one experience with such a problem?

Hallo Frank,
how can I change the variable values in the WAD?
The parameters of the variable: mandatory, customer exit, reference characteristic: 0calyear, single value, not ready for input.
My coding:
DATA: l_s_range TYPE rsr_s_rangesid.
  DATA: i_s_var_range   TYPE  rrs0_s_var_range.
  DATA: i_calyear(4) TYPE c,
        i_duedate(4) TYPE c.
  IF i_step = 1.   " Variable nach Selektionsbild bearbeiten
    READ TABLE i_t_var_range
    WITH KEY vnam = 'CALYEAR_X01'
    INTO i_s_var_range.
    i_calyear = i_s_var_range-low.
    i_duedate = '0210'.
    IF sy-datum+4(4) GE i_duedate.
      i_calyear = sy-datum(4).
    ELSE.
      i_calyear = sy-datum(4) - 1.
    ENDIF.
Rückgabetabelle füllen
    CLEAR l_s_range.            " Range-Tabelle füllen
    l_s_range-low  = i_calyear.
    l_s_range-sign = 'I'.
    l_s_range-opt  = 'EQ'.
    APPEND l_s_range TO e_t_range.
  ENDIF.
Thank you for your fast reply!
Regards
Jens

Similar Messages

  • Help needed in Customer exit variable

    Hi Experts,
    We have a scenario as below.
    User enters fiscal year period.Based on the fiscal year period,entire year will be selected.
    Row would contains
    0fiscper3(Fiscal months from Jan to Dec)
    Column contains Amount(Actual or Forecast)--There is a restricted keyfigure on amount.If value type=60 then forecast
    and value type=10 then actual amount
    If the user enters 002.2010 then it should give Actual values ie value type=10 for 001.2010 and 002.2010.For all values greater than 002.2010, it should give forecast values(value type=60)
    Report Format.
    Jan----
    Actual Value(value type=10 in the column for amount)
    Feb----
    Actual Value(value type=10 in the column for amount)
    Mar----
    Forecast Value(value type=60 in the column for amount)
    Apr----
    Forecast Value(value type=60 in the column for amount)
    May----
    Forecast Value(value type=60 in the column for amount)
    Jun----
    Forecast Value(value type=60 in the column for amount)
    Jul----
    Forecast Value(value type=60 in the column for amount)
    Aug----
    Forecast Value(value type=60 in the column for amount)
    Sep----
    Forecast Value(value type=60 in the column for amount)
    Oct----
    Forecast Value(value type=60 in the column for amount)
    Nov----
    Forecast Value(value type=60 in the column for amount)
    Dec----
    Forecast Value(value type=60 in the column for amount)
    I know that i have to create a customer exit variable for value type
    But in this scenario.the value for value type may change in each row based on fisper3(month).
    How can i obtain such a scenario in the customer exit
    Your help will be appreciated.
    Thanks,
    Senoy
    Edited by: senoy laxman on Feb 15, 2010 6:42 AM

    Hi Senoy,
    you have to create two customer exit variables for fiscal year period(0fiscper) as given below.
    1. for actual values (value type=10), coding in cmod such that showing values less than and equal to user input values.
    2. for forecasting values(value type=60,)coding such that showing values greating than user input values.
    use the first varible in the first selction and the second varible in the second selection in the given below structure(use the structure in rows)
    use the fiscal period user input varible in the third selection in the given structure below.
    structure
    selection - (Actual)-restrict with value 20 and first customer exit variable .
    selection -(Forecast)-restrict with value type 60 and second customer exit variable.
    Selection - 0fiscper
    Add the key figure 0Amount in the columns or in rows(in the selection of second structure) as per your requirment.
    hope this helps you.

  • How to change a customer exit variable in columns

    Hallo Experts,
    i have a query with two columns. In the first column is a customer exit variable, who get filled with the actual calyear. In the second column is the same variable with an offset -1.
    When i execute the query, in the first column i can see the year 2007 and in the second column i can see 2006. That´s ok.
    Now i want to change the year (dynamically) in a filter 2007 in 2005. The result should be in the first column 2005 and in the second column 2004.
    What can i do?

    Hi Jens,
    As I understand the scenario, you have two RKF or selections in column 1 and 2, one is restricted with variable ZYear, the other with the same variable, offset - 1 and variable ZYear provides current year.
    I think there is no way to change years dynamically in a filter, but you could solve the issue by refreshing the query and overwrite default value provided by customer exit.
    To achieve this, please change variable and check 'Ready for input' in change dialog..
    If this shouldn't work, please let me know details a variable definition and customer exit.
    Have a nice w/e
    Joe

  • Changing a customer exit variable in Step 2 which was already set in Step 1

    Hello,
    i have the following problem.
    There are 2 BEx customer exit variables A and B.
    Variable A is filled in Step 1 before the user dialog appears.
    Variable B is determined in Step 2 in dependence of variable A.
    Now i want to change variable A in dependence of user entry althoug it was already filled in step 1. Can i somehow force the variable manipulation in step 2 for a single variable wich has already been set in step 1?
    Or is there a way to change all variables at once after they have been set e.g. in step 3?
    Regards,
    Alexander

    Hello Alexander!
    It's true: You cannot change values that were entered in step 1. It's a feature This is supposed to make sure that a value that was entered (or confirmed) by the user can never be changed by any piece of coding - customer or SAP. If that possibility existed, then that would create some real issues for reliability and also support.
    What is your scenario that you are trying to solve? Maybe there's another way to do it?
    Regards,
    Christian!

  • Customer Exit variable of Query not working in View

    Hi,
    I have a customer exit variable in my query to calculate the last 6 month period on Calendar month. I have used 0CMONTH for the same and then using offset of 6 on its value range to get it.
    Now, I have many views based on this query, which should ideally be having the same filter condition for the calendar month, but it is not happening. Although, it is working fine for the query! The views do not seem to be catching the selection correct.

    Hi there,
    As far as I Know, yes they exist. The only difference here, is that you build a query with a selection screen, and  you execute the query with some selection parameters, and therefore all customer exit variables, offsets, etc, will be read and changed at the runtime execution of the query, and you can rearrange your query visualization drilling down free char., making filters, etc. and storing that visualization in a view.
    If you save your view and execute it afterwards, you'll get the same selection parameters to input, the same offsets, etc, that you have with the query, but with a visualization stored by you.
    So that should have been working.
    Diogo.

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

  • Problem with Bex Customer Exit Variable

    Hi Friends,
    I have a customer exit variable which is getting filled based on the User Input.  I have written the code inside the If condition checking i_step = 2. The code is working as required.
    But the problem is when I try refreshing the query or change the user variable selection, the Customer exit variable is not changing.  I tried to debug the code and realized that the  values for the exit variable based on the previous selection is not cleared and the i_step = 2  is not being executed for the variable.
    While I close and reopen the query, the code is working fine.  
    Does anyone know why this is happening?  Please suggest..
    Thanks in advance..
    Regards,
    Priya

    Hi Binu,
    Here is the code sample.  I am trying to populate the month based on the input Week number '0I_WEKIN'
    .  For eg.  If I give 37.2011, the month value should be 08.2011.  If I give 39.2011, month should be 09.2011.
      WHEN 'ZC_MONTH'.
        IF i_step = 2.     "after the popup
            READ TABLE i_t_var_range INTO lw_var_range WITH KEY vnam =
        '0I_WEKIN'.
           IF lw_var_range-high IS NOT INITIAL.
              l_week  = lw_var_range-high.
              l_week = l_week - 3.
              CALL FUNCTION 'WEEK_GET_FIRST_DAY'
                EXPORTING
                  week = l_week
                IMPORTING
                  date = l_date.
              lw_range-low = l_date+0(6).
            ENDIF.
            lw_range-sign = 'I'.
            lw_range-opt  = 'BT'.
            APPEND lw_range TO e_t_range.
        ENDIF.
    Regards,
    Priya

  • Customer Exit Variable to fetch the data from the cube..

    Hello Gurus,
    I am having a requirement to select the latest changed record from the cube while executing the query.  where we are having the Calday as the date with a variable .
    I suggested my client we can filter it at the DSO leve or Data loading level but my client dont want to distrurb the existing design so he want to perfrom the changes at the Query level only.
    For Example we are having below records in the cube.
    PO             Material     Calday       Qty         Price
    101            ABC          1/12           100         10
    101            ABC          2/12            100         10
    101            ABC          3/12            100         11
    I am having Calday in the selection screen as the variable.
    Now from the above example i need to show the record which has been changed on 3/12.
    For this i am planning to write the customer exit variable on the calday , when the user enter the range of Calday then i will fetch the whole records which fall in between the range and i will sort each PO with respect to the date and i will pick those which are the latest records.
    My Concerns:
    !. Kindly let me know if it is possible and what are the other things that i need to consider.
    2. Did it will impact the performance.
    Waiting for your quick replies
    Thanks & Regards
    KK

    Hi Mate,
    Sorry for late reply.
    By d way in your word.
    initially when the user enter the date range as the vairable input. suppose 1/12 to 31/12 then i will pick all those records which fall in this range.
    suppose the records are
    PO Date
    P1 01/12
    P1 02/12
    P2 02/12
    P2 03/12
    P3 03/12
    P3 04/12
    In the customer exit variable Now for each PO i will sort the date in ascending order and i will pick the last record to display it in the Report.
    The ouput will be
    PO Date
    P1 02/12
    P2 03/12
    P3 04/12
    Now hope you are aware about exit variable concept.
    so what value will pass in the calday filter.
    here after sorting on each PO , you will get 3 different dates, 02/12 for P1
    03/12 for P2
    and 04/12 for P3
    Now if you are aware about exit variable concept, then you will pass this three date to CALDAY(I_t_VAR_Range-low = ...)
    but how query will understand that for P1 calday filter value is 02/12, for P2 calday filter value is 03/12.... and so on...
    actually i have also experienced this kind of issue 1-2 years before, i have tried same thing at that time without thinking and stuck with this problem..
    By d way you can also learn from your mistake.. so just try ur logic and then you will understand what is the problem?
    By d way this will not work, parallel you can work on other solution.

  • Sequence of Customer exit variables executed by a Query?

    Hi All,
    Can some one please answer my query!
    We have 2 queries
    1. First query speaks about sales Actual vs Planned
    and in this query we have the KF restricted by time period(Customer exit var) & 0INFOPROV(Customer exit var).
    2.Second speaks about Profits for Actuals Vs Planned
    and in this query also we have the KF restricted by time period(Customer exit var) & 0INFOPROV(Customer exit var).
    when we execute query 1(In Debug mode in CMOD under the Processing step 2 I can find that the CASE I_VARNAM catches first the Time period and then for 0INFOPROV but when I run query 2 exactly the vice versa happens i.e the varname first catches for 0INFOPROV n then for Time period(due to which we have an incorrect result). So I just want to know how is the sequence of this customer exit variables defined/cached in CMOD under Processing step 2 maintained.
    How can I change the 2nd query to fetch first the Time Period n then 0INFOPROV
    Regards

    Hi Udo,
    This is meant for the sequence of the input variables in the d selection screen, but I'd like to know the sequence of customer exit variables captured in CMOD and how can we change this.
    Regards

  • Default value of BeX customer Exit variable not Displayed in WeBI??

    Hello Experts,
    We are stuck with a problem where WeBI report is created on top of BeX query and we are not able to see the default value of Bex Customer exit variable in WeBI run. Here is the complete scenario:
    1. One restricted KF is created in BeX, restricted with Customer exit variable on net Due date. And this variable is mandatory, ready for input, and Default value in calculated is user exit as current Week's Monday.
    2. So, by default KF data should be restricted to Monday of current week, if user does not change this value.
    3. Now, WeBI report is created on top of this Bex query, and all is working fine, i.e. we are getting variable as Prompt in WeBI, but Default value is not shown while Running the Webi Report.
    So, need your inputs on the same, if default values from BeX in WeBI is supported or not? If yes, why this is happening, and how to resolve it?
    Please notice, the restrcition is in KF only, it is not a separate restrcition on Net Due date in Filter area or in Defualt area of BeX
    and we are on SAP BW 7.1 and BOXI 3.1 SP4.
    Regards,
    Vipul
    Edited by: VIPUL GOYAL on Nov 23, 2011 9:44 PM

    Hi,
    See 1285993 - Support of Customer Exit Variables from BEx query into WebIntelligence via OLAP universe
    WebI will prompt when executed, but the default values calculated by the user exit  - do not appear.
    Note: If the BEx variable has property 'ready for input' set / enabled, then its WebI prompt shows ok, but no default value appears.
    Cause
    This behaviour expected 'by design' (in the context of the product's current limitations) as explained in the online guide below:
    Please refer to Chapter 7, page 44, document link here: http://help.sap.com/businessobject/product_guides/boexir3/en/xi3_sap_olap_universes_en.pdf
    Characteristic variable > processing type > Customer Exit  is "Supported, without user entry"                                                                               
    -->  This should be understood as meaning "User will not be shown a prompt"
    regards,
    H

  • Display Error Message in BW Report based on Customer Exit Variable

    Hi
    I need to display an error message in the BW report based on the value of a customer exit variable - i was able to do this successfully in BW3.5 using the below code.
      WHEN 'ZUPN'. "Here ZUPN is the customer exit variable
        IF i_step = 1.
          <check for condition -- if successful, variable flag = 1, else variable flag = 0>
          IF flag = 0.
            MESSAGE e157(00). "Error Message
          ENDIF.
        ENDIF.
    I have upgraded my system to BI 7.0 now. Whenever the variable check is not successful, it displays a blank screen instead of the error message in the report. Please advice if we need to change the code and how ??

    Bhanu,
      Thanks for u r reply.This warning message appears every time i execute the report through portal.
    Any idea ?
    Regards
    Mano

  • Customer Exit variable and Filter routine in DTP does not works?

    Hello Experts,
    Does anyone know what might be the possible reason - A customer exit variable working fine on the OLAP side does not work in a DTP??
    I have also tried to use the Filter routine, which does not give me the right results..I am trying to fetch a Fiscalyear period maintained in an infoObject as follows in my Filter routine..
    ata: sel_period like /BIC/PZPARAM-/BIC/ZPARAMVAL.
    DATA: zperiod type /BI0/OIFISCPER.
              SELECT SINGLE /BIC/ZPARAMVAL INTO sel_period
              FROM /BIC/PZPARAM
              WHERE /BIC/ZPARAM = 'ZPCA'
              AND objvers = 'A'.
              zperiod = sel_period.
    data: l_idx like sy-tabix.
              read table l_t_range with key
                   fieldname = 'FISCPER'.
              l_idx = sy-tabix.
              l_t_range-iobjnm = '0FISCPER'.
              l_t_range-fieldname = 'FISCPER'.
              l_t_range-sign = 'I'.
              l_t_range-option = 'EQ'.
              l_t_range-low = zperiod.
              if l_idx <> 0.
                modify l_t_range index l_idx.
              else.
                append l_t_range.
              endif.
              p_subrc = 0.
    Please let me know if I am making any mistakes above..
    Kind Regards,
    Kadriks

    Hi
    1.  CLEAR l_t_range-high. is missing in your code befor assigning values to l_t_range.
    2. use simple append l_t_range after the l_t_range asisgnments. remove below code :
    if l_idx 0.
    modify l_t_range index l_idx.
    else.
    append l_t_range.
    endif.
    p_subrc = 0.
    3. I dont think you need to assign infoobject.
    4. Clear sel_period and zperiod is also missing
    Hence your code should be  :
    data: l_idx like sy-tabix.
    read table l_t_range with key
    fieldname = 'FISCPER'.
    CLEAR l_t_range-high.
    l_idx = sy-tabix.
    l_t_range-fieldname = 'FISCPER'.
    l_t_range-sign = 'I'.
    l_t_range-option = 'EQ'.
    l_t_range-low = zperiod.
    append l_t_range .

  • Customer exit variable - internal table in BEX

    Hi,
    i am running a report and using variables in it.
    The report runs over a info cube. There are few challenges in it.
    One of the variable is posting date, and when user enters posting date i need to negate it with current system date.
    If the negated value is greater than 28 then i need to exclude documnet type 'YG' and display the query, else i need to include the dcumnet type 'YG' and document type '  '.  The above logic can be well implemented via a customer exit variable(for posting date) using an internal table. We have internal tables like C_T_DATA which is used in data source enhancement, which help us to implement our own desired logic.
    Do we have such kind of internal tables, based on which the report output (result set) is derived?
    i know that we have l_t_range and e_t_range, but dont know their usage, some one can explain in detail about them?
    Thanks in advance.

    Hi Selva & Lakshmin,
    The code given by Selva is almost correct . If my understanding is clear , you also wanted to include  document type ' ' when the negated value is less than 28 .
    Modification in Selvas Code :
    Variable 'V_DOCTYP' must be of type Multiple Single Values.
    DATA : V_DATE LIKE SY-DATUM.
    DATA : V_DAYS TYPE I.
    if i_step = 2.
    when 'V_DOCTYP'.
    READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZV_PDATE''.
    IF SY-SUBRC = 0.
    V_DATE = loc_var_range-low.
    ENDIF.
    V_DAYS = SY-DATUM - V_DATE.
    IF V_DAYS > 28.
    l_s_range-low = 'YG'
    l_s_range-sign = 'E'.
    l_s_range-opt = 'EQ'.
    APPEND l_s_range TO e_t_range.
    ELSE.
    l_s_range-low = 'YG'
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    APPEND l_s_range TO e_t_range.
    clear l_s_range.
    l_s_range-low = ' '.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    APPEND l_s_range TO e_t_range.
    ENDIF.
    ENDIF.
    Hope the above reply was helpful.
    Kind Regards,
    Ashutosh Singh

  • Customer exit variable output error

    Hi gurus,
    I have created one customer exit variable. in the selection screen i am giving multiple plant and material value,
    my code is working for sigle plant and single material.
    when i have taken multiple value. i am getting error message
    error is 'No value determined for th variable"
    When i debug my code in RSRT, it is giving all the values for different combination of plant and material. and those values are getting in the E_T_RANGE.
    but out put it is giving the error.
    my code is:
    WHEN 'ZPRDEMVA'.
        IF i_step = 2.
          READ TABLE I_T_VAR_RANGE INTO LOC_VAR_RANGE
          WITH KEY VNAM = 'ZPRRNDT'.
          v_date = LOC_VAR_RANGE-LOW.
          v_year = v_date+0(4).
          v_month = v_date+4(2).
          v1_date = v_date+6(2).
          v3 = v_year - 1.
          v4 = v_month - 1.
          if v4 = 00.
          v4 = 12.
          v3 = v3 - 1.
          endif.
          concatenate v3 v4 v1_date into ddate.
          CALL FUNCTION 'DATE_GET_WEEK'
            EXPORTING
              DATE         = ddate
            IMPORTING
              WEEK         = zweek
            EXCEPTIONS
              DATE_INVALID = 1
              OTHERS       = 2.
          CALL FUNCTION 'WEEK_GET_FIRST_DAY'
            EXPORTING
              WEEK         = zweek
            IMPORTING
              DATE         = monday
            EXCEPTIONS
              WEEK_INVALID = 1
              OTHERS       = 2.
          sunday = monday + 6.
          v3_date = monday.
          v4_date = sunday.
          LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
                  WHERE VNAM = 'ZPRPLNML'.
          CLEAR L_S_RANGE.
            v_werks          = LOC_VAR_RANGE-LOW.
          LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
                  WHERE VNAM = 'ZPRMATML'.
          CLEAR L_S_RANGE.
            v_matnr          = LOC_VAR_RANGE-LOW.
          data: dummy_menge like i_mseg-menge value '0.01'.
          Do 52 times.
               select MATERIAL PLANT QUANT_B MOVETYPE
                     from /BIC/AWINO0100 into  table  i_mseg
                     where PSTNG_DATE between monday and sunday
                     and   MOVETYPE between 261 and 262
                     and   MATERIAL = v_matnr
                     and   PLANT = v_werks.
                         if sy-subrc NE 0.
                           i_mseg-menge = '0.01'.
                           i_mseg-matnr = v_matnr.
                           i_mseg-werks = v_werks.
                           i_mseg-bwart = '261'.
                           append i_mseg.
                         endif.
            loop at i_mseg.
              itab1-matnr = i_mseg-matnr.
              itab1-werks = i_mseg-werks.
              itab1-menge = itab1-menge + i_mseg-menge.
              itab1-bwart = i_mseg-bwart.
              COLLECT i_mseg into itab1.
            endloop.
            sort itab1 by matnr werks bwart.
            loop at itab1 where bwart = '261'.
              itab2-matnr = itab1-matnr.
              itab2-werks = itab1-werks.
              itab2-bwart = itab1-bwart.
              itab2-menge = itab1-menge.
              read table itab1 with key matnr = itab2-matnr
                                        werks = itab2-werks
                                        bwart = '262'.
              if sy-subrc = 0.
                itab2-menge =  itab2-menge - itab1-menge.
              endif.
              append itab2.
            endloop.
            clear itab1[].
            refresh itab1.
            sunday = sunday + 7.
            monday = monday + 7.
          ENDDO.
          loop at itab2.
            sum1 = sum1 + itab2-menge.
          endloop.
          average = sum1 / 52.
          loop at itab2.
            sum2 = sum2 + ( ( itab2-menge - average ) *  ( itab2-menge - average ) ).
          endloop.
          sum2 = sqrt( sum2 / 52 ).
          l_s_range-sign = 'I'.
          l_s_range-opt = 'EQ'.
          l_s_range-low = sum2.
          Append l_s_range to E_T_RANGE.
          clear itab2[].
          refresh itab2.
          sum1 = 0.
          sum2 = 0.
          monday = v3_date.
          sunday = v4_date.
          ENDLOOP.
          ENDLOOP.
        ENDIF.
    Can any one please help me.
    Thanks in advance.

    Hi Alec,
    i created a customer exit with the formula variable only. in the code i am getting the both quantity and unit fields. now i want to get quantity with unit in output.
    thanks

  • Customer Exit Variable in formula to get values for multiple keyfigures

    Hi to all,
    I have query as defined in following scenario:
    CHAR_X     C_KF1 (based on KF1)     C_KF2 (based on KF2)     u2026     C_KFn (based on KFn)
    Value1                    
    Value2                    
    u2026                    
    Valuem                    
    C_KF = calculated key figure
    I need to create a customer exit variable that will search through selection e.g. CHAR_X/KF1 and give some result. I need this variable for every keyfigure (KF1-KFn). Using customer exit variable is the only solution.
    My question is: do I have to create formula variable (customer exit) representing every keyfigure separately (VAR1 u2013 VARn, like in below example)?
    CHAR_X     C_KF1 (using VAR1)     C_KF2 (using VAR2)     u2026     C_KFn (using VARn)
    Value1                    
    Value2                    
    u2026                    
    Valuem                    
    Or is it possible to create one general formula variable since the way to retrieve the value in variable is always the same (like in below example)? In this case, how do I pass the value of the respective keyfigure to this variable?
    CHAR_X     C_KF1 (using VAR_X)     C_KF2 (using VAR_X)     u2026     C_KFn (using VAR_X)
    Value1                    
    Value2                    
    u2026                    
    Valuem                    
    Thanks for your replies, points will be awarded!
    Cheers

    That is my concern, the value of variable is not the same.
    What variable should do is:
    take KF1 id, go through values for CHAR_X, get back one value
    This value would always be different, and also "KF" part in code of variable should be different, based on the column where the variable is being used (so, in column C_KF1 ,variable should "pick up" id of KF1, etc.).
    I hope it makes it more clear. For now, I do not have the code for variable yet, I am just interested in concept whether it is possible to pass the ID of keyfigure dynamically so I can make decision how to model this request.
    Thanks

Maybe you are looking for

  • How to use an available field more than once  to define an unique field?

    At the table level in the console you can indicate various combinations of fields that must be unique either individually or in combination. However, you can assign an available field only once,  individually or in combination. For our data model it

  • Smart Playlist JUST for 'Free Songs of the Week?'

    I would like to create a Smart playlist comprising exclusively the 'Free Songs of the Week' from the iTunes Store. So when I get the weekly 'Free Song,' it goes right into that list. But I need some sort of 'unique identifier' that allows this to hap

  • How to write two item in the same line?

    In the smartforms,how to write two item in the same line? eg 1   *************                                    2  ***************** 3  **************                                   4  ****************** 5  *************** Anyone got any idea to

  • Final Cut Project file has become bloated

    My Final Cut Project file seems to be growing at an exponential level.  It jumped from 160mb to 367mb after I DELETED a bunch of files to try & reduce the size.  The problem is getting serious.  I try & "save as" or create a new project and drag my e

  • Help in interpreting the output of explain plan

    Hi, I have written a query in two different ways and then run an explain plan on both of them. Both these queries give same result. I want to know which one will be more efficient. I am giving the output of explain plan for both the queries: The seco