How to compare closeness of pixels?

i'd like to create a photomosaic generator. the difficult part is to determine the best matching picture (from a database of pictures) to replace a tiled section of the original picture. given tile, pic0, pic1 (all bufferedimage objects of the same dimension), determine whether pic0 or pic1 is a better replacement for tile.
my attempt:
0. compare* (details below) tile with pic0 pixel by pixel and sum up the differences (call it s0).
1. compare* (details below) tile with pic1 pixel by pixel and sum up the differences (call it s1).
2. replace tile with pic0 if s0 <= s1, otherwise replace it with pic1.
*pixel comparison:
0. extract the rgb components of the corresponding pixels.
1. abs(tilePix.red - picPix.red) + abs(tilePix.green - picPix.green) + abs(tilePix.blue - picPix.blue).
results: the same picture is always used as a replacement.
using the distance formula on rgb doesn't work either:
sqrt(sqr(tilePix.red - picPix.red) + sqr(tilePix.green - picPix.green) + sqr(tilePix.blue - picPix.blue).
please help, thanks.

Are you accumulating the differences in a large enough datatype? You might be getting overflows.

Similar Messages

  • How can I closed credit card from any update of my iphone

    How can I closed credit card from any update of my iphone.
    it is billed otomaticly. last bill around 32$. every month bill around 100$. I want to making control by manuel. so could you explain me how to do it?

    Hey donyh1,
    Thanks for the question. You can hide the recent contacts in the multitasking screen by navigating to your Contacts settings:
    Contacts settings - iPhone
    http://help.apple.com/iphone/8/#/iph96b20610
    Thanks,
    Matt M.

  • How do I find the pixel size of a photo?

    I have taken a photo or found one online.
    It's now on my ipad.
    How do I tell the pixel resoution of the photo via the ipad?
    I have two of the same photos on my device at the moment and want to delete one.  They may both be 2048/2048, but without emailing them or putting them in Dropbox, and viewing on my laptop, I don't see how to tell.

    Get the Actual Pixels App from the App Store. It's free and will tell you the pixel size of any photo you open.
    https://itunes.apple.com/ca/app/actual-pixels/id608679577?mt=8

  • How to Upload Closing balances of ECS and SHECS

    Hi Experts ,
    Please let me know how to upload closing balances of Education cess and Higher Secondary Education cess of Excise duties
    Thanks in advance
    GMR

    hi
    Through Table J2_IACCBAL (OPENING/CLOSING ACC.BALANCE TABLE)

  • How to compare result from sql query with data writen in html input tag?

    how to compare result
    from sql query with data
    writen in html input tag?
    I need to compare
    user and password in html form
    with all user and password in database
    how to do this?
    or put the resulr from sql query
    in array
    please help me?

    Hi dejani
    first get the user name and password enter by the user
    using
    String sUsername=request.getParameter("name of the textfield");
    String sPassword=request.getParameter("name of the textfield");
    after executeQuery() statement
    int exist=0;
    while(rs.next())
    String sUserId= rs.getString("username");
    String sPass_wd= rs.getString("password");
    if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
    exist=1;
    if(exist==1)
    out.println("user exist");
    else
    out.println("not exist");

  • How can i closed production verion wise in c223

    Welcome, ANILKUMAR BEHERA   
    Your Control Panel 
    Your Reward Points 
    Your Questions 
    Expert Forums » ABAP Development » ABAP Objects
    Thread: how can i get production version value(verid) for luck through bdc.
    Your question is not answered.
    Mark as answered.
      You are watching this thread. To stop watching this thread, click "Stop Watching Thread" below. (Watch Options)
    This watch sends emails by default. If you don't want to receive emails on changes in this thread, go to the watch options, un-mark the "Email" checkbox next to the thread's entry and click "Update". 
    Reply to this Thread   Search Forum    Stop Watching Thread    Back to Thread List 
      Replies: 0 - Pages: 1  Threads: Previous  
    ANILKUMAR BEHERA  
    Posts: 20
    Registered: 10/13/07
    Forum Points: 0 
       how can i get production version value(verid) for luck through bdc.  
    Posted: Feb 14, 2008 1:32 PM     Edit      E-mail this message      Reply 
    HI..
    i have one requirement..that in c223 tcode while i luck the production version through BDC in my report program as i given bellow...i upload mat.no , plant, production version and 1(for luck)...
    req:: i want while i given production version for particlular plant and material no...that production version should be luck....
    so in standard tcode c223 how can i get value to compair it with my input production version value then i will close that...
    program:::
    report ZC2232
    no standard page heading line-size 255.
    *include bdcrecx1.
    Tables : mkal.
    data : nodata value '/' .
    data : CTUMODE type c value 'E'.
    DATA : CUPDATE TYPE C VALUE 'L'.
    DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    messages of call transaction
    DATA: MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    data: begin of HEADER OCCURS 0,
    data element: MATNR
    MATNR_001(018),
    data element: WERKS_D
    WERKS_002(004),
    data element: PLNNR
    PLNNR_003(008),
    data element: CP_STTAG
    STTAG_003(010),
    data element: ENTRY_ACT
    ENTRY_ACT_005(011),
    data element: PLNAL
    PLNAL_004(001),
    data element: FLG_SEL
    FLG_SEL_01_006(001),
    data element: PLANTEXT
    STLAL_004(002),
    DATUV_005(010),
    WERKS_008(004),
    data element: PLN_VERWE
    ktext_005(001),
    data element: PLNST
    DELKZ_005(001),
    data element: LOSGRVON
    LOSVN_011(017),
    data element: LOSGRBIS
    LOSBS_012(017),
    data element: PLNME
    PLNME_013(003),
    data element: PLNME
    stlal_014(002),
    end of HEADER.
    data : begin of it_header occurs 0,
    matnr like marc-matnr,
    werks like marc-matnr,
    verid like mkal-verid,
    mksp like mkal-mksp,
    end of it_header.
    data : exnum(40) type c,
    exnum1(40) type c,
    cnt type I,
    CN(2) TYPE C,
    c1 type c value '(',
    c2 type c value ')'.
    start-of-selection.
    parameters: p_file like rlgrap-filename.
    at selection-screen on value-request for p_file.
    call function 'F4_FILENAME'
    EXPORTING
    PROGRAM_NAME = SYST-CPROG
    DYNPRO_NUMBER = SYST-DYNNR
    FIELD_NAME = ' '
    importing
    file_name = p_file.
    start-of-selection.
    call function 'WS_UPLOAD'
    exporting
    CODEPAGE = ' '
    filename = p_file
    filetype = 'DAT'
    HEADLEN = ' '
    LINE_EXIT = ' '
    TRUNCLEN = ' '
    USER_FORM = ' '
    USER_PROG = ' '
    DAT_D_FORMAT = ' '
    IMPORTING
    FILELENGTH =
    tables
    data_tab = it_header
    EXCEPTIONS
    CONVERSION_ERROR = 1
    FILE_OPEN_ERROR = 2
    FILE_READ_ERROR = 3
    INVALID_TYPE = 4
    NO_BATCH = 5
    UNKNOWN_ERROR = 6
    INVALID_TABLE_WIDTH = 7
    GUI_REFUSE_FILETRANSFER = 8
    CUSTOMER_ERROR = 9
    NO_AUTHORITY = 10
    OTHERS = 11
    if sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    DELETE it_header WHERE MATNR IS INITIAL.
    LOOP AT it_header.
    *start-of-selection.
    *perform open_group.
    perform bdc_dynpro using 'SAPLCMFV' '1000'.
    perform bdc_field using 'BDC_OKCODE'
    '=ENTE'.
    perform bdc_field using 'BDC_CURSOR'
    'MKAL-WERKS'.
    perform bdc_field using 'MKAL-WERKS'
    it_header-werks.
    perform bdc_field using 'MKAL-MATNR'
    it_header-matnr.
    perform bdc_dynpro using 'SAPLCMFV' '1000'.
    perform bdc_field using 'BDC_OKCODE'
    '=PICK'.
    perform bdc_field using 'MKAL-WERKS'
    it_header-werks.
    perform bdc_field using 'MKAL-MATNR'
    it_header-matnr.
    *>>>>>>>>>>>>>>>>>>>>here what logic can i write****
    clear cnt.
    do 15 times.
    cnt = cnt + 1 .
    CN = CNT.
    exnum = 'MKAL_EXPAND-VERID'.
    concatenate exnum c1 cn c2 into exnum1.
    *perform bdc_field using 'BDC_CURSOR'
    exnum1.
    GET PARAMETER ID 'VER' FIELD EXNUM1.
    CALL TRANSACTION 'C223' AND SKIP FIRST SCREEN.
    if ( it_header-verid = EXNUM1 ).
    exit.
    endif.
    enddo.
    ****************************************************end***>>>>>>>>
    perform bdc_field using 'BDC_CURSOR'
    exnum1.
    perform bdc_dynpro using 'SAPLCMFV' '2000'.
    perform bdc_field using 'BDC_CURSOR'
    'MKAL_EXPAND-PLNTY'.
    perform bdc_field using 'BDC_OKCODE'
    '=PRFG'.
    perform bdc_dynpro using 'SAPMSSY0' '0120'.
    perform bdc_field using 'BDC_OKCODE'
    '=RW'.
    perform bdc_dynpro using 'SAPLCMFV' '2000'.
    perform bdc_field using 'BDC_OKCODE'
    '/ECANC'.
    perform bdc_field using 'BDC_CURSOR'
    'MKAL_EXPAND-VERID'.
    perform bdc_dynpro using 'SAPLCMFV' '1000'.
    perform bdc_field using 'BDC_OKCODE'
    '=SAVE'.
    perform bdc_field using 'BDC_CURSOR'
    'MKAL-WERKS'.
    perform bdc_field using 'MKAL-WERKS'
    it_header-werks.
    perform bdc_field using 'MKAL-MATNR'
    it_header-matnr.
    perform bdc_dynpro using 'SAPLCMFV' '1000'.
    perform bdc_field using 'BDC_OKCODE'
    '/EBACK'.
    perform bdc_transaction using 'C223'.
    endloop.
    *perform close_group.
    *& Form bdc_dynpro
    text
    -->P_0161 text
    -->P_0162 text
    form bdc_dynpro USING PROGRAM DYNPRO.
    CLEAR BDCDATA.
    BDCDATA-PROGRAM = PROGRAM.
    BDCDATA-DYNPRO = DYNPRO.
    BDCDATA-DYNBEGIN = 'X'.
    APPEND BDCDATA.
    endform. " bdc_dynpro
    *& Form bdc_transaction
    text
    -->P_0351 text
    form bdc_transaction USING TCODE.
    call transaction 'C223' using bdcdata
    mode CTUMODE
    update CUPDATE
    messages into messtab.
    if sy-subrc 0.
    message e000(zmm01) with
    'Check your input data'.
    endif.
    endform. " bdc_transaction
    *& Form bdc_field
    text
    -->P_0346 text
    -->P_0347 text
    form bdc_field USING FNAM FVAL.
    if fval nodata.
    CLEAR BDCDATA.
    BDCDATA-FNAM = FNAM.
    BDCDATA-FVAL = FVAL.
    APPEND BDCDATA.
    endif.
    endform. " bdc_field
    Pages: 1    Back to Thread List 
    Threads: Previous  
      New content since your last visit 
      Updated content since your last visit

    macbook pro, 500gb ,version 10.9.5 ,
    all files in open in Quiketime media player  how can i closed..whenever i open quicktime all files are open..i have tried to closed by force quit..but whenever i again open quicktime files are still open..
    You have basically formed a "poor" habit—i.e., closing apps and assuming they will close any/all open activity windows. The latest versions of Mac OS X now, by default, "remembers" what windows are open when an app is closed. You have three options here:
    1) Get in the habit of closing active windows before closing an app to prevent them from re-opening automatically the next time the app is opened.
    2) Hold down the "Option" key when selecting the "Quit" menu option (keyboard shortcut "Option-Command-Q") with system preference option in the default mode.
    3) Change the default system preference to automatically close active windows in the same manner that older Mac OS X versions did by checking the "Close windows when quitting an app" in the Syeyem Preferences "General" menu.
    NOTE: This setting works as a "software switch" for your application's "Quit" menu option. I.e., in the "Unchecked" mode the Option-Quit menu option and keyboard shortcut (Option-Command-Q) tells the system to forget active windows when the app is next opened while the "Checked" option mode tells the system to remember the active windows when using the Option-Quit menu or keyboard shortcut options.
    Your choice for settings and/or method of closing apps.

  • How to compare the no. items in an order i ERP and CRM?

    Hi SAP Experts,
    We are facing an issue where the number of line  items in an order(same order) in ERP and CRM are different , properly not synchronized.e.g., one order in ERP is having 5 line items but in CRM for the same order has 7 line items.
    How to compare and identify the difference in number of line items in ERP and CRM for same orders?
    Is there any report or tables , any  other way?
    Thanks in advance
    Best Regards
    Succhi

    You can use transaction SDIMA for checking if data between crm and erp are synchronized. You can either run a Header comparison or Detailed comparison of the data. It is simple and easy to use. You can find more details here: http://help.sap.com/saphelp_crm70/helpdata/EN/49/2a5a1d6c7f3895e10000000a421937/frameset.htm
    Or you can use report CRM_ODE_CHECK_DOC in CRM system to compare sales Documents between R/3 and CRM per transaction type/sales organization or even the transaction number. Also has got options to check transactions Not equal in CRM and R/3.
    Regards.

  • How to compare dates in Crystal Reports 2008

    Hello,
    I cannot figure out how to compare the dates in the Crystal reports.
    I need all dates that are in the future to be displayed with the green font.
    So in the formula for the font for this texbox I've tried to use different
    formulas like:
    If DateDiff("d", CurrentDate, {DevelopmentTracking_SELECT.Anticipated}) > 1
    Then
         crGreen
    or
    If {DevelopmentTracking_SELECT.Anticipated} > CurrentDate Then
         crGreen
    (where DevelopmentTracking_SELECT is the stored procedure, and Anticipated
    is a date field).
    None of them worked. All dates are treated like they were in the past
    comparing to the CurrentDate. If I reverse these formulas like:
    If {DevelopmentTracking_SELECT.Anticipated} < CurrentDate Then
         crGreen
    then all dates turn to green, otherwise they always stay black.
    What could be a problem here?
    I would appreciate your help.
    Thank you.

    OK, got it, thank you. It worked.
    However, I also need to use another field value which is not on the report, like this:
    If CurrentFieldValue < CurrentDate And {DevelopmentTracking_SELECT.Completed} = False Then
    crRed
    DevelopmentTracking_SELECT.Completed is not on the report.
    Is it possible to use it with the cross-tab?

  • How to compare records in singe internal table

    Hi Folks,
    iam having 3 records in my first itab( T_FINAL) with fields
    material no,  descrip ,  mat type and  group.
    and 16 records in second itab(T_MVKE ) with fields
    mat no ,  distri.chanel  and division
    now I want to fetch the records from T_MVKE  by comparing the records in
    T_FINAL .my requirement is to check the given mat no. in sales org.2000,2100.  if yes then i have to consider 2000 only, if it is in only 2100 then consider 2100 only . is it is in 2000 only then consider 2100 only
    my code is
    LOOP AT T_FINAL.
        READ TABLE T_MVKE WITH KEY MATNR = T_FINAL-MATNR.
       IF SY-SUBRC = 0.
       ON CHANGE OF T_MVKE-MATNR OR T_MVKE-VKORG.
    IF T_MVKE-VKORG = '2000' and SY-TABIX > 1.
          CONCATENATE '2000' 'TS' P_WERKS T_FINAL-MATNR INTO KEY.
    ELSEIF T_MVKE-VKORG = '2000' AND SY-TABIX = 1.
         CONCATENATE '2000' 'TS' P_WERKS T_FINAL-MATNR INTO KEY.
    ELSE.
        CONCATENATE '2100' 'TS' P_WERKS T_FINAL-MATNR INTO KEY.
        ENDIF.
    this logic fails ,. could tell me how to compare values in single itab?
    Thanks
    neha

    Hi ,
    if i've understand you correctly , try that:
    LOOP AT t_final.
      AT NEW matnr.
        CLEAR: v_2000, v_2100.
    *1) 2000
        READ TABLE  t_mvke    WITH KEY matnr = t_final-matnr
                                       vkorg = 2000.
        IF sy-subrc = 0.
          v_2000 = 'X'.
        ENDIF.
    *2) 2100
        READ TABLE  t_mvke    WITH KEY matnr = t_final-matnr
                                       vkorg = 2100.
        IF sy-subrc = 0.
          v_2100 = 'X'.
        ENDIF.
    *compare
        IF v_2000 = 'X' AND  v_2100 = 'X'.
    *read 2000 only
        ELSEIF v_2000 = ' '  AND v_2100 = ' '.
    *nothing found
        ELSE.
    *all other combinations
    *read 2100 only
        ENDIF.
      ENDAT.
    ENDLOOP.
    regards Andreas

  • How to compare values in table control

    Hi Experts,
    How to compare two values of a field in table control. Like the frist row of feld1 with the second row of field1.
    because when ever two values are same i need to display error message that we are entring duplicate entry.
    i have been tring for a very log time but not getting any solution for this.
    Thanks and Regards,
    Ashwin.

    you need to write in code for this..
    A possible solution is given below..
    Suppose your internal table fields are col1 and col2.
    in the loop .....endloop of yout internal table in your PAI..there will be  following(if your table control is made using wizard. otherwise you might have to add it..
    loop at itab.
    chain.
    field col1.
    field col2.
    "some module
    endchain.
    endloop.
    now make changes as shown to the above code..
    loop at itab.
    chain.
    field wa-col1.
    field wa-col2.
    module table_modify on chain-request.
    endchain.
    now in your program add module table modify.
    module table_modify input.
    read table itab with key col1(which shud be unique) = wa-col1 transporting no-fields.
    if sy-subrc = 0. " there exists another record with the same value
    message e001(your message class).
    endif.
    endmodule.
    i guess that shud work. get back if it dosnt.
    regards
    Suzie

  • How to compare two excel files in java ?

    how do i compare two excel files in java.?
    I have two excel files stored on my computer in d: drive.
    Ex:
    D:\\file a
    D:\\file b
    How to compare the contents of these two files and print " files are equal " or "files not equal "

    Javamastermahe wrote:
    I mean i want to print on the console "files are equal " or any message like " both the files match "If this is your requirement, this program satisfies it...
    import java.util.Random;
    public class SuperExcelTester {
        public static void main(String[] args) {
            Random rnd = new Random();
            String[] messages = {
                "files are equal",
                "files are not equal",
                "unexpected error"
            int index = rnd.nextInt(messages.length);
            System.out.println(messages[index]);
    }

  • How to compare two rows in PL/SQL?

    Hi All,
    How to compare two rows in PL/SQL? Is there any method that I can use instead of comparing them column by column?
    Any feedback would be highly appreciated.

    PhoenixBai wrote:
    Hi All,
    How to compare two rows in PL/SQL? Is there any method that I can use instead of comparing them column by column?What "rows" are you referring to?
    If you're talking of rows within a PL/SQL associative array there are techniques as described in the documentation... e.g.
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    type v1 is table of number;
      3    r1 v1 := v1(1,2,4);
      4    r2 v1 := v1(1,2,3);
      5  begin
      6    if r1 MULTISET EXCEPT DISTINCT r2 = v1() then
      7      dbms_output.put_line('Same');
      8    else
      9      dbms_output.put_line('Different');
    10    end if;
    11* end;
    SQL> /
    Different
    PL/SQL procedure successfully completed.
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    type v1 is table of number;
      3    r1 v1 := v1(1,2,3);
      4    r2 v1 := v1(1,2,3);
      5  begin
      6    if r1 MULTISET EXCEPT DISTINCT r2 = v1() then
      7      dbms_output.put_line('Same');
      8    else
      9      dbms_output.put_line('Different');
    10    end if;
    11* end;
    SQL> /
    Same
    PL/SQL procedure successfully completed.
    SQL>If you're talking about rows on a table then you can use the MINUS set operator to find the rows that differ between two sets of data...
    SQL> select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-1980 00:00:00        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-1981 00:00:00       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-1981 00:00:00       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-1981 00:00:00       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-1981 00:00:00       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-1981 00:00:00       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-1981 00:00:00       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-1987 00:00:00       3000                    20
          7839 KING       PRESIDENT            17-NOV-1981 00:00:00       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-1981 00:00:00       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-1987 00:00:00       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-1981 00:00:00        950                    30
          7902 FORD       ANALYST         7566 03-DEC-1981 00:00:00       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-1982 00:00:00       1300                    10
    14 rows selected.
    SQL> select * from emp2;
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7521 WARD       SALESMAN        7698 22-FEB-1981 00:00:00       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-1981 00:00:00       2975                    20
          7782 CLARK      MANAGER         7839 09-JUN-1981 00:00:00       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-1987 00:00:00       3000                    20
          7839 KING       PRESIDENT            17-NOV-1981 00:00:00       5000                    10
          7900 JAMES      CLERK           7698 03-DEC-1981 00:00:00        950                    30
          7934 MILLER     CLERK           7782 23-JAN-1982 00:00:00       1300                    10
    7 rows selected.
    SQL> select * from emp
      2  minus
      3  select * from emp2;
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-1980 00:00:00        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-1981 00:00:00       1600        300         30
          7654 MARTIN     SALESMAN        7698 28-SEP-1981 00:00:00       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-1981 00:00:00       2850                    30
          7844 TURNER     SALESMAN        7698 08-SEP-1981 00:00:00       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-1987 00:00:00       1100                    20
          7902 FORD       ANALYST         7566 03-DEC-1981 00:00:00       3000                    20
    7 rows selected.If you actually need to know what columns data is different on "non-matching" rows (based on your primary key) then you'll have to compare column by column.

  • How to compare table's date field with dropdown year field

    Hi All,
    I have one requirement to display the selected rows from a database table based on the selection of drop down.
    Here, I have one dropdown of year(like 2009,2010,....) and I have one database table which contains one field with "DATE".
    Now, I want to compare table's DATE field with my dropdown field.
    Problem is that table's DATE field is of type "DATS" and dropdown is of type INTEGER(or) STRING ...
    How to compare this fields?
    Can any one please give me solution for this...!
    Thanks in Advance!

    Hi  sreelakshmi.B,
    try the following:
    DATA lt_dats        TYPE TABLE OF dats.
    DATA l_dat_i        TYPE          i.
    DATA l_dat_c_4(4)   TYPE          c.
    DATA l_dat_c_12(12) TYPE          c.
    DATA l_dats_from    TYPE          dats.
    DATA l_dats_to      TYPE          dats.
    *Move Date from Integer to Char
    l_dat_c_4 = l_dat_i = 2005.
    *Create Date From use in WHERE-Clause
    CONCATENATE '01.01.' l_dat_c_4 INTO l_dat_c_12.
    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
         EXPORTING
              date_external            = l_dat_c_12
         IMPORTING
              date_internal            = l_dats_from
         EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
    IF sy-subrc <> 0.
    ENDIF.
    *Create Date To use in WHERE-Clause
    CONCATENATE '31.12.' l_dat_c_4 INTO l_dat_c_12.
    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
         EXPORTING
              date_external            = l_dat_c_12
         IMPORTING
              date_internal            = l_dats_to
         EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
    IF sy-subrc <> 0.
    ENDIF.
    * Select records in range
    SELECT *
           FROM [DBTAB]
           INTO TABLE [ITAB]
           WHERE [DATE] BETWEEN l_dats_from
                        AND     l_dats_to.
    Regards
    REA

  • How to compare date which is greatest date

    iam new to sql
    how to compare date which date is greatest date with example
    can i use to_char to compare date
    SELECT eno, ename, GREATEST (TBLE.MAX1, TBLE.MAX2) recent_date "
                   FROM (SELECT TBLA.eno, TBLA.ename, "
                   MAX (TO_CHAR (TBL.date1, 'MM/DD/YYYY HH24:MI') "
                   ) MAX1, "
                   MAX (TO_CHAR (TBL.date2, 'MM/DD/YYYY HH24:MI') "
                   ) MAX2 "
                   FROM dual TBL, dual2 TBLA
    in above query if any one of the date having null value then recent_date is showing 'null'
    and also it showing wrong value
    example
    date1='08-22-2009' and date2='01-23-2010' then it showing wrong recent_datel ike='08-22-2009'
    as according my knowledge it is comparing with month it sholud not be like this wat i have to do pls explain with example my o/p should come for recent_date like =''01-23-2010''
    Edited by: user9112274 on Aug 27, 2010 5:31 AM

    Hi,
    there are numerous ways to compare dates, i give you some examples:
    with data_Sample as
    (select to_date('01-jan-2001','dd-mon-yyyy') d1, to_date('01-mar-2002','dd-mon-yyyy') d2, to_date('03-feb-2002','dd-mon-yyyy') d3 from dual)
    select greatest(d1,d2,d3) from data_Sample
    GREATEST(D1,D2,D3)
    3/1/2002
    with data_Sample as
    (select to_date('01-jan-2001','dd-mon-yyyy') d1 from dual union all
    select to_date('01-mar-2002','dd-mon-yyyy')   from dual union all
    select to_date('03-feb-2002','dd-mon-yyyy')  from dual)
    select max(d1) from data_Sample
    MAX(D1)
    3/1/2002
    declare
    d1 date :=to_date('01-jan-2001','dd-mon-yyyy');
    d2 date :=to_date('01-jan-2001','dd-mon-yyyy');
    begin
    if d1>d2 then
    dbms_output.PUT_LINE('d1 greater than d2');
    else
    dbms_output.PUT_LINE('d1 less or equql than d2');
    end if;
    end;
    output:
    d1 less or equal than d2now concerning your question:
    >
    can i use to_char to compare date
    >
    If you have date data types : don't convert them.
    if you have no choice, use something like:
    if to_char(d1,'YYYYMMDD') > to_char(d2,'YYYYMMDD') then
    else
    end if;Take care when you convert a date into a char format it becomes string comparison (with all it implies) (It's the reason why i've use an explicit mask format).

  • How to compare date and time together

    Hi,
    How to compare Date and Time together?
    For example in a database table there are two fields rundate and runtime.  I want to compare these two with perticular date and time in the program.  Like, I want to pull all the records where the records's date and time are less than a perticular date and time in the program.
    Hope the question is clear...
    Thanks.
    Kavita

    Hi Kavita
    There is no as such Date and Time Comparision FM in Standard SAP  But You can define your own like this
    <b>FUNCTION ZAV4_COMPAREDATETIME.
    ""Lokale Schnittstelle:
    *"  IMPORTING
    *"     REFERENCE(DATE1) TYPE  DATS
    *"     REFERENCE(TIME1) TYPE  TIMS
    *"     REFERENCE(DATE2) TYPE  DATS
    *"     REFERENCE(TIME2) TYPE  TIMS
    *"  EXPORTING
    *"     VALUE(TWOISMORETOPICAL) TYPE  C
      twoismoretopical = ''.
      if date2 > date1.
        twoismoretopical = 'X'.
      else.
         if date2 = date1 and time2 > time1.
           twoismoretopical = 'X'.
         endif.
      endif.
    ENDFUNCTION.</b>
    Regards
    Mithlesh

Maybe you are looking for

  • I restored my macbook pro and updated to OSX 10.10.1, however i didn't get iMovie when i updated?

    is there a way to get it back, without buying it from the app store?? i have a time capsule that has my back ups on it, and i have iMovie in those backups, but i can't access any of my old old backups using the time machine app.  i have to it through

  • Error during burning slideshow

    I get an error message during encoding using iDVD 7.0 when burning a DVD or when attempting to save as disc image. I've used Apple support and nothing helps.  Any ideas?

  • Human Task expiration issue

    Hi, I have the following scenario. Its a simple BPEL process with string input and string output with a call to Human Task. the Human Task has the expiration duration of 5 mins. I invoke the process from bpel console and as expected it waits for the

  • How can I change default OEM DataPump job?

    Greetings, I have successfully created a DataPump job to run out of OEM GC by choosing the target database I wish to export, then under the Data Movement tab selecting the Export to Export Files option. I then create the DataPump job and it runs succ

  • Where do you locate your location on the iPad?

    Where can you check your location on the iPad?