Using function(s) to select date range in a computation.

Hello
Within my ApEx report, I would like to be able to have data returned from within a date range selected by the user. Under "Compute" there are lots of "Functions" (Least, Greatest, Last_Day, etc.) but so far I have not been able to find the right syntax for date range.
This seems so simple - any help appreciated.
Thanks
Paul S.

I do not use APEX but is the BETWEEN operator available to you?
Normally to select a date range you just write code like
select ....
from table_t
where date_col between to_date(start_date,'format') and to_date(end_date,'format')
or
where date_col >= to_date(start_date,'format')
and date_col < to_date(end_date,'format') + 1
as this form eliminates worrying about the time component.
HTH -- Mark D Powell --

Similar Messages

  • Devloped an ALV report for daily cash receipts for selected date range

    hi,   
                 how to devlop an ALV report for daily cash receipts for selected date range.for this report what are the tables and fields we have to use.what is the selectionscreen&what is logic.give me sample report.

    Hi,
    You can develop simple reports using Report Painter.
    You may be also interested in:
    Check report SAPMF05A for credit memo
    See the following Std reports on Payment Advices execute the Tcodes:
    S_ALR_87009888
    S_ALR_87009889
    S_ALR_87009890
    S_ALR_87009891
    S_ALR_87009892
    S_ALR_87009893
    S_ALR_87009978
    S_ALR_87009979
    S_ALR_87009980
    S_ALR_87009981
    S_ALR_87009982
    S_ALR_87009983
    S_ALR_87010056
    S_ALR_87010057
    S_ALR_87010058
    S_ALR_87010059
    S_ALR_87010060
    S_ALR_87010061
    S_ALR_87010066
    S_ALR_87010067
    S_ALR_87012106
    S_ALR_87012107
    S_ALR_87012108
    S_ALR_87012109
    S_ALR_87012110
    S_ALR_87012111
    S_ALR_87012116
    S_ALR_87012117
    S_ALR_87012200
    S_ALR_87012201
    S_ALR_87012202
    S_ALR_870122
    S_ALR_87012204
    S_ALR_87012205
    S_ALR_87012350
    S_ALR_87012351
    S_ALR_87012352
    S_ALR_87012353
    S_ALR_87012354
    S_ALR_87012355
    sample ALV report:
    tables:
    marav. "Table MARA and table MAKT
    Data to be displayed in ALV
    Using the following syntax, REUSE_ALV_FIELDCATALOG_MERGE can auto-
    matically determine the fieldstructure from this source program
    Data:
    begin of imat occurs 100,
    matnr like marav-matnr, "Material number
    maktx like marav-maktx, "Material short text
    matkl like marav-matkl, "Material group (so you can test to make
                            " intermediate sums)
    ntgew like marav-ntgew, "Net weight, numeric field (so you can test to
                            "make sums)
    gewei like marav-gewei, "weight unit (just to be complete)
    end of imat.
    Other data needed
    field to store report name
    data i_repid like sy-repid.
    field to check table length
    data i_lines like sy-tabix.
    Data for ALV display
    TYPE-POOLS: SLIS.
    data int_fcat type SLIS_T_FIELDCAT_ALV.
    select-options:
    s_matnr for marav-matnr matchcode object MAT1.
    start-of-selection.
    read data into table imat
      select * from marav
      into corresponding fields of table imat
      where
      matnr in s_matnr.
    end-of-selection.
    Now, we start with ALV
    To use ALV, we need a DDIC-structure or a thing called Fieldcatalogue.
    The fieldcatalouge can be generated by FUNCTION
    'REUSE_ALV_FIELDCATALOG_MERGE' from an internal table from any
    report source, including this report.
    The only problem one might have is that the report and table names
    need to be in capital letters. (I had it )
    Store report name
    i_repid = sy-repid.
    Create Fieldcatalogue from internal table
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_PROGRAM_NAME         = sy-repid
                I_INTERNAL_TABNAME     = 'IMAT'  "capital letters!
                I_INCLNAME             = sy-repid
           CHANGING
                CT_FIELDCAT            = int_fcat
           EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 2
                OTHERS                 = 3.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM       = i_repid
                I_STRUCTURE_NAME         = 'marav'
                I_DEFAULT                = 'X'
                I_SAVE                   = 'A'
           TABLES
                T_OUTTAB                 = imat.
      IF SY-SUBRC <> 0.
        WRITE: 'SY-SUBRC: ', SY-SUBRC .
      ENDIF.
    Hope this will help.
    Regards,
    Naveen.

  • Devolped an ALV report for daily cash receipts for selected date range

    hi,   
                 how to devlop an ALV report for daily cash receipts for selected date range.for this report what are the tables and fields we have to use.what is the selectionscreen&what is logic.give me sample report.

    hi,   
                 how to devlop an ALV report for daily cash receipts for selected date range.for this report what are the tables and fields we have to use.what is the selectionscreen&what is logic.give me sample report.

  • Error when selecting date range in query designer

    hi all,
    when iam trying to select date range in query designer like 01.04.2009 to 10.04.2009 it has to select only that dates where as it is selecting all the dates in between those like 010.04.2009,01.03.2009,01.02.2009.why this is happening ,iam unable to understand.plzz help me in this issue.
    Vamshi D Krishna

    hi ,
    i have created a variable as you told but no use.still i have to select the dates manuallyone after the other.for more user friendly can i have a calander where i can select date ranges.is it posible to have calander for selecting date ranges instead selecting dates one by one,if posible i request you to give  the detailed steps.plzz guide me in this issue.thanks in advance.
    Vamshi D Krishna

  • File Count with selected date range

    Hi,
    Our requirement is to get the file count with selected date by the user from two sharepoint date time controls i.e. dtp1 and dtp2 into the data table. I am able to get the file count of specific folder from Pages library through below code. Now need to get
    the selected date range from two date time picker controls and check with the item created by is within the date range. If yes I need to get the file count.
    So please share your ideas/thoughts to do the same.
    SPList list =
    wikiweb.Lists["Pages"];
                        SPFolderCollection oFolders
    = list.RootFolder.SubFolders["foldername"].SubFolders;
                        DataTable dt
    = new DataTable();
                        dt.Columns.Add("Column1");
                        DataRow dr;
                        if (oFolders.Count
    > 0)
                            foreach (SPFolder oFolder in oFolders)
     if (!oFolder.Name.Equals("Forms"))
                                    dr
    = dt.NewRow(); 
    dr["Column1"] = oFolder.ItemCount.ToString();
    dt.Rows.Add(dr);
    Regards,
    Sudheer
    Thanks & Regards, Sudheer

    Hi,
    I have modified the code as below
    if((DateTime)(oFolder.Item.File.TimeCreated>dtFromDate.SelectedDate)&&(DateTime)(oFolder.Item.File.TimeCreated<dtToDate.SelectedDate))
    But still it is throwing the error.
    Please share your ideas on the same.
    Regards,
    Sudheer
    Thanks & Regards, Sudheer

  • Resource Assignment Select date range not wokring

    The Select Date Range control is not working properly it does not change the results shown in resource assignments under resource center in Project server 2013. Any ideas? Have I missed some configuration?
    Regards, Syed Faizan ur Rehman, CBPM®,PRINCE2®, MCTS

    Hi Syed,
    It does work correctly for me in my Project Online instance. Have you installed the SP1?
    Note that the date range is only available for the timephased data and not for the Gantt chart.
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • Creating report based on user selected Date Range

    Hello.
    I am trying to display an Apex report that selects data for the report based on a user entered date range.
    It's a simple page with two date picker fields (p18_start and p18_end).
    The report region SQL looks like this:
    SELECT *
    FROM prj_items
    WHERE LM_DT BETWEEN :p18_start AND :P18_end
    One table, one field on the table to search and two Apex variables.
    I thought this would be fairly simple, but I am obviously missing something.
    I not even sure what other information is needed to help me figure this out.
    -Jody

    Hi,
    You can set defaults for the datepickers if you need to - this could be done in a computation on the page for each item and conditional on the item being null.
    When I've done something similar to this, I've created two hidden page items - eg, :P19_FIRST_DATE and :P19_LAST_DATE and populated these with the earliest/latest date that the user could reasonably select (perhaps, in your case, the MIN(LM_DT) and MAX(LM_DT) values).
    Then your SQL would be:
    select * from PRJ_ITEMS
    where LM_DT BETWEEN TO_DATE(NVL(:P19_START,:P19_FIRST_DATE), 'DD-MON-YY')
    AND TO_DATE(NVL(:P19_END,:P19_LAST_DATE), 'DD-MON-YY')If you don't want to set default dates, you could do something like:
    SELECT * FROM PRJ_ITEMS
    WHERE (:P19_START IS NULL AND :P19_END IS NULL)
    OR (:P19_START IS NOT NULL AND :P19_END IS NULL AND LM_DT >= TO_DATE(:P19_START,'DD-MON-YY'))
    OR (:P19_START IS NULL AND :P19_END IS NOT NULL AND LM_DT <= TO_DATE(:P19_END,'DD-MON-YY'))
    OR (LM_DT BETWEEN TO_DATE(:P19_START,'DD-MON-YY') AND TO_DATE(:P19_END,'DD-MON-YY'))There are various reasons why your two dates are being cleared when the page is reloaded. Firstly, you should check the branch that returns to the same page - make sure you are not clearing the cache for the page. Then, have a look to see if there is a "reset page" process (usually created for you when you create a form page). Then, check the Source settings for the items. Typically, these would be "Only when current value in session state is null" and a Source Type of "Static Assignment" with the "Source Value or Expression" left empty.
    Andy

  • How to use function module to update data

    Hello ,
    Can any body have idea how we can use function module SAVE_TEXT to update the master recipe header and operation long text.
    I want to use this functional module to update the master recipe long text
    step by step procedure is highly appreciated
    thanks & regards
    siddhasrth

    Hi
    SAVE_TEXT
    SAVE_TEXT writes a text module back to the text file or the text memory, depending on the storage mode of the corresponding text object.
    You can use this module either to change existing texts or to create new texts. If you know for sure that the text is new, use the parameter INSERT to indicate this. The system then does not have to read the text first, which improves the performance of the function module.
    If the lines table passed with the function module is empty, the system deletes the text from the text file.
    Function call:
    CALL FUNCTION 'SAVE_TEXT'
    EXPORTING CLIENT = SY-MANDT
    HEADER = ?...
    INSERT = SPACE
    SAVEMODE_DIRECT = SPACE
    OWNER_SPECIFIED = SPACE
    IMPORTING FUNCTION =
    NEWHEADER =
    TABLES LINES = ?...
    EXCEPTIONS ID =
    LANGUAGE =
    NAME =
    check thi sample code
    CALL FUNCTION 'SAVE_TEXT'
    EXPORTING
    CLIENT = SY-MANDT
    HEADER = t_header
    SAVEMODE_DIRECT = 'X'
    * OWNER_SPECIFIED = ' '
    * LOCAL_CAT = ' '
    * IMPORTING
    * FUNCTION =
    * NEWHEADER =
    TABLES
    LINES = t_long
    EXCEPTIONS
    ID = 1
    LANGUAGE = 2
    NAME = 3
    OBJECT = 4
    OTHERS = 5
    Reward all helpfull answers
    Regards
    Pavan

  • Function Module for selecting date by day

    Is there any function module to choose date by day. for example if I give today's date the FM should give me next thursday's date.
    Thanks
    Tharani

    this works good........
    *& Report  YCHATEST                                                    *
    REPORT  YCHATEST
    data:day like DTRESR-WEEKDAY.
    parameters:curr_dat like sy-datum default sy-datum.
    CALL FUNCTION 'DATE_TO_DAY'
      EXPORTING
        DATE          = CURR_DAT
    IMPORTING
       WEEKDAY       = day.
    write : / day.
    case day.
    when 'Monday'.
       CURR_DAT = CURR_DAT + 3.
    when 'Tuesday'.
       CURR_DAT = CURR_DAT + 2.
    when 'Wed.'.
       CURR_DAT = CURR_DAT + 1.
    when 'Thursday'.
       CURR_DAT = CURR_DAT + 7.
    when 'Friday'.
       CURR_DAT = CURR_DAT + 6.
    when 'Sat.'.
       CURR_DAT = CURR_DAT + 5.
    when 'Sunday'.
       CURR_DAT = CURR_DAT + 4.
    endcase.
      write :/ CURR_DAT.

  • Using FUnction keys on selection screen

    Hi All,
    I want to submit a report if the user presses any assigned function key when he is on the selection screen of a t-code.
    how can i capture the commands of function key on selection screen.

    hi
    try below code
    TABLES sscrfields.
    INITIALIZATION.
    PARAMETERS : p_1 TYPE c.
    SELECTION-SCREEN : FUNCTION KEY 1.
    SSCRFIELDS-FUNCTXT_01 = 'Report'.
    SELECTION-SCREEN : FUNCTION KEY 2.
    SSCRFIELDS-FUNCTXT_02 = 'Report2'.
    AT SELECTION-SCREEN.
      IF sscrfields-ucomm = 'FC01'.
        SUBMIT ZXXX1 VIA SELECTION-SCREEN AND RETURN.
      ENDIF.
      IF sscrfields-ucomm = 'FC01'.
        SUBMIT ZXXX2 VIA SELECTION-SCREEN AND RETURN.
      ENDIF.

  • Using Function module to calculate date

    Hi,
    I need to use an exit variable in Bex in order to dynamically add or substract months, days, and years from another input variable and have a date interval.
    After searching, i found that the FM   RP_CALC_DATE_IN_INTERVAL is exactly what i'm searching for, but it exists only in ECC and not in BI.
    Is there another FM that can do the same  work and can be used in ZXRSRU01, or is there a way to copy it to BI ?.
    Thanks for ur help
    Best regards
    Raed

    sorry Francis,
    this will run:
    REPORT zforum101 .
    TABLES: faede, bsid, bsega, t052.
    PARAMETERS : p_zterm LIKE t052-zterm DEFAULT '1400'.
    PARAMETERS : bldat TYPE sy-datum DEFAULT '20060801'.
    SELECT SINGLE * FROM  t052
           WHERE  zterm  = p_zterm.
    CLEAR faede.
    MOVE-CORRESPONDING t052 TO faede.
    MOVE: t052-ztag1 TO faede-zbd1t,
          t052-ztag2 TO faede-zbd2t,
          t052-ztag3 TO faede-zbd3t.
    MOVE bldat TO faede-bldat.
    faede-koart = 'D'.
    CALL FUNCTION 'DETERMINE_DUE_DATE'
         EXPORTING
              i_faede = faede
         IMPORTING
              e_faede = faede
         EXCEPTIONS
              OTHERS  = 1.
    bsega-netdt = faede-netdt.
    WRITE bsega-netdt.
    A.
    pls reward useful answers
    Message was edited by: Andreas Mann

  • Copy-function: Where to select data-target?

    Hi experts,
    First, I worked on a cube for consolidation and created several input ready queries.
    Second, I have buid-up a second cube for disribution planning. (Because there are lots of additional dimensions being used; such as country, region, products[...]).
    Now, I want to copy planned turnover in distribution cube to consolidation cube. In other threads I've read, that it would be possible to copy data from cube to cube.
    The problem is that I don't find any properties defining the data-target.
    So. what needs to be done to reach my goals? Do I have to buid-up a multiprovider as well?
    Thanks a lot for your hints!
    Regard, Martin

    Hi Martin,
    copy function can only copy from a char value to another value. It can not copy between key figures.
    For this you need a fox formula.
    Copy functions in BI IP will always overwrite the values that were in the target before it is run.
    Fox functions usually will also overwrite the values that were there before the function is run. If you want to do it different, your fox code would have to include some checks and so on.
    if you do not change other characteristics, you take only the 0Info_prov into the fields to be changed and make a formula like:
    {keyfigtarget, infoprovtarget} = {keyfigsource, infoprovsource}.
    when including the function button into a web template you can choose:
    planning function simple - you will need a data provider type filter or query to fill info the selection binding
    planning function - you can choose you "filter" by naming each individual char that has to be restricted while running the function
    planning sequence - aggrlevel, filter and function are fixed in the sequence
    I usually prefer sequences (I trust them more than the selections for individual functions)
    regards
    Cornelia

  • Index used or not for selecting data from ODS in a start routine

    Dear friends,
    In the start routine of the update rules to a cube, I am reading some data of an ODS in to an internal table .
    The ODS is indexed. But, I am not sure if the index is at all used in the Select statement (that gets the data from ODS to the internal table in the start routine) while loading data to the cube.
    Any help is highly appreciated.
    regards,
    atlaj

    Hi Atlaj
    You can findout this is display execution plan for SQL statement in DB02.
    Goto DB02. and under diagnostic, you find explain. Select that and enter your query. Make sure that everything here is in capital format. Below is a sample query which I have entered.
    SELECT "CRM_SALORG" "SALESORG" FROM "/BI0/QORGUNIT"
    WHERE "SALESORG" = ? AND "OBJVERS" = ? AND "DATETO" >= ?
    AND "DATEFROM" <= ?
    The select parameters should be inside qoutes and in caps and even the from table. Once you enter your query in this format, click on explain. It will show the index scan if the index is present. the output for my query will be something like
    0 SELECT STATEMENT ( Estimated Costs =  1,348E+01 [timerons] )
            1 (COOR) RETURN
                2 (    0) TQ
                    3 (    0) FETCH /BI0/QORGUNIT
                        4 (    0) IXSCAN /BI0/QORGUNIT~Z1
    Where my last statement (line 4) is showing index scan and the name of index read is Z1.
    Hope this helps.
    Please let me know if you have any problems entering the query in the specified format and u get any error.
    Regards
    Sriram

  • Using menu ring to select data out of database with SQL

    I have a database setup with two tables and six columns of data. One of the columns contains an array of data. I would like to be able to read the data out with two ring controls. One ring to select the table and the other to select certain rows of data based on the value in one row. I want the data charts to update automatically inside a loop when the ring values are changed. I started by modifying the playback(fetching) example. The problem is when I change the menu item, I am not closing the first connection before opening a new one. Should I be using the running stored procedures with parameters method to accomplish this task?? I suppose all of the data could be read and then sorted out of the result.
    Attachments:
    myPlayback_rev2.vi ‏120 KB

    unclebump,
    There are two possible solutions. If you are using LabVIEW 6.0.x, then you will need to put a while loop around all of your program and poll to see if the values of the ring controls have changed (can be done with a shift register). If nothing has changed, then have a case structure that does nothing. If the values have changed, then get the new data.
    If you are using LabVIEW 6.1, then you can check for a value changed event on the ring controls. Everything else from the 6.0.x version from above would be the same. This eliminates the polling which reduces processor use.
    Randy Hoskin
    Applications Engineer
    National Instruments
    http://www.ni.com/ask

  • Dynamic flat file name based on selected date range

    Hi,
    I have created mapping which load data into file, i have to create file with the range specified for the data to be pulled.
    e.g if i have to load data from 01-sep-12 to 15-sep-12 the file name should be ext_rio_15-sep_to_15_sep. how can i achive through owb

    https://blogs.oracle.com/warehousebuilder/entry/dynamically_generating_target
    Cheers
    David

Maybe you are looking for