Parameter for Last Week, Last Month & Last Year from the current Date

I have a crystal report that has a StartDate & EndDate parameters from the stored procedure that I am calling. Now i got a new requirement saying that my user wants a drop-down parameter in which they need to be able to select last week (Sunday to Saturday), last month, last year instead of manually selecting start date and end date parameters? Can anyone please explain me how to do this?
(FYI, I am using Crystal 2008)

Hi Naveen,
You'll need to handle the logic in the Stored Proc's where clause.
If you're using oracle, I have something like this in the Stored Proc's where clause for our reports:
Where {Date_Field} Between
Decode('{?Relative Date}',
'Yesterday', sysdate - 1,
'Last Week', Tunc(sysdate, 'IW')-7)
AND
Decode('{?Relative Date}',
'Yesterday', sysdate,
'Last Week', Tunc(sysdate, 'IW'))
where 'Relative Date' is a prompt in the Stored Proc and 'yesterday'. 'last week' are the 'static values' in the prompt.
-Abhilash

Similar Messages

  • Posting Depreciation for last year in the current year

    Hi,
    We have a situation in which we have to book depreciation for assets that were put into service since last year in the current year. The depreciation expense was accrued and reported when the year was closed out. However SAP wouldnt allow us to calculate the depreciation for anything before 01/01/2009. The assets were put into service in July of last year and hence we need to post 6 months of depreciation that we accrued last year in this posting period (when we will be capitalizing those assets). How do we go about doing this?
    Here is what we tried:
    1. Manual Depreciation: Doesnt work. The depreciation key we are using (LINA) doesnt allow manual depreciation
    2. Changing the ordinary dep start date: You can change this date to last year but it wont calculate the depreciation from last year. It just starts the useful life from last year. The depreciation that is being caught up starts from 01/01/2009
    3. Unplanned Depreciation: This is not an option because it goes to a different G/L account. The client wants it to be in the regular depreciation expense account only.
    Any suggestions?
    Thanks!

    Hi,
    So far my knowledge goes there is no way wherein you can capitalise assets in currnet year and account for dep from the previous year unless you go for post capitalisation vide ABNAN.Let me try to explain it by the following example.
    FY: April to March
    APC 10000/
    Rate od dep   10%
    Ord dep Start   01.10.08.
    Asset capitalisation date 01.10.08 but posted in the system on,  say   01.04.09.
    Line items for ABNAN
    70   Asset A/c     10000
    75   Acc Dep                          500(on 10000 @ 10% for 6 months)
    50 Rev for post capitalisation 9500.
    FB60 Line items.
    31   Vendor Account       10000
    40  Prior per dep                   500
    40  Rev from post capitalisation  9500.
    I do hope you will be able to clear your confussion.
    With best wishes
    Monoj
    Edited by: MONOJ SARKER on Aug 5, 2009 12:11 PM

  • Web-Outlook appointments which are one year before the current date are removed

    Hi,
    my Web-Outlook works fine with my iPHONE4s but the appointments which are one year befoer the current date are removed.
    Is there an option to keep all appointments?
    regards
    Andreas

    For the OST problem, delete the OST file and let Outlook create a new one.  But your problem may be that Outlook connects to Exchange 2013 using Outlook Anywhere only--MAPI RPC is gone--and for that you need a valid certificate.  So the self-signed
    certificate is likely your main problem.
    For a self-signed certificate to work, you must add it to every client as a trusted certificate.  That is hard to do with mobile devices, which is why it's recommended to obtain a certificate from a trusted public certificate authority.  You'd
    probably find Go Daddy to be reasonably priced, and there are others.
    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."

  • Adding a year to the current date field

    Hello,
    Can any one please help on how to add a year to the current date field.
    e.g 7/19/2011 plus a year = 7/19/2012
    Thanks,
    Han Dao

    If you had a field DateTimeField1 and wanted to display the following year in DateTimeField2, you could do the following in JavaScript;
    var d1 = util.scand("yyyy-mm-dd", DateTimeField1.rawValue);
    if (d1 !== null)
    d1.setFullYear(d1.getFullYear()+1);
    DateTimeField2.rawValue = util.printd("yyyy-mm-dd", d1);
    Good luck
    Bruce

  • Get the last query from the current user

    Is there a way to get the last query of the current user, so every query could be log with a database trigger?
    Let's just say I execute:
    DELETE xxxx;
    I tried :
    SELECT T.SQL_TEXT FROM V$SQLAREA T where ADDRESS=(SELECT prev_sql_addr FROM v$session where audsid=userenv('sessionid'));
    But the result of this query is :
    'SELECT T.SQL_TEXT FROM V$SQLAREA T where ADDRESS=(SELECT prev_sql_addr FROM v$session where audsid=userenv('sessionid'))'
    Is there a way to execute a query that would return :
    'DELETE xxxx'
    Thanks

    You could join SQL_ADDR in v$session with ADDRESS in v$sqlarea to determine the SID that executed that SQL statement last. Note that PREV_SQL_ADDR in v$session will indicate the previous SQL he executed. Though you would have to look at these tables very often to get all SQL statements issued. One note here, I think if a different user ran the SAME SQL with just bind var differences the SQL_AREA will only show the last user’s information that executed it.
    BTW - it will show deletes also...

  • How can i get the month and year of the current  open Periode?

    At the beginning of each month the booking period for the new month was not open,but i need to book material automatically with the last day of the old month. The booking period will change at the first working day between 13 and 17 a clock. when the booking period was changed i have to book with the current date.
    How can i do this ??
    Regards
    Ralf

    Hi Ralf,
    here's a complete example:
    DATA: last LIKE sy-datum, "ultimo of last month
          gjahr LIKE t001b-frye1,
          buper LIKE t001b-frpe1.
    last = sy-datum - sy-datum+6(2) .
    PERFORM check_period.
    IF sy-subrc <> 0.
      ADD 1 TO last . "-> next month
      PERFORM check_period.
      IF sy-subrc <> 0.
        MESSAGE a001(00) WITH 'no open fi period'.
      ENDIF.
    ENDIF.
    *formatting for germany
    CONCATENATE last+6(2) last+4(2) last(4) INTO bbkpf-budat.
    WRITE: / bbkpf-budat.
    FORM check_period.
      MOVE last(4) TO gjahr.
      MOVE last+4(2) TO buper.
      CALL FUNCTION 'FI_PERIOD_CHECK'
           EXPORTING
                i_bukrs          = bbkpf-bukrs
                i_gjahr          = gjahr
                i_koart          = '+'
                i_monat          = buper
           EXCEPTIONS
                error_period     = 1
                error_period_acc = 2
                OTHERS           = 3.
    ENDFORM.                    " check_period
    regards <a href="https://www.sdn.sap.com:443/irj/servlet/prt/porta
    l/prtroot/com.sap.sdn.businesscard.SDNBusinessCard?u=i
    Wo3ssHlIihvCrADIEGqaw%3D%3D">Andreas</a>
    Message was edited by: Andreas Mann

  • How to get the currrent month and year from a new date object

    If I create a new Date object as "d",
    java.util.Date d = new java.util.Date();how can I format the date to get the current Month as 'Jan' and the current year as '2008'. So if I have something like d.getMonth() gets the current month as 'Oct' and d.getYear() gets '2008'
    Thanks,
    Zub

    [Read the flamin' manual you must. Hmm.|http://en.wikipedia.org/wiki/RTFM]
    ~~ Yoda.
    Well no actually, he didn't say that, but he should have.
    Cheers. Keith.
    PS: Don't say that to a 7 foot pissedOff wookie when he's got his head stuck in a smoking hyperdrive, and you're being chased by a S-class battle cruiser... Ask Yoda how he got to be so short.
    PPS: It is the SimpleDateFormat you seek ;-)
    Edited by: corlettk on 14/10/2008 22:37 ~~ Also far to slow... but funny.

  • Problem to insert only month and year instead of full date

    select b.penjara_id, p.penj_lokasi, a.no_daftar, b.episod, b.nama1,to_char(a.trkh_mula_prl,'dd/mm/yyyy') as trkh_mula_prl, to_char(bulan_proses,'mm/yyyy') as bulan_proses,
            b.epd, b.lpd
    from prl_daftar_proses a, senarai_pesalah b, penjara p
    where a.no_daftar=b.no_daftar
    and a.episod=b.episod
    and b.penjara_id = p.penjara_id
    and a.setuju_jplp is null
    and a.bulan_proses between to_date(:FROM,'dd/mm/yyyy') and to_date(:TO,'dd/mm/yyyy')
    order by b.penjara_id, a.bulan_proses,a.no_daftarHi,anyone can help me how i can insert only month and year from the value that have full date in the database??
    for example,the date is 09/18/2012, but i just want to insert 09/2012 as parameter. If i want to insert only one parameter, i can do that..But i have problem when I want to insert two parameters..

    jeneesh wrote:
    Welcome to the forum..
    This..?
    Assuming bulan_proses is a date without time part
    select b.penjara_id, p.penj_lokasi, a.no_daftar, b.episod, b.nama1,to_char(a.trkh_mula_prl,'dd/mm/yyyy') as trkh_mula_prl, to_char(bulan_proses,'mm/yyyy') as bulan_proses,
            b.epd, b.lpd
    from prl_daftar_proses a, senarai_pesalah b, penjara p
    where a.no_daftar=b.no_daftar
    and a.episod=b.episod
    and b.penjara_id = p.penjara_id
    and a.setuju_jplp is null
    and a.bulan_proses between to_date(:FROM,'mm/yyyy') and last_day(to_date(:TO,'mm/yyyy'))
    order by b.penjara_id, a.bulan_proses,a.no_daftar
    i got another problem..
    before that.may i know what is the function of last_day?

  • Get month and year from date type

    Hi all,
    I need to get the month and year from the date type.
    For example select to_date('2011-01-17', 'yyyy-mm-dd') from dual;Result needed:
    01-2011Any ideas?
    thanks in advance,
    Bahchevanov.

    Hello Bahchevanov,
    if you need the date to compute something, then you can
    TRUNC(SYSDATE,'mm')This will give you a date with the days removed -> 01.01.2011
    Regards
    Marcus

  • Function Module - Calculate 5 weeks lookup based on -7 increments from the Key Date

    Hi Guys,
    I am looking to create a variable on Fiscal Period/Year, that automatically populates the variable with the previous 5 weeks based on -7 increments from the key date , when the user runs the query .
    For Example: If key date is 03/11/2014 need to get previous 5 weeks 03/04/2014, 02/25/2014, 02/18/2014, 02/11/2014, 02/04/2014. mm/dd/yyyy.
    Is there any Function Module available/ please provide the logic code - can anyone help?
    Thanks,
    Suresh Narayan

    Hi suresh,
    Please once try with this approach,
    Create a variable with variable represents :  multiple input value, Processing type : customer exit ; variable is ready for input.
    and write the below code :
    if i_step = 1.
    data : fdate type d ,
            wa1 like line of e_t_range,
           n1 type i.
    n1 = 1.
    if n1 <= 5.
    wa1-opt = 'EQ'.
    wa1-sign = 'I'.
    wa1-low = fdate.
    append wa1 to e_t_range.
    fdate = fdate - 7.
    endif.
    endif.
    Hope you got it,

  • To extend SAP user date and to add months to the current date

    Hi All,
    I need to extent the user date in SAP based on one condition.
    If the condition is true extend the date by 12 monthd if false 6 months from the current date.
    Can i have the FM for user date extentions and FM for getting the date.
    Thanks,
    Chandu.

    Hi ,
    You can use this FM for exteding the date.
    CALL FUNCTION 'BAPI_USER_CHANGE'
        EXPORTING
          username   = us_username
          logondata  = e_bapilogond
          logondatax = e_bapilogondx
        TABLES
          return     = i_return.
    u need to pass date and correspoing flag also.
    For extension of the date by months u can use this FM.
          CALL FUNCTION 'MONTH_PLUS_DETERMINE'
            EXPORTING
              months  = 6 or 12 ( depending up on ur logic)
              olddate = sy-datum
            IMPORTING
              newdate = us_expdate.
    Thanks and regards.
    Sham

  • SQL select Statement -first day and last day of the month - 1 year from now

    Hi,
    I need to write a SQL to get the dates in between first day and last day of the month one year from now.
    SELECT last_day(add_months(sysdate,12)) as lastday from dual
    What could be the Query to get the first day of the month one year from now..
    ie ..Sysdate - 3-DEC-2009
    Result - 1-DEC-2010
    thank you

    Hi,
    You can use TRUNC with 2 arguments to get the first DATE in a month, year, quarter, week, hour, minute, ISO year, ...
    SELECT  TRUNC ( ADD_MONTHS ( SYSDATE
                               , 12
                  , 'MONTH'
                  )     AS first_of_month
    FROM    dual
    ;The DATE returned will be in the same month, year, quearter, ... as the first argument.
    \We convered the last day of the month in [your previous question|http://forums.oracle.com/forums/message.jspa?messageID=3942939#3942939].
    At that time, I warded about using LAST_DAY as a cutoff point; TRUNC is a much better way.
    For example, to find all appointment_dates in the current month next year:
    SELECT  *
    FROM    appointments
    WHERE   appointment_date >= TRUNC (ADD_MONTHS (SYSDATE, 12), 'MONTH')
    AND     appointment_date <  TRUNC (ADD_MONTHS (SYSDATE, 13), 'MONTH')Note that
    the first part of the WHERE clause calls for dates on or equal to the beginning of the 12th month in the future, but
    the second part of the WHERE clause calls for dates before, not equal to , the beginning of the 13th month in the future.

  • Materialstocks for last years

    hi guys,
    I have used the 2LIS_03_BX (Stock Initialization for Inventory Management  
    ) and 2LIS_03_BF (Goods Movements From Inventory Management). When I reviews my queries,
    the Goods Movements are ok.
    I have loaded the data into BW today as written in Whitepaper (How to handle inventory manag...) and "Total quantity stock"
    is also ok. The problem is
    that I can't validate the Stocks for last years. I use the transaction MB5B in R3 and I enter
    the selection date for ex. 30.11.2005 for particular Material and Plant (Stock type is valuated stock).
    I see 5000 PC as stock/value on 01.01.0000, so called "opening stock" which I can't see on BW-Side.
    I use Entry Variables for Fiscal year/Period in the query.
    Which Keyfigure I should use to validate stocks for last years?
    How I can view the stocks for last years in BW and compare it with R3 TR MB5B?
    Thanks for assistance.
    Regards,
    Moha
    [email protected]

    For last one month I am facing problem in watching online videos on my iPod touch. It is not opening or can say loading the online videos. Earlier it used to be work absolutely fine. Any solution for my problem.

  • I bought adobe CS6 design standard (CD) last year in the month of july and didn't active my product yet. I bought in from the University of Washington, Seattle store on a student and teacher licensing. I am a Mac user and I don't have cd drive in my compu

    I bought adobe CS6 design standard (CD) last year in the month of july and didn't active my product yet. I bought in from the University of Washington, Seattle store on a student and teacher licensing. I have the product code with me. I am a Mac user and I don't have cd drive in my computer and I am indeed to get this product activated now. How can I install this without cd drive?  Anyone please help me with this issue?

    You may download the product from
    http://helpx.adobe.com/x-productkb/policy-pricing/cs6-product-downloads.html

  • I bought iphone 5 in september last year and the whatsapp which I installed was free of cost.The number which I used is the one I was using in my android phone and validity for its expiring in april but for other users its lifetime free.how can I get it ?

    I bought iphone 5 in september last year and the whatsapp which I installed was free of cost.The number which I used is the one I was using in my android phone and validity for its expiring in april but for other iphone users its lifetime free.how can I get the lifetime free validity?

    kratigupta wrote:
    how can I get the lifetime free validity?
    Huh? AFAIK, such does not exist. Read here:
    http://www.whatsapp.com/faq/general/23014681

Maybe you are looking for