How to fetch data based on dates ?

How do i write the query for the below statements ?
1) net_bank_cr from rm_memorandum for the previous year end 31st March
2) net_bank_cr from rm_memorandum for the as on date
3) net_bank_cr from rm_memorandum as one year prior to current reporting date
The table structure of rm_memorandum is as given below:
create table RM_MEMO
AS_ON_DT DATE,
PAID_CAPITAL NUMBER(20,2),
TOTAL_OBE NUMBER(20,2),
CR_EQI_OBE NUMBER(20,2),
NET_BANK_CR NUMBER(20,2),
ADJ_NET_BANK_CR NUMBER(20,2),
DEP_CURREMT_CRR NUMBER(20,2),
LIAB_OTH_CRR NUMBER(20,2),
TOTAL_CRR NUMBER(20,2)
)

The following result includes all rows for the previous financial year relative to the current date.
SQL> with t as
  2  (
  3    select to_date('31/12/2010', 'dd/mm/yyyy') As_On_Dt, 205 Net_bank_CR from dual union all
  4    select to_date('15/03/2011', 'dd/mm/yyyy'), 205  from dual union all
  5    select to_date('15/03/2011', 'dd/mm/yyyy'), 666  from dual union all
  6    select to_date('31/03/2011', 'dd/mm/yyyy'), 9856 from dual union all
  7    select to_date('31/03/2011', 'dd/mm/yyyy'), 521  from dual union all
  8    select to_date('05/04/2011', 'dd/mm/yyyy'), 20   from dual union all
  9    select to_date('07/05/2011', 'dd/mm/yyyy'), 965  from dual
10  )
11  --
12  select *
13  from t
14  where  t.As_On_Dt between (case
15                              when ( sysdate >  add_months(trunc(t.As_On_Dt, 'YYYY'), 3) - 1 ) then
16                                add_months(trunc(add_months(sysdate, -12), 'YYYY'), 3) - 1
17                              when ( sysdate <= add_months(trunc(t.As_On_Dt, 'YYYY'), 3) - 1 ) then
18                                add_months(trunc(add_months(sysdate, -24), 'YYYY'), 3) - 1
19                            end) + 1 -- plus 1 to ensure it is the 1st Apr
20                     and
21                            case
22                             when ( sysdate >  add_months(trunc(t.As_On_Dt, 'YYYY'), 3) - 1 ) then
23                               add_months(trunc(sysdate, 'YYYY'), 3) - 1
24                             when ( sysdate <= add_months(trunc(t.As_On_Dt, 'YYYY'), 3) - 1 ) then
25                               add_months(trunc(add_months(sysdate, -12), 'YYYY'), 3) - 1
26                            end
27  /
AS_ON_DT  NET_BANK_CR
31-DEC-10         205
15-MAR-11         205
15-MAR-11         666
31-MAR-11        9856
31-MAR-11         521Edited by: bluefrog on Sep 7, 2011 1:35 PM Ensure it is the 1st of Apr as the first date, hence add 1

Similar Messages

  • How to fetch the Table Control data to Customer Table(Z-Table) ?

    How to fetch the Table Control data to Customer Table(Z-Table) ?

    Hi Krishna,
    Check this sample programs
    http://www.planetsap.com/online_pgm_main_page.htm
    http://sap.niraj.tripod.com/id29.html
    http://www.sapdevelopment.co.uk/dialog/tabcontrol/tc_basic.htm
    Have a look at below links. It will help you.
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac5135c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/content.htm
    Thanks,
    Reward If helpful.

  • How to fetch post goods issue date and sales order creation date

    Hi All,
    How to find out the difference between SD Sales Order Item Creation Date and final Post goods issue Date. I would like to know how to fetch those dates and what is the relationship between the tables from which i will get the dates.
    Please let me know the solution .
    Thanks in advance.

    Hi,
    Sales order creation date is when u raise a sales order in favor of the customer using VA01.......using ATP logic system purposes the material availability date....
    after saving ur sales order...when u raise the Delivery using VL01n  w.r.t to OR...than u have to perform picking ....In the picking Tab...specify the amount to be picked than press Post Good Issue....means the goods left the company premises ..
    You can the fetch the values using tables-  Use T code   SE12  or SE16
    Vbak-----order header
    Vbap-----order item
    Vbek-----order schedule line
    Likp-----Delivery header
    Lips----Delivery item

  • Process Chain - How to make decision based on data in PSA and execute DTP

    Need to create process in Process Chain, which will execute the DTP based on data in PSA.
    Say we have two DSO A & B, both getting data from same datasource.
    In process chain, we need to read data in one of the date field in PSA and make a decision, which DTP to get execute in process chain.
    Say if date field contains year = 2000, than load to DSO A, if year is 2001, load data to DSO B.
    Suggest the solution. ...

    Hi,
    Tyr this steps.
    1) Develop ABAP process types
    ABAP report to read PSA data using function module
    Trigger events based on year
                           event1 -> for even year data
                           event2 -> for add year data
    2) Develop local process chains for each DTPs and schdule it with events mentioned above.
    Do reply with comments.

  • How to group data based on date

    In my program the internal table is returning several values based on date.
    for example for the first pernr in the image below  there are four records. i need to delete the first record which is between the dates 20 and 30 .
    and also i need to get the difference between the dates as the record 23 and 28  i need to get separate dates as 24, 25..28.

    I am not sure if I understood your question correctly.
    From what I have understood, you can use the following logic.
    This logic will move all the records from lt_fields2 to another table lt_fields1 with begda between 20 and 30 of any month, except for the first record. It will also move records for every date between begda and endda of each record.
    You can alter the logic based on your exact requirement.
    declare another table lt_fields1 like lt_fields2.
    data del_flag.
    data prev_month(2) type c.
    sort lt_fields by pernr begda.
    clear del_flag.
    loop at lt_fields2 into wa_fields where begda+6(2) GE 20.
    * Delete the first record having date greater than 20 in a month for each pernr.
       at new pernr.
            clear del_flag.
       endat.
       if begda+4(2) NE prev_month.
           clear del_flag.
      endif.         
        if del_flag is initial. 
            del_flag = 'X'.
            continue.  " This record will not be moved to the final internal table.
       endif.
    * Add records for each date between begda and endda.
       append wa_fields to lt_fields1.
       prev_month = begda+4(2)
       while wa_fields-begda LT wa_fields-endda.
             wa_fields-begda = wa_fields-begda+1.
             append wa_fields to lt_fields1.
       endwhile.
    endloop.

  • Read data based on date in internal tables

    Hi Abapers,
    In my zreport , i am retreving data from vbrk, vbrp into one internal table ( itab1) and retreiving data from customized table i nto internal table itab2.
    itab1 contains following fields.
    matnr - Material code
    erdat - date ( billing date).
    itab2 contains following fields.
    matnr - material code.
    zfromdate - from date
    ztodate  - to date
    zstprs - material price
    loop at itab1 .
    endloop.
    how to read particular record from itab2 ( which consists of material code with price maintaing with  date range )  based on my billing document date i.e erdat 
    ex: material code     fromdate             todate           price
         10000          01.11.2008     20.11.2008     100.
         10000          21.11.2008     30.11.2008     104
    if for example in itab1 , erdat ( billing doc date is 15.11.2008 ) , how to read first record in itab2 which will fall under that date range.
    please give me any suggestions, or provide sample code.
    regards,
    Hari priya

    Hi,
    Please go in this way
    while selecting fileds from table into itab2
    select in this way
    select * from  <tablename> into tabel itab2 where
      matnr = itab1-matnr and
      zfromdate LE erdat and
      ztodate   GE erdat.
    Loop at itab2.
    read table itab1 with key matnr = itab2-matnr.
    take ur fields into internal table
    endloop.

  • Restrict Query Data based on Date range and Users

    Hi All,
    I have a few web reports that I need do restrict data based on Users.
    In all the queries i have an infoobject 0CALDAY, and  a User Entry range variable on it. Because of performance issues  I need to restrict the range of dates a User can see. Typically most of users could go to a max date range of 1 month back. But some others would need the ability to see data for much bigger range of dates.
    Pls suggest how should i go about with this. Should I have to enforce this at Variable level(user exit).... but then i might have to maintain a table for the users.. Is there any other way of doing it.
    thanks
    Raj

    Any thoughts ?

  • Getting aggregated data based on Date in Webi.

    Hi,
                  I have a requirement to display last 6 Months Receviables Month Wise in Webi. And i am getting data based on clearing Date in Bex query. And data from Bex query will be like
           Month             Measure
         01.01.2014       12
         06.01.2014       15
         15.01.2014       16
        02.02.2014        8
        05.02.2014       10
        12.03.2014        4
        14.03.2014        6
        18.03.2014       10
        21.03.2014        20
        30.03.2014       30
       03.04.2014        30
    And i want aggregated data as
    Month  Measure
    Jan      43
    Feb     18
    Mar     66
    Apr     30

    Hi Satish,
    Have you tried below:
    Create Month1 object as =Month([Month]) and [total]as =Sum([Measure])
    Then drag both Month1 and total objects in report block.
    Regards,
    Yuvraj

  • Problem when sorting data based on date

    I am trying to sort the following data based on the Transaction Receipt date column,unable to do it usi g the following syntax:
    <?sort:TRANSACTION_RECEIPT_DATE;'ascending';data-type='date'?>
    I have problem in converting the date in report to canonical date ,is there any other way to achieve the output without converting the date format.
    <?xml version="1.0"?>
    <!-- Generated by Oracle Reports version 6.0.8.27.0 -->
    <RECDTREP>
    <LIST_G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO104</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>07-APR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1></SNO_ATTRIBUTE1>
    <OBJECT_ID>24636</OBJECT_ID>
    <INITIALIZATION_DATE>07-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863063</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO107</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>07-APR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1></SNO_ATTRIBUTE1>
    <OBJECT_ID>24641</OBJECT_ID>
    <INITIALIZATION_DATE>07-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863068</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO123</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>07-APR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/11 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>24658</OBJECT_ID>
    <INITIALIZATION_DATE>07-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863086</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO75</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>31-MAR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1></SNO_ATTRIBUTE1>
    <OBJECT_ID>22190</OBJECT_ID>
    <INITIALIZATION_DATE>14-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510860842</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>31-Mar-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>971515</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO116</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>25-JUN-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/11 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>64271</OBJECT_ID>
    <INITIALIZATION_DATE>30-JUN-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863077</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>25-Jun-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO92</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>31-MAR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/11 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>22253</OBJECT_ID>
    <INITIALIZATION_DATE>14-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510860890</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>31-Mar-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>971515</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO99</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>31-MAR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1></SNO_ATTRIBUTE1>
    <OBJECT_ID>22263</OBJECT_ID>
    <INITIALIZATION_DATE>14-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510860899</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>31-Mar-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>971515</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO109</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>25-JUN-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1></SNO_ATTRIBUTE1>
    <OBJECT_ID>64204</OBJECT_ID>
    <INITIALIZATION_DATE>30-JUN-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863070</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>25-Jun-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO135</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>25-JUN-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/18 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>64296</OBJECT_ID>
    <INITIALIZATION_DATE>30-JUN-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510875546</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>25-Jun-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO101</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>07-APR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1></SNO_ATTRIBUTE1>
    <OBJECT_ID>24618</OBJECT_ID>
    <INITIALIZATION_DATE>07-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863046</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO120</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>07-APR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/11 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>24653</OBJECT_ID>
    <INITIALIZATION_DATE>07-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863081</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO122</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>07-APR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/11 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>24657</OBJECT_ID>
    <INITIALIZATION_DATE>07-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863085</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO127</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>07-APR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/11 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>24662</OBJECT_ID>
    <INITIALIZATION_DATE>07-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863090</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO100</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>07-APR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1></SNO_ATTRIBUTE1>
    <OBJECT_ID>24585</OBJECT_ID>
    <INITIALIZATION_DATE>07-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863033</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO110</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>25-JUN-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/11 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>64265</OBJECT_ID>
    <INITIALIZATION_DATE>30-JUN-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863071</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>25-Jun-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO130</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>25-JUN-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/13 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>64275</OBJECT_ID>
    <INITIALIZATION_DATE>30-JUN-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510875487</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>25-Jun-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    </LIST_G_ASW_REC_DATE>
    <CF_SORT_BY>Manufacture,Receipt Date,Organization,Item Code</CF_SORT_BY>
    <CF_SERIAL_WHERE></CF_SERIAL_WHERE>
    </RECDTREP>

    HI Mahesh,
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    this is not a date,
    so you should change the query to get you the format in xsd format : YYYY-MM-DDThh:mm:ss+HH:MM
    otherwise, you have to write a custom sort function to decode and order it it.
    if you dont do the custom order and use
    <?sort:TRANSACTION_RECEIPT_DATE;'ascending';data-type='date'?>
    the data will be treated as string and you will see the row is sorted on string.

  • Getting the data based on dates

    Hi All,
    In my application i am not able to retrieve the data from database between two dates.
    while entering the dates i am entring using :
    + "',to_date('+ fromdate+ "','DD-Mon-YYYY HH24:MI:SS'),"
    as in database i have kept my fromdate type as "varchar2"
    So while selecting data i have written the query as :
    String sqlQuery =
                                  "select SID,SERVER_NAME,DOWNTIMETYPE,FROMDATE,TODATE,FROMTIME,TOTIME,TIMETAKEN,DOWN_REASON from SS_UPDOWNTIME where (FROMDATE >='"
    + frmdate
    + "'  OR  (FROMDATE between '"
    + frmdate
    + "' and '"
    + todate
    + "')) ";
    but i am not able to get the data between the two selected dates
    Regards,
    Anupama

    Hi Anupama,
    'between' wont work because you have taken dates as varchar2.
    Just try like this.
    Take "Date" type in database and in java take java.sql.Date
    java.sql.Date sqlDefaultDate = new java.sql.Date(System.currentTimeMillis());
    System.out.println("sqlDate: "+sqlDefaultDate);  
    //  this will be in the format 2008-11-13 , So we can pass sqlDefaultDate variable to backend
    Regards,
    Lakshmi Prasad.

  • How to fetch details based on sales order....

    hi,
    How to fetch all invoice number with corresponding net value,cost then credit and
    debit memo details corresponding to one sales order .
    plz reply.

    HI,
    See the relation b/w sales order table & billing table
    VBAP=VBRLN = VBRP-AUBEL
    VBAP-POSNR = VBRP-AUPOS
    then for fetching the cost & credit debit indicator , use this relationship.
    VBRK-VBELN = BKPF-AWKEY
    BKPF-AWTYP = 'VBRK'
    Reward Points if it is Useful.
    Thanks,
    Manjunath MS

  • Sql query to fetch data based on date conditons

    Hi All,
    We have to schedule a script that runs at 1:00 AM from Monday to Friday.
    The script will run a  sql query  ,that will fetch the data from sql database 2008 based on the below conditions.
    Case 1: If date = current Date then retrieve the data of the previous Date.
    Case 2: If date = Monday then retrieve the entries of Friday ,Saturday and Sunday.
    Please help us on how we can achieve this.
    Thanks

    Hi,
    Are you asking about Patrick's
    solution?
    If so I highly recommend NOT to use this solution. PLease read LMU92's
    and
    Visakh16's responses.
    Why not to use it?
    1. This solution is not deterministic!
    A deterministic algorithm is an algorithm which, given a particular input, will always produce the same output. This solution give different values for different setting! It is depending for example on "SET LANGUAGE" value
    As mentioned above if you try to use any other languge then English then this query will not work since you will never get the value "Sunday"
    2. Moreover! Even if you are using "SET LANGUAGE 'English'" then this
    solution depend on "SET DATEFIRST" and only take into consideration that the value can be 1 or 7, using any other value you will get that @weekendDateMod is null!
    What can you use?
    let's test some value first to get the solution yourself. We know that we don't care about "SET LANGUAGE" since I will not use any language dependency but we need to examine "SET DATEFIRST". Try to change the value from 1 to 7 and check
    the value of this query
    SET DATEFIRST 1 -- Change this value from 1 to 7!
    DECLARE @Sunday DATE = '2014-08-03' -- This is Sunday
    DECLARE @Munday DATE = '2014-08-04' -- This is Munday
    SELECT DATEPART(DW,@Sunday),DATEPART(DW,@Munday), @@DATEFIRST
    Can you see the behavior ?
    The results are hidden here (select the text and you will see them)
    DATEFIRST___Sunday_______Monday
    1___________7___________1
    2___________6___________7
    3___________5___________6
    4___________4___________5
    5___________3___________4
    6___________2___________3
    7___________1___________2
    assuming you did the exercise above yourself, then  you can now think now what is the filter that you need...
    You can use a filter on those two parameters together using "where DATEPART... and @@DATEFIRST...) or using one combine check. Can you think how?
    Notice that this value is always 2 on Monday! Regarding our setting
    (DATEPART(DW,@CurrentDate) + @@DATEFIRST) % 7
    Please Don't Go Down Before YOu Understand!
    Now we can go to the solution
    * I really hope that you read all and did the small exercise yourself! You can not become a developer by copy answers, and this is the reason that from the start I only gave you tha way and not the final query!
    DECLARE @CurrentDate DATE = '2007-08-20' -- This is only for testing since you should use the function GETDATE() instead
    DECLARE @MinDateToFilter DATE
    SET @MinDateToFilter = CASE
    WHEN ((DATEPART(DW,@CurrentDate) + @@DATEFIRST) % 7) = 2 THEN DATEADD(DAY,-4,@CurrentDate)
    ELSE DATEADD(DAY,-1,@CurrentDate)
    END
    SELECT *
    FROM sales.salesOrderHeader
    WHERE orderDate > @MinDateToFilter
    I hope this was useful :-)
    [Personal Site] [Blog] [Facebook]

  • How to make reports based on Data block work on web?

    I am using form 6i and oracle 9ias
    I have successfully call the common reports from the form on the web using run_report_object, then web.show_documnet(..);
    But when it come to the reports based on the data block from the form, it doesn't work. it always fetch all the records from the table which the data block is based
    Anyone can tell me how to make that work?
    thanks

    I have successfully do this when I am running forms and >reports in localhostTell me how did you achieve this?
    Did you have both Reports and Forms running under same oracle home?
    and off course was it a clinet server architecture?
    What version for Form and Reports did you use?
    Which executables did you use and what was your call from forms? When you call from Forms, which Reports executable use to run the report?
    The data integration can only be achive if both the product were running under same Oracle home and were in client server architecture. I do not think data integration is possible in web architecture.
    Thanks
    Rohit (Orcale Reports Team)

  • How to select data based on date range

    Hi all,
    how do I make the following scenario happen:
    I am tracking my sales people's performance from 1/01/00 to 1/01/09, and I want to give $200 bonuses to only those whom made a sale between 1/01/06 to 1/01/08.  I need a formula that captures the sale between 1/01/06 to 1/01/08 and assign a $200 bonus that I can then insert into my report as a field. 
    I've been trying with the "If" "then" functions, and I'm unsure how to incorporate the date field into it. 
    please help!
    Thanks,
    Frank

    Hi Newbie,
    You will have to create the following formula, call it @Bonus and place it in the detail section:
    If {date.field} >= Date(2006,01,01) and
    {date.field} <= Date(2008,01,01) then
    200 else 0
    You can then summarize it however you want.
    I hope this helps,
    Regards,
    Zack H.

  • How to fetch,update,insert the data using database link on diff. servers

    I am using two oracle server.
    1st) Oracle 9i ( Server1 )
    2nd) Oracle 10g ( Server2 )
    3) Forms 6i
    I have created a database link on Server 1 for connecting to Server 2.
    I written a piece of code which will be executed in Forms 6i and is connected to Server1.
    The piece of code brings the data from SErver2 via cursor and I try to insert / update the relevant records
    in my Server1 database users.
    The Insert/Update runs sucessfully but at the time of commit I get the following errors
    in Forms ORA-01041:internal error. hostdef does not exist.
    Then it forcefully rollback the data and come out of the application.
    contact :email-id : [email protected]

    Suggest you test your code from sqlplus before running from forms.
    Start by testing a simple "select sysdate from dual@<database link>;" then test select from application_table@<database link> then test the insert/update code. After it works from sqlplus, then try it from forms.

Maybe you are looking for

  • The apexafterrefresh event not being fired in Chart IR's

    Hi all, I am adding additional functionality to IR reports using the plug-in architecture in Apex 4.1.1. A Dynamic action has been added to the "After Refresh" event for the #apexir_WORKSHEET_REGION jQuery selector. This works fine in all cases excep

  • Updating users profile when infoobject marked as authorization relevant

    Hi All, Consider a scenario where there are some projects in which perticuler infoobject is not authorization relevant but in some upcomming project the same infoobject needs to be authorization relevant.but when i marked this infoobject as authoriza

  • Trouble installing OSX 10.4

    I'm having issues installing 10.4. I'm doing everything correctly (I think...). I hit "upgrade" and it say's "Verifying Installation DVD", then, "Verifying Desination Drive". Then I get (something like) "...please Restart". Has anyone seen this befor

  • Build array efficiency

    Hello, I would like to know, wheather my solution is efficient, or it can be done in a better way. I have a mass spectrometer with a shipped labview driver and example VIs. I want to modify one of the VI. Here the used structure of the spectrum is a

  • Help understanding Oracle Providers

    Hi, I'm using the Oracle Providers in a ASP.NET application and need some help to understand the way the providers works. There is some documentation including code samples and a more detailed explanation about de relationship of the providers and it