Doubt on Dates

Hi exports,
I want to create executable program which is having date field in selection screen. date is select-options field.
now my problem is i want to select the data from ztable.
the table contains many filed in that one field is from_date and another is to_date.
ex: from date: 01.01.2010 to date: 31.12.2010.
but in selection screen user will enter like:
ex: from date: 05.05.2010 ; to 31.05.2010.
now i want to search the user enter date range is between the ztable from and to dates.
in example above it is following in that range.
i want to select that record.
so how can i write select statement for this.
plz help me.
Harsha

hi harsha
compare from_date with sdate-low
and  to_date with sdate_high
like
select *  lab lab ....where  from_date GE sdate-low and to_date LE sdate-high.
but before using this check if we can compare date fields directly.
else.
If it is not possible at select statement level we can do that in internal table level very easily.

Similar Messages

  • Doubt in data element creation

    Hi,
        I have doubt in data element creation ie, there is 2 options elementary type
    (domain and built-in-type) and reference type (name of the reference type &
    ref to predefined type). if there is built in type here then what is the use of
    built-in-type in initial screen of the table and also explain me about the use of
    reference type.
    with regards,
    nanjunda sharma

    Hi!
    With the use of the built-in type, you have to set always in every different data element the exact type.
    With the use of the domains (pre-defined types) you just have to enter the domain name into the data element. If you have to modify the type, you can maintain it in the domain (only once) but the built in types have to modifyed in every data element (which means more work).
    Domains have a little more options also, than the built in types.
    Regards
    Tamá

  • Doubt regarding Data transfer from R3 to BW

    Hello Experts,
    I have a basic questions to ask,I am curious to know that how the data is transfered from a
    remote system (let say R3 or CRM) to BW system.Though i know that two systems
    make a RFC connections and make use of idocs.
    But if somebody can through more light on this and help me clear my doubts.
    Also case when the data is transfered with in BW.
    Thanx and Regards
    Priyanka

    Hi,
    Chek in teh follwoing PDF you will get some Idea.
    http://sap-idoc2edi-consulting.com/pdfFiles/EDI_IDoc_Overview.pdf
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/908836c3-7f97-2b10-4cb8-e6790361c152
    Thanks
    Reddy

  • Doubt in Date tracking update of person records

    Dear all,
    I have a doubt on the approach to be followed for a particular scenario. The following is the explanation:
    Let us say we have a person record as follows:
    Employee_No      Effective start Date         Marital status
    100                    01-Jan-2000                  Single
    Let us say HR user date tracked to  01-Jan-2010 and  updated to Married
    So we have the following :
    Employee_No      Effective start Date    Effective end date      Marital status
    100                    01-Jan-2000                31-Dec-2009            Single                 
    100                    01-Jan-2010                31-Dec-4712            Married
    Later HR found that the date of updation was not correct it should be 01-Jan-2011, which was wrongly entered as 01-Jan-2010.
    Now should the HR
    1) Go to the earliest record and delete the next change and then re enter with correct date? or
    2)  Go to 01-Jan-2010 , Correct the record to Single, go to 01-Jan-2011 update to Married.
    Because Oracle allows both. In the second case, per_all_people_f  will have 2 records with the same set of data but with different start and end dates.
    Can any body say which is correct approach and why?
    Thanks
    Raj

    Hi Raj,
    In terms of business both the actions will fine as in reports it will show the same result.
    From technical (data level) It is your decision on the way you want to go ahead.
    In case of a error it is better practice to purge the next changes and update the record with correct details.
    Thanks,
    Sanjay

  • GP doubt in  Data Input form

    Hi Experts,
    I have a doubt in GP Input Data Form callable object.
    When i insert a callable object of type "Data Input Form" and test it.
    It should display Input box and a button only. But i'm getting "Edit/View Attributes Values" and below i'm getting the input box, button. (u can view in following link https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d027c966-b6de-2910-0681-cdb0be7e1b59 )
    My question is, How to avoid "Edit/View Attributes Values"?
    I was following the tutotial
    SAP Composite Application Framework - CAF Tutorial Center [original link is broken]
    Tutotial name: 33 Creating a Callable Object in Group - Data Forms (GP)
    Valuable answers will b rewarded.
    Thanks in Advance,
    Suba

    Hi,
    You are creating Data Input Form callable Object. The template for Data Input Form is provided by SAP. So you can not change the template. It is fixed.
    Which Service Pack are you using? The screen short within the link (https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1f589ed1-0c01-0010-9988-e3a67384acd9) are taken from SP7 or before that. But from SP8 onwards you will not get that type of Data Inout Form template. So I think you are using SP8 or nowards. Now staing on your current SP level If you want to hide the "Edit/View Attributes Values" then you need to create your own (custom) Form either using Web Dynpro Application or VC application.
    Please set your requirement which technique and which SP you will use.
    Thanks
    Chandan

  • Doubt in data transfer

    can anybody tell
    wat type of interface or which method  can be used to move datas or table from flat file structure
    the requriement is first we have to generate a flatfile structure from sap r/3 and we have to trasfer the datas to one particular server.
    wat method we can use
    eg:material master
    sales order

    Hi,
      try the following code n let me know if it meets ur requirement.
    *"Table declarations...................................................
    tables: kna1.
    *"Selection screen elements............................................
    select-options: s_kunnr for kna1-kunnr.             " Customer Number 1
    Type declaration of the structure to hold Customer master           *
    data:
      begin of fs_kna1,
        kunnr type kna1-kunnr,             " Customer Number 1
        adrnr type kna1-adrnr,             " Address
        anred type kna1-anred,             " Title
        erdat type kna1-erdat,             " Date on which Record Was reated
        ernam type kna1-ernam,             " Name of Person who Created
      end of fs_kna1.
    Internal table to hold Customer master                              *
    data:
      t_kna1 like standard table
               of fs_kna1.
    Type declaration of the structure to hold file data                 *
    data:
      begin of fs_table,
        str type string,
      end of fs_table.
    Internal table to hold file data                                    *
    data:
      t_table like standard table
                of fs_table.
    field-symbols: <fs>.
    *" Data declarations...................................................
    Work variables                                                      *
    data:
      w_char(50) type c.
    select kunnr                           " Customer Number 1
           adrnr                           " Address
           anred                           " Title
           erdat                           " Date on which Record Was reated
           ernam                           " Name of Person who Created
      from kna1
      into table t_kna1
    where kunnr in s_kunnr.
    if sy-subrc eq 0.
      loop at t_kna1 into fs_kna1.
        do.
          assign component sy-index of structure fs_kna1 to <fs>.
          if sy-subrc ne 0.
            exit.
          else.
            move <fs> to w_char.
            if sy-index eq 1.
              fs_table-str = <fs>.
            else.
              concatenate fs_table-str ',' w_char into fs_table-str.
            endif.                         " IF SY-INDEX...
          endif.                           " IF SY-SUBRC...
        enddo.                             " DO...
        append fs_table to t_table.
      endloop.                             " LOOP AT T_KNA1...
    endif.                                 " IF SY-SUBRC...
    call function 'GUI_DOWNLOAD'
      exporting
      BIN_FILESIZE                    =
        filename                        = 'C:\Assign\kna1'
      FILETYPE                        = 'ASC'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = ' '
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
    IMPORTING
      FILELENGTH                      =
      tables
        data_tab                        = t_table
      FIELDNAMES                      =
    exceptions
       file_write_error                = 1
       no_batch                        = 2
       gui_refuse_filetransfer         = 3
       invalid_type                    = 4
       no_authority                    = 5
       unknown_error                   = 6
       header_not_allowed              = 7
       separator_not_allowed           = 8
       filesize_not_allowed            = 9
       header_too_long                 = 10
       dp_error_create                 = 11
       dp_error_send                   = 12
       dp_error_write                  = 13
       unknown_dp_error                = 14
       access_denied                   = 15
       dp_out_of_memory                = 16
       disk_full                       = 17
       dp_timeout                      = 18
       file_not_found                  = 19
       dataprovider_exception          = 20
       control_flush_error             = 21
       others                          = 22
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    reward if helpful.
    regards,
    kiran kumar k

  • Doubt in data import from R3 to B1

    Hi ,
    After many trails and errors we have successfully installed B1iSN and connected with both R3 and B1. But as of now the problem is the data transfer. I have did the following steps,
    1.Installed B1iSN successfully with Event Sender.
    2.In the Administration of B1iSN I have defined 2 systems for B1 and R3 respectively (Test connection is positive.)
    3. I have imported the zip files (B1ISN2007SIMP_08_import_01.zip,B1ISN2007SIMP_08_import_02.zip from SIM->Import and B1ISN2007CONTNTP_08.zip from Content folder )
    4. Using the application manager I have deployed (used the file B1ISN2007SIMP_08_deploy.zip under SIM->Deploy) the Subsidary Integration console.
    I guess that all the above steps are successfully done. Now comming to the problem areas, I am trying to import Customer master data from R3 system, I have followed the Config_Guide_Master_Data_Distribution_Customer_EN.pdf, I did the following steps in the Integration Console...
    1. Assigned the B1 and R3 systems.
    2. Filled the system properties.  (Some fields are left blank, HQ vendor no is left blank.. )
    3. Created a BizProcess from Business Processes-> Define, I have selected Master Data and in the BizPackage i have selected Business Partner.
    4. Selected sender (R3) and receiver(B1) systems.
    5. I have not set and parameters.(like country,region and regional market)
    6. In the set data properties step i have not given text ID..? Actually what is this text id and from where should i get it..? (Document is not of much help here.)
    7.Saved these settings and activated the Bizpackage.
    Now in R3 using the TCODE BD12 i have tried to send a selected customer, but no error message is shown in the message log..
    Please guide me if I have done some mistake or if i have missed something.
    Thanks in advance,
    Vasu Natari.

    Yatsea,
    As u can see the above post, the I doc is being sent successfully i suppose... But in B1 no data is added.. I have created a new database but no entries are created, Am i missing something here..?
    Below is the log file from tomcat temp folder...
    Aug 25, 2009 11:45:00 AM com.sap.b1i.bizprocessor.AtomStatusToken log
    CONFIG: BPC040 Size of next input-message for current Atom:
    bizflow:/com.sap.b1i.system.xc/bfd/DBQgc.bfd/QCleaner[xform]/0000b/-_(0)
    198 bytes
    Aug 25, 2009 11:45:00 AM com.sap.b1i.bizprocessor.AtomScheduler run
    CONFIG: BPC094 BizFlow-Properties passed to invoked Atom:
    (BFProperties:
    +P bpc.XSLprofile := sapxml
    +P bpc.currflow := /com.sap.b1i.system.xc/bfd/DBQgc.bfd
    +P bpc.dataset := com.sap.b1i.system.xc
    +P bpc.group := bfd
    +P bpc.jobid := 09082509421225000517C0A801686F91
    +P bpc.pltype := xml
    +P bpc.propertylist :=
    +P bpc.vers.bpc := 0.28.0 (built 200907070050)
    +P bpc.vers.cos := 0.13.2 (built 200907070050)
    +P bpc.vers.dbl := 0.17.0 (built 200907070050)
    +P bpc.vers.utl := 0.23.0 (built 200907070050)
    +P xcl.instance := com_sap_b1i_system_xc
    +P xcl.ipocall := com.sap.b1i.xcl_srvc.IPOCall
    +P xcl.ipostep := /com_sap_b1i_system_xc/com.sap.b1i.system.xc/ipo/cronjobs.ipo/DBQgc
    +P xcl.port := com.sap.b1i.xcellerator.XsPort
    +P xcl.tid := 09082509421225000517C0A801686F91
    +P xcl.version := 0.35.0 (built 200907070050)
    +P xcm.msgid := 09082509421225000515C0A801683696
    BFProperties)
    Aug 25, 2009 11:45:00 AM com.sap.b1i.bizprocessor.XformAtom process
    CONFIG: BPC141 XSL-stylesheet to execute: bizstore:/com.sap.b1i.system.xc/xsl/DBQgc.xsl
    Aug 25, 2009 11:45:00 AM com.sap.b1i.xcellerator.InternalDocuments provideDocument
    CONFIG: XCL118 Request for an Internal Document: xc|dbqgc.xml|
    Aug 25, 2009 11:45:00 AM com.sap.b1i.dblayer.DBLayer$DBConnection logP
    CONFIG: DBL034 DBConn.#3 Execution time for write-stmnt DBQ_GarbageCollector: 16 mSec
    Aug 25, 2009 11:45:00 AM com.sap.b1i.bizprocessor.AtomStatusToken log
    CONFIG: BPC133 Execution time for current Atom:
    bizflow:/com.sap.b1i.system.xc/bfd/DBQgc.bfd/QCleaner[xform]/0000b/-_(0)
    31 mSec
    Aug 25, 2009 11:45:00 AM com.sap.b1i.bizprocessor.AtomStatusToken log
    CONFIG: BPC040 Size of next input-message for current Atom:
    bizflow:/com.sap.b1i.system.xc/bfd/DBQgc.bfd/bpc.output[output]/0001b/-_(0)
    313 bytes
    Aug 25, 2009 11:45:00 AM com.sap.b1i.bizprocessor.AtomScheduler run
    CONFIG: BPC094 BizFlow-Properties passed to invoked Atom:
    (BFProperties:
    +P bpc.currflow := /com.sap.b1i.system.xc/bfd/DBQgc.bfd
    +P bpc.dataset := com.sap.b1i.system.xc
    +P bpc.group := bfd
    +P bpc.jobid := 09082509421225000517C0A801686F91
    +P bpc.pltype := xml
    +P bpc.propertylist :=
    +P bpc.vers.bpc := 0.28.0 (built 200907070050)
    +P bpc.vers.cos := 0.13.2 (built 200907070050)
    +P bpc.vers.dbl := 0.17.0 (built 200907070050)
    +P bpc.vers.utl := 0.23.0 (built 200907070050)
    +P xcl.instance := com_sap_b1i_system_xc
    +P xcl.ipocall := com.sap.b1i.xcl_srvc.IPOCall
    +P xcl.ipostep := /com_sap_b1i_system_xc/com.sap.b1i.system.xc/ipo/cronjobs.ipo/DBQgc
    +P xcl.port := com.sap.b1i.xcellerator.XsPort
    +P xcl.tid := 09082509421225000517C0A801686F91
    +P xcl.version := 0.35.0 (built 200907070050)
    +P xcm.msgid := 09082509421225000515C0A801683696
    BFProperties)
    Please  tell me whats the above thing means..?
    Thanks,
    Vasu Natari.

  • I have doubt in data sources

    Hi Friends
    im using 2lis-11-vahdr, vaitm, vascl data sources.
    any one tell this senario which cube is installed.

    Hi,
    2lis_13_vdhdr and 2lis 13vditm  : for this sales overview cube is used ( 0sd_Co3 )
    tables concerned to billing data sources: vbrk(billing header ), vbrp(billing item )
    Regards,
    Chendrasekhar

  • Doubt on date modifier

    Dear All,
    I have created three date modifier. 11 for the pay date on 25th of every month,
    22 on 30th and
    33 on 5th of the succeeding month.
    My question is,
    1. We have just entered some text in the table, so how does the system knows 11 means 25th, 22 means 30th and 33 is next month 5th ??
    2. Is there any other table there we specify the dates?
    3. Also let me know what does the standard modifier 00 means? payment date on 30th of every month?
    Regards
    ET

    Hi ET,
    Actually first you define the date modifiers as you did.
    And then assign them to pay days in table V_T549S_B.
    Without maintaining the latter table, the definition does not make sense.
    These modifiers are used as keys in pay day table to create separate entries - for same payroll area differen pay day.
    They do not mean anything by themselves (00 standard modifier is not by itself meaningful. But standard SAP table entries in V_T549S_B have it as key)
    Regards,
    Dilek

  • Doubt in date

    select hire_date from dual;
    Output :20-jun-2011
    is it possible to calculate date in this format?
    2+0+0+6+2+0+1+1

    845946 wrote:
    select hire_date from dual;
    Output :20-jun-2011
    is it possible to calculate date in this format?
    2+0+0+6+2+0+1+1Why on earth would you want to add up the numerical digits of a date?
    What are you trying to achieve?
    Surely you don't want the dates in that format?
    SQL> select hiredate from emp;
    HIREDATE
    17-DEC-1980 00:00:00
    20-FEB-1981 00:00:00
    22-FEB-1981 00:00:00
    02-APR-1981 00:00:00
    28-SEP-1981 00:00:00
    01-MAY-1981 00:00:00
    09-JUN-1981 00:00:00
    19-APR-1987 00:00:00
    17-NOV-1981 00:00:00
    08-SEP-1981 00:00:00
    23-MAY-1987 00:00:00
    03-DEC-1981 00:00:00
    03-DEC-1981 00:00:00
    23-JAN-1982 00:00:00
    14 rows selected.
    SQL> ed
    Wrote file afiedt.buf
      1* select rtrim(regexp_replace(to_char(hiredate,'DDMMYYYY'),'(.)','\1+'),'+') from emp
    SQL> /
    RTRIM(REGEXP_REPLACE(TO_CHAR(HIREDATE,'DDMMYYYY'),'(.)','\1+'),'+')
    1+7+1+2+1+9+8+0
    2+0+0+2+1+9+8+1
    2+2+0+2+1+9+8+1
    0+2+0+4+1+9+8+1
    2+8+0+9+1+9+8+1
    0+1+0+5+1+9+8+1
    0+9+0+6+1+9+8+1
    1+9+0+4+1+9+8+7
    1+7+1+1+1+9+8+1
    0+8+0+9+1+9+8+1
    2+3+0+5+1+9+8+7
    0+3+1+2+1+9+8+1
    0+3+1+2+1+9+8+1
    2+3+0+1+1+9+8+2
    14 rows selected.

  • Doubt Regarding Dates

    Hello,
    I want a list of dates of last 15 days from the date i pass ... how to achieve this ia a sql query...
    & i also want to display 'January - December' in a query ..
    plz help.

    Try this,
    SQL> SELECT &p_date - LEVEL dt
      2    FROM DUAL
      3  CONNECT BY LEVEL <= 15;
    Enter value for p_date: sysdate
    old   1: SELECT &p_date - LEVEL dt
    new   1: SELECT sysdate - LEVEL dt
    DT
    25-APR-11
    24-APR-11
    23-APR-11
    22-APR-11
    21-APR-11
    20-APR-11
    19-APR-11
    18-APR-11
    17-APR-11
    16-APR-11
    15-APR-11
    14-APR-11
    13-APR-11
    12-APR-11
    11-APR-11
    15 rows selected.
    SQL> SELECT TO_CHAR ( ADD_MONTHS ( TRUNC ( SYSDATE, 'YYYY'), LEVEL - 1), 'MONTH') mnth
      2    FROM DUAL
      3  CONNECT BY LEVEL <= 12;
    MNTH
    JANUARY
    FEBRUARY
    MARCH
    APRIL
    MAY
    JUNE
    JULY
    AUGUST
    SEPTEMBER
    OCTOBER
    NOVEMBER
    DECEMBER
    12 rows selected.
    SQL> G.

  • Doubt on date format

    I am doing some analysis on date wise record, I have two different formats of date in single column dd-mm-yyyy, dd-mm-yy and while doing calculations excel considers the first one as it is, the second one it takes as yy-mm-dd , pls help me to solve this
    issue. i.e. how to convert both in a single format. thanks

    Just change select the column and change format of the entire column
    columns($A:$A).NumberFormat = "dd-mm-yyyy"
    jdweng

  • Doubt on data to download excel

    Hi SAP Experts,
    I done the report to download the itab data to excel sheet.Its working very fine.. But the problem is i have the data around 1lakh records. But in excel sheet it takes only upto maximum of 65,535 records only.
    How can i display the remaining records in the excel shett. Please suggest me how to do. 
           Thanks in advance
    Thanks and Regards
    Siri.......

    Hi,
      May be the following code be helpful.
    hi
    good
    pls check this code , this might help you to solve your problem
    Multiple excel sheets generation in a workbook
    CREATE OBJECT EXCEL 'EXCEL.SHEET'.
    GET PROPERTY OF EXCEL 'Application' = APPLICATION.
    SET PROPERTY OF APPLICATION 'Visible' = 1.
    CALL METHOD OF APPLICATION 'Workbooks' = BOOKS.
    CALL METHOD OF BOOKS 'Add' = BOOK.
    CALL METHOD OF BOOK 'WORKSHEETS' = SHEET.
    CALL METHOD OF SHEET 'ADD'.
    Fill all the sheets with relavant data
    PERFORM SHEET1 TABLES ITAB1.
    PERFORM SHEET2 TABLES ITAB2.
    PERFORM SHEET3 TABLES ITAB3.
    PERFORM SHEET4 TABLES ITAB4.
    Quit the excel after use
    CALL METHOD OF EXCEL 'QUIT'.
    FREE OBJECT: COLUMN,SHEET,BOOK,BOOKS,APPLICATION,EXCEL. "NO FLUSH.
    CLEAR V_SHEET.
    FORM FILL_CELL USING ROW COL VAL.
    CALL METHOD OF SHEET 'cells' = CELL NO FLUSH
    EXPORTING #1 = ROW #2 = COL.
    SET PROPERTY OF CELL 'value' = VAL.
    FREE OBJECT CELL NO FLUSH.
    ENDFORM. " FILL_CELL
    FORM SHEET1 TABLES ITAB1 STRUCTURE ITAB1.
    V_SHEET = Sheet Name.
    V_NO = V_NO + 1.
    CALL METHOD OF BOOK 'worksheets' = SHEET NO FLUSH EXPORTING #1 = V_NO.
    SET PROPERTY OF SHEET 'Name' = V_SHEET NO FLUSH.
    PERFORM FILL_SHEET1 TABLES ITAB1 USING V_NO V_SHEET.
    CALL METHOD OF SHEET 'Columns' = COLUMN.
    FREE OBJECT SHEET.
    CALL METHOD OF COLUMN 'Autofit'.
    FREE OBJECT COLUMN.
    ENDFORM.
    Repeat above procedure for all sheets you want to add
    FORM FILL_SHEET1
    TABLES ITAB1 STRUCTURE ITAB1
    USING V_NO V_SHEET.
    ROW = 1.
    PERFORM FILL_CELL USING ROW 1 'Column1 Name'.
    PERFORM FILL_CELL USING ROW 2 'Column2 Name'.
    PERFORM FILL_CELL USING ROW 3 'Column3 Name'.
    ROW = ROW + 1.
    LOOP AT ITAB1.
    PERFORM FILL_CELL USING ROW 1 ITAB1-Column1.
    PERFORM FILL_CELL USING ROW 2 ITAB1-Column2.
    PERFORM FILL_CELL USING ROW 3 ITAB1-Column3.
    ROW = ROW + 1.
    ENDLOOP.
    ENDFORM.
    Repeat above procedure for all sheets you want to add
    Try this also
    TYPE-POOLS: truxs.
    DATA: it_raw TYPE truxs_t_text_data.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    field_name = 'P_FILE'
    IMPORTING
    file_name = p_file.
    Upload Excel file
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
    EXPORTING
    I_FIELD_SEPERATOR =
    i_line_header = 'X'
    i_tab_raw_data = it_raw
    i_filename = p_file
    TABLES
    i_tab_converted_data = i_XCEL[]
    EXCEPTIONS
    conversion_failed = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    pls reward if useful,
    Thanks,
    Sirisha.

  • Doubt regarding Date Comparison

    Hello,
    i am facing a problem in date comparison
    SELECT max(l.id)
    FROM irf_bill_details l
    WHERE to_char(l.agreement_id) = '508814'
    AND l.billing_client_id = 'BHPIF'
    AND extract(YEAR FROM l.bill_date) < extract(YEAR FROM to_date('01-Jan-2010', 'dd-Mon-yyyy'))
    So when i am using this Query m getting the result ...BUT ...
    When i use the Below Query .... i am getting NULL ... So the problem surely is in when comparing with months ..?? how to get rid
    SELECT max(l.id)
    FROM irf_bill_details l
    WHERE to_char(l.agreement_id) = '508814'
    AND l.billing_client_id = 'BHPIF'
    AND extract(YEAR FROM l.bill_date) < extract(YEAR FROM to_date('01-Jan-2010', 'dd-Mon-yyyy'))
    AND extract(MONTH FROM l.bill_date)||'-'||extract(YEAR FROM l.bill_date) < extract(MONTH FROM to_date('01-Jan-2010', 'dd-Mon-yyyy'))||'-'||extract(YEAR FROM to_date('01-Jan-2010', 'dd-Mon-yyyy'))
    --------------------------------------------------------------------------------------

    Aijaz Mallick wrote:
    Hello,
    i am facing a problem in date comparison
    SELECT max(l.id)
    FROM irf_bill_details l
    WHERE to_char(l.agreement_id) = '508814'
    AND l.billing_client_id = 'BHPIF'
    AND extract(YEAR FROM l.bill_date) < extract(YEAR FROM to_date('01-Jan-2010', 'dd-Mon-yyyy'))
    So when i am using this Query m getting the result ...BUT ...
    When i use the Below Query .... i am getting NULL ... So the problem surely is in when comparing with months ..?? how to get ridAre you saying that you're still getting one row of output, but the id on the row is NULL?
    SELECT max(l.id)
    FROM irf_bill_details l
    WHERE to_char(l.agreement_id) = '508814'
    AND l.billing_client_id = 'BHPIF'
    AND extract(YEAR FROM l.bill_date) < extract(YEAR FROM to_date('01-Jan-2010', 'dd-Mon-yyyy'))
    AND extract(MONTH FROM l.bill_date)||'-'||extract(YEAR FROM l.bill_date) < extract(MONTH FROM to_date('01-Jan-2010', 'dd-Mon-yyyy'))||'-'||extract(YEAR FROM to_date('01-Jan-2010', 'dd-Mon-yyyy'))
    --------------------------------------------------------------------------------------Whenever you have a problem, post some sampel data (CREATE TABLE and INSERT statements) and the results you want from that data. Explain how you get those results from that data.
    As long as I don't know where you're starting from (sample data) or where you want to go (results) it's hard for me to give you good diorections.
    I suspect you want to be using TRUNC rather than EXTRACT, if not a plain DATE comparison.
    For example, if you have a string p_cutoff_date (such as '01-Jan-2010', but not necessaily the 1st of the month) and you want to see if l.bill_date is earlier than the beginning of the month that contains p_cutoff_date, then:
    WHERE   l.bill_date < TRUNC ( TO_DATE ( p_cutoff_date
                                          , 'dd-Mon-yyyy'
                       , 'MONTH'
                       )As you said in the subject line, you're trying to compare DATEs. So compare DATEs: don't convert them to NUMBERS (using EXTRACT) and then to strings (using ||); keep the DATEs as DATEs.

  • Doubt on data retrieval

    Hi all,
    i have a ztable in which i have matnr field which is a not a primary key.
    Now  i have to retrieve all the records based on a particular material number which would be from selection screen.
    i.e my statemnt would be
    select *  from zxyd into table itab where matnr = pmatnr.
    Do i have to create a secondary index for matnr, because the table contains large amount of  data
    Let me know
    Thanks

    Hi Rich and Ferry,
    i did as you told me to do
    after creating index
    12,565 ztest     OPEN        1
       181 ztest     FETCH      29
         3 ztest     FETCH       0
         9 ztest     CLOSE       0
    before creating index
    1,999 ztest     OPEN        1
      186 ztest     FETCH      29
        3 ztest     FETCH       0
        9 ztest     CLOSE       0
    This are st05 trace.
    I working in the otherway.
    time taken after creating index is more .
    do i have to mention anything in my select query
    let me know
    Thanks

Maybe you are looking for

  • Good old insufficient bandwidth

    i am going mad trying to figure out how to troubleshoot my "insufficient bandwidth to maintain the conference" problem. i have just moved from one side of north america to another, and i can no longer video chat with anyone using ichat, nor can i aud

  • Can I link Apple TV to stereo wirelessly?

    Hi. I want to get Apple TV for my parents. Their TV and stereo are on opposite sides of the room and they do not want to run wires across. I'm hoping to find a way to link the Apple TV to the stereo wirelessly. Apple Express has been suggested, but I

  • Problem configuring wireless bridge

    Don't know of this is the right forum, but no doubt someone will put me right if it isnt... I'm trying to get my son's hand-me-down G4 Powermac on to our home's wireless network. I bought a Belkin wireless bridge. I can log in to the router, select i

  • Mvt 122 vs 161.

    Hi, why for returns delivery to vendors SAP allows two different mvt (122 or 161) ? When is better use 122 and when 161 ? Regards

  • How do i rotate the shape

    how do i rotate the image in draw