<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: optimization of code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975537#M1491908</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Siegfried,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm a little bit confused now, you said:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; the view exist only on ABAP side, the DB interface sends the join to the database. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; And for the KNA1VV I see a join in the explain (DB6 database):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and what SQL is sent to the database? To my understanding it should be&lt;/P&gt;&lt;P&gt;the SELECT on the VIEW and no join. The join appears in the execution plan.&lt;/P&gt;&lt;P&gt;But in the SAP DBI it should be a SELECT on the view (no join).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The translation from the select on the view is not done in the SAP DBI which&lt;/P&gt;&lt;P&gt;just sends the SQL on the view, but in the database (where view definition&lt;/P&gt;&lt;P&gt;exists as well for materialized AND 'normal' views).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whether we have a materialized view or not is not visible in the SAP DDIC&lt;/P&gt;&lt;P&gt;and should make no difference here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Jun 2010 11:06:11 GMT</pubDate>
    <dc:creator>HermannGahm</dc:creator>
    <dc:date>2010-06-21T11:06:11Z</dc:date>
    <item>
      <title>optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975522#M1491893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me to optimize this code w.r.t performance tuning.  thanks in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT   v~aufpl
         v~aplzl
         V~FSAVD
         V~FSEDD
         V~ISDD
         V~IEDD
         V~MGVRG
         V~GMNGA
         V~MEINH
         c~ltxa1
         c~objnr
         C~ARBID
         s~werks
         s~arbpl
         s~vornr
         s~aufnr
         s~matnr
         o~cy_seqnr
         o~dispo
         D~VERWE
         u~usr04
         u~use04
         INTO  TABLE itab
         FROM ( ( ( ( ( afvv AS v INNER JOIN afvc AS c  ON v~aufpl EQ c~aufpl and  v~aplzl eq c~aplzl )
         inner join s022 as s  on c~objnr eq s~objnr  ) INNER JOIN
         AFko  AS O ON v~AUFPL EQ O~AUFPL AND S~AUFNR EQ O~AUFNR AND S~MATNR EQ O~PLNBEZ ) INNER JOIN CRHD
         AS D ON C~ARBID EQ D~OBJID AND S~ARBPL EQ D~ARBPL AND S~WERKS EQ D~WERKS )
         inner join afvu as u on v~aufpl eq u~aufpl and v~aplzl eq u~aplzl )
                                      WHERE  s~vornr in s_vornr
                                      and    s~werks in s_werks
                                      and   s~arbpl in s_arbpl
                                      AND   D~VERWE  IN S_VERWE
                                      and    o~aufnr in s_aufnr
                                      and    o~cy_seqnr in s_seqnr
                                      and   o~dispo in s_dispo
                                      and   c~ltxa1 in s_ltxa1
                                      and  V~fsavd in p_fsavd
                                      and  V~Fsedd in p_fsedd.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anoop&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jun 2010 11:35:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975522#M1491893</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-08T11:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975523#M1491894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anoop,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Optimization is depend on your input condition. Here you have many fileds as selection option. Which fileds or manditary we don't know or optional.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pl. specify mandatory fields an optional fields according that we process different logic for different input criteria.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pl. Specify minumum input if possible selection option and parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;P&gt;Ravi Lanjewar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Ravishankar Lanjewar on Jun 8, 2010 5:55 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jun 2010 12:20:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975523#M1491894</guid>
      <dc:creator>ravi_lanjewar</dc:creator>
      <dc:date>2010-06-08T12:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975524#M1491895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Welcome to SDN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;restrict your JOIN to a max of 3 tables. So break your SELECT into 2 or more...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jun 2010 12:21:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975524#M1491895</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-08T12:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975525#M1491896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See if you can you Database views, CAUFV may be useful. Also depending on the number of return entries see if you should use FOR ALL ENTRIES.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jun 2010 12:36:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975525#M1491896</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-08T12:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975526#M1491897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the select-option are the central point. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Specify how they are filled?  You can not expect that any combination can be optimized. But try to optimize the most important.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rest of the analysis is straightforward test of combinations ... however there are a lot of combinations &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jun 2010 13:42:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975526#M1491897</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-08T13:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975527#M1491898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="green" __jive_macro_name="color"&gt;Moderator message - Welcome to SCN.

Please see &lt;SPAN __jive_macro_name="thread" id="1283414"&gt;&lt;/SPAN&gt; before posting. You need to do some further work before posting here.

Also, Please read &lt;SPAN __jive_macro_name="thread" id="927634"&gt;&lt;/SPAN&gt; and &lt;SPAN __jive_macro_name="thread" id="1170968"&gt;&lt;/SPAN&gt; and [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers] before posting again.

Rob&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jun 2010 14:33:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975527#M1491898</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-08T14:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975528#M1491899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi  Ravishankar Lanjewar, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is my selection screen pls help &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
PARAMETERS: p_vari LIKE disvariant-variant. " ALV Variant
SELECTION-SCREEN END OF BLOCK blk1.

SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME title text-001.
SELECT-OPTIONS :  S_werks FOR s022-werks,
                  s_seqnr  FOR afko-cy_seqnr,
                  s_aufnr  FOR afko-aufnr,
                  s_arbpl  for s022-arbpl,
                  S_VERWE   FOR CRHD-VERWE,
                  s_vornr  for s022-vornr,
                  s_dispo  for  afko-dispo,
                  s_ltxa1  for  afvc-ltxa1.
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME title text-002.
 SELECT-OPTIONS : p_fsavd  FOR  s022-fsavd,
                  p_fsedd  FOR  s022-fsedd.
 PARAMETERS :CB AS checkbox.
 SELECTION-SCREEN END OF BLOCK blk2.
PARAMETERS :   rb_teco AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK blk.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jun 2010 03:47:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975528#M1491899</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-09T03:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975529#M1491900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anoop,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can used the following stratagey to read data from multiple table having multiple select option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Don't used more than 3 table in join.&lt;/P&gt;&lt;P&gt;2) Used for all entries to read data from other table.&lt;/P&gt;&lt;P&gt;3) check the table is not empty while using in for all entries otherwise it will give timeout runtime error.&lt;/P&gt;&lt;P&gt;4) Read data first from most index fields in select-option input, it minimuze the data read and fast fetching the data. After then use select for all entires to read data from other table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For your program you should you following execution plan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  1. if s_vornr[] or s_werks[] or s_arbpl[] is not initial&lt;/P&gt;&lt;P&gt;     First Read data from table s022 and there read data from afvC &amp;amp; afvc using join&lt;/P&gt;&lt;P&gt;     after then read data from table AFKO using for all entries and also read other data using for all entires&lt;/P&gt;&lt;P&gt;  2. elseif S_AUFNR[] or S_SEQNR[] or s_DISPO[] is not INITIAL.&lt;/P&gt;&lt;P&gt;     First Read data from AFKO and then read data from table AFvv &amp;amp; AFVC using join and then s022 &lt;/P&gt;&lt;P&gt;     after read other data from other table.&lt;/P&gt;&lt;P&gt;  3. elseif P_FSAVD[] or P_FSEDD[] is not initial&lt;/P&gt;&lt;P&gt;      Read data from AFVV and AFVV using join and after thern read other data from s022 and after then read from afko table&lt;/P&gt;&lt;P&gt;  4. else used your query to here&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;P&gt;Ravi Lanjewar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jun 2010 06:38:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975529#M1491900</guid>
      <dc:creator>ravi_lanjewar</dc:creator>
      <dc:date>2010-06-09T06:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975530#M1491901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should be aware that there is big difference between the coding and the actual usage of select-options.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jun 2010 07:27:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975530#M1491901</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-09T07:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975531#M1491902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Anoopk ,&lt;/P&gt;&lt;P&gt;   create a view with all the tables you mentioned in the query using INNER JOIN and select data from that view, it should improve the performance. Note: join tables only on key fields for better performance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jun 2010 07:51:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975531#M1491902</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-21T07:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975532#M1491903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unless it's a materialized view (which SAP doesn't support), the performance gain through a view is more or less insignificant (as far as my experience goes). It may profit a little bit from datebase buffering though, but only if the view is frequently used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can gain more if you analyze how the optimizer executes the statement, and maybe create an usefull index (or two).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jun 2010 08:54:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975532#M1491903</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-21T08:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975533#M1491904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; It may profit a little bit from datebase buffering though, but only if the view is frequently used.&lt;/P&gt;&lt;P&gt;Not even that is the case, the view exist only on ABAP side, the DB interface sends the join to the database. For the DB join and view are 100% identical.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it is hard work you must analyse the coding in detail.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jun 2010 09:00:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975533#M1491904</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-21T09:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975534#M1491905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;just to add even more confusion.. &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Unless it's a materialized view (which SAP doesn't support) &lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it does "support" if SAP doesn't &lt;EM&gt;know&lt;/EM&gt; it is a materialized view... &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Not even that is the case, the view exist only on ABAP side, the DB interface sends the join to the database.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a database view created in SE11 &lt;STRONG&gt;does&lt;/STRONG&gt; exist in the database (hence the name &lt;STRONG&gt;database&lt;/STRONG&gt; view.. &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jun 2010 09:16:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975534#M1491905</guid>
      <dc:creator>Rui_Dantas</dc:creator>
      <dc:date>2010-06-21T09:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975535#M1491906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Siegfried,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &amp;gt; It may profit a little bit from datebase buffering though, but only if the view is frequently used.&lt;/P&gt;&lt;P&gt;&amp;gt; Not even that is the case, the view exist only on ABAP side, the DB interface sends the join to the database. .&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that's a surprising statement. Which platform are you talking about? For me on ORACLE:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i go to SE16 and select from KNA1VV (which is a view in the SAP DDIC) this SELECT goes to the database:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SELECT&lt;/P&gt;&lt;P&gt; /*+&lt;/P&gt;&lt;P&gt;   FIRST_ROWS (200)&lt;/P&gt;&lt;P&gt; */&lt;/P&gt;&lt;P&gt;   *&lt;/P&gt;&lt;P&gt; FROM&lt;/P&gt;&lt;P&gt;   "KNA1VV"&lt;/P&gt;&lt;P&gt; WHERE&lt;/P&gt;&lt;P&gt;   "MANDT" = :A0 AND ROWNUM &amp;lt;= :A1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So no join is sent to the database but the select to the view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and i can confirm that the VIEW KNA1VV is defined on the database as well in the&lt;/P&gt;&lt;P&gt;database catalog:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select view_name from dba_views where view_name = 'KNA1VV'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(no hit in dba_tables for that object name)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; For the DB join and view are 100% identical.&lt;/P&gt;&lt;P&gt;So it is hard work you must analyse the coding in detail.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, i agree with this statement. If we do an explain plan for this select on the view&lt;/P&gt;&lt;P&gt;we get a join which is 100% identical to a join that would have been done in OPEN SQL.&lt;/P&gt;&lt;P&gt;And yes it is hard work to analyze the execution details for joins / views.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jun 2010 09:37:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975535#M1491906</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2010-06-21T09:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975536#M1491907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please do not confuse a view which is only a definition in the data dictionary and a view which actually&lt;/P&gt;&lt;P&gt;contains data in the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My comment above was correct, if you read the statement in the comment above:&lt;/P&gt;&lt;P&gt;&amp;gt;Unless it's a materialized view (which SAP doesn't support), the performance gain through a view is more or less insignificant&lt;/P&gt;&lt;P&gt;&amp;gt;(as far as my experience goes). It may profit a little bit from datebase buffering though, but only if the view is frequently used.&lt;/P&gt;&lt;P&gt;two different kinds of views !!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And for the KNA1VV I see a join in the explain (DB6 database):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT FROM kna1vv :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
    0 SELECT STATEMENT ( Estimated Costs =  2,292E+03 [timerons] )
           1 RETURN
               2 MSJOIN
                   3 [O] FETCH KNA1
                       4 IXSCAN KNA1~0 #key columns:  1
                   5 &amp;lt;i&amp;gt; FILTER
                       6 FETCH KNVV
                           7 IXSCAN KNVV~0 #key columns:  1
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;same for DD03VV now on Oracle&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 SELECT STATEMENT ( Estimated Costs = 11 , Estimated #Rows = 201 )
        5 COUNT STOPKEY
          Filter Predicates

            4 TABLE ACCESS BY INDEX ROWID DD03L
              Estim. CPU-Costs = 4.509 Estim. IO-Costs = 0

                3 NESTED LOOPS
                  ( Estim. Costs = 10 , Estim. #Rows = 201 )
                  Estim. CPU-Costs = 133.703 Estim. IO-Costs = 10

                    1 TABLE ACCESS FULL DD02L
                      ( Estim. Costs = 2 , Estim. #Rows = 69.173 )
                      Estim. CPU-Costs = 39.023 Estim. IO-Costs = 2
                      Filter Predicates
                    2 INDEX RANGE SCAN DD03L~1
                      Search Columns: 2
                      Estim. CPU-Costs = 1.824 Estim. IO-Costs = 0
                      Access Predicates
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are materialized views, but I doubt that this is valid performance optimization in most cases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jun 2010 10:44:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975536#M1491907</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-21T10:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975537#M1491908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Siegfried,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm a little bit confused now, you said:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; the view exist only on ABAP side, the DB interface sends the join to the database. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; And for the KNA1VV I see a join in the explain (DB6 database):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and what SQL is sent to the database? To my understanding it should be&lt;/P&gt;&lt;P&gt;the SELECT on the VIEW and no join. The join appears in the execution plan.&lt;/P&gt;&lt;P&gt;But in the SAP DBI it should be a SELECT on the view (no join).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The translation from the select on the view is not done in the SAP DBI which&lt;/P&gt;&lt;P&gt;just sends the SQL on the view, but in the database (where view definition&lt;/P&gt;&lt;P&gt;exists as well for materialized AND 'normal' views).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whether we have a materialized view or not is not visible in the SAP DDIC&lt;/P&gt;&lt;P&gt;and should make no difference here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jun 2010 11:06:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975537#M1491908</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2010-06-21T11:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975538#M1491909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;o.k., you are right, the database does know the structure of view. It is possible to write direct change statements on the view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But still; i am not aware of any performance difference between the join and the not materialized database-view. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jun 2010 15:14:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975538#M1491909</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-22T15:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975539#M1491910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;performance difference between the join and the not materialized database-view&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If we used the  &lt;STRONG&gt;view&lt;/STRONG&gt; database know the join condition, but ABAP JOINs are formulated in ABAP directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want the database system to determine the resulting set of the JOIN operator, you can use DB views, ABAP JOINs or subqueries. DB views are first created in the ABAP Dictionary, and are created on the database when the Dictionary object is activated. DB views created by other developers can also be used (reusability). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;But there is not any performance difference between join and view.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following important access strategies are available to the database optimizer for processing ABAP JOINs, subqueries, or SQL statements against database views:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Nested loop:&lt;/STRONG&gt; This strategy is relevant for database views and ABAP JOINs. First, the WHERE clause is used as a basis for selecting the (outer) table to be used for access. Next, starting from the outer table, the table records for the inner tables are selected according to the JOIN condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sort merge join:&lt;/STRONG&gt; First, the WHERE clause is evaluated for all tables in the join, and a resulting set is produced for each table. Each resulting set is sorted according to the JOIN conditions and then merged, also according to the JOIN conditions.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;It is possible to write direct change statements on the view&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Yes, Some cases it is possble to direct changes on view, but not all cases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;P&gt;Ravi Lanjewar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Ravishankar Lanjewar on Jun 23, 2010 11:07 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jun 2010 05:37:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975539#M1491910</guid>
      <dc:creator>ravi_lanjewar</dc:creator>
      <dc:date>2010-06-23T05:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975540#M1491911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Siegfried,&lt;/P&gt;&lt;P&gt;Hi Ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes, there is no difference with respect to performance in processing a select with join or a view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to add the &lt;STRONG&gt;hash join&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, the WHERE clause is evaluated for the table that is supposed to have the smaller result set (optimizer estimated rows). This result set is stored in a hashed table (hashing the join keys). Then the remaining resultset (2nd table with where / join condition applied or other resultset e.g. from anohter join) is read and probed again the hash table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;It is possible to write direct change statements on the view&lt;/P&gt;&lt;P&gt;&amp;gt;Yes, Some cases it is possble to direct changes on view, but not all cases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure whether Siegfried meant "it is" or "it is not"... . Up to my knowledge &lt;/P&gt;&lt;P&gt;within OPEN SQL only projection views (a view that has only ONE table) can be&lt;/P&gt;&lt;P&gt;updated. In standard SQL i think views with more than one table can be updated too,&lt;/P&gt;&lt;P&gt;but I'm not sure... .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jun 2010 08:00:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975540#M1491911</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2010-06-23T08:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: optimization of code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975541#M1491912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;STRONG&gt;Hermann&lt;/STRONG&gt; wrote:&lt;/P&gt;&lt;P&gt;yes, there is no difference with respect to performance in processing a select with join or a view.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here's a strange comment from the SAP help on [minimize the number of data transfers|http://help.sap.com/saphelp_nw70ehp2/helpdata/en/aa/47349a0f1c11d295380000e8353423/frameset.htm]:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;You can define joins between database tables statically and systemwide as views in the ABAP Dictionary. Such views can be used by all ABAP programs. One of their advantages is that &lt;STRONG&gt;fields that are common to both tables (join fields) are only transferred once from the database to the application server&lt;/STRONG&gt;. &lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I don't have a system to do any tracing right now, but does this actually mean that with a &lt;EM&gt;select *&lt;/EM&gt; on a join the join fields are really returned multiple times by the database? If this would be true, this might contribute to some performance degradation when lots of or larger fields are joined and we have a bigger result set...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, on a theoretical level I'm wondering if parsing and preparing the SQL statement (by the DBI, i.e. database interface) has any impact (if though, I doubt it's measurable). I.e. let's say I have an ABAP program with an Open SQL statement containing a join with 5 tables. Could it be that the parsing and preparation of the SQL join statement by the DBI is more time consuming than if I'd had used a dictionary view?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess to some degree it depends how efficiently the Open SQL statements are compiled and what is done at ABAP compile time versus DBI runtime (e.g. are conditions for client handling added for the join at compile time and the client value is filled at run time or are even the conditions only added at runtime?). I'm pretty sure this is all negligible, but it still would be interesting to understand how it works (couldn't find any details).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers, harald&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jun 2010 11:04:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-of-code/m-p/6975541#M1491912</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-23T11:04:06Z</dc:date>
    </item>
  </channel>
</rss>

