<?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: SAP-ABAP in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312381#M162365</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;Always use the following check before the FOR ALL ENTRIES clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not lit_itab[] is initial.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Write the select query.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise it will go into infinite loop if the internal table is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward points if it helps.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Jun 2006 09:51:31 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-06-05T09:51:31Z</dc:date>
    <item>
      <title>SAP-ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312376#M162360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plz explan about usage of For All Entries in Select Stmt?&lt;/P&gt;&lt;P&gt;wt are the pre-requisities for for all entries?&lt;/P&gt;&lt;P&gt;Can we  get the data from more than two tables using For All Entries? How?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PLz Explain these things?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jun 2006 09:46:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312376#M162360</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-05T09:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAP-ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312377#M162361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;select for all entries is used when you want to select the data into one table comparing the entries fo another table.It is usually used in place of joins when you want to populate an internal table with the data from 2 different tables.&lt;/P&gt;&lt;P&gt;for that:&lt;/P&gt;&lt;P&gt;select &amp;lt;field1&amp;gt; &amp;lt;field2&amp;gt; from &amp;lt;db&amp;gt;&lt;/P&gt;&lt;P&gt;into table itab1&lt;/P&gt;&lt;P&gt;where key1 = &amp;lt;key1-value&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select &amp;lt;field1&amp;gt; &amp;lt;field2&amp;gt; from &amp;lt;db&amp;gt;&lt;/P&gt;&lt;P&gt;into table itab2&lt;/P&gt;&lt;P&gt;for all entries in itab1&lt;/P&gt;&lt;P&gt;where key2 = &amp;lt;key2-value&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;move-corresponding itab1 to itab-final.&lt;/P&gt;&lt;P&gt;read table itab2 with key key2 = &amp;lt;key2-value&amp;gt;.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;move-corresponding itab2 to itab-final.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;append itab-final.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jun 2006 09:48:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312377#M162361</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-05T09:48:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAP-ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312378#M162362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check the sap provided documentation for for al entries:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;FOR ALL ENTRIES WHERE &lt;/P&gt;&lt;P&gt;Syntax &lt;/P&gt;&lt;P&gt;... FOR ALL ENTRIES IN itab WHERE ... col operator itab-comp ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;If the addition FOR ALL ENTRIES is specified before the language element WHERE, then the components comp of the internal table itab can be used as operands when comparing with relational operators. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The internal table itab must have a structured line type and the component comp must be compatible with the column col. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The logical expression sql_cond of the WHERE condition can comprise various logical expressions by using AND and OR. However, if FOR ALL ENTRIES is specified, there must be at least one Comparison with a column of the internal table itab, which can be specified either statistically or dynamically (Release 6.40 and higher). In a statement with a SELECTstatement with FOR ALL ENTRIES, the addition ORDER BY can only be used with the addition PRIMARY KEY. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The whole logical expression sql_cond is evaluated for each individual line of the internal table itab. The resulting set of the SELECT statement is the union of the resulting sets from the individual evaluations. Duplicate lines are automatically removed from the resulting set. If the internal table itab is empty, the whole WHERE statement is ignored and all lines in the database are put in the resulting set. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes &lt;/P&gt;&lt;P&gt;In Release 6.10 and higher, the same internal table can be specified after FOR ALL ENTRIES and after INTO. &lt;/P&gt;&lt;P&gt;The addition FOR ALL ENTRIES is only possible before WHERE conditions of the SELECT statement. &lt;/P&gt;&lt;P&gt;Example &lt;/P&gt;&lt;P&gt;Exporting all flight data for a specified departure city. The relevant airlines and flight numbers are first put in an internal table entry_tab, which is evaluated in the WHERE condition of the subsquent SELECT statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS p_city TYPE spfli-cityfrom. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF entry_tab_type, &lt;/P&gt;&lt;P&gt;         carrid TYPE spfli-carrid, &lt;/P&gt;&lt;P&gt;         connid TYPE spfli-connid, &lt;/P&gt;&lt;P&gt;       END OF entry_tab_type. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: entry_tab   TYPE TABLE OF entry_tab_type, &lt;/P&gt;&lt;P&gt;      sflight_tab TYPE SORTED TABLE OF sflight &lt;/P&gt;&lt;P&gt;                       WITH UNIQUE KEY carrid connid fldate. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT carrid connid &lt;/P&gt;&lt;P&gt;       FROM spfli &lt;/P&gt;&lt;P&gt;       INTO CORRESPONDING FIELDS OF TABLE entry_tab &lt;/P&gt;&lt;P&gt;       WHERE cityfrom = p_city. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT carrid connid fldate &lt;/P&gt;&lt;P&gt;       FROM sflight &lt;/P&gt;&lt;P&gt;       INTO CORRESPONDING FIELDS OF TABLE sflight_tab &lt;/P&gt;&lt;P&gt;       FOR ALL ENTRIES IN entry_tab &lt;/P&gt;&lt;P&gt;       WHERE carrid = entry_tab-carrid AND &lt;/P&gt;&lt;P&gt;             connid = entry_tab-connid.&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;REgards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jun 2006 09:49:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312378#M162362</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-05T09:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: SAP-ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312379#M162363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;joins will worse your performance in most of the cases so it is advisable to avoid joins.u can instead use FOR ALL ENTRIES variant to your SELECT clause..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use select statement with for ALL ENTRIES OPTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the majority of cases inner joins will actually be the requirement, but in the minority of cases you will want to use an outer join. Outer joins are useful where you may need all records from a certain table, that meet the selection criteria, and all data from another table(s), IF it exists. But if the latter data does not exist, you still want to get the first table data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using outer joins places a heavy load on the database engine (although no heavier that if you coded a nested select), so be very parsimonious about the use of outer joins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The performance of the join depends on the database optimizer used especially if there are more than two tables used for joins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to give maximum number of conditions in the ON clause. This is because the ON conditions are evaluated first and the virtual table created as a result is the one on which the WHERE clause applies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use subqueries if possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make sure you follow this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consolidated selections&lt;/P&gt;&lt;P&gt;No row by row processing&lt;/P&gt;&lt;P&gt;No check statements&lt;/P&gt;&lt;P&gt;No selections within loops&lt;/P&gt;&lt;P&gt;Selections are 'into' internal tables - no appends&lt;/P&gt;&lt;P&gt;SQL trace check completed&lt;/P&gt;&lt;P&gt;All programs checked to make sure that they are using the full index and in the&lt;/P&gt;&lt;P&gt;Correct order.&lt;/P&gt;&lt;P&gt;Minimum or zero number of identical selects.&lt;/P&gt;&lt;P&gt;Use of appropriate Indexes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check this code for your problem .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A real life scenario that has been optimized.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Data : 	Begin of  I_vbak occurs 0,&lt;/P&gt;&lt;P&gt;Vbeln like vbak-vbeln,&lt;/P&gt;&lt;P&gt;End of I_vbak.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Data :	Begin I_vbap occurs 0,&lt;/P&gt;&lt;P&gt;          	Vbeln like vbap-vbeln,&lt;/P&gt;&lt;P&gt;           	Posnr like vbap-posnr,&lt;/P&gt;&lt;P&gt;           	Matnr like vbap-matnr,&lt;/P&gt;&lt;P&gt;           	Kwmeng like vbap-kwmeng,&lt;/P&gt;&lt;P&gt;End of I_vbap.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Data :	Begin of I_makt occurs 0,&lt;/P&gt;&lt;P&gt;Matnr like makt-matnr,&lt;/P&gt;&lt;P&gt;Maktx like makt-maktx,&lt;/P&gt;&lt;P&gt;End of  I_makt.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Data :	d_lines like sy-subrc.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Start-of-selection.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Refresh : I_vbak , I_vbap , I_makt.&lt;/P&gt;&lt;P&gt;Select vbeln from VBAK into table I_vbak&lt;/P&gt;&lt;P&gt;Where erdat = p_erdat   And&lt;/P&gt;&lt;P&gt;vkorg = p_vkorg  And&lt;/P&gt;&lt;P&gt;vtweg = p_vtweg And&lt;/P&gt;&lt;P&gt;spart = p_spart.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Clear d_lines.&lt;/P&gt;&lt;P&gt;Describe table I_vbak lines d_lines.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Check d_lines &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Select vbeln posnr matnr kwmeng from VBAP into table I_vbap&lt;/P&gt;&lt;P&gt;For all entries in table I_vbak&lt;/P&gt;&lt;P&gt;Where vbeln = I_vbak-vbeln.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Clear d_lines.&lt;/P&gt;&lt;P&gt;Describe table I_vbap lines d_lines.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Check d_lines &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;End-of-selection.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Sort I_vbap by vbeln matnr.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Select matnr maktx from makt into I_makt&lt;/P&gt;&lt;P&gt;For all entries in I_vbap&lt;/P&gt;&lt;P&gt;Where spras = sy-langu And&lt;/P&gt;&lt;P&gt;matnr = I_vbap-matnr.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Sort I_makt by matnr.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Loop at I_vbap.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;      Clear I_makt.&lt;/P&gt;&lt;P&gt;      Read I_makt with key matnr = I_vbap-matnr binary search.&lt;/P&gt;&lt;P&gt;      &lt;/P&gt;&lt;P&gt;      Write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; I_vbnap-vbeln,&lt;/P&gt;&lt;P&gt;                   I_vbap-psonr,&lt;/P&gt;&lt;P&gt;                   I_vbap-matnr,&lt;/P&gt;&lt;P&gt;                   I_Makt-matnr,&lt;/P&gt;&lt;P&gt;                   I_vbap-kwmeng.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Endloop.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jun 2006 09:49:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312379#M162363</guid>
      <dc:creator>rahulkavuri</dc:creator>
      <dc:date>2006-06-05T09:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAP-ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312380#M162364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai Ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thankyou for ur reply,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plz Explain prerequisities for for All Entries?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jun 2006 09:51:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312380#M162364</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-05T09:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: SAP-ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312381#M162365</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;Always use the following check before the FOR ALL ENTRIES clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not lit_itab[] is initial.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Write the select query.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise it will go into infinite loop if the internal table is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward points if it helps.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jun 2006 09:51:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312381#M162365</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-05T09:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: SAP-ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312382#M162366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hii&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Prerequiste for all entries &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Before using FOR ALL THE ENTRIES statements, check the internal table is not initial (if IT_KNA1 IS NOT INITIAL), else it will select for all the records.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;we can use as many tables as possible.. but more than three is not advisable ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same is addressed in the following link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="1758005"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="1758470"&gt;&lt;/A&gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if helpful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Revert back for more help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Naresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jun 2006 09:52:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312382#M162366</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-05T09:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: SAP-ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312383#M162367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Srinivas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select for all entries is used for performance optimization. We can avoid a loop using this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT belnr gjahr augdt augbl bukrs&lt;/P&gt;&lt;P&gt;        blart bldat xblnr lifnr wrbtr shkzg&lt;/P&gt;&lt;P&gt;        FROM bsak&lt;/P&gt;&lt;P&gt;        INTO CORRESPONDING FIELDS OF TABLE i_data&lt;/P&gt;&lt;P&gt;        FOR ALL ENTRIES IN i_doctype&lt;/P&gt;&lt;P&gt;        WHERE blart EQ i_doctype-blart&lt;/P&gt;&lt;P&gt;        AND augdt IN s_augdt&lt;/P&gt;&lt;P&gt;        AND ( bukrs = '1000' OR bukrs ='4200'  OR&lt;/P&gt;&lt;P&gt;            ( bukrs = '8000' AND blart NE 'ZP' ) ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This in effect, picks up only those records in database from table bsak whose document type is there as an entry in the internal table i_doctype.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The pre requisite is that the internal table used (i_doctype) and database table from where we are selecting should have a common field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Susmitha.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points for useful answers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jun 2006 09:53:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312383#M162367</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-05T09:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: SAP-ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312384#M162368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi srinivas,&lt;/P&gt;&lt;P&gt;eg:&lt;/P&gt;&lt;P&gt;select matnr from mara&lt;/P&gt;&lt;P&gt;   into table i_matnr&lt;/P&gt;&lt;P&gt;   where mtart in s_mtart.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;if i_matnr is not initial.&amp;lt;/b&amp;gt;( Main prerequiste: checking the first table is initial or not.)&lt;/P&gt;&lt;P&gt;    select matnr maktx&lt;/P&gt;&lt;P&gt;     from makt&lt;/P&gt;&lt;P&gt;      into table i_makt&lt;/P&gt;&lt;P&gt;      for all entries in i_matnr&lt;/P&gt;&lt;P&gt;      where matnr = i_matnr-matnr.&lt;/P&gt;&lt;P&gt;check this thread also.&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="143059"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="151154"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="148256"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;priya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jun 2006 09:57:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312384#M162368</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-05T09:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAP-ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312385#M162369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt; It's better to use all entries always instead of Join...&lt;/P&gt;&lt;P&gt;  kindly reqrds the points....&lt;/P&gt;&lt;P&gt; How to use for 2 table... it's simple...&lt;/P&gt;&lt;P&gt;data : begin of it_lqua occurs 0.&lt;/P&gt;&lt;P&gt;        include structure lqua.&lt;/P&gt;&lt;P&gt;data : end of it_lqua.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; select single * from t320&lt;/P&gt;&lt;P&gt;    where  werks = p_werks&lt;/P&gt;&lt;P&gt;    and   lgort in s_lgort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  select * from lqua client specified&lt;/P&gt;&lt;P&gt;    into corresponding fields of table it_lqua&lt;/P&gt;&lt;P&gt;    where mandt = sy-mandt&lt;/P&gt;&lt;P&gt;    and lgnum = t320-lgnum&lt;/P&gt;&lt;P&gt;    and lgort = t320-lgort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   select * from makt client specified&lt;/P&gt;&lt;P&gt;    into corresponding fields of table it_makt&lt;/P&gt;&lt;P&gt;    for all entries in it_lqua&lt;/P&gt;&lt;P&gt;    where mandt = sy-mandt&lt;/P&gt;&lt;P&gt;    and   matnr = it_lqua-matnr&lt;/P&gt;&lt;P&gt;    and   spras = sy-langu.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   select * from lagp client specified&lt;/P&gt;&lt;P&gt;    into corresponding fields of table it_lagp&lt;/P&gt;&lt;P&gt;    for all entries in it_lqua&lt;/P&gt;&lt;P&gt;    where mandt = sy-mandt&lt;/P&gt;&lt;P&gt;    and   lgnum = it_lqua-lgnum&lt;/P&gt;&lt;P&gt;    and   lgtyp = it_lqua-lgtyp&lt;/P&gt;&lt;P&gt;    and   lgpla = it_lqua-lgpla&lt;/P&gt;&lt;P&gt;    and   lgber in s_lgber.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    while calling it_lqua if it_lqua is empty then  no records would be found.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like above u would do the cdoing and add more tables...&lt;/P&gt;&lt;P&gt;and int he final intrnal table u would read all the data into final internal table...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jun 2006 09:59:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-abap/m-p/1312385#M162369</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-05T09:59:13Z</dc:date>
    </item>
  </channel>
</rss>

