Only key fields of table-cluster in where-condition for better performance?

Hi,
Say my cluster table is having following key fields: KEY1, KEY2, KEY3, KEY4.
And, my table-cluster is having following key fields: KEY1, KEY2, PAGENO .. [PAGENO is always there in a table-cluster].
Now, I have two versions of my (Open SQL) SELECT-WHERE clause:
a) SELECT *
    WHERE KEY1 EQ LV_KEY1
         AND KEY2 EQ LV_KEY2
         AND KEY3 EQ LV_KEY3.
b) SELECT *
    WHERE KEY1 EQ LV_KEY1
         AND KEY2 EQ LV_KEY2.
Please guide me whether version (a) or version (b) will be executed faster? In case of version (b), I will have to filter data using ABAP code corresponding to KEY3.
Regards,
Kamlesh Dhera H. R.

I think most experienced ABAPrs would tell you to try both, compare runtimes, and use the one that's more efficient.  SAP provides "get run time field <fieldname of type i>.  Get run time at start, get run time at end, and subtract start from end to get the time in microseconds (1 second / 1,000,000 ).
Run several times to minimize effect of buffering and system load activity, and you'll see which method produces lower run time.

Similar Messages

  • Error: No first field of table index in where condition

    I've got following errors while doing code inspector or extended syntax check:
    (Large table VEKP: No first field of table index in where condition).
    My code is like below as per as code-logic.
    What's the necessary changes to do to remove the above code?
    SELECT VENUM
                 BRGEW
                 BTGEW
                 BTVOL
                 VOLEH
                 VHILM
                 LMENG
                 BREIT
                 HOEHE
                 MEABM
                 VPOBJKEY
                 FROM VEKP
                 INTO TABLE i_vekp
                 WHERE vpobjkey = w_mkpf-xblnr.
    IF sy-subrc = 0.
    SORT i_vekp BY venum.
    ENDIF.
    How can I remove the error? How to use index in where clause I'm not getting and on which key? or, should I use the statement "EC C1_NOFIRST to remove the error?
    Kindly guide.

    > should I use the statement "EC C1_NOFIRST to remove the error?
    you can not really ask this question in this forum. This check gives you hints to the most serious problems in database accesses, if you want to override it, then you should better forget about performance.
    If you are not familiar how databases use indexes, then check resources in the net or in books, in
    short they use indexes and the indexes are absolutly necessary with large tables, if you want to get
    good performance.
    But indexes can only be used in the order of their field, until a field is not used in the WHERE-condition, (gap). If the gap is already the first field, then the index can not be used at all.
    In your case there is not first field of any index specified in the WHERE condition, so the SELECT might be slow. Either you can add a condition on a first index field or you have to live with a poor performance.
    Siegfried

  • No entry in key field of table MARC for BAPI_MATERIAL_MAINTAINDATA_RT

    Hi Gurus ,
    I have a requirment to upload Retail Articles. I am using BAPI_MATERIAL_MAINTAINDATA_RT to create articles for Basic View, Listing View and Sales View.
    I got the error:
    No entry in key field of table MARC
    Message no. MG502
    Moderator message - Please respect the 5,000 character maximum when posting. Post only the relevant portions of code
    Please let me know how to fix this.
    Edited by: Rob Burbank on Dec 22, 2010 12:38 PM

    Thanks a lot Rob Burbank  for the hint!
    I figured out that though I was passing the Site under MARC, it wasn't getting transfered to the field. I fixed the code.
    Thanks for prompt response!

  • No entry in key field of table MARM

    Hi,
    I am trying to import and create a Article Master using LSMW with IDoc method. ARTMAS IDoc is getting generated but it is showing error as No entry in Key field MARC, MVKE, etc etc and now finally stuck in No entry in key field of table MARM even after filling all possible data.
    Function Module used here is BAPI_MATERIAL_MAINTAINDATA_RT. I don't know any technical aspects here to look into.
    Kindly help me out with the information on what could have gone wrong here and what are the possible solutions?
    Thanks & Regards,
    Sudhanva Joshi

    Hi Venu,
    Now i am stuck in somewhat a deadlock situation. and this is in MARM segment. below are the issues,
    1. If I provide an entry in Alternate UOM field in MARM, Ex: EA is base unit and PC is ALT unit, I am getting an error as ' The Alternative unit of measure is same as Base unit of measure'
    2. And, If i don't give an entry in ALT_UOM field (which SAP suggests, in case there is no other units than Base unit, leave the ALT-UOM field as blank), I am getting an error as "No entry in key field of table MARM"
    Can you please assist in resolving this issue.
    Thanks & Regards,
    Sudhanva Joshi

  • How to Concatenate Table name and Where condition at runtime

    I am passing parameter as User and Zone to Stored Procedure.How to concatenate Table Name
    and WHERE CONDITION in SQL Statement.i have different type of users and zones.

    Hi !
    declare
      cur sys_refcursor;
      r emp%rowtype;
      v_sql varchar2(512);
    begin
    -- do your logic here
      v_sql := 'select * from emp';
      open cur for v_sql;
      loop
        fetch cur into r;
        exit when cur%notfound;
        dbms_output.put_line(r.ename);
      end loop;
      close cur;
    end;In this example you can see how can be done this with cursor vars .. You should concatenate v_sql string according to your requirements.
    But as in further posts has already been mentioned , be carefull at publishing such kind of procedures and think on security.
    Also when you want dynamicaly change from clause , you should consider using different records to accept data ? Maybe all your tables has the same structure and then this problem will be smaller.
    T
    T

  • Key fields in tables ce31000 and ce41000

    In transaction KE11 ( change sales and profit plan ), tables CE31000 and CE41000 are used. I have to read those tables in a report but I cannot find the relevant keys to find unique records.  There are some fields I know, but using those fields I get about 300 records where I only should have one.  I guess I should use another table which has the link to the other tables, but I have no idea which.  Does anybody have a clue ?

    As far as I remember there are 4 tables per operating concern, CE1xxxx for tha actuals, CE2xxxx for the planning, CE3xxxx for the summary lines and CE4xxxx for the objects.
    Depending on the defined characteristics there is one PAOBJNR in CE4xxxx for each existing combination. In CE3xxxx you should also find this PAOBJNR. At the moment I have no access to a SAP with COPA, but I hope, this helps you a little bit for the further search.
    Best regards
    André

  • How to Set Position Cursor Option to Non key fields in Table Maintenance .

    Hi,
    I have created a Ztable and i am using table maintenance for that table. In TMG ,by default  we have position cursor option to key fields only . User wants that position cursor option for non key fields also. Please help me out of this issue .
    How to provide Position Cursor option to Non key fields.
    Thanks & Regards,
    Prasad.

    Hi Nabheet,
    I tried using TYPE S DISPLAY LIKE E and am setting vim_abort_saving as X and sy-subrc as 4. However, this is also not enabling the fields. In this case, the first 2 fields - key fields are getting enabled but not the required ones. The above snapshot is for the same.
    lv_date1 = table1-date1.
       lv_date2 = table1-date2.
       lv_diff = lv_date2 - lv_date1.
       IF lv_diff LT 0.
         CLEAR: lv_err_msg.
         lv_err_msg = text-005.
         MESSAGE lv_err_msg TYPE 'S' DISPLAY LIKE  lc_e.
         vim_abort_saving = lc_x.
         sy-subrc = 4.

  • Want search help result directly only key field

    Hi friends
       i need one help, working on 4.6c, i want any fm that takes search help name and select options and write back the result list .
       i know some fm's like DD_SHLP_GET_HELPVALUES which is returning the result in string, for that i have to do lot of other stuff in that one i have to use cl_alv_table_create=>create_dynamic_table which i don't want.
        i want only the key field result list like F4IF_FIELD_VALUE_REQUEST rerurns RETURN_TAB type table of DDSHRETVAL .
      thanks in advance

    Hi Shiva,
    I know that this post is really old, but just for people who still visit this post, I extended Uwe's solution and came up with this. (Uwe's solution causes a popup to appear which I do not want as am accessing the F4 helps remotely).
    DATA: ls_shlp_descr TYPE shlp_descr,
           lt_ddshretval TYPE TABLE OF ddshretval,
           ls_ddshselops TYPE LINE OF ddshselops.
    " Get F4 Help structure
    CALL FUNCTION 'F4IF_GET_SHLP_DESCR'
       EXPORTING
         shlpname = 'T006_T'
       IMPORTING
         shlp     = ls_shlp_descr.
    " Add filter criterion
    ls_ddshselops-shlpname = 'T006_T'.
    ls_ddshselops-shlpfield = 'MSEH3'.
    ls_ddshselops-sign = 'I'.
    ls_ddshselops-option = 'EQ'.
    ls_ddshselops-low = 'MON'.
    APPEND ls_ddshselops TO ls_shlp_descr-selopt. " You can add more such filter options
    " Get the result values
    CALL FUNCTION 'F4IF_SELECT_VALUES'
       EXPORTING
         shlp       = ls_shlp_descr
       TABLES
         return_tab = lt_ddshretval.
    Maybe there are other ways to do this, just that I found this pretty OK for my case.
    best regards,
    Ashwani

  • Key fields are not visible in output condition table

    Hi,
         I have created few conndition tables using V/61. But i can not see Key field. It is not displaying. But when I check thru VK11 i can see that all fields are marked as key fields. example of table B018.
    My problem is that , i want to make few filed non key fields rest of fileds as key fields so that there should not be any duplicate ntry based on key fields. also I do not want to maintain these two fields for each record.
    Is there any exit to modify and view thesefields? or it is a security issue...bold
    Your earliest response is highly appreciated.\
    Thanks,
    AKS

    Hi Raga,
    Please check the documentation under the customizing path:
    IMG -> Sales and Distribution -> System Modifications ->
    Create New Fields (Using Condition Technique) ->
    New Fields For Pricing
    Then click on the paper icon
    Here is explained how to setup additional fields for pricing,
    not present in the standard.
    Notice the following rules:
    1. the new fields must have name beginning with 'ZZ' or 'YY' in order
       to avoid problem after upgrade
    2. add the new field in the table T681F for the application 'V' and the
       usage 'A'
    3. these new fields must be appened to the structures KOMKAZ or KOMPAZ
       (depending they are header or item fields)
    4. you should provide these fields by implementing the userexits
       USEREXIT_PRICING_PREPARE_TKOMK (header fields)
       USEREXIT_PRICING_PREPARE_TKOMP (item fields)
       in program MV45AFZZ for sales order, RV60AFZZ for invoice.
    In that documentation there are some examples too.
    Please check it.
    Regards,
    Alex

  • Searching non-key fields in table maintainance

    Hi..
    How to find non-key fields or how can we enble the FIND button in maintaince table ?
    Please reply....
    Thanks ...

    Hi,
    When you are on the table maintenance screen, you can :
    1. Goto menu options. Selection-->By Content
    2. Choose the fields you want to search data on and Press enter
    3. Enter the operator and the value  (you can append or insert a new field here as well )
    4. Click on the choose button.
    regards,
    Advait

  • Validating non key fields in table maintenance generator

    Hi,
    I ma using events for table maintenance generator event 05 ,there i want to validate non key fields ......i am throwing error message ....all the non key fields are getting in display mode ...i need them to enable to enter values ....
    please suggest
    Thanks,
    Shailaja Ainala.

    Hi Shailaja,
    Its property of error message, which makes it as non-editable.
    You can display either status or info message after validation check.
    And finally before saving (before save event) display error message, so that it invalid entries doesnt get saved.
    Thanks,
    Nisha Vengal.

  • F4 help values for currency key field in table

    Hi all,
    I have added currency and currency key fields in my Z table. For the curreny key field, i have assigned the standard data element WAERS. I have implemented Table Maintenance Generator for my table. But the F4 help values for the currency key field is not appearing when i tried to maintain table entry.
    Should i need to check the Foreign key check box for the field attribute? But this check box is in disable field in screen layout.
    Could someone tell me how to solve this issue?

    Hi,
    Make the check table of the currency field of your Ztable as TCURC,which is the master table of Currency.Inside the domain of the field you write the TCURC as a value table.and make foriegn key relationship with the TCURC table.
    Regards,
    Suvajit.

  • Where condition for a column in BMM

    Hi Gurus,
    I have a requirement where in the BMM(The LTS for this logical table is say 'Fact'), I need a logical column with the following definition.
    count(Dim.status) where Dim.status = ' Accepted' (I didnt add the Dim table to the LTS yet, should I?)
    I know that we can do a count(Dim.status) in the column source . but for the where Dim.status = ' Accepted' part im not sure what to do.
    Should I bring the Dim table as a LTS and define the 'where' condition in the content tab? will that work?
    but what if I have another logical column where I need dim.Status = 'Declined'( we have many more status)
    Plz help

    The suggest statement as Filter(count(Fact.Dollars) Using("dim.status = 'accepted'))
    is based on Answers, this would care about the column is available in Subject Area or not thats it.
    The same kind of functionality can get the using rpd.
    There you might need to map/add (fact source properties and then map using pencil icon on 11g add button in 10g) the dim table to the fact
    so that you can get the expression based on physical columns as
    case when dim.status = 'accepted' then Fact.Dollars else 0 end
    use Aggregate tab for sum;
    Since you are using Fact.Dollars it suppose to be sum, ROW_WIDs go by counts
    Hope this helps :) for more Qs send email
    If helps mark

  • Dynamic component in WHERE-condition for LOOP AT ?

    i want to make
    loop at itab where  (dynamic field) > 0
    how i can make it...
    Edited by: Thomas Zloch on Mar 2, 2010 2:47 PM

    I thought it's funny.
    And the problem can maybe be solved by using a completely dynamic where-condition, not just a dynamic component.
    http://help.sap.com/abapdocu_70/en/ABAPLOOP_AT_ITAB_COND.htm#!ABAP_ADDITION_4@4@
    Thomas
    P.S. meaningless subject enhanced, and please take the time to say hi and please when asking for help. Thanks.

  • Where condition for reading infotype while using ldb

    hi
    i want to read info from infotype p0000
    using where condition eg: for pernr = ' '.
    i am using LDB pnp.
    how can i put the where condition while using macro
    rp-provide-from-last.
    regards
    cs

    in fact you don't have to get the values, you only need to tell to the program to take them into account :
    GET PRPS.
      CHECK SELECT-OPTIONS.

Maybe you are looking for

  • OpenGL problems in photoshop cs5 64bit

    I have a nvidia GTX 550Ti graphics card with all available driver updates. Some features of openGL work without problem. The main problem I have is preview of animation with ray trace and export of finished animation. Niether will work. The preview w

  • X121e, other uses for WWAN mini PCIe slot?

    Does anyone know whether the mini PCIe slot in the X121e that the optional WWAN card goes in can be used for other cards? I'm aware of the whitelist, which had been suggested may only apply to wireless devices (e.g. WLAN and WWAN) - although I'm not

  • Lazerjet P1102w, Printing all black on pages

    Hi my HP 1102 is a great printer but now has a problem printing all black on anything i print thanks

  • Preparing Screenshots for Print

    Hi- I am looking for guidance for capturing screenshots, that will be for print. The company that I work for has a book being made that requires several figures from screenshots. The book is being printed in B&W. I do not have access to any other scr

  • BI NLS (Nearline Storage) interface with Documentum?

    Hi Experts, I attended a presentation by SAND Technologies at SAP Tech ED07 on BI Nearline Storage.  They mentioned BI NLS will will interface to archiving technology Open Text.  Does anyone know if NLS will interface to archiving provider EMC Docume