Using variables in the Query Designer

Hi,
I have 2 variables 'Z_COMP_CODE' and 'Z_BUS_AREA'. The type of 'Z_COMP_CODE' is single value ,customer exit and ready for input . The type of  'Z_BUS_AREA' is selection option,customer exit and not ready for input. I want the 2 variables to work like this: when 'Z_COMP_CODE' has the value '3000', 'Z_BUS_AREA' should have all the values excluding '2106'. Now in CMOD I have written the following codes for 'Z_BUS_AREA', But it does not work. 'Z_BUS_AREA' get no value while the query is running.Can somebody tell me how to correct it?thx.
WHEN 'Z_BUS_AREA'.
IF i_step = 2.
         READ TABLE i_t_var_range INTO l_s_range_v
            WITH KEY vnam = 'Z_COMP_CODE'.
         IF sy-subrc EQ 0.
           IF l_s_range_v-low = '3000'.
             l_s_range-low = '2106'.
             l_s_range-sign = 'E'.
             l_s_range-opt = 'EQ'.
             INSERT l_s_range INTO TABLE e_t_range.
           ENDIF.
         ENDIF.
       ENDIF.

It should be Customer Exit only.
Your code looks like ok to me. Have you tried to debug it? is l_s_range taking values?
Also i don't know much abt insert statement...may be same as append...but just try with append statement also.
Message was edited by:
        KJ (Kamaljeet)

Similar Messages

  • Providing access to Variables in the Query Designer

    Greetings experts and fellow consultants,
    I have a simple question, did a search and did not come up with much of an answer.  Currently, we have a system with a role for BI Power Users in order for them to create ad-hoc queries.  An issue we found was that these power users were not able to view variables within the query designer:
    Under the "Characteristic Restrictions" pane, the variables show up as (Display Not Allowed) under their associated InfoObjects.  This is presenting an issue (understandably) and I would like to provide access for these power users to see the variables.
    My question is, are there any circumstances where I would want to restrict which variables are shown to the power user?  Right now, I plan to allow display access to all variables (via S_RS_COMP+S_RS_COMP1 for those informed on Security).  Just trying to brainstorm on whether there might be scenerios where I would want to hide certain variables.
    Many thanks to all opinions, as always!

    Suresh, in my above post I knew how to enable this.  I just wanted to know in regards to security whether there were any exposures.  Apparently, I could not find any and the changes went through without issue.  The way you enable display of variables in the Query Designer is the following:
    S_RS_COMP:
    RSINFOAREA '*'
    RSINFOCUBE '*'
    RSZCOMPTP 'VAR'
    ACTVT '03'
    S_RS_COMP1:
    RSZCOMPTP 'VAR'
    RSZCOMPID '*'
    RSZOWNER '*'
    ACTVT '03'
    Hope this helps.  Of course, adjust the field values are you see fit but the minimum requirement is that RSZCOMOPTP 'VAR' (Variables) and ACTVT '03' (Display).

  • Creating customer formula to be used in the Query Designer

    hi,
    How can i code a specific formula to be used in the query designer. As an example, i need to calculate dynamically working days between two dates.
    i tried to find the corresponding BAdl interface with no success..
    Do you have any suggestion ?
    Ludovic

    Hi..
    I have a scenario ...  it may help..
    The group HR administrator wants a detailed line item report that lists all employee absences in a given period. The report is to show the employee number, the absence start date, together with the end date of the absence and show the number of calendar days the employee was absent.
    The good thing about using this technique is that no redesign work is needed from your technical BW team, no ABAP is involved and best of all, it quick and easy.
    Solution:
    For this example I created an ODS object called Absence that holds basic employee information along with individual absence record data.
    Follow the steps below:
         Open the BEx Query Designer and create a new report on your chosen InfoProvider.
                  Drag the Employee, Valid from and Valid to characteristics into the Rows section of the screen.
    If needed, apply data selection restrictions to the characteristics as pop up
         Right click on the Key Figures structure and select New Formula
         In the new formula window right click on Formula Variable and choose New Variable
         The Variables Wizard will launch and will require you to specify the variable details.
    ( Click the NEXT button if the Introduction screen appears )
         Enter the variable details on the General Information as shown in  pop up
    Enter the Variable Name , Description and select Replacement Path in the Processing by field.
    Click the Next Button.
         In the Characteristic screen (pop up) select the date characteristic that represents the first date to use in the calculation (From Date).
    Click the Next Button.
         The Save Variable screen (pop up) displays a summary of the new variable.
    Click on the Finish button to save the variable.
         Repeat steps first four  for to create a second variable for the second date to be used in the calculation.
    In the example shown, the characteristic 0DATETO is used to create the variable ABSEND (Absence End Date)
    Define the Calculation............
                The new calculated key figure will now show in the columns section of the BEx query designer
    excute...
    with regards,
    hari

  • What is the use of Condition is Query Designer  ??

    What is the use of Condition in Query Designer  ??
    How to use condition in   Query Designer  ??

    Hi,
    Conditions in a query can be defined for both characteristic combinations and key figures.
    Characteristic combinations can be used using the ranking list functionality (e.g Top N or Last N customers with highest sales).
    Key figures can be assigned the value limit conditions ( for e.g. display only rows in the query for which the key figure > 10 ).
    For your specific requirements in which you need to display only a limited set based on the key figures, then you can go for conditions.
    The conditions can be allowed to work on all the drill down characteristics independently, single characteristics or combination as well based on your requirement.
    While execution the report, you can activate or deactivate the condition anytime by right clicking on the data cells.
    Regards,
    VA

  • Variables in the query based on infoset

    Dear all,
       I defined a variable on an infoObject in the query designer. However, when this infoObject was used in the infoSet, the variable I defined could not be seen. So in the infoset how can I use the variable I defined in other query not based on infoset? Please advise. Thanks.
    Jin Ming

    I have the same problem:
    I created an Infoset where I am using an Infoobjet that is used in a Cube.
    I have defined variables on this Infoobjet but one of them cannot be used in the new Infoset even if in the new Infoset the links between infoobjets are the same as in the Cube.
    Thank you for any help.
    Stanislas

  • Userexit variables in the report designer

    I want to use a query with userexit variables where 1 variable is derived from another variable in the report designer. This does not seem to work, behavious seems to be as follows:
    1) when variables are derived from other variables they are filled in step 2 of the variable userexit. Variables filled in step 2 have no effect on the query: everything is selected
    2) if the derived variables are mandatory, they even cause a dump saying the variable is empty
    3) if variables are filled in step 1 (thus before the selection screen), they do impact the selection. The problem is that step 1 is too early to have access to the other variables.
    How can I derive variables from other variables when using the report designer?
    Thanks in advance for your answers,
    Best Regards,
    Filip Ledoux

    Hi,
    For example if you want use value from variable ZVAR_02 (manual entry) in variable ZVAR_01 (user exit) you can use similar code:
    DATA: L_S_RANGE TYPE RSR_S_RANGESID.
      DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.
      CASE I_VNAM.
       WHEN 'ZVAR_01'.
        IF I_STEP = 2.
          READ TABLE I_T_VAR_RANGE INTO LOC_VAR_RANGE
               WITH KEY VNAM = 'ZVAR_02'.
          IF SY-SUBRC = 0.
            CLEAR L_S_RANGE.
            L_S_RANGE-LOW      = LOC_VAR_RANGE-LOW.
            L_S_RANGE-SIGN     = 'I'.
            L_S_RANGE-OPT      = 'EQ'.
            APPEND L_S_RANGE TO E_T_RANGE.
            EXIT.
          ENDIF.
        ENDIF.
    ENDCASE.
    Variable ZVAR_01 shouldn't be ready to input.
    Krzys

  • Keyfigure value by comparing 2 date fields, in the query designer.

    Hi all,
    Could any one please intimate, how to display the key figure result with the comparison of 2 date fields.
    We are having "Completed Date" say(CDATE) and "Deadline Date"(DDATE) values in the report as time characteristics, dervied from the CRM system.
    Now we need to compare the values as:
    CDATE <= DDATE, then only consider this under "Meeting Planned Date"(Key Figure).
    Could you please intimate, how to display the key figure value, by using the code at  the query designer level.
    Thanks & Regards,
    A.V.N.Rao

    Hi Rao,
    Simple create two formula variables with replacement path from these two date fileds,then create a formula then do the comparison
    Eg:
    ZVAR_CDATE  WITH REPLACEMENT PATH PROCESSING TYPE REPLACED WITH OBJ CDATE
    ZVAR_DDATE  WITH REPLACEMENT PATH PROCESSING TYPE REPLACED WITH OBJ DDATE
    CREATE A FORMULA FORMULA1: IN THE FORMULA BUILDER AREA DO THE COMPARISON.
    Thanks & Regards
    Ramsthota

  • Variables in APD Query Design

    Hi Guru's,
    Can somebody please help me, in understanding the query design when we are using it as a source to apd. I have a scenario where i do some transformation using abap and then send the output to a pc file. However, i have huge data in the underlined multiprovider of a query( say 20 million) and the query is getting timed out.
    The only way is to have query variables to be able to restrict the data. When I do that, the APD is not supporting. Did somebody came across these scenario's.
    Any ideas will be highly appreciated.
    Thanks.

    Hi,
    can you please tell me if you are using BI oder BW ? In BI you can use variables in filter, in BW you can't.
    If you have problems in an APD to get all the required data, check, if you have limited your load to only required fields. Always keep in mind that each step of an APD is done in memory. So if your system cannot provide enough memory, it starts swapping and become slow. To avoid this, try working with minimal fields.
    If at all possible do not use a Query as Input. Use the Cube instead and apply filters in the next step. It seems that optimization then only collects the required data.
    ABAP Steps are not of much use as a filter, because for them the whole content of the data source is read. So all is in memory, and only then the ABAP coding including the filter will apply.
    Hope this helps.
    Kind regards,
    Jürgen
    Edited by: Jürgen Kirsch on Sep 8, 2008 9:46 AM

  • How to hide a single value node hierarchy in the query designer

    Hi,
    I would like to perform a calculation  in the infocube. It concern  a count "Nb of different customers" with the following hierarchy : Country / region / City.
    This KF would be read at the same time by city, region and country, and  certain customers exist in 2 different region, and I have to count them only once by country.
    To do this, I added a new record (at the country level when loading infocube) to deduct a number of customers in doubloons.
    This line added contain only a country code and the number of cutomers in doubloons (- 23 when I have 23 cutomers in doublons) with revrese sign.
    Now, I would like to use this value (-23) to have a right Nb of different customers by country, without showing the not assigned line in the report hierarchy.
    How can I hide, in the query designer or the WAD, a single value node from hierarchy (NOT assigned) but take in account the value (-23) at the country level ?
    Is there another solution (more simple) to perform this in the infocube ?
    For information,
    1) The infocube is loaded once per month, and the KF (Nb of different customers" is also performed by month.
    2) I can't perform this in the report (performance problem with calculated KF).
    thx.

    Hi,
    the short answer is "you can't", the longer is: The ADF Faces tree component is stamped for better performance. This stamping means that nodes are not rendered as JSF objects but copies of an existing component (just with a changed value). For this reason the nodes don't issue their own query for data and thus cannot be refreshed individually
    Frank

  • Using variable with the same name as field name?

    I have a complex proc where I have variables with the same name as field name used on a query. something like this:
    SELECT a.id_table WHERE a.id_table = id_table
    where the last id_table is a parameter sent to the proc:
    declare procedure myproc(id_table int)
    Is there any way or notation to declare the variable inside the query as a variable or I have to use a different name?

    Well, variables are not the only thing you have to change if you want to switch to Oracle.
    Although I don't think it is good practice (to use variable name same as column name), here is one example how you can achieve it using EXECUTE IMMEDIATE and bind variable
    SQL> select deptno, count(1)
      2  from scott.emp
      3  group by deptno;
        DEPTNO   COUNT(1)
            30          6
            20          5
    10 3
    SQL> set serveroutput on
    SQL> declare
      2  deptno varchar2(10);
      3  i number;
      4  begin
      5  deptno:=10;
      6  execute immediate
      7  'select count(1) from scott.emp where deptno=:deptno' into i using deptno;
      8  dbms_output.put_line('OUT ---> '||i);
      9  end;
    10  /
    OUT ---> 3
    PL/SQL procedure successfully completed.
    SQL> Message was edited by:
    tekicora
    Message was edited by:
    tekicora

  • Error in while Executing Query in the Query Designer

    Hi,
    I  created info Set based two  info object and  three Data Store Objects. and join condition is Left Outer Join.
    there are Business Partner info object, CRM  BP Sales View Info Object and Data Store Objects are  BP: Roles (0BP_ROLE),Partner: Industries(0BP_IS),CRM Marketing Attributes for Business Partner(0ATR_DS01)
    I given some Selection Parameters while executing query in the Query Designer. in That i given city is selection parameters
    and i creted variable for this info object.
    it gives the Error Messages
    Beim Lesen der Daten sind Fehler aufgetreten. Navigation ist möglich
    Der Wert "New Delhi " von Merkmal 0CITY40 enthält an der 10.ten Stelle einen Fehler
    it is very urgent , can any one help me regarding this.

    Hi Reddy,
    The Error message in english is this
    While reading the data mistakes have appeared. Navigation is possible
    The value " New of Delhi " from sign 0CITY40 contains a mistake at the 10.ten place
    and i think you need to run the change run and run the report with out selecting the variable option.and navigate in the report by filtering the report for your requirement.
    Try this and let me know.
    Thanks,
    RK

  • Using variables in a query

    Hello all,
    I just tried to use variable in a query and dont know how to
    output the content in the query. As you can see from what i am
    trying, i would only get the name of the query and the field name
    not the output. Please tell me the idiotic thing that i am over
    looking.
    Matt

    Mike,
    Thanks, ...if you were to output the url.fieldused, then you
    would get the name of the field, not the value of the field. The
    getfield[ ] is not something that i am familier with and cant seem
    to find documentation on this...I need to output the value of the
    field and this is where i am stuck.
    Matt

  • G/L Account Numbers missing in the Query Designer

    Hi Experts
                   New G/L Account numbers are been added to some items like Rebates & Discounts. These G/L Account Numbers are been seen in the RSA1 and are not present in the Query Designer. So i want to know the procedure to update these G/L Account numbers in the Query Designer, Can you please help me.
    G/L Account Numbers in RSA1 = 718 and in Query Designer it is 661 so please guide me to update the rest of the G/L Account nos in the query designer.
    Thanking you
    Regards
    Mrudul.
    Edited by: Mrudul Naidu Cherukupalli on Feb 1, 2008 5:23 PM

    Yes, the problem is with the extractor
    It is not been enhanced because i am working on SAP BW 3.1C and its been implemented in 2004 and since then it is not been used properly.
    The Datasource is 0EC_PCA_3 (Enterprice Controlling line items).
    Yes i maximized to 1000 records per call and searched for the G/L Account E16411 which i cannot find in the cube.
    When i checked the results with R/3 i found the totals are doubled and when divided the Key figure Net of Credit and Debit by 2 i got the some results correctly(Sales Revenue, Sales Revenue of Exports and Sales Revenue of Domestic)
    I Checked the Service Marketplace and found the note which should be implemented to rectify the error of duplicating the records,
    Can you please help me to update the  G/L Accounts in the datasource.
    My Development System contains more then 2000 G/L accounts in the cube (query designer).
    Thanking you,
    Regards
    Mrudul.

  • How can i reuse a structure in the query designer in 3.5

    Hi all,
    we are using the version BW 3.5,  now how can i reuse a structure made int he query designer, because i need it in another query, i did the structure and put it a technical name and save, help guys

    HI Richard,
    Create a Structure in Rows/columns and save As it, then in the left Panel of the Query Designer you can see three Folders
    1) Structures
    2) Keyfigures
    3) Dimensions
    then Expand the structures Folder, there you can find your saved structure, Structures are 2 types
    1) With Key figures
    2) Without Key Figures
    If you have the key figures in your saved structure, then you can find it in the subfolder of with Keyfigures, else in the other folder.
    Now you can use this structure by draging in all the queries which are on the same InfoProvider (CUbe. MultiProvider)
    Regards
    ReddY A

  • SPSiteDataQuery - filter by file Title - Can I use variable for the filter value?

    I use SPsiteDataQuery to search across multiple lists and filter by file title. I have the file title information in a variable.
    Can I use variable in the filter value?
    string fileName = "Policies.doc"
    SPSiteDataQuery spQry = new SPSiteDataQuery();
    spQry.ViewFields = "<FieldRef Name='Title'/><Value Type='Text'>fileName</Value>"

    If I have understood correctly, you want to search based upon a File title in all the sites. You can include a query to filename in the spQry
    spQry.Query = "<Where>" +
    "<Eq>" +
    "<FieldRef Name=\"FileLeafRef\"/>" +
    "<Value Type=\"Text\">" + fileName + "</Value>" +
    "</Eq>" +
    "</Where>";
    get2pallav
    Please click "Propose As Answer" if this post solves your problem or "Vote As Helpful" if this post has been useful to you.

Maybe you are looking for