Getting result for current date

Hi,
I have a problem on getting the following result
CO_ID   RECEIVE SHIP_OUT ONHAND OPENING DATE            GR_ID   COMPONENT_NAME
100     0     0      9     9     24-JUN-09     234     Paper
200     8     0      8     0     25-JUN-09     123     Plastic Bag
100     10     0      19     9     25-JUN-09     234     Paper
200     0     0      8     8     26-JUN-09     123     Plastic Bag
100     0     0      19     19     26-JUN-09     234     Paperwith this, it doesn't add a new result on tomorrow record, and today record also not correct. Help me pls....
PROCEDURE Inv_Rec IS     
          dToDate          DATE := TO_DATE(SYSDATE, 'DD-MON-YY');
                dLoopDay     DATE := TO_DATE(SYSDATE - 1, 'DD-MON-YY');
                rDayBeforeInvRec      Inventory%ROWTYPE;
          rInDateInvRec           Inventory%ROWTYPE;
          fInDateOnHandQty    FLOAT;
          fInDateOpeningQty FLOAT;
                fBForeDateOpeningQty  FLOAT;
                fBForeDateOnHandQty   FLOAT;
          nComponentId     NUMBER(25);
          vCompDept     VARCHAR2(20);
          vCompName     VARCHAR2(80);
          vWasteType     VARCHAR2(2);
          nGroupId     NUMBER(25);
          vComponentName     VARCHAR2(80);
    CURSOR Day_Before_Inv_Bal IS
               SELECT * FROM inventory
               WHERE date = dLoopDay;
          CURSOR InDate_Rec_Exist IS
               SELECT * FROM inventory
               WHERE date = dToDate
               AND co_id = nComponentId
               AND gr_id = nGroupId
               AND component_name = vComponentName;
     BEGIN
          WHILE dLoopDay <= dToDate + 1
          LOOP
                    OPEN Day_Before_Inv_Bal;
               LOOP
                    FETCH Day_Before_Inv_Bal INTO rDayBeforeInvRec;
                    nComponentId     := rDayBeforeInvRec.co_id;
                    nGroupId     := rDayBeforeInvRec.gr_id;
                    vComponentName     := rDayBeforeInvRec.component_name;
        fBForeDateOnHandQty := rDayBeforeInvRec.opening +
                rDayBeforeInvRec.receive - rDayBeforeInvRec.ship_out;
            UPDATE inventory SET
                                   ONHAND  = fBForeDateOnHandQty                         
                              WHERE date = dLoopDay
                              AND co_id = nComponentId
                              AND gr_id = nGroupId
                              AND component_name = vComponentName;
                    OPEN InDate_Rec_Exist;
                         FETCH InDate_Rec_Exist INTO rInDateInvRec;
                         IF InDate_Rec_Exist%FOUND THEN
                              fInDateOpeningQty := fBForeDateOnHandQty;
                              fInDateOnHandQty      := fBForeDateOnHandQty + rInDateInvRec.onhand
            - rInDateInvRec.ship_out;
                              UPDATE inventory SET
                                   OPENING = fInDateOpeningQty,
                                   ONHAND  = fInDateOnHandQty                              
                              WHERE date = dloopday + 1
                              AND co_id = nComponentId
                              AND gr_id = nGroupId
                              AND component_name = vComponentName;                              
                         ELSE          
                                   fInDateOpeningQty := rDayBeforeInvRec.wwin_onhand;
                                   fInDateOnHandQty      := rDayBeforeInvRec.wwin_onhand;
                                   INSERT INTO wste_waste_inventory (
                                        CO_ID,
                                        RECEIVE,
                                        SHIP_OUT,
                                        ONHAND,
                                        OPENING,
                                        DATE,
                                        GR_ID,
                                        COMPONENT_NAME )
                                   VALUES (
                                        nComponentId,
                                        0,
                                        0,
                                        fInDateOpeningQty,
                                        fInDateOnHandQty,
                                        dToDate,
                                        nGroupId,
                                        vComponentName );     
                         END IF;               
                    CLOSE InDate_Rec_Exist;
        EXIT WHEN Day_Before_Inv_Bal%NOTFOUND;
          END LOOP;
        CLOSE Day_Before_Inv_Bal;
      COMMIT;
      dLoopDay := dLoopDay + 1;
          END LOOP;
     COMMIT;     
     END Inv_Rec;Edited by: newBJeat on Jun 25, 2009 1:28 AM

You want:
TRUNC(sysdate)if you don't want the time element of a DATE variable.
When you to_date something that's already a date, you introduce a bug, as it forces some implicit conversions:
eg:
to_date(sysdate, 'dd/mm/yyyy')becomes
to_date(to_char(sysdate, <default nls_date_format parameter>), 'dd/mm/yyyy')If your default nls_date_format parameter happens to match the format mask you specify, then you're lucky and the code will work. However, someone with a different format will have an error.
Don't EVER to_date something that's already a date.

Similar Messages

  • Dynamic Date Calculation for Current Date - 1

    I am trying to create a variant with a dynamic date calculation attribute.
    I am following the instructions as they are posted to the web but I get an error message.
    I want to get all data EQ to the current date -1
    In the object for selection screen I enter a D for Selection Variable, for Name of Variable I enter an I to include specific values and the option EQ for current date +/- ??? days.  Then I enter 1- for the number of days.  I have tried to enter this many times and in many ways but it doesn't work.  I keep getting this message "lower limit of interval is greater than upper limit"

    Hi,
    Welcome to SDN.
    Selection-screen has four values -
    SIGN
    OPTION
    LOW
    HIGH
    Pass your date value in the option low for the screen.
    Sign you have already pass as I and option as EQ.
    Regard,
    Amit
    Reward all helpful replies.
    Can you paste your code here.
    Message was edited by:
            Amit Khare

  • Create a formula variable using replacement path for current date

    Hi All,
    I created a formula variable using replacement path for current date.
    But when i used this variable am getting an error message saying .
    " This Variable cannot be used in this query".
    Could you please let me know the reason?
    Thanks,
    Zehra

    Hi All,
    Thanks for all your help...
    I just found a solution via the below link
    in Bex Formula variabel, Current calander day(sap exit) missing.
    Here he is trying to use the existing formula variable.
    My doubt here is, Even i could not find this varaible in BEX formula variable, But could see this in BI Content path as mentioned in the above link.  DO i have to transport this varaible , or i simply can activate it in production?
    I just could find this in BI Content but not in MetaData Repository.
    Thanks,
    Zehra

  • How to get list of orders for current date.

    Hi,
    My requirement is to get list of orders for the date on which order was created such that I don't have to change the date in my application.
    Every time I run my application it should generate orders created on that current date without manually giving current date.
    This has to be done directly using BAPI and without creating a RFC. 
    I tried with bapi " BAPI_ALM_ORDERHEAD_GET_LIST " using parameter OPTIONS_FOR_START_DATE  but there I can't enter sy-datum and hence, every time I hence to change the date.
    Please tell me if there is any possible way to get fulfil above requirement.
    Thanks.
    Shilpi Agarwal.

    Hi Shilpi,
    This looks simple to me.
    Just create a variant in IW38 with U_your UserId as shown in the picture (Dynamic date selection for Created On set to Current Date)
    The status settings obviously would be
    Jogeswara Rao K

  • CUIC 9.1.1 Report scheduling issue - getting data only for current date

    Hi,
    CUIC : 9.1.1
    ICM: 9.0.3
    Description:We have CUIC publisher and Subscriber deployed in Cisco UCS C series server. When we schedule a report in Subscriber, we are getting data of current date even we schedule for old dates. Eg. If I schedule a report for yesterday, getting output as today's data. This is applicable for all the historical reports.
    There is no such issue in Publisher.
    Regards,
    Alag

    Try this...
    {TableName.DateField} < DateAdd("d", -2, CurrentDate)
    HTH,
    Jason

  • Use FI Posting date as a filter value, can I get YTD for current year?

    Dear Expert,
    I work on a BI report which calculate the YTD key figure (restricted by 0CYEAR and =< 0CMONTH).
    One of the requirement for the report is to allow user to enter a value for a date using FI Posting date (although this is optional).
    Without entering the value for FI Posting date, my report works fine.
    But once FI Posting date is entered, no data found.
    I expect that when the value for the FI Posting date is entered, the YTD value will be calcuated starting from the Jan 1 of that FI Posting year to the FI Posting date entered.
    But this seems not happen.
    Could you help me to resolve this problem?
    If there is a better solution, please let me know.
    Very appreciated.
    Arthur

    Hi Dipika,
    Thanks for your reply.
    In my report, FI Posting date is a free characteristic, which user can optionally select it and fiter it for a specific FI Posting Date. Do you consider it as a global filter?
    my query structure is as below:
    rows: profit center, department, manager
    columns: YTD for current year, YTD for Previous year, the difference betwwen the two
    The requirement is when user enter a FI Posting date, use it  to restrict the KF shown above.
    For example, if the FI posting date is March 15, 2008, then YTD for current year should be restricted by the period between Jan 1, 2008 and March 15, 2008 and YTD for previous year should be restricted by Jan 1, 2007 and March 15, 2007.
    Do you have any idea how to implement this requirement in term of FI Posting date?
    Thanks and appreciated.
    Arthur

  • Date rule for current date

    Hi.
    I have a date type for which I would like to fill DATE FROM field with current date, but the field DATE TO should stay empty for manual entry.
    I defined the following rule which I assigned to my date type but the problem with this rule is that it fills both fields (date from and date to) with current date.
    <?xml version="1.0"?>
    <TimeRule>
       <TimeRuleSource>
          <ruleline>
             <AssignTimeExp displaytype="AssignTime">
                <VarTimeExp displayType="VarTime"
                            name="RESULT"
                            position="F">
                </VarTimeExp>
                <ConstLocTimeExp displaytype="ConstLocTime"
                              date="now"
                              time="000000"
                              timeunit="DAY">
                   <VarObjectExp displaytype="VarObject" name="SYSTEM"/>
                </ConstLocTimeExp>
             </AssignTimeExp>
          </ruleline>
       </TimeRuleSource>
    </TimeRule>

    solved by other way

  • Odd Date for Current Date and Time

    I am modifying a column in a list to get current date and time using =TODAY()+NOW() in the calculated field and get a time that is behind by 1 hour but the date is 4 months 114 years ahead (2128). How can I fix this field?

    http://sharepointsolutions.com/sharepoint-help/blog/2011/04/how-to-add-and-subtract-hours-and-minutes-from-date-and-time-fields-in-sharepoint-lists/

  • How to get Client(browser) current date/time in BIP report

    Hi,
    I need to display report generated date in BIP report and this should be client(browser) current date/time. I tried the following things.
    1. have used MS Word Native Date/time using Insert->Date/Time. And we have chosen the M/d/yyyy h:mm:ss am/pm format. but it is printing BIp server date/time, not client date/time.
    2. <?xdofx:sysdate?>, <?xdoxslt:sysdate_as_xsdformat()?> and <?format-date:xdoxslt:sysdate_as_xsdformat();'SHORT_TIME'?> are giving GMT Date/Time, but we need client Date/Time.
    3.<?xdoxslt:sysdate('DD-MON-YYYY HH12:mi:ss')?> is giving the system date/time of the machine where BIP server is installed.
    Could you provide some help in this??
    Thanks
    Hari

    Hello, Hari,
    what would return something like this:
    Execution date:
    <?xdoxslt:current_date('ja-JP', 'Asia/Tokyo')?>
    <?xdoxslt:current_time('ja-JP', 'Asia/Tokyo')?>
    @Vetsrini,
    for my opinion,
    in the countries where time is switching (winter/summer) using the hard coded time zones in the format-date() cause a problem:
    for example:
    if we enter the date in date prompt in summer it will return PM_DT = 2010-07-20T00:00:00.000+04:00
    in winter 2010-07-20T00:00:00.000+03:00, so,
    using <?format-date:PM_DT;'DD.MM.YYYY';'GMT+3'?> return 2010-07-20 in winter and 2010-07-19 in summer.
    regards,
    Eldar A.

  • Displaying Graph for current date

    Hi,
    I want to pass a dynamic value to display graph. Let say I want to display graph for the current date, so that whenever user opens the web page, he sees the data for the current date. Can anyone suggest any solution for this.
    Regards.

    solved by other way

  • Script for current date

    I have a document javascript that used to work. It prints the current date upon first opening the PDF into a field called Today. Thereafter, the date does not change no matter how many more times the PDF is opened.
    var f = this.getField("Today");
    if (f.value == "") f.value = util.printd("mm/dd/yyyy", new Date());
    I'm using Acrobat 9 Pro, and for some reason this script no longer works in version 9. If anyone can assist to correct this sript, I would greatly appreciate it.

    It works fine for me in Acrobat 9.2.0 (under Windows 7). If the field is empty when the form opens, it inserts the current date. If the field is not empty, it does not do anything.
    Are you absolutely sure that the field 'Today' is empty when you open the PDF?

  • Change pointer report scheduling for current dat

    Hi Gurus
    I want to schedule change pointer report RBDMIDOC from current date .
    But i want that This report genrate idoc only for today's changes not for older days.
    Any way to set the Sy-date in Variant??
    or any other idea ..pls suggest.
    Thanks
    SA

    tk

  • To get output for latest date

    hi
    i have this query with me
    SELECT t1.phnum AS phone, t2.email AS emailid, t2.pin AS pin, t1.lang AS lang
      FROM cust_profile t1, profile_set t2, user_login t3
    WHERE t2.email IS NOT NULL
       AND t1.phnum = t2.phnum
       AND t1.phnum = t3.phnum
       AND t3.devicetype = 2
       AND EXISTS (
              SELECT dtn
                FROM div_call_log
               WHERE (MOD ((TRUNC (SYSDATE) - TRUNC (callstart)), 7) = 0)
                 AND callstart < SYSDATE - 7
                 AND dtn = t1.phnumi want to get output only for the latest callstart date ,now its showing output corresponding to earlier dates not latest date
    how to use max (callstart) in the where clause
    kindly guide me

    Hi
    thank you for the quick response
    dtn     callstart
    97845857     04/06/2011 19:24:09
    97845857     05/18/2011 13:38:54
    97845857     06/15/2011 07:49:59
    97845857     06/22/2011 11:16:09
    97845857     06/22/2011 11:19:14
    97845857     06/22/2011 09:31:48
    97845857     06/22/2011 10:17:13
    97845857     08/03/2011 17:49:36
    97845857     08/03/2011 17:51:30
    97845857     08/03/2011 18:22:37
    97845857     08/03/2011 18:23:31
    97845857     08/03/2011 18:24:23
    97845857     08/03/2011 18:26:28
    97845857     08/03/2011 18:40:53
    97845857     08/10/2011 11:42:58
    97845857     03/30/2011 19:51:05
    97845857     05/18/2011 09:11:38
    97845857     06/22/2011 11:21:24
    97845857     05/18/2011 13:21:53
    97845857     08/03/2011 17:46:11
    97845857     08/03/2011 17:47:13
    97845857     08/03/2011 18:03:49
    97845857     08/03/2011 18:28:06
    97845857     04/20/2011 14:09:32
    97845857     04/27/2011 10:23:55
    97845857     03/16/2011 07:20:19
    97845857     03/30/2011 12:32:06
    97845857     08/03/2011 17:45:21
    97845857     08/03/2011 18:25:11
    97845857     08/03/2011 18:30:17
    97845857     04/20/2011 14:08:32
    97845857     03/30/2011 12:32:46
    97845857     03/30/2011 19:52:11
    97845857     03/16/2011 07:16:32
    97845857     09/07/2011 12:09:58
    97845857     09/07/2011 16:07:33
    97845857     09/07/2011 16:10:44
    97845857     09/21/2011 18:10:39
    97845857     09/07/2011 17:08:46
    97845857     09/14/2011 20:33:45
    97845857     10/05/2011 18:02:11this is the data in div_call_log table , I want the latest value of callstart from this table corresponding to the phone number, but always i am getting the first value(04/06/2011 ) as callstart
    kindly guide
    thanking in advance
    Edited by: makdutakdu on Jan 25, 2012 9:41 AM
    Edited by: makdutakdu on Jan 25, 2012 9:43 AM

  • How to schedule RBDMIDOC for current date

    Hi Gurus
    Require your suggestion....
    In my system i have 2000 material but which is created few  month before.
    But i want to send Material using change pointer which i created today only not all
    How to schedule RBDMIDOC program as this report has no Data option.
    Pls suggest ....or i need to do some developlement
    rgd
    SA

    RBDMIDOC report will process all change pointers.
    If you do not want to process old change pointers, you can delete them using tcode BD22. You would need to uncheck test mode, and check "obsolete change pointers" option.
    After this, schedule the report to run daily so that new change pointers will get processed on same day.

  • JMF: getting player for current service question

    On interactivetvweb.org I found something like this:
    // Get a reference to the JavaTV ServiceContextFactory
    ServiceContextFactory factory;
    factory = ServiceContextFactory.getInstance();
    // From this, we can get a reference to the parent
    // service context of our Xlet.  To do this, we need a
    // reference to our Xlet context.  It's times like this
    // that show why your application should always keep a
    // reference to its Xlet context
    ServiceContext myContext;
    myContext = factory.getServiceContext(myXletContext);
    // ServiceContentHandler objects are responsible for
    // presenting the different parts of the service.  This
    // includes the media components
    ServiceContentHandler[] handlers;
    handlers = myContext.getServiceContentHandlers();
    for(int i=0; i < handlers.length ; i++) {
      if (handlers[i] instanceof ServiceMediaHandler) {
        // This is a Player for part of the service, since
        // ServiceMediaHandler objects are instances of JMF
        // Player objects
       //   so I guess here i can do something like:
        Player p = (Player) handlers;
    p.start();
    break;
    But do I have to do something like
    myContext.select(s);before getting service content handlers (where s is an instance of Service)? Because I don't quite understand idea of getting player from context.

    Dear stevem,
    Thanks for your apply. It is useful for me. The another question about this issue is, if the number of service context is at least the same as the number of tuner, I suppose that means the ServiceContext.select(new Service) can only select the another service in the same transport stream. Is my assumption is correct?? If so, if the ap want to select the new service in another ts, the ap should call the tunning api, then it can call the select() to select ap's desired service. it's right? ^^ If my assumption is false, could you share me the correct using flow ^^ ? Thx a lot~
    Happy new year! ^^

Maybe you are looking for