Skip to Content
author's profile photo Former Member
Former Member

For All Entries Primary Key?

Hi Guys,

I am having a doubt. when we are using For all entries in a select statement b/w Db table and Internal Table does we need to use only Primary key in Where condition ? can anybody tell in where condition i mean we can use any field or only Primary and Foreign keys?

for ex SELECT *

INTO TABLE lt_TJ30T

FROM TJ30T

FOR ALL ENTRIES IN lt_JSTO

WHERE STSMA EQ lt_JSTO-STSMA.

Very Urgent.

Thanks,

Gopi.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 03, 2007 at 06:03 PM

    Hi,

    No Gopi , there is no rule that we must use only primary key in the where clause.

    But using the fields of the primary key in the where clause makes the select statement work fast because of the primary index.

    Regards,

    Madhusudhan

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Madhusudhan,

      Can u tell me how to find relation in Project Support b/w tables ? I want to find the relation(Primary Foreign key relation ship) b/w JSTO ,PROJ ,JEST ,TJ02T , TJ30T and TJ30 tables? Can u plz help me regarding this.

      Thanks,

      Gopi.

  • author's profile photo Former Member
    Former Member
    Posted on Jul 03, 2007 at 06:49 PM

    HI,

    we use for all entries to improve the perfomance of data extraction. how can we reading the data from data base table fastly, by using primary or secondary indexes only. so while working with FOR ALL ENTRIES use only primary or secondary key values only.

    Before using for all entries, try to sort internal table.

    After that delete duplicate entries from internal table.

    In select for all entries use as much as key fields in a selection table.

    The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the length of the WHERE clause.

    The plus

    Large amount of data

    Mixing processing and reading of data

    Fast internal reprocessing of data

    Fast

    The Minus

    Difficult to program/understand

    Memory could be critical (use FREE or PACKAGE size)

    Some steps that might make FOR ALL ENTRIES more efficient:

    Removing duplicates from the driver table

    Sorting the driver table

    If possible, convert the data in the driver table to ranges so a BETWEEN statement is used instead of and OR statement:

    FOR ALL ENTRIES IN i_tab

    WHERE mykey >= i_tab-low and

    mykey <= i_tab-high.

    regards,

    Ashok Reddy

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.