Customer exit in BEx Query

Hi,
I've created a BEx query and added a variable MCE9004 in field Ref.org.unit and this variable is mapped to a customer exit code via CMOD step 2 (post_popup).
Basically how I want it to work is, I will select an org.unit value e.g. org.unit = A1 in tcode RSRT variable selection screen and this value will be passed in the customer exit code as shown below and retrieve the look up values and pass it to the field ref.org.unit via e_t_range.
CASE i_vnam.
     WHEN 'MCE9004'.
****      IF i_step = 2.
       READ TABLE i_t_var_range INTO LS_T_VAR_RANGE
       WITH KEY IOBJNM = '0CALMONTH'.
       l_date = LS_T_VAR_RANGE-low.
       IF l_date IS NOT INITIAL.
         CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
           EXPORTING
             day_in            = l_date
           IMPORTING
             last_day_of_month = ld_last_day
           EXCEPTIONS
             day_in_not_valid  = 1
             OTHERS            = 2.
       ENDIF.
       READ TABLE i_t_var_range INTO LS_T_VAR_RANGE
       WITH KEY IOBJNM = '0ORGUNIT'.
       SELECT /BIC/ORGUNT_PR FROM /BIC/AMPA5AX0000 INTO lv_org "l_s_range
         WHERE ORGUNIT = LS_T_VAR_RANGE-low
         AND DATETO LE ld_last_day.
         l_s_range-SIGN = 'I'.
         l_s_range-OPT = 'EQ'.
         l_s_range-LOW = lv_org.
*          l_s_range-HIGH =
         APPEND l_s_range TO e_t_range.
       ENDSELECT.
***** To clear value of org.unit field
****      READ TABLE i_t_var_range INTO LS_T_VAR_RANGE
****      WITH KEY IOBJNM = '0ORGUNIT'.
****      IF sy-subrc EQ 0.
*****        CLEAR LS_T_VAR_RANGE-low.
****        DELETE i_t_var_range index sy-tabix.
****      ENDIF.
   ENDCASE.
ENDFUNCTION.
Once this code has been executed it goes back to the selection screen and there is still an org.unit value on the screen even though I have removed it in my code in red above in i_t_var_range.
Therefore when I execute the query, the value for org.unit field is not emptied.
Can you please teach me how to clear that value of org.unit field?
Let me know if you need further details.
Thanks,
Rebekah

hi thomas,
yes i get your point but the thing is i need to modify a value in the import table. coz the export table is not for the org.unit field but the ref.org.unit field.
Basically i pass in org.unit = A1 and e_t_range will have the lookup values to be passed in ref.org.unit field which is B2 and C3.
Then when i click execute, i want my filter only to have the values B2 and C3 and A1 shud be removed.
is there any way i could do that?
please advice.
Thanks,
Rebekah

Similar Messages

  • How to select data from an aggregate in a customer exit for a query?

    Hi,
    I have written a virtual key figure customer exit for a query. Earlier the selection was from the cube, where there was severe performance issue. So I have created an aggregate, activated and have loaded the data.
    Now when I select that data I find that the Key table is different in development and production. How do I resolve this.
    My code is attached below. The table in developemnt is KEY_100027 and in production is KEY_100004. This code is activated and running in BW development server.
    SELECT
        F~KEY_1000041 AS K____035
         F~KEY_1000271 AS K____035
         F~QUANT_B AS K____051
         F~VALUE_LC AS K____052
    INTO (xdoc_date, xval1, xqty1)
    UP TO 1 ROWS
    FROM
    FROM
    */BIC/E100004 AS F JOIN
    /BIC/E100027 AS F JOIN
    /BIC/DZMM_CGRNU AS DU
    ON FKEY_ZMM_CGRNU = DUDIMID
    JOIN /BI0/SUNIT AS S1
    ON  DUSID_0BASE_UOM = S1SID
    JOIN /BI0/SCURRENCY AS S2
    ON DUSID_0LOC_CURRCY = S2SID
    JOIN /BI0/SMATERIAL AS S3
    *ON FKEY_1000042 = S3SID
    ON FKEY_1000272 = S3SID
    JOIN /BI0/SMOVETYPE AS S4
    *ON FKEY_1000043 = S4SID
    ON FKEY_1000273 = S4SID
    JOIN /BI0/SPLANT AS S5
    *ON FKEY_1000044 = S5SID
    ON FKEY_1000274 = S5SID
    JOIN /BIC/D100004P AS DP
    *ON FKEY_100004P = DPDIMID
    ON FKEY_100027P = DPDIMID
    WHERE
    WHERE
    ( ( ( ( F~KEY_1000041 BETWEEN 20051230 AND 20060630  ) ) AND  ( (
    ( ( ( ( F~KEY_1000271 BETWEEN 20051230 AND 20060630  ) ) AND  ( (
             S3~MATERIAL = <l_0material> ) ) AND  ( (
                s2~movetype BETWEEN '101' AND '102' OR
             s4~movetype BETWEEN '921' AND '922' OR
             s4~movetype BETWEEN '105' AND '106' OR
             s4~movetype BETWEEN '701' AND '701' OR
             s4~movetype BETWEEN '632' AND '632' ) ) AND  ( (
             S5~PLANT = <l_0plant> ) ) AND  ( (
             DP~SID_0RECORDTP = 0  ) ) ) )
    GROUP BY
        ORDER BY F~KEY_1000271 DESCENDING.
          IF sy-subrc NE 0.
            EXIT.
          ENDIF.
        ENDSELECT.
    How do I transport the code and make it work?
    Whats the reason that the two key fields are different.
    I had transported the aggregate from development to production. Activated it and filled the data.
    What is the way out? Please help.
    Regards,
    Annie.

    Hi Sonu,
    The main task is to move the contents of the one internal table to another with some condition.
    First sort and delete the duplicate entries from the First Internal table like below : 
    sort it_tab by material ascending date_modified descending.
    delete adjacent duplicates from it_tab.
    Then move that Internal table contents to another internal table.
    Define another internal table with the same structure as you have first internal table and then
    Second Step :
    it_itab1 = it_itab.
    If you are using seperate Header line and Body then you can do like below :
           it_itab1[] = it_itab[].
    This will fix the issue.
    Please let me know if you need any further explonation.
    Regards,
    Kittu
    Edited by: Kittu on Apr 24, 2009 12:21 PM

  • Customer exits in Bex

    Hello BW Experts,
    Could any one give me some pointers / web sites / materials / oss notes for Customer exits in Bex.
    Any help is highly appreciated.
    Thanks,

    Check Out service.sap.com/bw ... See under "SAP BW InfoIndex" there you find a section called "Exit".
    Let me warn you about Custome Exits usage in BEx ... be carefull about performances!
    Hope it helps
    GFV

  • How to get data for current week and previous week using customer exit in Bex.

    Hi everyone,
    I have a scenario in which I need to display data for current week and previous week (based on "sy_datum" the program has to calculate current week and previous week) in Bex using  Customer exit. I have created one variable in Bex Query Designer and I have written code for the variable in CMOD. But it is not working fine, (I know that we can do the same by using offset value in Bex). Can some one guide me how to achieve my requirement using customer exit.
    Thanks in Advance,
    G S Ramanjaneyulu.

    Hi krishna,
    Thanks for your quick reply, can you have a look at my code,
    case i_vnam.
    WHEN 'ZPWK_CWK'.
    ranges : pre_week for sy-datum.
    data : start_date type DATS,
           end_date TYPE dats .
    ************FM TO GET FIRST DATE OF CURRENT WEEK ************************
    CALL FUNCTION 'BWSO_DATE_GET_FIRST_WEEKDAY'
      EXPORTING
        DATE_IN  = sy-datum
      IMPORTING
        DATE_OUT = start_date.   " WEEK FIRST DATE
    end_date = START_DATE + 6.   " WEEK LAST DATE
    END_DATE   = START_DATE - 1.   " PREVIOUS WEEK END DATE
    START_DATE = START_DATE - 7.   " PREVIOUS WEEK START  DATE
    **********PREVIOUS WEEK DATES IN PRE_WEEK******************
    pre_week-SIGN   = 'I'.
    pre_week-option = 'BT'.
    pre_week-LOW    = START_DATE.
    pre_week-HIGH   = END_DATE.
    APPEND  pre_week.
    CLEAR : START_DATE,END_DATE.
    endcase.
    Regards,
    G S Ramanjaneyulu.

  • Removing or Suppressing 0DAT SAP Exit from BEx Query

    Hi,
    I have a BEx Query on a MultiProvider. The Multiprovider is based on two Cubes. Iam facing a problem with the 0DAT Characteristic Variable on 0CALDAY. Although I dont use the 0CALDAY in my query, this SAP Exit Variable pops-up when I run the query. How do I remove or atleast suppress it from popping-up?
    I tried the 'Save & Reuse Varibale Values' options from the Query Properties Dialog Box. Although this works but I want to use one more Customer Exit Characteristic Variable on 0CALDAY & this variable is also getting resued because of the setting I made for 0DAT. I want this variable to pop-up and the 0DAT variable to be removed completely(or atleast suppressed).
    Would also like to know why 0DAT Variable is popping-up even when I dont use 0CALDAY at all....
    Thanks in advance,
    -Ravi

    Hi,
    Please refer to your following mail..I have the same problem with 0dat. Could you provide me any solution for this..
    Thanks & Regards,
    Karthi
    > Hi,
    >
    > I have a BEx Query on a MultiProvider. The
    > Multiprovider is based on two Cubes. Iam facing a
    > problem with the 0DAT Characteristic Variable on
    > 0CALDAY. Although I dont use the 0CALDAY in my query,
    > this SAP Exit Variable pops-up when I run the query.
    > How do I remove or atleast suppress it from
    > popping-up?
    >
    > I tried the 'Save & Reuse Varibale Values' options
    > from the Query Properties Dialog Box. Although this
    > works but I want to use one more Customer Exit
    > Characteristic Variable on 0CALDAY & this variable is
    > also getting resued because of the setting I made for
    > 0DAT. I want this variable to pop-up and the 0DAT
    > variable to be removed completely(or atleast
    > suppressed).
    >
    > Would also like to know why 0DAT Variable is
    > popping-up even when I dont use 0CALDAY at all....
    >
    > Thanks in advance,
    > -Ravi

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

  • Date Customer Exit in the query is not reflecting in the workbook

    Hello.
    We have a BI 7.0 Query where we have a restriction for req del date and billing date to show the month of current date - 2.
    We have written 2 customer exit variables and we have restricted the same. The query is working well.
    For Broadcasting, we have created a workbook for this query and saved it under a role.
    The workbook is fine running for the current month., But if the month changes to the next, the workbook is not reflecting the same.
    Still only Old dates are available in the workbook.
    Please let me know if i am doing any mistake

    Hi Karthik,
    If the customer exit variable is of type i_step = 1, ie if it is a manual entry variable as well, then this will not get updated based on teh month of execution.
    Kindly check the article below for info.
    http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/enterprise-data-warehousing/how%20to%20update%20variable%20values%20in%20broadcast%20settings%20dynamically.pdf
    Regards.
    Shafi.

  • Problem in the variable customer exit in the query jump target

    Hi developers,
    we have problem because we have created a variable time on 0CALDAY who is mapped in the cube of the stock with posting date.We launch the query for example with range 01/8/2005 31/8/2005 and the resul is OK.
    Then we jump on the other query where the users wish see the result of the posting date for the period 01/8/2005 31/8/2005 For resolved this problem we have created a variable customer exit for the characteristic 0Postingdate and have inserted the code in user exit variable:
    WHEN 'ZV_CEREG'.
        IF i_step = 2.
          LOOP AT i_t_var_range INTO loc_var_range
                 WHERE vnam = 'Z_DAT_AN'.
            CLEAR l_s_range.
            CLEAR datastock.
            l_s_range-low  = loc_var_range-low.
            l_s_range-high = loc_var_range-high.
            l_s_range-sign = loc_var_range-sign.
            l_s_range-opt  = loc_var_range-opt.
            APPEND l_s_range TO e_t_range.
            EXIT.
          ENDLOOP.
        ENDIF.
    When we effectued the jump the our objective is transfer the date inserted by user in the variable  of the query sender 'Z_DAT_AN' to the variable of the query receveir 'ZV_CEREG'.
    This step it does not work correctly, this why are different query?
    You can help me for resolved this problem!!
    Thanks Domenico

    Hi,
    I think, this approach does not work. Because customer exit will be finished before displaying the result set of 1st report. So the assignment to VAR2 from VAR1 does not execute then after.
    I hope, In RSBBS,after assigning receiver, in the assignment details,select 'Variable' for 'Type' of 'infoobject' 0calday.And select '0Postingdate' for 'fieldname' and select 'selection options' for selection type.
    Take help.sap.com help for further information.
    With rgds,
    Anil Kumar Sharma. P
    Message was edited by: Anil Kumar Sharma

  • Search instring value of Variable in customer exit of bex report

    Hello experts-
    I have a situation where I need to search the records based on value  of a variable input in selection screen of bex report and according to that i need to show the results in report.
    Ex- if we have a material characteristics on selection screen,or material number has 10 digits(eg 1234567809). so the user will only type 2-3 digit(i.e 12) on selection screen, In this case I want only those records to be displyed, for which material has these 2 digits in it .
    Eg would be:
    1234567809,
    3451267809,
    9807654312.
    Could you please suggest ABAP logic for the above. Properties of variable and how many variable we have to create.
    Regards,
    Yatendra

    Hello Vineet,
    we have tried putting  ' * ' i n place of '=' in drop down screen.
    we have also tried customer exit code, please check below.
       WHEN 'ZSEARCH'.
         data: lv_string type string.
         data: wa_test type ZTEST_TOOLING.
    if I_STEP = 2.
         LOOP AT i_t_var_range INTO loc_var_range
                   WHERE vnam = 'ZTSEARCH'.
              CONCATENATE '' loc_var_range-low '' INTO L_S_RANGE-LOW.
              L_S_RANGE-SIGN = 'I'.
              L_S_RANGE-OPT = 'CP'.
              APPEND L_S_RANGE TO E_T_RANGE.
         ENDLOOP.
      endif.
    In  this code we have created two variables 1st 'ZSEARCH' which is type of 'customer exit' , and the second one 'ZTSEARCH' type of "user entry/ default value" .
    As we need the value provided by user in  ZTSEARCH (user entry), we loop at  i_t_var_range where vnam = 'ZTSEARCH'.
    But i_t_var_range doesn't contain  ZTSEARCH variable.
    Can you please suggest in customer exit code as well as in selection option.
    Thanks
    yatendra

  • Debug Customer Exit variable in Query

    Hi ,
    Iam new to debugging Query in BI7. I know we use RSRT to debug query, but what radio buttom to check so that during debug, the code stops at Customer exit code??
    Thanks,
    DV

    Hi,
    Go to the CMOD and Put a Break Point where u require it and Execute.
    or/and
    Go to RSRT>After giving ur Query Name>Click on Execute+Debug->In the LAst Tab u have Variables>Customer Exit Before and After.
    Execute it,it shud stop at that Exit for that Query.
    Rgds
    SVU123
    Edited by: svu123 on Feb 2, 2010 8:21 AM

  • Variable with Customer Exit  on BEX

    Hi Experts,
    I have a query with a key figure 0CALDAY, restricted by the variable ZSCAL7 (Acumulated Period). This variable is defined as 'customer exit'.
    How can I see with is the exit that apply?

    Go to CMOD tcode and select project for enhancement RSR00001.
    In the Function module EXIT_SAPLRRS0_001 create click oninclude ZXRSRU01  and there find your variable.
    Hope it helps.
    Regards

  • 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

  • Regarding Customer Exit in Bex

    Hello Expers.
    Here is my scenario: I have variable which accepts the key date from the user. The requirement is to get the calmonth from the date entered by the user. According to my point of view, Writing customer exit is a best option but i do not know is it possible for me to pass the date, entered by the user, to exit? If Yes than please let me know how?
    Help required Urgently

    use the parameter I_STEP which specifies when the enhancement is called.
    The following values are valid for I_STEP:
    ·        I_STEP = 1
    Call takes place directly before variable entry
    ·        I_STEP = 2
    Call takes place directly after variable entry. This step is only started up when the same variable is not input ready and could not be filled at I_STEP=1.
    ·        I_STEP = 3
    In this call, you can check the values of the variables. Triggering an exception (RAISE) causes the variable screen to appear once more. Afterwards, I_STEP=2 is also called again.
    ·        I_STEP = 0
    The enhancement is not called from the variable screen. The call can come from the authorization check or from the Monitor.
    sample code : user enter value of date in say variable ZDATE
    l_s_range TYPE rsr_s_rangesid,
    l_t_var_range TYPE rsr0_s_var_range.
    WHEN 'ZCALM' .
    if i_step=2.
    read table i_t_var_range into l_t_var_range with key vnam = 'ZDATE' .
    if sy-subrc = 0.
    l_s_range-low = l_t_var_range+0(6).
    l_s_range-high = l_t_var_range+0(6).
    l_s_range-opt = 'EQ'.
    l_s_range-sign = 'I'.
    append l_s_range to e_t_range.
    endif.
    endif.

  • Customer exit in BEx to derive Cal month

    hey all,
    i need to write  a customer exit, to derive  prev Cal Month value from the given Calday. I have written the code but it derives the current cal month instead of previous. any suggestions ?
    case I_VNAM.
      when 'ZCU_CMTH' .
        if i_step = 2.
          loop at i_t_var_range into l_s_var
                  where vnam = 'ZCCCD'.
            CMTH_YR = l_s_var-low.
            l_s_range-low = CMTH_YR(6).
            CMTH = CMTH_YR+4(2).
            CMTH = CMTH - 1.
            L_S_RANGE-LOW+4(2) = CMTH.
            l_s_range-sign = 'I'.
            l_s_range-opt  = 'EQ'.
            write :/ l_s_var.
            append l_s_range to e_t_range.
          endloop.
        endif.
           clear l_s_range.
    endcase.
    thanks
    Laura.

    Hi,
    Try the following logic to get the previous year month based on calday:
    data :CMTH_YR (4),
             cmth_mn(2).
    case I_VNAM.
    when 'ZCU_CMTH' .
    if i_step = 2.
    loop at i_t_var_range into l_s_var
    where vnam = 'ZCCCD'.
    if l_s_var-low+4(2) eq '01'.
      CMTH_YR = l_s_var-low+0(4) - 1 .
      concatenate CMTH_YR  '12' into L_S_RANGE-LOW.
    else.
      cmth_mn =  l_s_var-low+4(2) - 1 .
      concatenate l_s_var-low+0(4)  cmth_mn into L_S_RANGE-LOW.
    endif.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    append l_s_range to e_t_range.
    endloop.
    endif.
    clear l_s_range.
    endcase.
    hope it works...
    regards,r
    raju

  • User exit for bex query

    Hi ,
    My requirement is like this :
    When i put 20 ath week in calender week field the report has to calculate last  13 weeks data and do SUMUP .
    I have created Customer exit variable .
    I wrote user exit but it is not calculating for last 13 weeks and my code is like below :
    WHEN 'ZUEXIT' .
       IF  I_STEP EQ '2'.
        LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = 'ZWK11'.
       LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = 'ZWEEKVR'.
        CLEAR L_S_RANGE.
        L_S_RANGE-LOW = LOC_VAR_RANGE-LOW - 13 .
         CONDENSE L_S_RANGE-LOW .
        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 .
    Please can anybody suggest me .

    Hi Venkat
    what if u enter a value between 1 to 12  for the week? then the low range becomes -ve right?
    Instead of customer exit, you can try the following
    1. Create a new selection, in which drag the corresponding characterstic
    2. Select restrict from the context menu and
    3. select value ranges from the "show" popup box, choose Between and
    4. for the lower and upper values use the "select from list icon", and select "variables" from the popdown and select your ZWEEK variable
    5. tranfer to the right panel and then select the offset icon...two popup boxes appear once for the lower and once for the upper...select -13 for lower and 0 for upper..
    Assign points if helpful.
    Regards, Uday

Maybe you are looking for

  • Finder Cover Flow Background

    Has anyone noticed the Finder Cover Flow Background in Lion is very distracting?  Let me explain...  On my MacBook Pro, mid 2009 (with or without the Cinema Display attached) it shows up as a "glowing gradient" where the white is very overpowering. 

  • How to get rid of quotes in copied hyperlinks?

    I'm using Numbers to keep my hyperlinks, and suddenly discovered that it brakes them when I try to copy-paste them anywhere outside from Numbers. For example, link in cell looks like: (a href="link")link tex(/a) Note: symbols < and > are replaced wit

  • Migration from IAS 9i to Weblogic BEA

    Hi, I need to do a migration from IAS 9i to weblogic BEA, i need to know the compatibility problems, where I can found some documentation about it?

  • Regrading full windows drag in remoteapp

    Hi, I've set up the "disable full window drag:i:1" setting in the rdp file for a remoteapp program, but it does not work. Using windows 7, RDP 7.1 (haven't upgraded to 8.0). Doesn't this setting work for remoteapps? Thanks

  • Why does the list "jump" whenever I rename a song?

    Hey guys! When I organize my music I look at the files in the "Songs"-section (I don't know how you call it, sorry). Now with the newest iTunes-updates I noticed: whenever I rename a song or change the artist-name etc. the whole list makes a jump so