Howto select all entries with two fields value

Hi all,
I have the following SELECT stmt:
      SELECT SUM( betrw )
        INTO l_real_t
        FROM dfkkop
       WHERE opbel = l_opbel
         AND hvorg <> gc_hvorg_dun_fee
         AND tvorg <> gc_tvorg_dun_fee.
Now I get no lines, where hvorg = gc_hvorg_dun_fee OR tvorg = gc_tvorg_dun_fee.
But my intention is to get no lines, where BOTH conditions are met.
What am I doing wrong here?
Kind Regards, Matthias

Check this..
SELECT SUM( betrw )
        INTO l_real_t
        FROM dfkkop
       WHERE opbel = l_opbel
         AND NOT ( hvorg EQ gc_hvorg_dun_fee
         AND tvorg EQ gc_tvorg_dun_fee).

Similar Messages

  • For All Entries with two tables

    Hi All,
             Can we use FOR ALL ENTRIES with two tables. for example
    SELECT * FROM MKPF INTO TABLE T_MKPF
             WHERE BUDAT IN S_BUDAT.
    SELECT * FROM MARA INTO TABLE T_MARA
             WHERE MTART IN S_MTART AND
                            MAKTL IN S_MAKTL.
    SELECT * FROM MSEG INTO TABLE T_MSEG
           FOR ALL ENTRIES IN  "T_MKPF AND T_MARA"
                  WHERE MBLNR EQ T_MKPF-MBLNR AND
                                 MATNR EQ T_MARA-MATNR.
    can we do it like this or any other way to do this plz tell. I waitting for your responce.
    Thanks
    Jitendra

    Hi,
    u cannot do like this....chek some documentation on it..
    1. duplicate rows are automatically removed
    2. if the itab used in the clause is empty , all the rows in the source table will be selected .
    3. performance degradation when using the clause on big tables.
    Say for example you have the following abap code:
    Select * from mara
    For all entries in itab
    Where matnr = itab-matnr.
    If the actual source of the material list (represented here by itab) is actually another database table, like:
    select matnr from mseg
    into corresponding fields of table itab
    where ….
    Then you could have used one sql statement that joins both tables.
    Select t1.*
    From mara t1, mseg t2
    Where t1.matnr = t2.matnr
    And T2…..
    So what are the drawbacks of using the "for all entires" instead of a join ?
    At run time , in order to fulfill the "for all entries " request, the abap engine will generate several sql statements (for detailed information on this refer to note 48230). Regardless of which method the engine uses (union all, "or" or "in" predicates) If the itab is bigger then a few records, the abap engine will break the itab into parts, and rerun an sql statement several times in a loop. This rerun of the same sql statement , each time with different host values, is a source of resource waste because it may lead to re-reading of data pages.
    returing to the above example , lets say that our itab contains 500 records and that the abap engine will be forced to run the following sql statement 50 times with a list of 10 values each time.
    Select * from mara
    Where matnr in ( ...)
    Db2 will be able to perform this sql statement cheaply all 50 times, using one of sap standard indexes that contain the matnr column. But in actuality, if you consider the wider picture (all 50 executions of the statement), you will see that some of the data pages, especially the root and middle-tire index pages have been re-read each execution.
    Even though db2 has mechanisms like buffer pools and sequential detection to try to minimize the i/o cost of such cases, those mechanisms can only minimize the actual i/o operations , not the cpu cost of re-reading them once they are in memory. Had you coded the join, db2 would have known that you actually need 500 rows from mara, it would have been able to use other access methods, and potentially consume less getpages i/o and cpu.
    In other words , when you use the "for all entries " clause instead of coding a join , you are depriving the database of important information needed to select the best access path for your application. Moreover, you are depriving your DBA of the same vital information. When the DBA monitors & tunes the system, he (or she) is less likely to recognize this kind of resource waste. The DBA will see a simple statement that uses an index , he is less likely to realize that this statement is executed in a loop unnecessarily.
    Beore using the "for all entries" clause and to evaluate the use of database views as a means to:
    a. simplify sql
    b. simplify abap code
    c. get around open sql limitations.
    check the links
    http://www.thespot4sap.com/articles/SAPABAPPerformanceTuning_ForAllEntries.asp
    The specified item was not found.
    Regards,
    Nagaraj

  • Field in the selection screen as a select option with two default values

    Hi All,
    can anybody tell me how to put field in the selection screen with two defaul values.
    for ex:  selection screen the Account Group KNA1-KTOKD as a select option. The defeault value should be Y001 and Y005.
    please reply ASAP. Its urgent.
    Thanks in advance,
    Madhu

    Hi Madhu,
    Since Select options are nothing but ranges, you can use the following code to add two distinct values to the select options by default.
    s_ktokd-sign = 'I'.
    s_ktokd-option = 'EQ'.
    s_ktokd-low = 'Y001'.
    append s_ktokd.
    s_ktokd-low = 'Y005'.
    append s_ktokd.
    clear s_ktokd.
    However, if you want to mention a range like all the values between these given two values to be considered then u may use,
    select-options : s_ktokd for KNA1-KTOKD default 'Y001' to 'Y005'.
    or
    s_ktokd-sign = 'I'.
    s_ktokd-option = 'BT'.
    s_ktokd-low = 'Y001'.
    s_ktokd-high = 'Y005'.
    append s_ktokd.
    Reward if helpful.

  • Function Module to select all entries in  ALV output

    Hi,
      I have an ALV report and Select ALL and Deselect ALL Buttons added to it .
      When the Select ALL button is pressed,all entries of the ALV report should be selected.
      When the Deselect ALL button is pressed,all entries of the ALV report should be deselected.
      Is there any function module to select all entries of the output and vice versa.
      Thanks in advance.
    Regards,
    Navas

    Hi Navas,
    I have written a part of the code you can use.
      TYPE-POOLS: slis.
      DATA : ls_event TYPE slis_alv_event.
    Set PF Status
      ls_event-name = slis_ev_pf_status_set .
      ls_event-form = slis_ev_pf_status_set .
      APPEND ls_event TO gt_event.
      CLEAR  ls_event.
    FORM pf_status_set USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'Z_STATUS'.
    ENDFORM  .                 "set_pf_status
    (no need for any perform. This will be called automatically).
    While calling the FM for ALV, pass the internal table gt_event in it_events parameter.
    Double click on Z_STATUS and add two buttons in Application Toolbar.
    1. Select All - Give function code name as &ALL,
    2. Deselect All - Give function code name as &SAL.
    Hope this helps.
    Thanks,
    Dawood.
    Edited by: Dawood.S.Ghasletwala on Apr 3, 2009 3:51 PM

  • For all entries with inner join

    Hi All,
    I found some unusual thing.
    i have written INNERJOIN along with FOR ALL ENTRIES and also INNERJOIN in loop..endloop. I have tested both programs with around 1000 records, i found that INNERJOIN with FOR ALL ENTRIES is taking more time compared to the other one. As we know FOR ALL ENTRIES with SIMPLE SELECT takes less time compared to select in loop..endloop. Anybody tell me is there any specific reason for this
    thanks in advance
    rajavardhana reddy

    Have a look at this weblog by Dharmaveer Singh:
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2986 [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken]
    Sudha

  • How to find roles with open field values

    Hello SAP gurus,
    I need to find a way to find roles with open field values. Some kind of report that returns me a list of all roles that, despite having a generated profile, it still contains empty field values in it.
    Is there anything like it available on SAP?
    Thanks
    Antonio

    Some kind of report that returns me a list of all roles that, despite having a generated profile, it still contains empty field values in it
    Hey I am not sure, but seems I might have seen some report like that. Can you try search report named PFCG* / PFUD*
    Again this is either report (SE38/SA38) or may be FM (SE37). I am away from system a bit while and can't recall.
    Regards,
    Arpan Paik

  • How do I select all "beginning with...", to copy and paste in numbers?

    Hi all, I hope someone can help me. I am working to re-organise a very large spreadsheet that I have exported from endnote. The entries are all jumbled and instead of being organised into columns all data has been entered row by row under the first column. To save me time is there a way for me to select all entries beginning with a certain word so that I can copy and paste them all into seperate columns? I hope that makes sense.

    See item 29 on this page. Choose 'Tab Delimited' as your export style and save a file with .tsv as the extension. Then drag that file into Numbers wherever you want it. You can also open the .tsv file in a text editor, command-a to select all, command-c to copy, click once in a Numbers cell, and command-v to paste.  The results should be aligned in separate columns.
    SG

  • Arrow mark with kunnr field values in alv output.

    Hi ,
    I  need to increase the column field length. I am using Function Module REUSE_ALV_LIST_DISPLAY because alv_grid display fm is not available in 4.0b version. I have used column optimization in layout. The column kunnr is coming with a small arrow though there is no data loss. Is there any way I can remove the arrow mark with kunnr field values.

    Hi,
    You can increase your column lenght in fieldcat by using Fcat-columnwidth = "SIZE OF KUNNR ".
    Set the size of kunnr field in fieldcat and get the appropiate output.
    Regards
    Abdul

  • I have a L7680 All in with two new print heads but the new cyan/magenta shows yellow monitor status.

    I have a L7680 All in with two new print heads but the new cyan/magenta shows yellow monitor status. Ink status, cyan more than 50% and magenta is a 25% w/no low ink warnings... Just ran a clean print head again, print out looks good now but the status of the new cyan/magenta shows yellow monitor status. Is it time to buy another..When I purchased this printer it had to be replaced 3 times because of problems... Just a lemon?
    thx for your help in advance...
    Jim

    Could you share a link to the page?
    Seeing it in context and in our browsers is much easier to debug.
    If not, make sure to run the validator here The W3C Markup Validation Service and clear out any problems. HTML errors, especially structural ones, will cause all kinds of display problems in various browsers/versions/platforms.

  • Adding a custom tab in Purchase Order with two fields - ME21N

    Hello Experts,
    My requirement is to add a custom tab with two fields in purchase order at header level.
    The BADI ME_PROCESS_PO_CUST is alreday implemented previously as there was one custom tab added previously in header.
    The structure  CI_EKKODB already have the custom fields for the enhancement done earlier.
    Now to add my additional tab how should i proceed ....should i put my additional fields in the same structure and write my code in same BADI.....will there be any impact on already done enhanecement.
    Please suggest in achieving this functionality.
    Thanks,
    Naveen

    Hi,
    Check this [wiki|http://wiki.sdn.sap.com/wiki/display/ABAP/DetailedexplanationaboutBADIandthewaystofindtheBADIwithanexample%28ME23n+transaction%29], it tells you how to do with an example for item data.
    Regards,
    Eduardo

  • How, in Illustrator CS5, can I select all objects with three points (or nodes)?

    I am quite new to Illustrator, but it seems this should be simple.  (It is trivial in CorelDraw X4:  After selecting an object with three nodes, I go to Edit > Find and Replace > Find Objects > Find objects that match the currently selected object, and navigate through the remaining menus.)
    In Illustrator CS5, the options under Select > Same do not seem to include selecting all objects with the same number of nodes as the currently selected object.
    Double-clicking on the Magic Wand Tool also fails to provide such an option.
    Thank you for any help.
    P.S.  Also useful would be knowing how to add other criteria to this search, e.g. how to select all objects with three points *and* the current fill color.

    There is a script that can select "less than x points"
    Kelso Cartography

  • I cant select all files with the new update

    I cant select all files with the new itunes update

    Version 11.1.5.5 of iTunes was just released today. If you update to that, does that help with the recognition troubles?
    http://www.apple.com/itunes/download/

  • Select For all entries with multiple keys

    Dear Developers,
    im writing a program which reads the last the last mseg entry with bwart 101 and bwart 201 an writes it into different fields of a table. In dependance of the bwart the max-value of mkpf-budat should be moved into field wedat or wadat.
    At the moment i use this coding:
    loop at gt_daten assigning <fs_daten>.
        select distinct max( budat ) from wb2_v_mkpf_mseg2 into <fs_daten>-wedat
          where matnr_i = <fs_daten>-matnr
            and werks_i = <fs_daten>-werks
            and lgort_i = <fs_daten>-lgort
            and bwart_i = '101'.
        select distinct max( budat ) from wb2_v_mkpf_mseg2 into <fs_daten>-wadat
        where matnr_i = <fs_daten>-matnr
          and werks_i = <fs_daten>-werks
          and lgort_i = <fs_daten>-lgort
          and bwart_i = '201'.
      endloop.
    wb2_v_mkpf_mseg2 is a view combining mkpf an mseg by primary keys.
    Searching the internet i read, using FOR ALL ENTRIES should be prefered to selectstatements in loops.
    So i tried:
    *selectstatement
    select budat matnr_i werks_i lgort_i bwart_i from wb2_v_mkpf_mseg2 into table lt_mseg for all entries in gt_daten
        where matnr_i = gt_daten-matnr
          and werks_i = gt_daten-werks
          and lgort_i = gt_daten-lgort
          and ( bwart_i = '101' or bwart_i = '201' )
    *Substitute the MAX( )-Function
      sort lt_mseg descending by matnr werks lgort bwart budat.
      delete adjacent duplicates from lt_mseg comparing matnr werks lgort bwart.
    *Differ between wedat and wadat
      loop at gt_daten assigning <fs_daten>.
        loop at lt_mseg assigning <fs_mseg>
          where matnr = <fs_daten>-matnr
            and werks = <fs_daten>-werks
            and lgort = <fs_daten>-lgort.
          case <fs_mseg>-bwart.
            when '101'.
              <fs_daten>-wedat = <fs_mseg>-budat.
            when '201'.
              <fs_daten>-wadat = <fs_mseg>-budat.
          endcase.
        endloop.
    Even in the dev-system this takes twice the time of the "nested" selects.
    Imho this is because of the internal OR interpretation of the FOR ALL ENTRIES-statement and the size of the result.
    Can somebody give me a hint, how to tune this code?
    Select Inner join should be difficult because the target field differs, dependent of the value in bwart...
    Thanks in advance!

    I understand that you are trying to capture the maximum value of posting date MKPF-BUDAT for movement types 101 and 201 for each combination of material, plant and storage location.
    Few things, that makes the below coding more efficient at both application and database level and I confirmed this on an IDES sandbox
    1. Along with MKPF and MSEG, there is another table WBGT, in the view WB2_V_MKPF_MSEG join and also WBGT has select condition restrictions imposed on its fields. So if this restriction impacts your selection you may want to do a INNER JOIN of MSEG with MKPF only (with MSEG as leading table, as it has an active secondary index with MATNR, WERKS, LGORT and BWART ) and also there won't be overhead from the unnecessary join with WBGT table whose fields you are not using.
    2. The below SORT on lt_mseg will ensure that the record having greatest BUDAT will be at the top of all rows (least index) for each combination of MATNR, WERKS, LGORT and BWART.
    3. DELETE ADJACENT DUPLICATES will ensure that only the top row (having greatest BUDAT) remains in the table lt_mseg for each combination of MATNR, WERKS, LGORT and BWART. This will ensure that subsequent READs with BINARY SEARCH will always and efficiently read the row with maximum value of BUDAT for each unique combination of MATNR, WERKS, LGORT and BWART.
    4. The below logic will require more memory (even though it is more efficient performance wise) compared to direct SELECT with MAX for each MATNR, WERKS, LGORT and BWART in a LOOP the way you were doing before. So if the size of lt_mseg is causing memory issues, your logic with aggregate function MAX at database level will be your only option.
    So, I propose you revise your coding like below for most optimal results
    CHECK NOT gt_daten[] IS INITIAL.
    *selectstatement
    *SELECT budat matnr_i werks_i lgort_i bwart_i
    *  FROM wb2_v_mkpf_mseg2
    *  INTO TABLE lt_mseg
    *    FOR ALL ENTRIES IN gt_daten
    *    WHERE matnr_i = gt_daten-matnr
    *      AND werks_i = gt_daten-werks
    *      AND lgort_i = gt_daten-lgort
    *      AND ( bwart_i = '101' OR bwart_i = '201' ).
    * The below SELECT is more economical than the one commented above
    SELECT mkpf~budat mseg~matnr mseg~werks mseg~lgort mseg~bwart
      FROM mseg INNER JOIN mkpf
        ON mseg~mblnr = mkpf~mblnr AND
           mseg~mjahr = mkpf~mjahr
        INTO TABLE lt_mseg
          FOR ALL ENTRIES IN gt_daten
            WHERE mseg~matnr = gt_daten-matnr
              AND mseg~werks = gt_daten-werks
              AND mseg~lgort = gt_daten-lgort
              AND ( mseg~bwart = '101' OR mseg~bwart = '201' ).
    *Substitute the MAX( )-Function
    SORT lt_mseg BY matnr werks lgort bwart DESCENDING budat.
    DELETE ADJACENT DUPLICATES FROM lt_mseg COMPARING matnr werks lgort bwart.
    *Differ between wedat and wadat
    LOOP AT gt_daten ASSIGNING <fs_daten>.
      READ TABLE lt_mseg ASSIGNING <fs_mseg>
        WITH KEY matnr = <fs_daten>-matnr
                 werks = <fs_daten>-werks
                 lgort = <fs_daten>-lgort
                 bwart = '101' BINARY SEARCH.
      IF sy-subrc = 0.
        <fs_daten>-wedat = <fs_mseg>-budat.
      ENDIF.
      READ TABLE lt_mseg ASSIGNING <fs_mseg>
        WITH KEY matnr = <fs_daten>-matnr
                 werks = <fs_daten>-werks
                 lgort = <fs_daten>-lgort
                 bwart = '201' BINARY SEARCH.
      IF sy-subrc = 0.
        <fs_daten>-wadat = <fs_mseg>-budat.
      ENDIF.
    ENDLOOP.

  • Using for all entries of two internal tables in where clause of the select

    Hi experts,
    My requirement is, need to select Marc-minbe and wrpl-sobst, for all the entries of the two internal tables it_mara , and it_t001w.
    here is the select queries i have used,
    select matnr normt from  mara into it_mara for all entries in it_data where normt = it_data-normt.
    select konnr werks from t001w into it_t001w for all entries in it_data where konnr = it_data-konnr.
    now i need to select minbe of marc table and sobse of wrpl table for all the entries of above internal tables, it_mara and it_t001w, using both matnr of it_mara and werks of it_t001w in where condition.
    Pls advise how i can do it.
    Thanks.
    Moderator message: very basic, please work on this yourself first, these forums are not a substitute for ABAP training.
    Edited by: Thomas Zloch on Dec 6, 2010 9:38 AM

    Hi
    call SE16 with table TFTIT in order to get a full list (it will be long...)
    A list of FMs with parameters can be found in table FUNCT.
    Finally go to sm37rsdf4
    that will give you all the function modules with description
    Here is the list:
    http://www.erpgenie.com/abap/functions.htm
    hope this helps...
    Regards
    CSM Reddy

  • Want to Avoid Loop for all entries with select query !!

    Hi Guru's  !
    This is my following code . I want to avoid loop  to improve the performance of program.
    data: lt_cuhd type HASHED TABLE OF /sapsll/cuhd WITH UNIQUE key guid_cuhd,
          ls_cuhd type /sapsll/cuhd.
    data: lt_comments type STANDARD TABLE OF zss_comments,
          ls_comments type zss_comments.
    data: lv_objkey type string.
    select * from /sapsll/cuhd into table lt_cuhd.
    loop at lt_cuhd  into ls_cuhd.
      CONCATENATE ls_cuhd-corder '%' into lv_objkey. " Example 'Mum%'
      select * from zss_comments into table lt_comments
                where objkey like lv_objkey
                 AND guid_cuhd = ls_cuhd-guid_cuhd
                  AND event_id <> ''.
    endloop.
    I want
    New code should be...using all entries no loop required.
      *select * from zss_comments into table lt_comments
                where objkey like lv_objkey
                 AND guid_cuhd = ls_cuhd-guid_cuhd
                  AND event_id <> ''.*

    why dont you add the object key also to  lt_cuhd and once you fetch the data to lt_cuhd loop it and add the '%'
    when looping use field symbols so that you dont have to use  modify.
    then use for all entries using lt_cuhd
    i don't you can find a better way to add the % mark apart from looping but by this way only one select query will be done for
    zss_comments
    Thanks
    Nafran

Maybe you are looking for

  • Boot Camp won't update, no Bluetooth, can't install drivers, see OS X DVD

    I have a client who has a whole mess: Mac Mini Core2Duo running Leopard 10.5.6 Boot Camp 1.4 Beta Vista Inserting the OS X DVD produces nothing, can't see it, can't open it, can't install drivers from OS X Install Disc 1. Can't update Boot Camp to 2.

  • TOSHIBA 46TL963B watching movies from online

    I'll start by saying I'm new to smart tvs. I bought a Toshiba 46TL963B tv thinking that as I could get facebook, etc on it then I could log onto the internet via the tv. I watch movies online and wanted to be able to view them on my tv. I thought the

  • How do I purchase and install e-books on iPad?

    I am just now starting to use my iPad.  How do I purchase e-books and install them on my iPad?  Which sites sell books that are compatible with iPad?  Are there any sites that offer free e-books that can be downloaded to my iPad?

  • PCUI - CRM - Text (Field Label) Replacement

    Hi Friends, I want to change the Field Label displayed on the PCUI. In PCUI the field label displayed, is the value taken from the Medium Text of that field's respective Data Element in DDIC. Please correct me if I am wrong. Now for example - I want

  • HT1386 ipad disabled sister put wrong password in

    ipad disabled anyone help unlock it please thankyou....