Querying Date ranges

I'm a beginner with Crystal.  I am creating a report that needs to prompt the user for a start and end date.  I have the parameter created and it prompts the user.  But the query doesnt seem to use the dates I enter.  I have had to enter start and end dates in the select expert/record function and it seems to use those.  What am I missing?  I've stated "is between" in the drop down and I expected to see my parameter field listed but its not there.  Its only there if I switch to "is equal to".  any ideas are greatly appreciated.
do I need to specify a formula?  and if so, what is the syntax?  I tried a formula but it didnt like when I put in my parameter field.  I got an "it must be a date" error.   
Dave

Hi David,
You need to ensure that your date parameter is of datatype, Date or DateTime depending on your database date values.
You will need to insert the following logic into your select expert:
{Database.DateField} <= {?End Date Parameter} and
{Database.DateField >= {?Start Date Parameter}
This should give you everything in between.
I hope this helps.
Regards,
Zack H.

Similar Messages

  • Query date range modification

    Hi there, im new to BW and query designer. Im on BW 7.3. User has requested me to make modification to and existing BEX query. This query at present returns 1 month worth of data. the user now wants this query to return last year + current YTD data. How do I approach this modification, please suggest. thanks Regards

    Hi Samique,
    It is not clear why do you need the user to provide input for a report spanning from last year to YTD. I can only assume that it is either to decide the period till which YTD(year to date) values are to be calculated or to decide which of the last year periods will be considered.
    e.g. if user inputs 003.2015 then this will be the end period for YTD calculation or the last year data to be considered will be from 003.2014. Please provide clarification for this part.
    These both cases can be achieved using customer exit variable.
    Suppose you accept the user input in say variable Var1.
    Now, you need to create a new variable, VAR2, on 0FISCPER characteristics, with properties, select options range and processing as customer exit.
    In your query designer in the filter pane-> characteristics restriction, you must restrict 0FISCPER with Var2.
    Now in CMOD tcode you need to write a logic to fill the values for Var2.
    Logic could be as follows:
    Data: Curr_Period(7) TYPE C,
             Year (4)           TYPE C. 
    WHEN 'Var2'.
       IF i_step = 2.
         LOOP AT  i_t_var_range INTO  loc_var_range  WHERE  vnam = 'VAR1'.
          l_s_range-low = loc_var_range-low. (assuming the YTD end value is the user input)
    **OR ELSE if the YTD value is to be derived from system date then
         Curr_Period = get_period_from_date (sy-datum) . (pass system date to get current period )
         l_s_range-low = Curr_Period .
    Year =  loc_var_range-low(4) - 1 . (get last year value from Var1)
    CONCATENATE Year loc_var_range-low+4(3) INTO l_s_range-high.
    (Assuming the last year data is required from the period as entered by user).
    OR ELSE if entire last year data is required then
    CONCATENATE Year '001' INTO l_s_range-high.
           l_s_range-sign    = 'I'.
           l_s_range-opt      = 'EQ'.
        APPEND l_s_range  TO  e_t_range.
    EXIT.
    ENDLOOP.
    ENDIF.
    ENDCASE.
    Hope this helps.
    -Swati.

  • Small Validation in sql Query Date range..

    hi.
    I need Some suggestions for validating the Date.
    In customization form From date and to date i given.
    like
    01/08/2014 and 30/08/2014..
    Second time if  they give...
    i can validate like below
    select  DocEntry from  [@PR_OTIMESHEET] where U_frmdate >='20140801' and U_todate <='20140830'
    It's fine everything is fine. but.
    if i give like from date 15/08/2014 and 30/08/2014 it should be validate and stop it..
    if i run the  above query by replace the dates it is not working..
    Simply.
    Date is  200   to  300 if they give first time it will be save in db.
    second time if i give 150 to 400 it should not accept bcz 150 all ready comes between 200 to 300
    How can i restrict it.

    Hi,
    If your question is related to SDK, please post it there.
    Thanks,
    Gordon

  • Date range query  problem  in report

    Hi all,
    I have created a report based on query and i want to put date range selection but query giving problem.
    If i am creating select list selection then it is working fine means it will display all records on the particular date.
    But what i need is that user will enter date range as creation_date1,creation_date2 and query should return all the records between these date range. i want to pass it by creating items, i created two items and passing creation_date range to display all records but not displaying and if not passing date then should take null as default and display all records
    Here is the query:
    /* Formatted on 2006/12/10 20:01 (Formatter Plus v4.8.0) */
    SELECT tsh."SR_HEADER_ID", tsh."SALES_DEPT_NUMBER", tsh."COUNTRY",
    tsh."LOCAL_REPORT_NUMBER", tsh."ISSUE_DATE", tsh."SUBJECT",
    tsh."MACHINE_SERIAL_NUMBER", tsh."MACHINE_TYPE", tsh."MACHINE_HOURS",
    tsh."STATUS"
    FROM "TRX_SR_HEADERS" tsh, "TRX_SR_PARTS" tsp
    WHERE (tsh.status LIKE :p23_status_sp OR tsh.status IS NULL)
    AND (tsh.machine_type LIKE :p23_machine_type_sp)
    AND ( tsh.machine_serial_number LIKE
    TO_CHAR (:p23_machine_serial_number_sp)
    OR tsh.machine_serial_number IS NULL
    AND ( TO_CHAR (tsh.failure_date, 'DD-MON-YY') LIKE
    TO_CHAR (:p23_failure_date_sp)
    OR TO_CHAR (tsh.failure_date, 'DD-MON-YY') IS NULL
    AND ( TO_CHAR (tsh.creation_date, 'DD-MON-YY')
    BETWEEN TO_CHAR (:p23_creation_date_sp)
    AND TO_CHAR (:p23_creation_date_sp1)
    OR TO_CHAR (tsh.creation_date, 'DD-MON-YY') IS NULL
    AND (tsh.issue_date LIKE :p23_date_of_issue_sp OR tsh.issue_date IS NULL)
    AND (tsh.country LIKE :p23_country_sp OR tsh.country IS NULL)
    AND ( tsh.local_report_number LIKE TO_CHAR (:p23_local_rep_num_sp)
    OR tsh.local_report_number IS NULL
    AND ( tsp.part_number LIKE TO_CHAR (:p23_part_number_sp)
    OR tsp.part_number IS NULL
    AND tsh.machine_type IN (
    SELECT DISTINCT machine_type
    FROM trx_sales_dept_machine_list
    WHERE sales_department_id IN (
    SELECT DISTINCT sales_department_id
    FROM trx_user_sales_department
    WHERE UPPER (user_name) =
    UPPER ('&APP_USER.'))
    AND SYSDATE >= valid_from)
    AND tsh.sr_header_id = tsp.sr_header_id
    can any one tell me wat is wroung in this query.
    Any other way to write this?
    Thank You,
    Amit

    Hi User....
    Here is some date range SQL that my teams uses with some success:
    For date columns that do not contain NULL values, try this (note the TRUNC, it might help with your "today" problem).
    The hard coded dates allow users to leave the FROM and TO dates blank and still get sensible results (ie a blank TO date field asks for all dates in the future.
    AND TRUNC(DATE_IN_DATABASE)
    BETWEEN
    decode( :P1_DATE_FROM,
    TO_DATE('01-JAN-1900'),
    :P1_DATE_FROM)
    AND
    decode( :P1_DATE_TO,
    TO_DATE('31-DEC-3000'),:
    :P1_DATE_TO)
    For date columns that contain NULL values, try this (a little bit trickier):
    AND nvl(TRUNC(DATE_IN_DATABASE),
    decode( :P1_DATE_FROM,
    decode( :P1_DATE_TO,
    TO_DATE('30-DEC-3000'),
    NULL),
    NULL)
    BETWEEN
    decode( :P1_DATE_FROM,
    TO_DATE('01-JAN-1900'),
    :P1_DATE_FROM)
    AND
    decode( :P1_DATE_TO,
    TO_DATE('31-DEC-3000'),
    :P1_DATE_TO)
    Note the 30-DEC-3000 versus 31-DEC-3000. This trick returns the NULL dates when the FROM and TO date range items are both blank.
    I hope this helps.
    By the way, does anyone have a better way of doing this? The requirement is given a date column in a database and a FROM and a TO date item on a page,
    find all of the dates in the database between the FROM and TO dates. If the FROM date is blank, assume the user want all dates in the past (excluding NULL dates). If the TO date is blank, assume that the user wants all of the dates in the future (excluding NULL dates). If both FROM and TO dates are blank, return all of the dates in the databse (including NULL dates).
    Cheers,
    Patrick

  • Query for all open sales order with a date range

    Hi Experts!
    I wrote this query that will look up all open sales order of a particular customer and how much was served:
    SELECT T0.[DocNum] 'OS #', T0.[DocDate] 'Posting Date', T0.[CardName] 'Customer',  T1.[Dscription] 'Item Description',T4.[SalUnitMsr] 'Sales UOM', T4.[InvntryUom] 'Invty UOM', T1.[UseBaseUn] 'Use of Invty UOM' , T1.[Quantity], T1.[Quantity]-T1.[OpenQty] 'Served Qty', T1.[OpenQty] 'Unserved Qty' FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCTG T2 ON T0.GroupNum = T2.GroupNum INNER JOIN OSLP T3 ON T0.SlpCode = T3.SlpCode INNER JOIN OITM T4 ON T1.ItemCode = T4.ItemCode WHERE T0.[DocStatus] = 'O' and T0.[CardName] =[%0]
    However, I don't know how to input a parameter for the date range in a query.  Can anyone help with this issue?
    Your input will be highly appreciated.
    Warm regards,
    Jen

    Hiiiiiii
             Try This.....
    SELECT T0.DocNum 'OS #', T0.DocDate 'Posting Date', T0.CardName 'Customer', T1.Dscription 'Item Description',T4.SalUnitMsr 'Sales UOM', T4.InvntryUom 'Invty UOM', T1.UseBaseUn 'Use of Invty UOM' , T1.Quantity, T1.Quantity, T1.OpenQty 'Served Qty', T1.OpenQty 'Unserved Qty' FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCTG T2 ON T0.GroupNum = T2.GroupNum INNER JOIN OSLP T3 ON T0.SlpCode = T3.SlpCode INNER JOIN OITM T4 ON T1.ItemCode = T4.ItemCode WHERE T0.DocStatus = 'O' and T0.CardName ='[%0]' and (T0.DocDate>='[%1]' and T0.DocDate<='[%2]')
    Regards,

  • Query based on a date range

    I want to query based on a date range. I wrote the following EJB QL:
    "select object(a) from ActionItems as a where a.dueDate
    between ?1 and ?2"
    But when I deployed the application to Oracle's EJB server, I got the following error:
    Auto-deploying biogen.jar (No previous deployment found)... Invalid type for expression (a.dueDate BETWEEN ?1 AND ?2)
    EJB QL statement : 'select object(a) from ActionItems as a where a.dueDate between ?1 and ?2'
    EJB QL method : public abstract java.util.Collection ActionItemsLocalHome.findByDueDateRange(java.sql.Date,java.sql.Date) throws javax.ejb.FinderException
    at com.sun.ejb.ejbql.parser.EjbQLParser.parse EjbQLParser.java:218)
    at com.sun.ejb.ejbql.EjbQLDriver.parse(EjbQLDriver.java:86)
    at com.sun.ejb.sqlgen.SQLGenerator.generateSQLForEjbQLQueries(SQLGenerator.java:704)
    It works fine for a number range, but does not work for a date range.
    Any one has an idea on how to write a correct EJB QL for a query based on date range?
    Thanks.
    Jingzhi

    Re-posted. Please help!

  • Visual Composer: Date Range in Query

    Hi,
    While working in Visual Composer, I have come across the need to re-use the same query 20 times, but with slightly different date ranges. One way would be to create 20 copies of the same query and change the selection dates as needed on each of them. However, is it possible to provide date ranges in a query in Visual Composer? Right now its only letting me enter single values.
    Thanks
    Adeel

    Problem can be resolved by using a colon between the dates. Furthermore, the DSTR function in the expression editor can be used to form the desired dates.

  • Can I use SYSDATE in the WHERE clause to limit the date range of a query

    Hi,
    Basicaly the subject title(Can I use SYSDATE in the WHERE clause to limit the date range of a query) is my question.
    Is this possible and if it is how can I use it. Do I need to join the table to DUAL?
    Thanks in advance.
    Stelios

    As previous poster said, no data is null value, no value. If you want something, you have nvl function to replace null value by an other more significative value in your query.<br>
    <br>
    Nicolas.

  • SQL Query on Date Range

    Hi, I am using Oracle 10g. I want a query which gives me below output.
    Data Setup
    ========
    create table t_date_range (
    ID     number (2),
    start_date     date,
    end_date     date);
    insert into t_date_range values (1,to_date('20110101', 'YYYYMMDD'),to_date('20110331', 'YYYYMMDD'));
    insert into t_date_range values (2,to_date('20110401', 'YYYYMMDD'),to_date('20110531', 'YYYYMMDD'));
    insert into t_date_range values (3,to_date('20110701', 'YYYYMMDD'),to_date('20110731', 'YYYYMMDD'));
    insert into t_date_range values (4,to_date('20110901', 'YYYYMMDD'),to_date('20111130', 'YYYYMMDD'));
    insert into t_date_range values (5,to_date('20111201', 'YYYYMMDD'),to_date('20111231', 'YYYYMMDD'));
    commit;
    SQL> select ID, to_char(start_date,'DD-MON-YYYY') START_DATE, to_char(end_date,'DD-MON-YYYY') END_DATE from t_date_range;
    ID START_DATE END_DATE
    1 01-JAN-2011 31-MAR-2011
    2 01-APR-2011 31-MAY-2011
    3 01-JUL-2011 31-JUL-2011
    4 01-SEP-2011 25-OCT-2011
    5 26-OCT-2011 30-NOV-2011
    6 01-DEC-2011 31-DEC-2011
    6 rows selected.
    I want result in this form:
    START_DATE END_DATE
    01-JAN-2011 31-MAY-2011
    01-JUL-2011 31-JUL-2011
    01-SEP-2011 31-DEC-2011
    Means if there is a difference of exact one day between "start_date of 2nd row" and "end_date of first row" then make a single row as shows in above results set.
    Thanks!

    Hi,
    Solomon Yakobson wrote:
    Keep in mind, Franks's solution assumes date ranges do not overlap. ...That's true. If rows can overlap, then we might need to use two sub-queries, like you did: one to see if a new group starts with this row, and another to count how many new groups have already started.
    The solution you posted assumes a relationship between id and dates. If we add a row like this to the sample data:
    insert into t_date_range values (6,to_date('20101201', 'YYYYMMDD'),to_date('20121231', 'YYYYMMDD'));that overlaps all the others, then how would that solution work?
    LAG won't work, because no matter how we sort the rows, we can't be sure that overlapping rows will be consecutive.
    Here's one way to handle overlapping rows:
    WITH     got_new_grp          AS
         SELECT     id, start_date, end_date
         ,     CASE
                  WHEN  start_date > 1 + MAX (end_date) OVER ( ORDER BY  start_date
                                                                        ,             id
                                                                        ROWS BETWEEN  UNBOUNDED PRECEDING
                                                  AND      1      PRECEDING
                  THEN  1
              END     AS new_grp
         FROM     t_date_range
    ,     got_grp          AS
         SELECT  start_date, end_date
         ,     COUNT (new_grp) OVER ( ORDER BY  start_date
                                     ,           id
                             ) AS grp
         FROM    got_new_grp
    SELECT       MIN (start_date)     AS start_date
    ,       MAX (end_date)     AS end_date
    FROM       got_grp
    GROUP BY  grp
    ORDER BY  start_date
    ;This solution uses id (assumed to be unique) just to get a consistent ordering, in case 2 (or more) rows have exactly the same start_date. It does not assume any relationship between ids and either start_date or end_date.
    I'm also assuming that start_date<=end_date on each row.
    Edited by: Frank Kulash on May 11, 2011 12:54 PM
    The above refers to the solution you oriognally posted, which was:
    with t1 as (
                select  id,
                        start_date,
                        end_date,
                        case
                          when lag(end_date) over(order by id) + 1 >= start_date then 0
                          else 1
                        end start_of_group
                  from  t_date_range
         t2 as (
                select  id,
                        start_date,
                        end_date,
                        sum(start_of_group) over(order by id) grp
                  from  t1
    select  min(start_date) start_date,
            max(end_date) end_date
      from  t2
      group by grp
      order by grp
    ;

  • Date Range in Query

    Hi All,
    We have created a query report which we have created as a stored procedure and we are executing the sp in SBO to get the result. However, there is one issue, we have passed the variables in the sp as well as the fms to get the date range, but if we input the date manually, the result shown is incorrect!!
    It works fine when we tab on the from date, scroll down and select the date from the cfl!! This is not acceptable to the client. They want to enter the dates manually and not select from the cfl.
    Please advise what is wrong here and how to correct this issue?? Is there any limitation of this sort..
    Thanks,
    Joseph

    Hi Joseph,
    Instead of getting the date as string, try by changing the below declaration part
    Declare @datefrom VARCHAR(20)
    DECLARE @dateto VARCHAR(20)
    by this
    Declare @datefrom datetime
    DECLARE @dateto datetime
    I think, then you need to chenge the same in the SP too
    Regards,
    Bala

  • Date range in query keydate

    Hi,
    Is the keydate in query accepts the date range, from the query properties keydate accepts one date.  I also tried from variable customer exit  it is giving an error shown below.
    EError for variable  in customer enhancement <variable name>                      
    EVariables contain invalid values.                                       
    I>> Row: 82 Inc: LRRMSU13 Prog: SAPLRRMS                                 
    ASystem error in program CL_RSR_OLAP_VAR and form INIT-02- (see long text)
    The requirement is to display multiple records from master data (the time dependent master data in the given data range) based on the keydate range provided. 
    Please respond how to resolve this.
    Thanks
    Sreedh.

    Hi Shalabh,
    Here is the output i'm looking for
    Time dependent Master data 
    Emp1           date  from         date to               Attr1          Attr2
    ABCD           01/01/2008        02/29/2008        Name1       Name2
    ABCD           03/01/2008        05/31/2008        Name3       Name4
    In query when the key date is >= 01/01/2008, the trsn data will show as
    Emp1   Attr1     Attr2       Keyfig
    ABCD  Name1  Name2    
    ABCD  Name3  Name4    30
    The keydate for the query is not accepting the range, is there anyway to achieve this.   Don't want to use the Infoset. 
    Thanks
    Sreedh

  • Query problem with date range

    I have a query that needs to pull data between a date range.
    I've tried several things and nothing seems to work.
    Any help would be greatly appreciated.
    Here's the code:
    <cftransaction>
    <cfquery name="QryFollowUp"
    datasource="NBProdReports">
    SELECT TblContractInfo_SubMenuTable.User_ID,
    TblContractInfo_SubMenuTable.Contract_Number,
    TblContractInfo_SubMenuTable.Transaction_Type,
    TblContractInfo_SubMenuTable.Notes,
    TblContractInfo_SubMenuTable.Num_Checks_Trans,
    TblMasterTrans.Date_Opened
    from TblContractInfo_SubMenuTable ,tblMasterTrans
    WHERE Transaction_Type = 'FollowUp'
    And TblContractInfo_SubMenuTable.Task_Number =
    tblMasterTrans.Task_Number
    And TblMasterTrans.Date_Opened BETWEEN #form.StartDate# AND
    #form.EndDate#
    ORDER BY TblMasterTrans.Date_Opened ASC,
    TblContractInfo_SubMenuTable.User_id ASC
    </cfquery>
    </cftransaction>

    Any help would be greatly appreciated.
    Ok, why are you using a <cftransaction...> around a
    single select query?
    It should be unnecessary.
    This is probably not helpful to your original question. There
    is
    nothing obviously wrong with your query at least to my glance
    through.
    Thus this important question, the one without which you are
    unlikely to
    get any helpful advice, "How does this not work?" Error
    Messages? No
    Data? Wrong Data? Serves you coffee instead of tea?
    It would also probably be helpful to know how your date data
    is
    represented in the database and the form controls, depending
    on what
    your difficulties are.

  • Query for aggregates for each date in a date range

    Hi,
    I want to generate a Trend report with a T-SQL proc, which needs following logic. 
    Input -
    Date Range say '10/10/12' to '20/10/12'  (Say to check the trend of Size of account in 20 days of Trend report)
    Account balance is captured randomly, (i mean not every day) 
    Table with date looks like this..
    --Account Balance Table
    CREATE TABLE AccBanalce (
    BranchId SMALLINT
    NOT NULL,
    AccId CHAR(9)
    NOT NULL,
    Amount DECIMAL(9,3)
    NOT NULL,
    SnapShotDate DATETIME
    NOT NULL 
    CONSTRAINT PK_AccBanalce PRIMARY KEY NONCLUSTERED (AccId, SnapShotDate) )
    GO
    Create CLUSTERED INDEX CIx_AccBanalce ON AccBanalce (SnapShotDate)
    GO
    --Date Range table
    CREATE TABLE DateRange ( StartDate DATETIME, EndDate DATETIME)
    GO
    --Date for the Account Balance Table
    INSERT INTO AccBanalce (BranchId, AccId, Amount, SnapShotDate)
    VALUES (1, 'C1-100',  10.4, '10/11/2010' ),
    (1, 'G1-110',  20.5, '10/11/2010' ),
    (2, 'GC-120',  23.7, '10/11/2010' ),
    (2, 'Gk-130',  78.9, '10/13/2010' ),
    (3, 'GH-150',  23.5, '10/14/2010'),
    (1, 'C1-100',  31.8, '10/16/2010' ),
    (1, 'G1-110',  54.8, '10/16/2010' ),
    (2, 'GC-120',  99.0, '10/16/2010' ),
    (3, 'Gk-130',  110.0, '10/16/2010' ),
    (3, 'G5-140',  102.8, '10/16/2010' ),
    (2, 'GC-120',  105,  '10/18/2010' ),
    (2, 'Gk-130',  56.7, '10/18/2010' ),
    (1, 'C1-100',  84.3, '10/18/2010' ),
    (1, 'G1-110',  75.2, '10/19/2010' ),
    (2, 'GC-120',  64.9, '10/20/2010' ),
    (3, 'GH-150',  84.0, '10/20/2010' ),
    (1, 'C1-100',  78.0, '10/20/2010' ),
    (1, 'G1-110',  89.5, '10/20/2010' )
    GO
    --Date for DateRange Table
    INSERT INTO DateRange (StartDate, EndDate) VALUES
    ('2010-10-11 00:00:00.000', '2010-10-11 23:59:59.997'),
    ('2010-10-12 00:00:00.000', '2010-10-12 23:59:59.997'),
    ('2010-10-13 00:00:00.000', '2010-10-13 23:59:59.997'),
    ('2010-10-14 00:00:00.000', '2010-10-14 23:59:59.997'),
    ('2010-10-15 00:00:00.000', '2010-10-15 23:59:59.997'),
    ('2010-10-16 00:00:00.000', '2010-10-16 23:59:59.997'),
    ('2010-10-17 00:00:00.000', '2010-10-17 23:59:59.997'),
    ('2010-10-18 00:00:00.000', '2010-10-18 23:59:59.997'),
    ('2010-10-19 00:00:00.000', '2010-10-19 23:59:59.997'),
    ('2010-10-20 00:00:00.000', '2010-10-20 23:59:59.997')
    GO
    Question - 
    I want TOTAL Balance of all Accounts in a Branch per each day between 10/11/2010 to 10/20/2010
    If the Snapshotdate (date) on which the account was not made an entery to AccBalance table, last available  balance to be considered for that account.
    like for account [C1-100] on 10/15/2010 the balance should be [10.4]
    --Group By Branch
    --Last valid Account balance to be considered.
    I know, this is long solution, but any one who is expert in T-SQL can help me in this solution.
    Thanks,
    Krishna

    Thanks Himanshu You almost solved my issue...but can you provide the final output as following...
    Actually you are aggregating the Amount, which is not required, as it is the total available in that account.
    But the missing pint is I need the SUM of all the accounts for each DAY in a BRANCH.
    The 3rd Result Query modified to get DAILY balances for each account as following...
    --*RESULT*
    SELECT a.AccId, a.StartDate, 
                        (SELECT TOP 1 b.Amount
                        FROM #InterimOutput b
                        WHERE b.AccId = a.AccId and b.Amount > 0
                        AND B.StartDate<=A.StartDate  ORDER BY B.StartDate DESC) as ToDateBal
    FROM   #InterimOutput a
    ORDER BY a.AccId
    go
    Now I need SUM of all Account Balances AT each BRANCH on DAILY basics. Can you help on that?
    Thanks again
    Krishna

  • MDM ABAP API query to pass the date range

    Hi
    I want to retrieve certain data from MDM repository based on filter criteria by date stamp.
    Not sure how to do it to pass the select option value in the query.
    select-options: s_cdate for sy-datum obligatory .
    DATA  wa_query     TYPE mdm_query.
    DATA: v_search_date1    TYPE MDM_CDT_DATE_TIME.
    data: v_datestamplow1   type string.
    data: v_datestamplow    type TZNTSTMPL.
    concatenate s_cdate-low '000000' into v_datestamplow1
    v_datestamplow  = v_datestamplow1.
    clear wa_query.
        wa_query-parameter_code = 'Changed_On '.             "Field code ( Field name )
        wa_query-operator = 'EQ'.
        wa_query-dimension_type = mdmif_search_dim_field.    "Field search
        wa_query-constraint_type = MDMIF_SEARCH_CONSTR_DATE. "Date  serach
    I am able to get the data when I just pass the low value from selecct option.  But I dont how  to pass the date range.
       v_search_date1-CONTENT = v_datestamplow.
        ET REFERENCE OF v_search_date1 INTO wa_query-value_low.
        APPEND wa_query TO gt_query.
      CALL METHOD cl_api->mo_core_service->query
          EXPORTING
            iv_object_type_code = 'Vendors'
            it_query            = gt_query
          IMPORTING
            et_result_set       = gt_result.
    II could see the below operator types . Although EQ says "Like standard select-options parameter" not sure how to pass the value.
    EQ     Equal to (like standard select-options parameter)
    NE     Not equal to (like standard select-options parameter)
    LT     Less than (like standard select-options parameter)
    LE     Less than or equal to (like standard s-o parameter)
    GT     Greater than (like standard select-options parameter)
    GE     Greater than or equal to (like standard s-o parameter
    SW     Starts with (MDM specific parameter)
    Thanks,
    Krishna.

    Hi,
    To get the date range for select options, pass the low value with 'GE' operator and another query option with 'LE' operator for high value.
    select-options: s_cdate for sy-datum obligatory .
    DATA wa_query TYPE mdm_query.
    DATA: v_search_date1 TYPE MDM_CDT_DATE_TIME.
    data: v_datestamplow1 type string.
    data: v_datestamplow type TZNTSTMPL.
    concatenate s_cdate-low '000000' into v_datestamplow1
    v_datestamplow = v_datestamplow1.
    clear wa_query.
    wa_query-parameter_code = 'Changed_On '. "Field code ( Field name )
    wa_query-operator = 'GE'.
    wa_query-dimension_type = mdmif_search_dim_field. "Field search
    wa_query-constraint_type = MDMIF_SEARCH_CONSTR_DATE. "Date serach
    GET REFERENCE OF v_search_date1 INTO wa_query-value_low.
    APPEND wa_query TO gt_query.
    concatenate s_cdate-high '235959' into v_datestamphigh1
    v_search_date2 = v_datestamphigh1.
    clear wa_query.
    wa_query-parameter_code = 'Changed_On '. "Field code ( Field name )
    wa_query-operator = 'LE'.
    wa_query-dimension_type = mdmif_search_dim_field. "Field search
    wa_query-constraint_type = MDMIF_SEARCH_CONSTR_DATE. "Date serach
    GET REFERENCE OF v_search_date2 INTO wa_query-value_low.
    APPEND wa_query TO gt_query.
    CALL METHOD cl_api->mo_core_service->query
    EXPORTING
    iv_object_type_code = 'Vendors'
    it_query = gt_query
    IMPORTING
    et_result_set = gt_result.
    Thanks.

  • User Prompt for Date Range in Bex Query Analyzer

    I have a workbook that has two queries. The queries both require the user to enter a date range upon refresh. I want the user to be able to hit refresh, enter the date input into the dialog box and then both queries to use this date range for their input. I have seen this in other book, but when I click refresh on my book it only runs the first query. How do I get the second query to use the first queries input?

    use the same variable in both the queries. this will let the user enter the date in a single variable and this will refresh both the queries.
    rgds, Ghuru

Maybe you are looking for

  • How can I remove an email address from one apple account and associate it with another?

    I created an appleID account to use with the mac AppStore without realising i previously had an appleID account from my first iPod touch. Now with OSX 10.8 I want to use the email address from the old account with the new account for Messages.app wit

  • Script language problem

    Hi friends, We designed a script for purchase order for taiwans, and it is displaying the incorrect Payment Terms when outputted (e.g. printed) using the ZEBT(own outtype) output type in language 'ZF'.  The Payment Terms text displayed in the ouputte

  • PDE-PPU017 error type

    Can any one plz explain me wt exactly this error means PDE-PPU017 The program unit source must define a Subprogram Body or Package when i create a new procedure in my program unit n try to ompile i get this error. it doesn'e even close.

  • How do I return to the former firefox? I don't like firefox 4.get back to me A.S.A.P please!

    Nothing is the same! i can't find anything. Please uninstall firefox 4 and put me back how i was

  • Implementation of Hash Bucket

    Hi, I'm working on a 10.2.0.2 RAC database and have heard of hash bucket implementation to get better performance of the database. Can you give some knowledge on that? And also, the process of implemetation of hash bucket.. Thanks in advance.. Rgds,