Skip to Content

AMDP APPLY_FILTER before or after SELECT query

Dear Experts,

I found two different types of approaches of using SELECT-OPTIONS in an AMDP method as follows. Please help me with understanding the difference and significance.

Case #1:

<int_tab1> = APPLY_FILTER ( <database_table>, :<sel_opt> ).

<int_tab2> = select ... from <int_tab1>

Case #2:

select ... from <db_table> into table @(int_tab1)

<int_tab2> = APPLY_FILTER ( <int_tab1>, :<sel_opt> ).

Thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Nov 05, 2019 at 05:28 AM

    Hello Shubham Banerjee,

    The difference between the two is straight forward, in that CASE1 you are applying the filter directly at the database table where as in the CASE2 you apply the filter to the internal table which in turn posses all the entries from database table.

    The efficiency of the program will be improved when we ensure we always deal with entries that are we are supposed to process rather that dealing with unnecessary entries.

    If you closely watch CASE2 is unnecessarily fetching certain entries from database table into the internal table since we did not apply filter up front. Where as CASE1 is more efficient as it applies filter directly to the database thus you are dealing with less number of entries from the beginning.

    CASE1 is better approach than CASE2.

    Regards!

    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.