Compare fields

Dear all,
I will not use SE38 to create ABAP for simple problem below.
I'd like to compare 2 fields in EKKO table. EKKO-AEDAT and EKKO-BEDAT.
Is there a way to achieve that ? how about SQ01, SQ02, SE16, etc ...
I believe there must be a way just for comparing content of two columns.
Points will be awarded for sure.
Regards,
BWAS

Yes, you can do it with the SQ01.
Create a join on EKKO with EKKO (create aliase like EKKO_1 and table EKKO) and join them on your required dates.
It will give you only those records which have both dates same.
Regards,
Naimesh Patel

Similar Messages

  • Compare fields in collection model to display which fields differ

    Hi all
    I have a previous post, which I may not have clearly enough stated my objective, and hence I feel as I may have been given an incorrect directive.
    Anyway, I aim to be able to compare fields in collection model to display which fields differ between records. Ie, in my collection model, the SQL query may return 3 records. I want to be able to compare field A (rowindex 1) to field A (rowindex 2). I want to do this, so that I can use some EL or other method to change the text color presented to the user.
    The problem here is that the SQL query has over 100 fields, so I definitely need a generic / reusable / programmatic way of doing this.
    My initial approach was to create a bean that referenced values in the current and previous record set / iterator. Really, I am looking for a validation of my approach or any other alternatives.
    My last resort will be to modify the SQL query, and duplicate each column with a 'changed flag'.
    Thanks in advance,
    Simo

    Sure,
    you should create a transient attribute in your VO and in method getters and setters in the view row class implement your bussiness logic. There are several posts in this forum about this subject. For example, how to create a transient attribute in a VO in r12
    Regards,

  • Get the values from a table comparing fields of different data types

    Hi Experts,
    I want to fetch AFVC-AUFPL and AFVC- APLZL by passing WBS element from a ztable.
    select aufpl aplzl
      from  afvc
      into TABLE gt_afvc
      FOR ALL ENTRIES IN gt_boq
      where projn = gt_boq-posid.
    AFVC-PROJN - NUMC 8  (WBC ELEMENT)
    ZTABLE-POSID - CHAR24 (WBC ELEMENT)
    How to get aufpl and aplzl by comparing those 2?
    Regards
    Mani

    WBS element does have an conversion routine at the domain level. So sometimes you work with one format (8 digits) and sometimes with 24 digits.
    You use FMs
    CONVERSION_EXIT_ABPSP_INPUT
    CONVERSION_EXIT_ABPSP_OUTPUT
    to convert between values. Do your conversion before your select and do not forget to use a large enough data element for the field, which gets the 24-digits long value of the field.

  • If statement comparing fields

    Hello,
    I have a field in which I am trying to compare two calculated fields, then enter one of two choices. Example
    If A1 < B1 then enter A1.value, else enter B1.value
    I know very little about scripting and thank goodness I've found most of what I need here on the forum.  What is the script I would need to use to accomplish this task?
    Thank you!

    A custom calculate script for the third calculated field could look like:
    (function () {
        // Get the field values, as numbers
        var v1 = +getField("A1").value;
        var v2 = +getField("B1").value;
        // Set this field's value
        if (v1 < v2) {
            event.value = v1;
        } else {
            event.value = v2;
    The "if" block could be simplified to just:
        // Set this field's value
        event.value = v1 < v2 ? v1 : v2

  • How to compare field symbols

    Dear experts,
    I have a piece of code like this..
    ASSIGN (lv_field)  TO <f1>.
          IF NOT <f1> IS INITIAL.
            CONCATENATE 'IS_BUS000_EEW' '-' lv_fieldname INTO lv_field.
            ASSIGN (lv_field)  TO <f1>.
            CONCATENATE 'LS_BUT000-' lv_fieldname INTO lv_field2.
            ASSIGN (lv_field2) TO <f2>.
            <f2> = <f1>.       "
          ENDIF.
    After assigning <f1> to <f2>, in runtime <f2> is getting a value '  .  .    '(like 'xx.xx.xxxx' spaces are missing when the question is posted). Now my requirement is that, if <f2> is '   .  .    '  i want to clear <f2>. So please let me know how do we compare the field symbols(for type DATS) with values like '  .  .    '.
    Edited by: Shwetha H S on Apr 2, 2008 6:56 AM

    Dear experts,
    I have a piece of code like this..
    ASSIGN (lv_field)  TO <f1>.
          IF NOT <f1> IS INITIAL.
            CONCATENATE 'IS_BUS000_EEW' '-' lv_fieldname INTO lv_field.
            ASSIGN (lv_field)  TO <f1>.
            CONCATENATE 'LS_BUT000-' lv_fieldname INTO lv_field2.
            ASSIGN (lv_field2) TO <f2>.
            <f2> = <f1>.       "
          ENDIF.
    After assigning <f1> to <f2>, in runtime <f2> is getting a value '  .  .    '(like 'xx.xx.xxxx' spaces are missing when the question is posted). Now my requirement is that, if <f2> is '   .  .    '  i want to clear <f2>. So please let me know how do we compare the field symbols(for type DATS) with values like '  .  .    '.
    Edited by: Shwetha H S on Apr 2, 2008 6:56 AM

  • Comparing fields

    Hi,
    I am getting problem with comparing blank fields in table gt_in. Syntax is this...
    IF GT_IN-BSTART = ' ' AND GT_IN-BEND = ' ' AND GT_IN-FSTART = ' '
        GT_IN-FEND = ' ' AND GT_IN-ASTART = ' ' AND GT_IN-AEND = ' '.
    Error:
    Incorrect logical expression: Comparison / SELECT-OPTION can only be followed by "AND", "OR" or ")".          
    Regards
    Reddy

    IF GT_IN-BSTART = ' ' AND GT_IN-BEND = ' ' AND GT_IN-FSTART = ' ' <b>AND</b>
    GT_IN-FEND = ' ' AND GT_IN-ASTART = ' ' AND GT_IN-AEND = ' '.
    Surely you were missing the 'AND'in your above statement the other way to check blank is to use IS INITIAL check.
    IF GT_IN-BSTART IS INITIAL AND
       GT_IN-BEND IS INITIAL AND
       GT_IN-FSTART IS INITIAL AND
       GT_IN-FEND IS INITIAL AND
       GT_IN-ASTART IS INITIAL AND
       GT_IN-AEND IS INTIAL.
    ENDIF.

  • Comparing fields from multiple entities in the same report (report builder 1.0)

    Created a model that contains 2 entities. I open that model in report builder 1.0.  When I drag a field from one of the entities into the design area, i can no longer see the other entity or use any of the fields from that other entity. 
    I need to use fields from both entities in the same report (join tables).  In management studio i would simply write a query and join tables but i cannot figure out how to do this in report builder.  Once i select a field from one entity
    how do i select fields from more than one entity and drag them into the same report.

    Would it be possible for you to send me instructions for this? I am not that familiar with SQL coding but I can definitely figure it out. I have been wanting to get information on reports from multiple entities for a very long time! The only way I can
    currently do it is have our document management software people write the report for me for quite a large fee. I would much rather do this myself. Right now I can select a few fields from one entity (the main one), some from a second entity under that one,
    but I cannot add any fields from a third entity! Quite annoying and hindering! Thank you :)

  • Comparing field with select-option

    HI
    i have one slect option
    s_bukrs for coas-bukrs.
    and
    loop..
    if w_bukrs eq s_bukrs"here is the problem,w_bukrs is
       "holding single value and s_bukrs a range,so in such
       "case how i can do comaprison
    endif.
    endloop

    Hi Sanju,
    Just use IN as said..
      if w_bukrs <b>IN</b> s_bukrs
    in case you want to compare a single value use..
    if w_bukrs <b>EQ</b> s_bukrs-low or
    if w_bukrs <b>EQ</b> s_bukrs-high
    regards
    satesh

  • Javascript help to compare fields

    Looking for some help with javascript to check values using if/then statements.
    I have 3 fields:
    JobTitle
    RateRange
    RateAmount
    JobTitle is a drop down with the following list items and corresponding values:
    List Item Text Value
    Manager 1
    Supervisor 2
    Rep 3
    RateRange is a drop down that gets its value from the JobTitle.I pass the rawValue to pull up the corresponding Rate. Here are the values:
    List Item Text Value
    $30 - $37 1
    $26 - $31 2
    $12 - $17 3
    This part works perfect. If I choose Manager then the RateRange shows me $30-$37.
    So the process is the user has selects the JobTitle and the RateRange auto populates, then they will enter the RateAmount. Once the RateAmount is entered, I want to have a script check to see if the amount entered is between the RateRange amounts. If it is not I want it to change the color of the field. Ive figured out how to change the color, but I cant get any if/then statements to work correctly. I figure its because how the RateRange field is set up.
    So Ive tried adding a field that will do the same thing as the RateRange except it will only pull the first value, instead of both values in the range, but Im having problems getting that to work.
    Any ideas?
    Also, how do you reference the display text of a drop down? I believe the binding value is the rawValue? What do you use to look at the display text value?
    Thank you in advance!

    try this:
    window.location.href = "mailto:[email protected]?subject=Subject&body=message%20goes%20here";
    Fouad Roumieh

  • Form to compare two fields ... cast needed?

    Hi all gurus,
    I'm rebuilding a report that performs a lot of checks by comparing fields of two different structures.
    Basically, the check has a structure that is repeated over and over in many check: it looks like this:
    IF srm_items-{field1} NE r3_services-{field2}.            
       t_temp-prezzi_errati = icon_red_light.
       t_temp-error_code    = '{errorcode}'.
       IF counter_s = 0.
          PERFORM add_son_in_t_temp USING srm_items e_backend w_obj-posting_date w_obj-changed_at.
       ELSE.
          PERFORM add_additional_error_temp USING srm_items 0.
       ENDIF.
       counter_s = counter_s + 1.
       fl_errore_s = 'X'.
    I was thinking to create a form, say 'check_son', that takes as USING parameter , and . My doubt is about types ad casts; in a check, could be a text string, in another a number, in another again a guid, and so on. Always simple field (no structures or complex field by now), but for what that concerns my FORM:
    FORM check_son USING compare1
                                          compare2
                                          errorcode.
    how should I declare the form in order to have the check working? I mean, I'd like that compare1 and compare2 get the same TYPE of the parameter I pass.. Is there a way? Or implicitly the params are converted into text (this should not work for me)?
    Thanks in advance

    >
    Matteo Montalto wrote:
    > I don't know macros
    Hi, Matteo
    Test the following Sample Code it will help you to understand the working of Macros.
    DEFINE check_son.
      if &1 NE &2. " If Field1 Not Equal Field2
        &3 = 'NE'. " In This Variable it will Return Error Code NE for Not Equal and EQ for Equal
      else.
        &3 = 'EQ'.
      endif.
    END-OF-DEFINITION.
    DEFINE write_message.
      if &1 = 'EQ'.
        write: 'Two Numbers are Equal', /.
      else.
        write: 'Two Numbers are Not Equal', /.
      endif.
    END-OF-DEFINITION.
    DATA: f1 TYPE i,
          f2 TYPE i,
          error_code(2).
    f1 = 10. f2 = 15.
    check_son f1 f2 error_code.
    write_message error_code.
    f1 = 10. f2 = 10.
    check_son f1 f2 error_code.
    write_message error_code.
    Please Reply if any Confusion,
    Best Regards,
    Faisal

  • Compare sales order items (specific fields)

    Hi guys,
    I need to compare some fields from vbap and vbkd and to add values from sales order items, before I print then on screen.
    I need to compare if vbkd-ihrez_e and vbkd-bstkd and vbap-matnr are the same for two records from sales order (10 and 20), If they are the same then add vbkd-ihrez values (for items 10 and 20), also add vbap-kwmeng, and write that sum on screen.
    Compare item with previous one. if doing for 20 compare with 10, for item 30 compare with 20 etc.
    I start like this.
    select aubel posnr into (wa_tab-vbeln, wa_tab-posnr)
             from vbrp
             where vbeln = p_vbeln.
        append wa_tab to it_tab.
      endselect.
    loop at it_tab into wa_tab.                   << I need somewhere to compare fields if they are the same before I print them.
          select single fbuda bstkd_e ihrez_e ihrez bstkd
                          into
                          (wa_tab-fbuda,
                          wa_tab-bstkd_e,
                          wa_tab-ihrez_e,
                          wa_tab-ihrez,
                          wa_tab-bstkd)
                          from vbkd
                          where vbeln = wa_tab-vbeln and
                                posnr = wa_tab-posnr.
    select single kbmeng waerk netwr arktx kwmeng
                          into
                          (wa_tab-kbmeng,
                          wa_tab-waerk,
                          wa_tab-netwr,
                          wa_tab-arktx,
                          wa_tab-kwmeng)
                          from vbap
                          where vbeln = wa_tab-vbeln and
                                posnr = wa_tab-posnr.
    modify it_tab from wa_tab.
    endloop.
    How can I modify code to get this process? Thanks,
    Edited by: nihad omerbegovic on Nov 2, 2009 9:45 AM

    Hi Nihad
    select aubel posnr into CORRESPONDING FIELDS OF TABLE it_tab
    from vbrp
    where vbeln EQ p_vbeln.
    select a~vbeln a~posnr a~fbuda a~bstkd_e a~ihrez_e a~ihrez a~bstkd
    b~kbmeng b~waerk b~netwr b~arktx b~kwmeng
    into CORRESPONDING FIELDS OF TABLE it_vb
    from vbkd as a INNER JOIN vbap as b ON a~vbeln EQ b~vbeln AND a~posnr EQ b~posnr
    FOR ALL ENTRIES IN it_tab
    where vbeln EQ it_tan-vbeln and
    posnr EQ it_tab-posnr.
    SORT it_tab BY vbeln posnr.
    LOOP AT it_tab INTO wa_tab.
    IF lv_vbeln EQ wa_tab-vbeln. "means it's the same order but a different item
    IF ( lv_ihrez_e = wa_tab-ihrez_e ) AND ( lv_bstkd = wa_tab-bstkd ) AND ( lv_matnr = wa_tab-matnr ).
    ADD wa_tab-kwmeng TO lv_kwmeng.
    WRITE lv_kwmeng.
    ENDIF.
    CLEAR lv_kwmeng.
    lv_ihrez_e = wa_tab-ihrez_e.
    lv_bstkd = wa_tab-bstkd.
    lv_matnr = wa_tab-matnr.
    lv_vbeln = wa_tab-vbeln.
    lv_kwmeng = wa_tab-kwmeng.
    endloop.
    Thanks
    Pushpraj

  • How to compare the two same fields of different tables

    Hi can any one let me know the logic for compare the two fields of different tables.

    hi
    good
    IF it_1[] = it_2[].
       " Tables contents are the same
    ELSE.
       " Tables contents are different
    ENDIF.
    If they have different structure, you probably must loop one of the tables, and inside read the other, then compare field by field.
    Or if you don't need the contents (just comparing) you can do this, for example:
    LOOP AT it_1 INTO wa_1.
       READ TABLE it_2 WITH KEY field2 = wa_1-field2
                                field5 = wa_1-field5
                       TRANSPORTING NO FIELDS.
       IF sy-subrc = 0.
          " Record is on both tables (field2 and field5 are the fields in common for both tables).
       ENDIF.
    ENDLOOP.
    thanks
    mrutyun^

  • Sorting techinque without using sort statement /Comparing table fields.

    Hi,
    How to achieve sorting techinque without using sort statement in tables.
    Also how to compare fields of 2 custom tables and check their compatability without using code ?

    Hi,
    Refer the below program, it will be helpful.
    types: begin of t_int,
             int type i,
            end of t_int.
    data: it_int type standard table of t_int,
           wa_int type t_int,
           wa_int1 type t_int.
    wa_int-int = 70.
    append wa_int to it_int.
    clear wa_int.
    wa_int-int = 50.
    append wa_int to it_int.
    clear wa_int.
    wa_int-int = 20.
    append wa_int to it_int.
    clear wa_int.
    wa_int-int = 30.
    append wa_int to it_int.
    clear wa_int.
    wa_int-int = 23.
    append wa_int to it_int.
    clear wa_int.
    wa_int-int = 23.
    append wa_int to it_int.
    clear wa_int.
    wa_int-int = 32.
    append wa_int to it_int.
    clear wa_int.
    wa_int-int = 77.
    append wa_int to it_int.
    clear wa_int.
    wa_int-int = 99.
    append wa_int to it_int.
    clear wa_int.
    wa_int-int = 1.
    append wa_int to it_int.
    clear wa_int.
    wa_int-int = 11.
    append wa_int to it_int.
    clear wa_int.
    wa_int-int = 90.
    append wa_int to it_int.
    clear wa_int.
    wa_int-int = 40.
    append wa_int to it_int.
    clear wa_int.
    data: wk_line type i.
    data: cnt type i.
    data: cnt1 type i.
    describe table it_int lines wk_line.
    clear: cnt,cnt1.
    data wk_flag type c.
       clear wk_flag.
    while wk_line gt cnt1.
       cnt = cnt + 1.
       read table it_int into wa_int index cnt.
       cnt1 = cnt + 1.
       read table it_int into wa_int1 index cnt1.
       if wa_int-int lt wa_int1-int.
         modify it_int from wa_int index cnt1.
         modify it_int from wa_int1 index cnt.
         wk_flag = 'X'.
       endif.
       if cnt1 eq wk_line.
         clear: cnt, cnt1.
         if wk_flag eq 'X'.
         clear wk_flag.
         continue.
         else.
           exit.
         endif.
       endif.
    endwhile.
    loop at it_int into wa_int.
       write: / wa_int-int.
    endloop.

  • Comparing two ResultSet

    Hi Everybody,
    Can anybody tell me is there any method to compare the contents of two ResultSets and decide whether they are same or not.
    Thanks

    Yes,
    Create a method that takes the two result sets, get the metada of the table and compare field by fiel.
    Another alternative is to copy the ResultSet to a Vector and than compare it.
    HTH
    Trajano Roberto

  • How to add columns in field-symbol

    Dear All,
                  Have made a report for HR - ZHR_CTC by using logical database and field-symbol. Report is working fine, but now have to add columns e.g business area text, positions text etc.
    Have added columns in field-symbol.But not able to fetch data into that.
    Data has to be fetched from different trasparent table comparing <field-symbol>-field.
    Plz suggest the proper way to do it.
    <<text removed>>
    Regards,
    Gulrez Alam
    Edited by: Gulrez Alam on Dec 16, 2008 11:02 AM
    Edited by: Matt on Dec 16, 2008 11:36 AM

    Hi Rimpa,
                   Thanks a lot for you reply, have tried ur suggestion but it's not working. I am not able to understand how to insert data into field-symbol. Plz give some more clarifications about the same.
    Regards,
    Gulrez Alam

Maybe you are looking for