Define query variable

Hi Experts
I want to run a  query using parameters. can you please provide me instructions on how to create the parameters. Basically what i want is to be able to select the query and then the ' define query variables' to pop up in-order for me to enter the variables.
What do i need to do to prompt for this 'define query variable' window
Thank you
Regards
Apsara

Hi!
Try this !
Declare @FromDate Datetime
Declare @ToDate Datetime
Set @FromDate = (select min(S0.DocDate) from OINM S0 Where S0.Docdate >= '[%0]')
Set @ToDate = (Select max(S1.Docdate) from OINM S1 Where S1.DocDate <='[%1]')
SELECT T0.* FROM vw_HHBookingAdvice T0 WHERE T0.BookingDate >= @Fromdate and T0.BookingDate <= @ToDate

Similar Messages

  • When I define a variable in BO it automatically turns it into a detail

    i have made a user prompt in my report
    so the user can input a value that does not exist in universe so i can use it as condition or a filter,
    i have done this by using the followiing condition in the query
       object = object
    or
       object = ToPrompt("Give number")
    As you can see by the logic this condition will ALWAYS be true because object  = object  is always true. So this logic will not impact the rest of the query it will just allow to enter any value in the user prompt
    in the report when i try to create a new variable
    =ToNumber(UserResponse ("Query 1 with NEW_UNIV" , "Give number"))
    it automatically turns it into a detail and i cant change it to measure or dimension.
    is there a way to fix this
    thanks in advance

    some one answered in the following link
    [When I define a variable in BO it automatically turns it into a detail;

  • Optional BEx query variables not working in WebI

    Hi,
    I have an Webi report based on Bex Query using BICS connection.
    One characteristic is restricted with two variables. First an authorization variable and additional with an input ready variable.
    This input ready variable is optional. When it comes up in webi and you choose a value it doesn't filter on it.
    We are on BO 4.1. SP3 and BW 7.31.
    With SAP_ALL the optional prompt is working, but for a user with limited access, the optional variable doesn't work.
    I have already made a RSRT trace with a test user. But I'm not sure what's the problem.
    Trace returned:
    S_RS_AUTH  RC=4 -->  BIAUTH=0BI_ALL; type=RF;name=BICS_PROV_OPEN;
    But I don't want to give the user 0BI_ALL, otherwise my analysis authorizations for this info object would be obsolete.
    Any ideas?
    Thx and Regards,
    Katharina

    Hi Neetika,
    thank you for your advice!
    I tried the filter without authorziation variable and it was working.
    I in addition I tried another option: I defined auth variable as input ready and deleted filter variable and that would work working.
    With this setting I recognized that for the authorization variable all allowed values are set as default values! If you execute query with SAP_ALL no default is set, but with limited access the allowed values are set as default.
    This may be the problem here. I don't know if this behaviour is by design or if there is a problem with rights?
    But now I know where the problem comes from.
    Regards,
    Katharina

  • Query variable : selection option with no interval

    Hello,
    Is it possible to define a query variable as selection option, with no interval (like in abap).
    I am in 3.X version.
    Many Thanks in advance,
    Manuel

    Hi Manuel,
    This should be possible through multiple single value variables, but to ensure that the user has not in input the same charateristic value for exclusion and selection you may choose to write customer exit at the background.
    I think interval and select option would allow 'To values'.
    So I was wrong in what I said before. SORRY
    However multiple single value would not allow exclusion, I think.
    Your scenario would only be possible by excluding multiple single values in variable type select option and process the variable using customer exit, to trmove all to Values.
    But you are right, you cannot have your scenrio handled , I think.
    ( ie multiple exclusion in from values with no To Values )
    One more way is restrict your characteristic by two input ready variables, one select option for exclusion and have a customer exit to delte all inclusion that were input accidently and one multiple value ready for input variable.
    But, all in all, there would be no straight drive through this I think.
    Hope it helps,
    Regards,
    Sunmit.

  • Dynamic query variable

    How can I have a variable inside the query variable?
    someQuery.dynVar# to be defined as "some text some text #
    url.someVar# some text"
    ColdFusion seems to disregard the CFML code contained inside
    the
    query or
    cffile[read] variables and outputs it with variable names
    surrounded with #. When it's set with
    <cfset> it's displayed as intended.
    How can I force CF to process CFML inside query
    variables?

    This reminds me of the biggest issue that has been bothering
    me for years. ColdFusion CANNOT do dynamic code evaluating. This is
    one of PHP's (it still sucks big time as a web application
    development language) greatest advantages over CF, although
    evaluating dynamic pieces of code is almost just as slow as
    including them from files, one by one. But still...
    CF's evaluate() can only evaluate functions, variables, etc.
    But not actual code, including tags, multiple statements, or
    anything complex like that.
    Actually, I'm not quite sure what you're trying to achieve
    here. It sounds like you want to set _triggers_ for variables, so
    that they would auto-update themselves as some other variables
    changes. Sounds impossible.
    Also, you're wrong when you say "it" works with
    <cfset>. Try this:
    <cfset var1 = "dang">
    <cfset var2 = "ding#var1#****">
    <cfset var1 = "">
    <cfoutput>#var2#</cfoutput>
    If this would work as you stated, you would get "dingdong".
    But you won't, since you can't process code dynamically within a
    variable in CF.
    So, you're best off with something like like cflib's UDF,
    which takes care of the parsing right when you need it.

  • User defined query parameter in query generator

    Hi All,
    i am using query generator in SAP to print some records of user defined query. precisely, the details about sales employees are to be printed. now the columns which exist in the database (ie. sales employee code, name, cardcode) etc can be given as a parameter like [%0] and [%1]. but some user defined parameter such as sales commission does not show as such parameter. i want one column as
    select T0.doctotal, (T0.doctotal * [%0]) / 100  as brokerage from OINV T0
    --where [%0] is some commission percentage that the user will give while running this query
    This query gives correct results but it gives the parameter name as 'doctotal' while showing. any idea as to how to handle it properly in SAP?
    thanks in advance,
    Binita
    Edited by: Binita  Joshi on Sep 8, 2009 3:35 PM

    I sometimes defined a UDT only for getting the appropriate parameter entering window. The table has no data; I used it only for its field names in this window.
    (The parameter request can be placed inside a comment and the entered value is used setting an SQL variable like this:
    declare @d datetime
    /*select t.createdate from ordr t where t.createdate=[%0]*/
    set @d=[%0]
    This SQL variable can be used later in the real query.)

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

  • Copy Paste Query Variable

    Hi,
    (1) Can we copy n paste query variable which is difined using customer exit???
    (2) can we change description of the variable only for a particular query? Only for a particular query that description should appear n it should not appear for rest of the queries wherever that variable is used...
    Thanks,
    Geetanjali

    1. You can have only one variable technical names,  you can't copy and past it, you have to define another one.
    2. And also you can't change the discription of the variable for only one query without affecting the others.
    too bad, both are no.
    thanks.
    Wond

  • Date Picker for Query Variable

    Hello,
    I have a query, which has a input variable as date. For the Query Variables when i drag and create an input form, i have the field as input field. How do i change this field to a date picker drop down...I do not get any option to make it as a date picker/calendar...
    REgards,
    Vikram

    Hello Vikram,
    If I understand correctly, the field type is String, but it represents a Date. You want to be able to edit it as such.
    1. In the input Form open the Define Data dialog (using the Right Click context menu) and add a field of type Date (letu2019s say its name is u201CDATE1u201D).
    2. On the link between the input Form and the Service Open the Map Data dialog using Right Click => Map Datau2026
    3. Find the relevant Field Assign in the table. Here you want to get the Date value converted into a String. From the Assign Value drop down you can choose Define Expression to open the Dynamic Expression Editor (you can skip this and write the value yourself in the Assign Value input if you know what to write).
    4. On the right hand side you have model elements and functions to create an expression. You can use the function DSTR(@DATE,[format]) u2013 where parameter 1 is the Date field and parameter 2 is the Format (optional). The function returns a String representation of a given Date.
    5. Your expression can look like this for example: =DSTR(@DATE1,"dd/mm/yyyy"), assuming the name of the new Date field in the Form is DATE1.
    6. You can remove the old Text field from the Input Form if you donu2019t need it u2013 using the Define Data dialog.
    Hope this helps,
    Udi

  • Error on running BEx Query: Variable does not exist or is incorrectly used

    Hi all,
    I have a characteristic in my query which I restrict using a variable with Mutliple Single values.
    When I run the query in the Analyzer or RSRT, I get the following error:
    "Variable does not exist or is incorrectly used"
    Please help me fix this error.
    Thanks and Regards,
    Srilakshmi B

    Hi,
    I have a characteristic in my query which I restrict using a variable with Mutliple Single values.
    When you define any Filter Values, BEx will ask you to select either Single Values or Variables or Value Ranges etc..
    If you want to select by Multiple single values, you should include all the values in the Restriction area.
    Please do not define any variables, unless the User wants to enter any thing. Look for any other variables which are not defined correctly..........
    Regards,
    Suman

  • Connecting Query variable with Table Values

    Hi all,,
    I'm trying to connect a query variable to table column contents. The problem is, there is an additional Date as input which is single value. As a result, the query does not get executed. It gives an error that it expects a single value for the date field.
    Am I doing something wrong. Please guide.
    Regds,
    Srinivasan.

    Hi Srinivasan,
    Sorry but i didnt got exactly what you are trying to do? You have query to which you are passing multiple values from a table. or are you selecting a single row in the table and passing it to the query? How is the variable defined in the query?
    Thanks,
    Regards,
    Vikram

  • Text lines in the BW query variables screen

    Hi gurus.
    The bw users ask me to display some text lines in the BW query variables prompt.
    The text lines are saved in a custom table.
    The only idea that I've got is to use customer exit text variables and fill them in CMOD when I_step = 1.
    I don't like this solution (I should have more the 10 text lines and so I have to mantain more than 10 Text variables) but I can't find any other solution.
    Any new idea or solution?
    Is there in Bex enviroment a functionality (that I don't know) for doing somenthing like this ?
    Thanks fo any help.
    S.

    Hi,
    to resolve it you should create all the prompts in the BW query. You are using a query with 2 parameters and then a dynamic list of values. the dynamic list of values can only work after you entered the other values.
    Ingo

  • BW Query variable default value put in Crystal report variable question

    Why BW Query variable default value put in Crystal report variable for BO InfoView to open crystal report.
    I using Analyzer to open bw query,variables had default value ,but crystal report can't had variable default value ,and can't search variable  value.
    pho:
    [http://file.itpub.net/f/e38876ad4f6efb7e73980488e7d71f8d/4ae940e9/day_091029/20091029_2b04da1232144feba180OrB23SNvXtoT.gif/p/1.gif]
    [http://file.itpub.net/f/d93ddfe61e0eaf80429726c61f1a02ff/4ae940e9/day_091029/20091029_3211ffe04bf0302fbab5FRKnbwmH80p7.gif/p/BW_QUERY_Crystal.gif]
    Edited by: flying on Oct 29, 2009 8:20 AM

    I Know what to do .
    but Crystal report date variable value are Garbage characters "###".
    PHO:
    [http://file.itpub.net/f/39a8510104476707ae21c945db93ecba/4ae97949/day_091029/20091029_32dcbb7e7d99141483aesJ9KBJHXN0Kj.gif/p/2.gif]

  • BW Authorizations - Query variable with processing mode as "customer exit"

    Hi,
    Iam new to BW authorizations and have not yet worked on customer exit before. I was going through the documentation at various sites but I could not get the end to end description on how the query process( when using a variable for an InfoObject) works in case of customer exit.
    Let's assume that I am using  a query variable with processing mode as "customer exit" and at the exit I  write some code to extract user's authorizations from a z table. if this is the case, then when an end user runs a query,how will the the system know what value needs to be filled in the variable for the requesting user. Are the user details  also sent to the code along with the query variable? If so how. If I mis-understood the process then forgive me and let me know the correct process.

    Hi!
    welcome to SDN!
    customer exit variables need programing by user. so if you create a customer exit variable, you got to right a program which extracts values into this variable. we can do what ever we want in program, SAP will not deal anything ´with customer exits.
    with regards
    ashwin
    PS n:  Assigning point to the helpful answers is the way of saying thanks in SDN.  you can assign points by clicking on the appropriate radio button displayed next to the answers for your question. yellow for 2, green for 6 points(2)and blue for 10 points and to close the question and marked as problem solved. closing the threads which has a solution will help the members to deal with open issues with out wasting time on problems which has a solution and also to the people who encounter the same porblem in future. This is just to give you information as you are a new user.

  • PLD report from user defined query

    Hello experts,
    Is possible to create a new PLD report from a user defined query ?
    Thanks in advance.
    Best regards
    Andrea

    Hi,
    It is possible on Query Print Layout Design(QPLD) so Try to create QPLD.
    Check this link u can get presentation slide form SAP.
    [Query Pld from SAP site]
    First you can try to create the Query report with UDF filed.
    for example,
    SELECT T0.DocNum, T0.DocDate, T0.CardName, T0.CheckSum, T0.U_UDF1, T0.U_UDF2, T0.U_UDF3
    FROM OVPM T0 WHERE T0.DocNum>='%0' and T0.DocNum<='%1' ORDER BY T0.DocNum
    Steps to Develop a User Report in QPLD:-
    If you save your Query in Query Manager. Next you can do this,
    ->> Choose the Query Manager on Top Menu.
    ->> Open the Qeury Manager Window.
    ->> Select the specific Query report. and
    ->> Click the Create Report button in Bottom on Qeury Manager Window.
    ->> then, Open the Create User Report Window and Select the User Report(System) in Base Template.
    If you Change the QPLD name.
    ->> Click OK.
    ->> (or) If your Query Report have parameter. Click OK.
    Now your Query report was Created QPLD.
    Note: All SELECT statement fields will be Stored and Display in Repetetive Area1. and
    Parameter Fields are in Repetetive Area0 so you can Try to Copy & Paste the Field_ID's to Repetetive Area Header (or) Repetetive Area Footer.
    Example:
    ->> Open the QPLD and Goto Field index Window, then
    ->> Select the Repetetive Area Header & Repetetive Area Footer ncrease the Height on Properties Window.
    ->> Create the Formula fields in Repetetive Area Header & Repetetive Area Footer.
    ->> Which Field you want to print in header or footer. Drag the Field ID(in Repetetive Area) Copy & Paste to Formula Field.
    Can you see to your Query PLD? do this,
    ->> Choose the Tools on Top Menu.
    ->> Click the Queries. -> Query Print Layout...
    ->> Open the Query Print Layout Window.
    ->> Click Reports Tab and Double the Template (Requrie QPLD) on QPLD Window.
    ->> Customize and Save the QPLD.
    Can you see your Query PLD Preveiw and Print? do this,
    ->> Choose the Tools on Top Menu.
    ->> Click the Queries. -> Query Print Layout...
    ->> Open the Query Print Layout Window.
    ->> Select Template in Report Tab on QPLD Window.
    ->> Click Print Preview on Top menu.
    Close this thread if issue solved
    Regards,
    Madhan.

Maybe you are looking for

  • Problem with OEM  in 11g R2 Production database

    Hi, Oracle Version : 11.2.0.1(standard edition) Operating system : RHEL-5 We are getting the below problem when trying to start the DBCONSOLE but when i check the status it is showing as running as shown below. [oracle@prc4s3 ~]$ emctl status dbconso

  • Free Safari for all

    There doesn't seem to be anything in the Tiger version of Safari that would keep it from being used in Panther. So, why doesn't Apple release the latest version of Safari for all versions of OS X for free? Like how Windows IE is free for whatever ver

  • Oracle 11gR2 client for window7

    Hi all; I want to know that is there any separate versio of software available for win xp,vista,wind7. Is there any sub-type of oracle client....?

  • Moving Calendar to a New Computer & Moving Data: Downloads and Add-ons

    Moving Calendar to a New Computer & Moving Data: Downloads and Add-ons The handle says is all. Totally lost here & in a virtual house of cards. Please first see screen-shot. I have the Mozilla calendar (Lightening?) program on my computer. Is this sc

  • Ipad3 Retina image

    I am making an offline mobile app. To make ipad3 images do I make images at 2048 X 1536 by 263ppi? or is the save for web still at 72ppi?