Check a number range with date range.

i have table test which is having column
Start Range
End Range
Start Date
End date
how can i check start range and end range does not exists b/w existing record also with date range of this record.
end date can be blank also.

990690 wrote:
i have table test which is having column
Start Range
End Range
Start Date
End date
how can i check start range and end range does not exists b/w existing record also with date range of this record.
end date can be blank also.Your question makes absolutely no sense whatsoever. We could make guesses, but then we may be wrong in our guesses.
Please provide sufficient details for people to be able to help you. Read the FAQ: {message:id=9360002}

Similar Messages

  • MDX Filter with date range

    Hi,
    my requirement is to create a calculated member to calculate Total unique customers who has sales > 0 within the date range.
    Below mdx works normally with single date
    DistinctCount(FILTER([Customer_Sales].[Outlet ID].[Outlet ID].members,
    ([Measures].[distribution],
    [Date].[CalendarWeek].CurrentMember
    )=1))
    I'm looking for something like below with date range,
    DistinctCount(FILTER([Customer_Sales].[Outlet ID].[Outlet ID].members,
    ([Measures].[distribution],
    WTD([Date].[CalendarWeek].CurrentMember
    ))=1))
    Above MDX fails with the error: String of numeric expression expected, Tuple set expression was used.
    Appreciate your immediate response.
    Thanks in advance

    Hi Chandima,
    Thanks for the response.
    I tried your code, it works but the results are not correct.  As per manual calculations, there are 28 unique customers who has positive sales on Week to date (2014-11-03), but result shows only 19.
    For the first day of week (2014-11-01), there are 9 unique customers, which is correct. But for the following days it is not giving correct result.
    Further, performance of this approach is very poor
    Thanks,

  • SUMIFS with Date Range and Condition

    Hi, I have search in the forums and read the online numbers guide but can't seem to get the formular working in Numbers.
    I want to sum up a column of durations, if they are in between 2 dates and meet the condition to belong to one project. I have the following table:
    project
    total duration
    project
    start
    end
    duration
    date range start
    date range end
    one
    0
    one
    02.01.2013
    02.01.2013
    15:30
    01.01.2013
    31.01.2013
    two
    0
    one
    03.01.2013
    03.01.2013
    15:30
    three
    two
    04.01.2013
    04.01.2013
    15:30
    four
    two
    05.01.2013
    05.01.2013
    15:30
    five
    three
    06.01.2013
    06.01.2013
    15:30
    six
    three
    07.01.2013
    07.01.2013
    15:30
    seven
    three
    08.01.2013
    08.01.2013
    15:30
    I have the following formular but it does not give me any value: =SUMIFS(F,C,A5,D"≥"$G$2,E"≤"$H$2)
    What am I doing wrong
    Thank you for your help.

    Hi Barry,
    thank you very much for your detailed reply.
    The first difference I spot is that my duration is in hours:minutes 00:00 but this should not make a difference, right? I attach you here some sample data:
    Project
    Start date
    Start time
    End date
    End time
    Duration
    Project 1
    07.01.2013
    11:00
    07.01.2013
    11:42
    00:42
    PINC: 1
    07.01.2013
    16:11
    07.01.2013
    17:11
    01:00
    Theatro
    07.01.2013
    19:50
    07.01.2013
    19:54
    00:03
    Project 3
    08.01.2013
    11:19
    08.01.2013
    13:30
    02:11
    Project 1
    09.01.2013
    12:32
    09.01.2013
    13:02
    00:30
    PINC: 1
    09.01.2013
    17:55
    09.01.2013
    18:29
    00:34
    Project 3
    09.01.2013
    18:29
    09.01.2013
    19:36
    01:06
    And I will go through my formular again and check if everything is correct.
    Many greets, Andreas

  • Stock report with date range

    Hi Experts.
    Material stock report (unrestricted, blocked, quality) with in date range.
    getting information in T-CODE:  MB52 but not in date range.
    In mard table i did't find the date for unrestricted, blocked and quality.
    from where can i get that information and how should i link all
    Need a psudo code for it.
    If any one worked on this kind of object plz send me the code.
    Points assured..
    Regards..
    Ravi Reddy.

    Hi
    Check this sample code hope it will helpfull for you
    *DATA: ED TYPE F.
    DATA : ED(15) TYPE N .
    TABLES: EKKO, EKBE, EKPO, KONH , KONV ,LFA1 ,ESLL.
    TYPE-POOLS: SLIS.
    DATA: val1  like konh-vakey.
    Data:GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
         G_REPID LIKE SY-REPID,
         G_GRID_TITLE TYPE LVC_TITLE.
    Data:G_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
    DATA:G_TABNAME TYPE SLIS_TABNAME VALUE 'ITAB1',
    G_SAVE .
    DATA:GS_VARIANT LIKE DISVARIANT.
    DATA:LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA:GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
         G_SAVE = 'A'.
    DATA: BEGIN OF ITAB OCCURS 10,
              EBELN LIKE EKKO-EBELN,
    *          LIFNR  like p_vendor,
              LIFNR LIKE EKKO-LIFNR,
              NAME1 LIKE LFA1-NAME1,
              NAME2 LIKE LFA1-NAME2,
    *          EBELP LIKE EKBE-EBELP,
              BELNR LIKE EKBE-BELNR,
              VGABE LIKE EKBE-VGABE,
              GJAHR LIKE EKBE-GJAHR,
              KNUMV LIKE EKKO-KNUMV,
              EKORG LIKE EKKO-EKORG,
              BEDAT LIKE EKKO-BEDAT,
    *          VAKEY LIKE KONH-VAKEY,
         END OF ITAB.
    DATA: BEGIN OF ITAB1 OCCURS 10,
              NAME1 LIKE LFA1-NAME1,
              NAME2 LIKE LFA1-NAME2,
              EBELN LIKE EKPO-EBELN,
              LIFNR LIKE EKKO-LIFNR,
              EBELP LIKE EKPO-EBELP,
    *          EBELP LIKE EKBE-EBELP,
              KNUMH LIKE KONH-KNUMH,
              BELNR LIKE EKBE-BELNR,
              MATNR LIKE EKPO-MATNR,
              TXZ01 LIKE EKPO-TXZ01,
              PS_PSP_PNR LIKE EKKN-PS_PSP_PNR,
              EXTROW LIKE ESLL-EXTROW,
              SRVPOS LIKE ESLL-SRVPOS,
              KTEXT1 LIKE ESLL-KTEXT1,
              KOSTL LIKE EKKN-KOSTL,
              NETPR LIKE EKPO-NETPR,
              NETWR LIKE EKPO-NETWR,
              ED1  TYPE p decimals 2,
              KBETR2 LIKE KONV-KBETR,
              KBETR1 LIKE KONV-KBETR,
              KBETR LIKE KONV-KBETR,
    *          KBETR3 LIKE KONV-KBETR,
              KWERT LIKE KONV-KWERT, " THIS IS FOR FREIGHT
              KWERT1 LIKE KONV-KWERT, " THIS IS FOR PBXX OR PB00
              KWERT2 LIKE KONV-KWERT, " THIS FOR OTHER CONDITION
              MENGE LIKE EKPO-MENGE,
    *          TOTAL(15) type  .
              TOTAL TYPE p decimals 2,
              VAKEY LIKE KONH-VAKEY,
              WERKS LIKE EKPO-WERKS,
              MWSKZ LIKE EKPO-MWSKZ,
              PACKNO LIKE EKPO-PACKNO,
              KNUMV LIKE KONV-KNUMV,
              SUB_PACKNO LIKE ESLL-SUB_PACKNO,
              GJAHR LIKE RSEG-GJAHR,
          END OF ITAB1.
    DATA: BEGIN OF ITAB2 OCCURS 10,
             EBELN LIKE EKKN-EBELN,
             EBELP LIKE EKKN-EBELP,
             PS_PSP_PNR LIKE EKKN-PS_PSP_PNR,
             KOSTL      LIKE EKKN-KOSTL,
          END OF ITAB2.
    data: begin of itab3 occurs 10,
            KNUMH LIKE KONH-KNUMH,
            KSCHL LIKE KONH-KSCHL,
         end of itab3.
    data: begin of itab4 occurs 10,
            KBETR LIKE KONP-KBETR,
          end of itab4.
    data: begin of itab5 occurs 10,
            KPOSN LIKE KONV-KPOSN,
            KNUMV LIKE KONV-KNUMV,
            KSCHL LIKE KONV-KSCHL,
            KBETR LIKE KONV-KBETR,
            KWERT LIKE KONV-KWERT, " THIS IS FOR FREIGHT
    *          KAWRT LIKE KONV-KAWRT,
         end of itab5.
    DATA: BEGIN OF ITAB6 OCCURS 10,
    *          PACKNO LIKE EKPO-PACKNO,
              SUB_PACKNO LIKE ESLL-SUB_PACKNO,
            END OF ITAB6.
    DATA: BEGIN OF ITAB7 OCCURS 10,
           BELNR LIKE RSEG-BELNR,
           GJAHR LIKE RSEG-GJAHR,
    END OF ITAB7.
    DATA: BEGIN OF ITAB8 OCCURS 10,
           SUB_PACKNO LIKE ESLL-SUB_PACKNO,
           SRVPOS LIKE ESLL-SRVPOS,
           EXTROW LIKE ESLL-EXTROW,
           KTEXT1 LIKE ESLL-KTEXT1,
    END OF ITAB8.
    *selection-screen
    *SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    *SELECTION-SCREEN SKIP 2.
    *SELECTION-SCREEN BEGIN OF LINE.
    *SELECTION-SCREEN COMMENT 25(23) text-002.
    **SELECT-OPTIONS: s_lifnr FOR ekko-lifnr.
    *PARAMETERS:p_lifnr LIKE ekko-lifnr obligatory.
    *SELECTION-SCREEN END OF LINE.
    *SELECTION-SCREEN END OF BLOCK b1.
    START-OF-SELECTION.
      PERFORM get_data.
    *  PERFORM field_catalog.
    *  PERFORM display_data.
    END-OF-SELECTION.
    **&      Form  display_data
    **       text
    *FORM display_data.
    *data: new(15) TYPE N.
    *  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    *    EXPORTING
    *      i_callback_program = sy-repid
    *      it_fieldcat        = int_cat[]
    *    TABLES
    *      t_outtab           = int_out
    *    EXCEPTIONS
    *      program_error      = 1
    *      OTHERS             = 2.
    *ENDFORM.                    "display_data
    PERFORM GET_DATA.
    PERFORM CALL_ALV_GRID.
    FORM CALL_ALV_GRID.
    PERFORM FIELDCAT_INIT USING GT_FIELDCAT[].
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM                = G_repid
          I_CALLBACK_USER_COMMAND           = G_USER_COMMAND
          I_GRID_TITLE                      = G_GRID_TITLE
          IT_FIELDCAT                       = GT_FIELDCAT[]
          I_DEFAULT                         = 'X'
          I_SAVE                            =  G_SAVE
          IS_VARIANT                        =  Gs_VARIANT
        TABLES
          T_OUTTAB                          = ITAB1.
    ENDFORM.
    FORM FIELDCAT_INIT
           USING RT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-TABNAME       = G_TABNAME.
      LS_FIELDCAT-seltext_l     = 'Vendo No'.
      LS_FIELDCAT-FIELDNAME     = 'LIFNR'.
      LS_FIELDCAT-REF_FIELDNAME = 'LIFNR'.
      LS_FIELDCAT-REF_TABNAME   = 'EKKO'.
      APPEND LS_FIELDCAT TO  RT_FIELDCAT.
       CLEAR LS_FIELDCAT.
      LS_FIELDCAT-TABNAME       = G_TABNAME.
      LS_FIELDCAT-SELTEXT_L  = 'Vendor Name'.
      LS_FIELDCAT-FIELDNAME     = 'NAME1'.
      LS_FIELDCAT-REF_FIELDNAME = 'NAME1'.
      LS_FIELDCAT-REF_TABNAME   = 'LFA1'.
      APPEND LS_FIELDCAT TO  RT_FIELDCAT.
    * CLEAR LS_FIELDCAT.
    *  LS_FIELDCAT-TABNAME       = G_TABNAME.
    *  LS_FIELDCAT-FIELDNAME     = 'NAME2'.
    *  LS_FIELDCAT-REF_FIELDNAME = 'NAME2'.
    *  LS_FIELDCAT-REF_TABNAME   = 'LFA1'.
    *  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-TABNAME       = G_TABNAME.
      LS_FIELDCAT-seltext_l   = 'Purchase Document No'.
      LS_FIELDCAT-FIELDNAME     = 'EBELN'.
      LS_FIELDCAT-REF_FIELDNAME = 'EBELN'.
      LS_FIELDCAT-REF_TABNAME   = 'EKKO'.
      APPEND LS_FIELDCAT TO  RT_FIELDCAT.
    *  CLEAR LS_FIELDCAT.
    *  LS_FIELDCAT-TABNAME       = G_TABNAME.
    *  LS_FIELDCAT-FIELDNAME     = 'VGABE'.
    *  LS_FIELDCAT-REF_FIELDNAME = 'VGABE'.
    *  LS_FIELDCAT-REF_TABNAME   = 'EKBE'.
    *  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-TABNAME       = G_TABNAME.
      LS_FIELDCAT-SELTEXT_L     = 'Item No'.
      LS_FIELDCAT-FIELDNAME     = 'EBELP'.
      LS_FIELDCAT-REF_FIELDNAME = 'EBELP'.
      LS_FIELDCAT-REF_TABNAME   = 'EKPO'.
      APPEND LS_FIELDCAT TO  RT_FIELDCAT.
    *  CLEAR LS_FIELDCAT.
    *  LS_FIELDCAT-TABNAME       = G_TABNAME.
    *  LS_FIELDCAT-FIELDNAME     = 'BELNR'.
    *  LS_FIELDCAT-REF_FIELDNAME = 'BELNR'.
    *  LS_FIELDCAT-REF_TABNAME   = 'EKBE'.
    *  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
       CLEAR LS_FIELDCAT.
      LS_FIELDCAT-TABNAME       = G_TABNAME.
      LS_FIELDCAT-SELTEXT_L     = 'Document Con'.
      LS_FIELDCAT-FIELDNAME     = 'KNUMH'.
      LS_FIELDCAT-REF_FIELDNAME = 'KNUMH'.
      LS_FIELDCAT-REF_TABNAME   = 'KONH'.
      APPEND LS_FIELDCAT TO  RT_FIELDCAT.
    *   CLEAR LS_FIELDCAT.
    *  LS_FIELDCAT-TABNAME       = G_TABNAME.
    *  LS_FIELDCAT-SELTEXT_L = 'Service/Material No'.
    *  LS_FIELDCAT-FIELDNAME     = 'MATNR'.
    *  LS_FIELDCAT-REF_FIELDNAME = 'MATNR'.
    *  LS_FIELDCAT-REF_TABNAME   = 'EKPO'.
    *  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
    *   CLEAR LS_FIELDCAT.
    *  LS_FIELDCAT-TABNAME       = G_TABNAME.
    *  LS_FIELDCAT-SELTEXT_L = 'Service / Material description' .
    *  LS_FIELDCAT-FIELDNAME     = 'TXZ01'.
    *  LS_FIELDCAT-REF_FIELDNAME = 'TXZ01'.
    *  LS_FIELDCAT-REF_TABNAME   = 'EKPO'.
    *  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
    *   CLEAR LS_FIELDCAT.
    *  LS_FIELDCAT-TABNAME       = G_TABNAME.
    *  LS_FIELDCAT-SELTEXT_L =  'WBS Element' .
    *  LS_FIELDCAT-FIELDNAME     = 'PS_PSP_PNR'.
    *  LS_FIELDCAT-REF_FIELDNAME = 'PS_PSP_PNR'.
    *  LS_FIELDCAT-REF_TABNAME   = 'EKKN'.
    *  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
    *   CLEAR LS_FIELDCAT.
    *  LS_FIELDCAT-TABNAME       = G_TABNAME.
    *  LS_FIELDCAT-SELTEXT_L =  'Serial Number' .
    *  LS_FIELDCAT-FIELDNAME     = 'EXTROW'.
    *  LS_FIELDCAT-REF_FIELDNAME = 'PACKNO'.
    *  LS_FIELDCAT-REF_TABNAME   = 'ESLL'.
    *  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
    *  CLEAR LS_FIELDCAT.
    *  LS_FIELDCAT-TABNAME       = G_TABNAME.
    *  LS_FIELDCAT-SELTEXT_L =  'Service Number' .
    *  LS_FIELDCAT-FIELDNAME     = 'SRVPOS'.
    *  LS_FIELDCAT-REF_FIELDNAME = 'SRVPOS'.
    *  LS_FIELDCAT-REF_TABNAME   = 'ESLL'.
    *  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
    *   CLEAR LS_FIELDCAT.
    *  LS_FIELDCAT-TABNAME       = G_TABNAME.
    *  LS_FIELDCAT-SELTEXT_L =  'Dscription' .
    *  LS_FIELDCAT-FIELDNAME     = 'KTEXT1'.
    *  LS_FIELDCAT-REF_FIELDNAME = 'KTEXT1'.
    *  LS_FIELDCAT-REF_TABNAME   = 'ESLL'.
    *  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
    *   CLEAR LS_FIELDCAT.
    *  LS_FIELDCAT-TABNAME       = G_TABNAME.
    *    LS_FIELDCAT-SELTEXT_L = 'Cost Center'.
    *  LS_FIELDCAT-FIELDNAME     = 'KOSTL'.
    *  LS_FIELDCAT-REF_FIELDNAME = 'KOSTL'.
    *  LS_FIELDCAT-REF_TABNAME   = 'EKKN'.
    *  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-TABNAME       = G_TABNAME.
    *  LS_FIELDCAT-FIELDNAME     = 'NETWR'.
      LS_FIELDCAT-FIELDNAME     = 'NETPR'.
      LS_FIELDCAT-reptext_ddic = 'Basic'.
    *  LS_FIELDCAT-SELTEXT_L    = 'Basic'.
       LS_FIELDCAT-REF_FIELDNAME = 'NETPR'.
      LS_FIELDCAT-REF_TABNAME   = 'EKPO'.
      APPEND LS_FIELDCAT TO  RT_FIELDCAT.
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-TABNAME       = G_TABNAME.
      LS_FIELDCAT-FIELDNAME     = 'NETWR'.
    *  LS_FIELDCAT-FIELDNAME     = 'NETPR'.
    *  LS_FIELDCAT-reptext_ddic = ''.
    *  LS_FIELDCAT-SELTEXT_L    = 'Basic'.
       LS_FIELDCAT-REF_FIELDNAME = 'NETWR'.
      LS_FIELDCAT-REF_TABNAME   = 'EKPO'.
      APPEND LS_FIELDCAT TO  RT_FIELDCAT.
    CLEAR LS_FIELDCAT.
      LS_FIELDCAT-TABNAME       = G_TABNAME.
        LS_FIELDCAT-SELTEXT_L = 'Excise'.
      LS_FIELDCAT-FIELDNAME     = 'ED1'.
      LS_FIELDCAT-REF_FIELDNAME = 'ED1'.
    *  LS_FIELDCAT-REF_TABNAME   = 'EKKN'.
      APPEND LS_FIELDCAT TO  RT_FIELDCAT.
       CLEAR LS_FIELDCAT.
      LS_FIELDCAT-TABNAME       = G_TABNAME.
      LS_FIELDCAT-SELTEXT_L = 'Insurance'.
      LS_FIELDCAT-FIELDNAME     = 'KBETR2'.
        LS_FIELDCAT-REF_FIELDNAME = 'KBETR'.
      LS_FIELDCAT-REF_TABNAME   = 'KONV'.
      APPEND LS_FIELDCAT TO  RT_FIELDCAT.
    CLEAR LS_FIELDCAT.
      LS_FIELDCAT-TABNAME       = G_TABNAME.
      LS_FIELDCAT-SELTEXT_L     = 'Frieght'.
      LS_FIELDCAT-FIELDNAME     = 'KWERT'.
      LS_FIELDCAT-REF_FIELDNAME = 'KWERT'.
      LS_FIELDCAT-REF_TABNAME   = 'KONV'.
      APPEND LS_FIELDCAT TO  RT_FIELDCAT.
    * CLEAR LS_FIELDCAT.
    *  LS_FIELDCAT-TABNAME       = G_TABNAME.
    *  LS_FIELDCAT-SELTEXT_L     = '' .
    *  LS_FIELDCAT-FIELDNAME     = 'KBETR1'.
    *  LS_FIELDCAT-REF_FIELDNAME = 'KBETR'.
    *  LS_FIELDCAT-REF_TABNAME   = 'KONV'.
    *  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
    *CLEAR LS_FIELDCAT.
    *  LS_FIELDCAT-TABNAME       = G_TABNAME.
    *  LS_FIELDCAT-SELTEXT_L     = 'PBXX'.
    *  LS_FIELDCAT-FIELDNAME     = 'KWERT1'.
    *  LS_FIELDCAT-REF_FIELDNAME = 'KWERT'.
    *  LS_FIELDCAT-REF_TABNAME   = 'KONV'.
    *  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-TABNAME       = G_TABNAME.
      LS_FIELDCAT-SELTEXT_L     = 'VAT/ST '.
      LS_FIELDCAT-FIELDNAME     = 'KBETR'.
      LS_FIELDCAT-REF_FIELDNAME = "KBETR".
      LS_FIELDCAT-REF_TABNAME   = 'KONV'.
      APPEND LS_FIELDCAT TO  RT_FIELDCAT.
    CLEAR LS_FIELDCAT.
      LS_FIELDCAT-TABNAME       = G_TABNAME.
      LS_FIELDCAT-SELTEXT_L     = 'OTHER '.
      LS_FIELDCAT-FIELDNAME     = 'KWERT2'.
      LS_FIELDCAT-REF_FIELDNAME = "KWERT".
      LS_FIELDCAT-REF_TABNAME   = 'KONV'.
      APPEND LS_FIELDCAT TO  RT_FIELDCAT.
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-TABNAME       = G_TABNAME.
      LS_FIELDCAT-SELTEXT_L = 'TOTAL'.
      LS_FIELDCAT-FIELDNAME     = 'TOTAL'.
      LS_FIELDCAT-REF_FIELDNAME = 'TOTAL'.
    *  LS_FIELDCAT-REF_TABNAME   = 'EKKN'.
      APPEND LS_FIELDCAT TO  RT_FIELDCAT.
       ENDFORM.                    " FIELDCAT_INIT
       FORM GET_DATA.
       SELECT  A~EBELN A~LIFNR  A~EKORG A~KNUMV B~VGABE  B~GJAHR B~BELNR
               L~NAME1 L~NAME2
            FROM  EKKO AS A
                          INNER JOIN EKBE  AS B ON  B~EBELN = A~EBELN
                          INNER JOIN LFA1 AS L ON L~LIFNR = A~LIFNR
                          INTO  CORRESPONDING
                          FIELDS OF TABLE ITAB.
    *                      WHERE B~VGABE = '2'.
    SELECT EKPO~EBELN EKPO~EBELP EKPO~MATNR EKPO~TXZ01 EKPO~WERKS
              EKPO~NETWR EKPO~MENGE EKPO~MWSKZ  EKPO~NETPR EKPO~PACKNO
              FROM EKPO
                        INTO CORRESPONDING FIELDS OF TABLE ITAB1
                        FOR ALL ENTRIES IN ITAB
                        WHERE EKPO~EBELN = ITAB-EBELN and
                              EKPO~BUKRS = 'company code'.
       SELECT EKKN~EBELN EKKN~EBELP EKKN~KOSTL EKKN~PS_PSP_PNR
          FROM EKKN
                   INTO CORRESPONDING FIELDS OF TABLE ITAB2
                   FOR ALL ENTRIES IN ITAB1
                   WHERE EKKN~EBELN = ITAB1-EBELN  AND
                         EKKN~EBELP = ITAB1-EBELP.
       SELECT KONV~KNUMV KONV~KSCHL KONV~KBETR KONV~KWERT KONV~KWERT
                  KONV~KPOSN
          FROM KONV
              INTO CORRESPONDING FIELDS OF TABLE ITAB5
              WHERE KONV~KNUMV =   ITAB1-KNUMV AND
                    KONV~KPOSN = ITAB1-EBELP.
    *    SELECT LFA1~NAME1 LFA1~NAME2 FROM LFA1
    *    INTO CORRESPONDING FIELDS OF TABLE ITAB1
    *    WHERE  LFA1~LIFNR = ITAB-LIFNR.
    *  SELECT ESLL~SUB_PACKNO ESLL~SRVPOS
    *           ESLL~EXTROW  ESLL~KTEXT1 FROM ESLL
    *       INTO CORRESPONDING FIELDS OF TABLE ITAB6
    *       FOR ALL ENTRIES IN ITAB1
    *       WHERE ESLL~PACKNO = ITAB1-PACKNO .
    **         SELECT ESLL~SUB_PACKNO FROM ESLL
    **       INTO CORRESPONDING FIELDS OF TABLE ITAB6
    **       FOR ALL ENTRIES IN ITAB1
    **       WHERE ESLL~PACKNO = ITAB1-PACKNO.
    *        SELECT ESLL~SUB_PACKNO ESLL~SRVPOS
    *           ESLL~EXTROW  ESLL~KTEXT1 FROM ESLL
    *       INTO CORRESPONDING FIELDS OF TABLE ITAB8
    *       FOR ALL ENTRIES IN ITAB6
    *       WHERE ESLL~PACKNO = ITAB6-SUB_PACKNO .
    * SELECT RSEG~BELNR RSEG~GJAHR FROM RSEG
    *        INTO CORRESPONDING FIELDS OF TABLE  ITAB7
    *        FOR ALL ENTRIES IN ITAB
    *        WHERE RSEG~BELNR = ITAB-BELNR AND
    *              RSEG~GJAHR = ITAB-GJAHR.
    *LOOP AT ITAB1.
    LOOP AT ITAB.
                  READ TABLE ITAB1 WITH KEY EBELN = ITAB-EBELN.
    *         IF ITAB1-EBELN = ITAB-EBELN.
                    IF sy-subrc eq 0.
    *                          ITAB1-EBELN = ITAB-EBELN.
                              ITAB1-LIFNR = ITAB-LIFNR.
    *                          ITAB1-EBELP = ITAB-EBELP.
                              ITAB1-BELNR = ITAB-BELNR.
                              ITAB1-KNUMV = ITAB-KNUMV.
                              ITAB1-NAME1  = ITAB-NAME1.
                              ITAB-NAME2 = ITAB-NAME2.
                              ITAB1-GJAHR = ITAB-GJAHR.
                    modify itab1 index   sy-tabix.
            ENDIF.
    ENDLOOP.
    *LOOP AT ITAB2.
    *         READ TABLE ITAB1 WITH KEY EBELN = ITAB2-EBELN.
    *          IF sy-subrc eq 0.
    *              ITAB1-EBELN = ITAB2-EBELN.
    *              ITAB1-PS_PSP_PNR = ITAB2-PS_PSP_PNR.
    *              ITAB1-KOSTL = ITAB2-KOSTL.
    *               modify itab1 transporting ps_psp_pnr kostl
    *               where ebeln = Itab2-ebeln AND EBELP = ITAB2-EBELP.
    *          ENDIF.
    *ENDLOOP.
    LOOP AT ITAB1.
    **ON CHANGE OF   ITAB1-ebeln or itab1-ebelp.
    *     concatenate itab1-werks itab1-lifnr itab1-matnr
    *         into val1.
    *   MOVE VAL1 TO ITAB1-VAKEY.
    *   MODIFY ITAB1.
    *    SELECT KONH~KNUMH KONH~KSCHL FROM KONH
    *        INTO  CORRESPONDING FIELDS OF TABLE ITAB3
    *        FOR ALL ENTRIES IN ITAB1
    *        WHERE KONH~VAKEY = ITAB1-VAKEY.
    **endon.
    **        sort Itab3 by kschl descending.
    **        Select konp-kbetr  from konp into itab4 where
    **        KONP~KNUMH = ITAB3-KNUMH AND KONP~KSCHL = ITAB3-KSCHL.
    **ON CHANGE OF  ITAB1-ebelp.
    **LOOP AT ITAB3
    **  ON CHANGE OF  ITAB1-ebelp.
    *              itab1-knumh = itab3-knumh.
    **              SELECT  KONP~KBETR FROM KONP INTO CORRESPONDING FIELDS
    **              OF  TABLE  ITAB4
    **              FOR ALL ENTRIES IN ITAB3   WHERE
    **              KONP~KNUMH = ITAB3-KNUMH AND KONP~KSCHL = ITAB3-KSCHL .
    **              IF ITAB3-KSCHL = 'JMOP' .
    **               ED = ITAB4-KBETR / 1000 * ITAB1-NETWR .
    **              ENDIF.
    **             IF ITAB3-KSCHL = 'JEC1'.
    **              Itab1-ed1 = ITAB4-KBETR / 1000 * ED.
    **              ADD ED TO ITAB1-ED1.
    **             modify  ITAB1 transporting ed1.
    **             ENDIF.
    *              IF ITAB3-KSCHL = 'JMOP' .
    *               ED = 16 / 100 * ITAB1-NETWR .
    *              ENDIF.
    *             IF ITAB3-KSCHL = 'JEC1'.
    *              Itab1-ed1 = 2 / 100 * ED.
    *              ADD ED TO ITAB1-ED1.
    *             modify  ITAB1 transporting ed1.
    *             ENDIF.
    **        ENDLOOP.
    **endon.
    modify  ITAB1.
    *endon.
      LOOP AT ITAB5.
         IF ITAB5-KSCHL = 'NAVS' OR ITAB5-KSCHL = 'NAVM'.
                ITAB1-KBETR = ITAB5-KBETR.
                 modify  ITAB1 transporting KBETR
                 where  KNUMV =  ITAB1-KNUMV AND EBELP = ITAB1-EBELP .
               ELSEIF ITAB5-KSCHL = 'FRA1' OR ITAB5-KSCHL = 'FRC1' OR
                    ITAB5-KSCHL = 'FRB1'.
                       ITAB1-KWERT = ITAB5-KWERT .
                       modify  ITAB1 transporting KWERT
                       where  KNUMV =  ITAB1-KNUMV AND EBELP = ITAB1-EBELP
    *               IF ITAB5-KSCHL = 'FRA1'.
    *                    ITAB1-KBETR1 = ITAB5-KBETR / 1000 * ITAB1-NETWR .
    *                   modify  ITAB1 transporting KBETR1
    *                   where  KNUMV =  ITAB1-KNUMV AND EBELP = ITAB1-EBELP
    *                 ELSEIF ITAB5-KSCHL = 'FRC1' .
    *                   ITAB1-KBETR1 = ITAB5-KBETR * ITAB1-MENGE .
    *                   modify  ITAB1 transporting KBETR1
    *                   where  KNUMV =  ITAB1-KNUMV AND EBELP = ITAB1-EBELP
    *                 ELSEIF ITAB5-KSCHL = 'FRB1' .
    *                    ITAB1-KBETR1 = ITAB5-KBETR .
    *                   modify  ITAB1 transporting KBETR1
    *                   where  KNUMV =  ITAB1-KNUMV AND EBELP = ITAB1-EBELP
    *              ENDIF.
    *           **THIS  CODE IS FOR iNSURANCE  CONDITION
               ELSEIF ITAB5-KSCHL = 'ZGIN' OR ITAB5-KSCHL = 'ZIN2'.
                       ITAB1-KBETR2 = ITAB5-KBETR.
                       modify  ITAB1 transporting KBETR2
                       where  KNUMV =  ITAB1-KNUMV AND EBELP = ITAB1-EBELP
    *           **THIS  CODE IS FOR PBXX OR PB00  CONDITION
    *          ELSEIF ITAB5-KSCHL = 'PBXX' OR ITAB5-KSCHL = 'PB00'.
    *                   ITAB1-KWERT1 = ITAB5-KWERT1.
    *                   modify  ITAB1 transporting KWERT1
    *                   where  KNUMV =  ITAB1-KNUMV AND EBELP = ITAB1-EBELP
    **          ELSEIF ITAB5-KSCHL = 'JOCM' OR ITAB5-KSCHL = 'RA00' OR
    **                 ITAB5-KSCHL = 'RA01' OR ITAB5-KSCHL = 'RB00' OR
    **                 ITAB5-KSCHL = 'RC00' OR
    **THIS  CODE IS FOR OTHER CONDITION
               ELSEIF ITAB5-KSCHL = 'RL01' OR ITAB5-KSCHL = 'ZA00' OR
                     ITAB5-KSCHL = 'ZA01' OR ITAB5-KSCHL = 'ZAE1' OR
                     ITAB5-KSCHL = 'ZAED' OR
                     ITAB5-KSCHL = 'ZAFR' OR ITAB5-KSCHL = 'ZB00' OR
                     ITAB5-KSCHL = 'ZBCH' OR ITAB5-KSCHL = 'ZBED' OR
                     ITAB5-KSCHL = 'ZC00' OR
                     ITAB5-KSCHL = 'ZCEX' OR ITAB5-KSCHL = 'ZCIF' OR
                     ITAB5-KSCHL = 'ZHC1' OR ITAB5-KSCHL = 'ZHC2' OR
                     ITAB5-KSCHL = 'ZHCT' OR
                     ITAB5-KSCHL = 'ZHCV' OR ITAB5-KSCHL = 'ZJOC' OR
                     ITAB5-KSCHL = 'ZOTH' OR ITAB5-KSCHL = 'ZOTP' OR
                     ITAB5-KSCHL = 'ZOTT' OR
                     ITAB5-KSCHL = 'ZPK1' OR ITAB5-KSCHL = 'ZPK2' OR
                     ITAB5-KSCHL = 'ZPK3' OR ITAB5-KSCHL = 'ZPK4' OR
                     ITAB5-KSCHL = 'ZRPO' OR
                     ITAB5-KSCHL = 'ZSE1' OR ITAB5-KSCHL = 'ZSED' OR
                     ITAB5-KSCHL = 'ZSFR' OR ITAB5-KSCHL = 'ZSTX' OR
                     ITAB5-KSCHL = 'ZTPI' OR
                     ITAB5-KSCHL = 'ZTPV' OR ITAB5-KSCHL = 'ZTRD' OR
                     ITAB5-KSCHL = 'ZWCT'.
                       ITAB1-KWERT2 = ITAB5-KWERT.
                       modify  ITAB1 transporting KWERT2
                       where  KNUMV =  ITAB1-KNUMV AND EBELP = ITAB1-EBELP
              modify itab1.
           ENDIF.
    ENDLOOP .
    ITAB1-TOTAL = ITAB1-NETWR + ITAB1-KWERT2 + ITAB1-KWERT + ITAB1-KBETR.
    *              ITAB1-TOTAL = ITAB1-NETWR + ITAB1-ED1 + ITAB1-KBETR2 +
    *                     ITAB1-KBETR1 + ITAB1-KBETR + ITAB1-KWERT   .
                     modify  ITAB1 transporting TOTAL.
    LOOP AT ITAB6.
              ITAB1-SUB_PACKNO = ITAB6-SUB_PACKNO.
    *           modify  ITAB1.
    ENDLOOP.
    LOOP AT ITAB7.
            ITAB1-BELNR = ITAB7-BELNR.
            ITAB1-GJAHR = ITAB7-GJAHR.
      ENDLOOP.
    LOOP AT ITAB8.
              ITAB1-SUB_PACKNO = ITAB8-SUB_PACKNO.
              ITAB1-SRVPOS  = ITAB8-SRVPOS.
              ITAB1-EXTROW = ITAB8-EXTROW.
              ITAB1-KTEXT1 = ITAB8-KTEXT1.
              modify  ITAB1.
    ENDLOOP.
    * SELECT ESLL~PACKNO ESLL~SUB_PACKNO ESLL~SRVPOS ESLL~KTEXT1
    *          FROM ESLL
    *          INTO CORRESPONDING FIELDS OF TABLE ITAB6
    *          WHERE ESLL~PACKNO = ITAB1-PACKNO.
    ** delete  adjacent  duplicates  from itab1 comparing EBELN .
    modify  ITAB1.
    endloop.
    sort Itab1 by EBELN Ascending.
            SELECT KONV~KBETR FROM KONV
            INTO ITAB1-KBETR
            WHERE KONV~KSCHL =  'NAVS' OR KONV~KSCHL = 'NAVM'.
            ENDSELECT.
            ITAB1-KBETR = ITAB5-KBETR.
    *ENDLOOP.
    *ENDLOOP.
    *ENDLOOP.
    ENDFORM.
    Reward all helpfull answers
    Regards
    Pavan

  • Help with Date Range

    Hi,
    I have an Oracle form which allows users to enter :start_date_active(mandatory) and :end_date_active (can be null).
    I need to check in form using SQL if there already exists a record for this date range or if there is any overlapping date ranges for the value entered and disallow user from entering that.
    I have my query as follows:
    SELECT (1)
    FROM <table> xsv
    WHERE 1=1
    AND ( (:START_DATE_ACTIVE >= xsv.start_date_active) AND
    (:START_DATE_ACTIVE <= nvl(xsv.end_date_active,'31-DEC-4712'))
    OR
         (:END_DATE_ACTIVE >= xsv.start_date_active) AND
    (:END_DATE_ACTIVE <= nvl(xsv.end_date_active,'31-DEC-4712'))
    But, this incorrectly allows me to enter over lapping date ranges when the :end_date_active is null.
    It should work as follows :
    eg.
    start_date_active end_date_active
    01-Apr-2009 allowed
    01-Mar-2009 10-Mar-2009 allowed
    01-feb-2009 Not allowed, as it overlaps with 1st record
    10-feb-2009 05-Mar-2009 Not allowed, as it overlaps with 2nd record
    05-Mar-2009 20-mar-2009 Not allowed, as it overlaps with 2nd record
    and so on.
    How do I modify my query to deal with null end dates ?
    Many Thanks
    Shankar

    Hi, Shankar,
    Whenever you have a question, it helps to post:
    (1) The version of Oracle (and any other relevant software) you're using
    (2) A little sample data (just enough to show what the problem is) from all the relevant tables
    (3) The results you want from that data (You posted this. It would be better if it were formatted.)
    (4) Your best attempt so far (formatted) (You posted this, but since it's unformated, it's very hard to read.)
    (5) The full error message (if any), including line number
    Executable SQL statements (like "CREATE TABLE AS ..." or "INSERT ..." statements) are best for (2).
    Formatted tabular output is okay for (3). Type these 6 characters
    &#123;code&#125;
    (small letters only, inside curly brackets) before and after formatted text, to preserve spacing.
    Use different names for the parameters and the columns. For example, if the column is called start_date_active, call the corresponding parameter :p_start_date_active. It will help to keep them straight.
    In this statement, if the column end_date_active IS NULL, you're treating it as an impossibly late date:
    (:END_DATE_ACTIVE <= nvl(xsv.end_date_active,'31-DEC-4712'))That's good. (You should really use TO_DATE ('31-DEC-4712', 'DD-MON-YYYY'), though.)
    If it's possible for the parameter :end_date_active to be NULL, you should use NVL in the same way, to equate it with some appropriate date.
    The correct way to see if the range a to b (a <= b) overlaps with x to y (x <= y) is:
    WHERE   b >= x
    AND     a <= yIf you want an expression that's TRUE when they do not overlap, then say
    WHERE   NOT (    b >= x
                AND  a <= y
                )or, equivalently,
    WHERE   b < x
    OR      a > y

  • Oracle 10g - Problem with Date Ranges using Between

    I am keeping track of patients who have not been contacted during a date range. if a nurse adds an event or note and the note is type 1,3,4 then this is a contact. The following works but if the event or note was made on the same day as the report is run, the current contact is not printed. Any help to improve the query and identify the problem would be appreciated. Also, if you add '1' to' n.created_date_time BETWEEN '10-Jan-2010' AND TRUNC(SYSDATE)' so it is ' n.created_date_time BETWEEN '10-Jan-2010' AND TRUNC(SYSDATE) + 1'. It works. What is wrong?
    SELECT upper(symptom_text),
      COUNT(UNIQUE(c.patient_id)) ,
      COUNT(UNIQUE(
      CASE
        WHEN e.eventdate BETWEEN '10-Jan-2010' AND TRUNC(SYSDATE)
        OR (n.created_date_time BETWEEN '10-Jan-2010' AND TRUNC(SYSDATE)
        AND n.note_type_id                                             IN (1,3,4))
        THEN c.patient_id
        ELSE 0
      END)) - 1
    FROM patient c,
      cust_info ci,
      event e,
      note n
    WHERE c.physician_id = 74
    AND c.patient_id      = ci.patient_id
    AND ci.info_type_id    = 32
    AND ci.symptom_text      IS NOT NULL
    AND c.patient_id      = e.patient_id(+)
    AND c.patient_id      = n.pk_id(+)
    AND n.table_name(+)    = 'patient'
    GROUP BY upper(symptom_text)
    ORDER BY DECODE(upper(symptom_text), 'A+', 1, 'A', 2, 'B', 3, 'C', 4, 'D', 5, 99)I suspect the end date is not inclusive. Fields are Date data types. Thanks for any help.

    Hi,
    achtung wrote:
    Understood. Frank was correct. Do you mean about the dates? Is that issue solved now?
    It would help a lot if you posted some sample data (CREATE TABLE and INSERT statements) and the results you want from that data. Simplify as much as possible. For example, if everything involving the e and n tables is working correctly, forget about them for now. Post a question that only invloves the c and ci tables.
    But, additionally, when a record in the cust_info doesn't exist my contact count is inaccurate. How can you explain this conceptually. I understand the query path is checking for this record due to the predicate. Perhaps the query should be redesigned. Thanks for your input!Again, you can see the results, and you know what they should be. Nobody else has that information. Please post some sample data and the results you want from that data.
    In your earlier message you said
    Could there be a problem if a record does not exist in the ci table?The condition:
    AND ci.symptom_text IS NOT NULL
    filters for this right? Maybe this could be part of the problem. why I'm not seeing records when a note is added to a patient's doc. How would this be technically be explained? You're doing a inner join between c and ci:
        AND c.patient_id      = ci.patient_id
        AND ci.info_type_id   = 32
        AND ci.symptom_text   IS NOT NULL ...Rows from c will be included only if there is a row in ci with the same patiend_id: even more, that matching row in ci must also have info_type_id=32 in a non-NULL symptom_text, otherwise, the row from c will be ignored.
    If you want rows from c to be included even if there is no matching row in ci, then do an outer join, like you're already doing with the e and n tables:
      WHERE c.physician_id = 74
        AND c.patient_id         = ci.patient_id (+)
        AND ci.info_type_id (+)  = 32
        AND ci.symptom_text (+)  IS NOT NULL
        AND c.patient_id         = e.patient_id(+)
        AND c.patient_id         = n.pk_id(+)
        AND n.table_name(+)      = 'patient'

  • FMLA standard hours infotype 2001 not editable when working with date range

    Hi All,
    The issue described below arises at the Juncture between FMLA Workbench and Absence Infotype IT2001.
    When we try to tie a FMLA Request to Absences the process takes us to the Infotype PA2001 screen wherein we would like the Absence Hours Field to be Editable so that we could enter Hours (less than full day).
    The process works fine when the FMLA absence is for a single day, i.e. if an employee availed a FMLA leave on a day (whether full day or part of a day) the Absence Hours field (PA2001-STDAZ) is editable and the user can enter any number of hours of his choice.
    But the process faces a glitch when the FMLA absence spans over a period of time (i.e. an employee availed a FMLA leave for over a period wherein each day may or may not be a full day absence, in this scenario it would be best if the system allow the user to enter Absence Hours so that the User could enter the exact number of Absence hours correctly. But unfortunately, when an absence spans multiple days the Infotype 2001 screen dynamically turns the Absence Hours field (PA2001-STDAZ) uneditable (grayed out) and the system forcefully enters hours equal to the sum of the work schedule hours for each working day covered in the span of period for which we are trying to enter FMLA Absence Hours.
    I have used the USER EXIT and the BADI route and tried to change the Screen Table to editable, but with no luck.
    Wondering, if anyone of you could help me out of this glitch.
    Thanks in Advance.

    Hi,
       I don't think this is possible.
       You cannot make the Hours field editable for a date range.
       I don't think its feasible to enter absence hours on a day basis given a date range.
       Better think of creating a custom infotype to enter absence hours .
       (Design would be : based on the date range entered , say 01.01.2011 to 05.01.2011 , you should get five input enabled
         boxes(dynamically) for five days to enter the absence hours , this is not possible in standard infotype ..... )
    Regards,
    Srini.

  • LookupCube based on CurrentMember of different dimensions along with date range

    Hi,
    I want to get a value through LookupCube based on CurrentMember of different dimensions along with a date range. For example, I want to make this happen: LookupCube("TMIClaim","([Measures].[Paid Amount],"+"[Transaction
    Date].[Hierarchy].[Day].&[2013-01-01T00:00:00]:[Transaction Date].[Hierarchy].[Day].&[2013-02-01T00:00:00]" +"," + "[Product].[Name].&["+[TMI Product].[Name].CurrentMember.Name+"]" +")")).
    It does not work as long as I put the date range. 
    I cannot use Aggregate either since it does not take multiple dimensions as filter criteria. That means when I use date range for aggregate I cannot use another dimensions as filter.
    I am looking for any of the solution which based filter that is combined with a date range and other dimensions.
    Thanks,
    Mamun

    Try using the Sum() function. Something like:
    LookupCube("TMIClaim","Sum( ( { "
    +"[Transaction Date].[Hierarchy].[Day].&[2013-01-01T00:00:00]:[Transaction Date].[Hierarchy].[Day].&[2013-02-01T00:00:00]
    }" +"," + "[Product].[Name].&["+[TMI Product].[Name].CurrentMember.Name+"]"
    ) ,  ([Measures].[Paid Amount]," +")
    (Check location of parenthesis, but this should point you in the right direction).
    This worked for me:
    WITH MEMBER MEASURES.LOOKUPCUBEDEMO AS
    LOOKUPCUBE("MyCube", "sum({[Date].[YQM].[Day].&[20140330]:[Date].[YQM].[Day].&[20140331]},[Measures].[Row" + " Count])")
    SELECT MEASURES.LOOKUPCUBEDEMO ON 0
    FROM [MyCube]
    Victor Rocca

  • Cascading Pick List with date range as first,  second pick list is dynamic

    Specifically, how is this accomplished?
    It does not seem possible to make first pick list static. If allowed this would be perfect.
    The system seems to only allow the first parameter to be dynamic if the second parameter is dynamic. No range seems to be available for date when second parameter is  dynamic.

    Consider a 3rd-party tool as a solution (for a list of such tools, see http://www.kenhamady.com/bookmarks.html).
    There is at least one Crystal report viewer with its own special implementation of dynamic & cascading parameters.  It would allow you to use any type of parameter within the cascade.  However, you will need to create a separate rpt to implement each dynamic parameter.  So in your case, you will have one main report, using a dynamic parameter that's implemented as a separate rpt, which has a date range parameter. 
    Cheers,
    - ido

  • Report with date range where the daily customer receipt profit centre wise

    Hi Experts,
    Could you please suggest me is there any developed  standard report or t-cod eis available  with which i can get date range where the daily customer receipt profit centre wise can be obtained............
    Thanks in Advance........
    Santosh Gupta...

    Hi:
              For this purpose you can develop Z report. There is no such standard report for it. Copy FBL5N to make a Z copy of it and use the table FAGLFLEXA for each document posted in BSEG/BKPF. You can also make use of BTE 1650.
    Regards

  • Query problem with date range

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

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

  • Group by with date range.

    Hi,
    I am looking for effective usage of Group by against date range.
    I have a transaction table as below.
    Date            customer_no      amount_paid
    01-Dec-13     001                  500
    02-Dec-13     001                  360
    09-Dec-13     001                  200
    02-Nov-13     001                  360
    09-Nov-13     001                  200
    02-Nov-13     001                  360
    09-Oct-13     001                  200
    02-Oct-13     001                  360
    09-Oct-13     001                  200
    02-Sep-13     001                  360
    09-Sep-13     001                  200
    ............... etc.
    I would like to see sum(amount_paid) by past date ranges 1-30 days, 31-60 days, 61-90 days.
    Below are expected results.
    Customer          Duration       amount_paid
    001                    1-30             980
    001                    31-60           450
    001                    61-90          1200
    002                    1-30             300
    002                    31-60           490
    002                    61-90           320
    003                    1-30             450
    ......................etc.
    I have to group by customer no and date range (1-30, 31-60, 61-90..etc).
    Can someone help me getting query for this.
    Thanks...
    Sreeram.

    SQL> with t
      2  as
      3  (
      4  select to_date('01-Dec-13', 'dd-Mon-rr') dt, '001' customer_no, 500 amount_paid from dual
      5    union all
      6  select to_date('02-Dec-13', 'dd-Mon-rr') dt, '001' customer_no, 360 amount_paid from dual
      7    union all
      8  select to_date('09-Dec-13', 'dd-Mon-rr') dt, '001' customer_no, 200 amount_paid from dual
      9    union all
    10  select to_date('02-Nov-13', 'dd-Mon-rr') dt, '001' customer_no, 360 amount_paid from dual
    11    union all
    12  select to_date('09-Nov-13', 'dd-Mon-rr') dt, '001' customer_no, 200 amount_paid from dual
    13    union all
    14  select to_date('02-Nov-13', 'dd-Mon-rr') dt, '001' customer_no, 360 amount_paid from dual
    15    union all
    16  select to_date('09-Oct-13', 'dd-Mon-rr') dt, '001' customer_no, 200 amount_paid from dual
    17    union all
    18  select to_date('02-Oct-13', 'dd-Mon-rr') dt, '001' customer_no, 360 amount_paid from dual
    19    union all
    20  select to_date('09-Oct-13', 'dd-Mon-rr') dt, '001' customer_no, 200 amount_paid from dual
    21    union all
    22  select to_date('02-Sep-13', 'dd-Mon-rr') dt, '001' customer_no, 360 amount_paid from dual
    23    union all
    24  select to_date('09-Sep-13', 'dd-Mon-rr') dt, '001' customer_no, 200 amount_paid from dual
    25  )
    26  select customer_no
    27       , ((grp_val - 1) * 30) + 1 start_val
    28       , grp_val * 30 end_val
    29       , sum(amount_paid) amount_paid
    30    from (
    31            select dt
    32                 , customer_no
    33                 , amount_paid
    34                 , ceil(sum(dt_interval) over(partition by customer_no order by dt)/30) grp_val
    35              from (
    36                      select dt
    37                           , customer_no
    38                           , amount_paid
    39                           , nvl(dt - lag(dt) over(partition by customer_no order by dt), 1) dt_interval
    40                        from t
    41                   )
    42         )
    43   group
    44      by customer_no
    45       , grp_val
    46   order
    47      by grp_val;
    CUS  START_VAL    END_VAL AMOUNT_PAID
    001          1         30         560
    001         31         60         760
    001         61         90         920
    001         91        120        1060
    SQL>

  • Dimention values with date range

    Hi All
    We have a requirement to have dimensions which have date ranges like
    today's
    yesterdays
    last week
    last month etc
    When tried to add dimension I can see only string integer and float values
    Do anybody knows how to add Date with the range??
    TIA
    Lalit

    The solution we've worked with in the past is to convert the dates to YYYYMMDD and store in the index as Integer values. Thus you can use range filters by converting any incoming values to the same format. Your interface layer will have to written to accommodate those mappings.

  • Issue with Date Range Search

    Hi, I am doing a search on a table using a date column having index defined on it.
    when I am using below query:[Here 26-OCT-2010 is the current date.]
    SELECT *
    FROM cs_incidents_all_b
    WHERE incident_date BETWEEN TO_DATE ('25-OCT-2010 00:00:00',
    'DD-MON-RRRR HH24:MI:SS'
    AND TO_DATE ('26-OCT-2010 23:59:59',
    'DD-MON-RRRR HH24:MI:SS'
    Explain plan statistics is - Cost : 4, Bytes: 559, Cardinality:1
    If I run the same query by changing the dates and with 1 day duration, the cost is increasing significantly:
    SELECT *
    FROM cs_incidents_all_b
    WHERE incident_date BETWEEN TO_DATE ('01-OCT-2010 00:00:00',
    'DD-MON-RRRR HH24:MI:SS'
    AND TO_DATE ('02-OCT-2010 23:59:59',
    'DD-MON-RRRR HH24:MI:SS'
    Explain plan statistics is - Cost : 3,643, Bytes: 2,217,553, Cardinality:3,967
    And if I increase the date range, the cost is becoming too high.
    If anybody faced this proble previously, kindly help me to resolve.
    Thanks in advance,
    Sam.

    Tuning request
    Take a look at the
    When your query takes too long ...
    HOW TO: Post a SQL statement tuning request - template posting

  • Select is not working with date range .

    In my program doing a simple select from cdhdr table based on date range i have created but it fails .
    here is the code I am using.
    SELECT SINGLE *   FROM tvarv  INTO  wa_tvarv WHERE name EQ 'Z_SERVICE_CHANGE_DATE' .
    move wa_tvarv-low to v_date .
    move wa_tvarv-high to v_time .
    fill the date range
    *write v_date to ra_date-low  .
        move  v_date TO ra_date-low  .
    *write sy-datum to v_dateh .
        ra_date-high = sy-datum  .
        ra_date-sign = 'I' .
        ra_date-option = 'BT' .
        APPEND ra_date .
    fill the time range
        move v_time  TO  ra_time-low .
    *write sy-uzeit to v_timeh .
        ra_time-high = sy-uzeit  .
        ra_time-sign = 'I' .
        ra_time-option = 'BT' .
        APPEND ra_time .
    *Get all the records from cdhdr table for contract i.e VERKBELEG .
        *SELECT objectclas objectid FROM cdhdr INTO CORRESPONDING FIELDS OF TABLE it_cdhdr*
                                   *WHERE objectclas = 'VERKBELEG'*
                                   *AND  udate IN ra_date*
                                   *and  UTIME in ra_time .*
    above select is creating Problem .
    Help will be Appreciated .

    I wonder if you have a conflict between your date and time.  If you want all records between 3PM and 3AM the next day, that will cause a conflict.  That's because the first date should be "before" the second date, wthin a given day.
    To troubleshoot, why don't you try taking the time part out of the SQL?

Maybe you are looking for

  • How do  I reinstall CS2 on Windows 7?

    I had to reformat a HD and reinstall Windows 7 and all my applications. When I try to re-install CS2, I get two problems. It doesn't let me install into its default folder (C:\Program Files (x86)\Adobe). There is a message that illegal characters are

  • Optional elements not supported in XML parser for java

    I am using v2 parser version 2.0.2.8.0 for java. Looks like this parser does not support optional elements. My DTD looks like <!ELEMENT Graph (Background, ImageSize)?> <!ELEMENT ImageSize EMPTY> <!ATTLIST ImageSize width CDATA #IMPLIED height CDATA #

  • Will not shut down (must use Task Manager) & will not open new window

    When I shutdown FF the FF window disappears, but a new FF cannot be started unless I manually end FF from Task Manager. When running I cannot "open Link in a new window" - nothing happens, but opening a link in a new tab works. I am running FF3.6.13

  • Problem with converting GF1 raw files

    I recently bought a Panasonic Lumix GF1 and use raw. However, my CS3 and Element 6.0 is not able to read the DNG files that I have created through Adobe DNG Converter. It doesn't seem to matter that I updated the Converter to 6.3. It creates DNG file

  • Transferring photoshop elements 11 from pc to imac.

    I have photoshop elements 11 on my old PC and want to migrate that to an Imac.  Can someone tell me how?