<?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: internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/3410893#M819166</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;create ine Final ITAB conains all fields of ur 3 ITABS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Loop the 1st ITAB
  MOVE CORRESPONDING FIELDS OF ITAB1 to FINALITAB
  read table ITAB2 with key fld1= itab1-fld1
  MOVE CORRESPONDING FIELDS OF ITAB2 to FINALITAB

  read table ITAB3 with key fld1= itab1-fld1
  MOVE CORRESPONDING FIELDS OF ITAB3 to FINALITAB

append finalita
endloop
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 14, 2008 5:11 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Feb 2008 05:57:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-14T05:57:01Z</dc:date>
    <item>
      <title>internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/3410889#M819162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to combine data for 3 diff tables having same primary keys in to a resulant table ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Sriram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2008 05:41:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/3410889#M819162</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-14T05:41:01Z</dc:date>
    </item>
    <item>
      <title>Re: internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/3410890#M819163</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;something like dis...........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at itab1.
move corresponding itab1 to itab_final.
read table itab2 with key fld1 = itab1-fld1. "fld1 is prim-ky
if sy-subrc is initial.
move corresponding itab2 to itab_final.
endif.
read table itab3 with key fld1 = itab1-fld1.
if sy-subrc is initial.
move corresponding itab3 to itab_final.
endif.
append itab_final.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;jose.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2008 05:49:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/3410890#M819163</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-14T05:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/3410891#M819164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use views and in where condition you use this primary key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check the example.&lt;/P&gt;&lt;P&gt;Syntax &lt;/P&gt;&lt;P&gt;... [(] {dbtab_left [AS tabalias_left]} | join &lt;/P&gt;&lt;P&gt;{[INNER] JOIN}|{LEFT [OUTER] JOIN} &lt;/P&gt;&lt;P&gt;{dbtab_right [AS tabalias_right] ON join_cond} [)] ... . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;The join syntax represents a recursively nestable join expression. A join expression consists of a left-hand and a right- hand side, which are joined either by means of [INNER] JOIN or LEFT [OUTER] JOIN . Depending on the type of join, a join expression can be either an inner ( INNER) or an outer (LEFT OUTER) join. Every join expression can be enclosed in round brackets. If a join expression is used, the SELECT command circumvents SAP buffering. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the left-hand side, either a single database table, a view dbtab_left, or a join expression join can be specified. On the right-hand side, a single database table or a view dbtab_right as well as join conditions join_cond can be specified after ON. In this way, a maximum of 24 join expressions that join 25 database tables or views with each other can be specified after FROM. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AS can be used to specify an alternative table name tabalias for each of the specified database table names or for every view. A database table or a view can occur multiple times within a join expression and, in this case, have various alternative names. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The syntax of the join conditions join_cond is the same as that of the sql_cond conditions after the addition WHERE, with the following differences: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At least one comparison must be specified after ON. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Individual comparisons may be joined using AND only. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All comparisons must contain a column in the database table or the view dbtab_right on the right-hand side as an operand. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following language elements may not be used: BETWEEN, LIKE, IN. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No sub-queries may be used. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For outer joins, only equality comparisons (=, EQ) are possible. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If an outer join occurs after FROM, the join condition of every join expression must contain at least one comparison between columns on the left-hand and the right-hand side. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In outer joins, all comparisons that contain columns as operands in the database table or the view dbtab_right on the right-hand side must be specified in the corresponding join condition. In the WHERE condition of the same SELECT command, these columns are not allowed as operands. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Resulting set for inner join &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The inner join joins the columns of every selected line on the left- hand side with the columns of all lines on the right-hand side that jointly fulfil the join_cond condition. A line in the resulting set is created for every such line on the right-hand side. The content of the column on the left-hand side may be duplicated in this case. If none of the lines on the right-hand side fulfils the join_cond condition, no line is created in the resulting set. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Resulting set for outer join &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The outer join basically creates the same resulting set as the inner join, with the difference that at least one line is created in the resulting set for every selected line on the left-hand side, even if no line on the right-hand side fulfils the join_cond condition. The columns on the right-hand side that do not fulfil the join_cond condition are filled with null values. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example &lt;/P&gt;&lt;P&gt;Join the columns carrname, connid, fldate of the database tables scarr, spfli and sflight by means of two inner joins. A list is created of the flights from p_cityfr to p_cityto. Alternative names are used for every table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: p_cityfr TYPE spfli-cityfrom, &lt;/P&gt;&lt;P&gt;p_cityto TYPE spfli-cityto. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF wa, &lt;/P&gt;&lt;P&gt;fldate TYPE sflight-fldate, &lt;/P&gt;&lt;P&gt;carrname TYPE scarr-carrname, &lt;/P&gt;&lt;P&gt;connid TYPE spfli-connid, &lt;/P&gt;&lt;P&gt;END OF wa. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA itab LIKE SORTED TABLE OF wa &lt;/P&gt;&lt;P&gt;WITH UNIQUE KEY fldate carrname connid. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT c&lt;SUB&gt;carrname p&lt;/SUB&gt;connid f~fldate &lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE itab &lt;/P&gt;&lt;P&gt;FROM ( ( scarr AS c &lt;/P&gt;&lt;P&gt;INNER JOIN spfli AS p ON p&lt;SUB&gt;carrid = c&lt;/SUB&gt;carrid &lt;/P&gt;&lt;P&gt;AND p~cityfrom = p_cityfr &lt;/P&gt;&lt;P&gt;AND p~cityto = p_cityto ) &lt;/P&gt;&lt;P&gt;INNER JOIN sflight AS f ON f&lt;SUB&gt;carrid = p&lt;/SUB&gt;carrid &lt;/P&gt;&lt;P&gt;AND f&lt;SUB&gt;connid = p&lt;/SUB&gt;connid ). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab INTO wa. &lt;/P&gt;&lt;P&gt;WRITE: / wa-fldate, wa-carrname, wa-connid. &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example &lt;/P&gt;&lt;P&gt;Join the columns carrid, carrname and connid of the database tables scarr and spfli using an outer join. The column connid is set to the null value for all flights that do not fly from p_cityfr. This null value is then converted to the appropriate initial value when it is transferred to the assigned data object. The LOOP returns all airlines that do not fly from p_cityfr. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS p_cityfr TYPE spfli-cityfrom. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF wa, &lt;/P&gt;&lt;P&gt;carrid TYPE scarr-carrid, &lt;/P&gt;&lt;P&gt;carrname TYPE scarr-carrname, &lt;/P&gt;&lt;P&gt;connid TYPE spfli-connid, &lt;/P&gt;&lt;P&gt;END OF wa, &lt;/P&gt;&lt;P&gt;itab LIKE SORTED TABLE OF wa &lt;/P&gt;&lt;P&gt;WITH NON-UNIQUE KEY carrid. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT s&lt;SUB&gt;carrid s&lt;/SUB&gt;carrname p~connid &lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE itab &lt;/P&gt;&lt;P&gt;FROM scarr AS s &lt;/P&gt;&lt;P&gt;LEFT OUTER JOIN spfli AS p ON s&lt;SUB&gt;carrid = p&lt;/SUB&gt;carrid &lt;/P&gt;&lt;P&gt;AND p~cityfrom = p_cityfr. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab INTO wa. &lt;/P&gt;&lt;P&gt;IF wa-connid = '0000'. &lt;/P&gt;&lt;P&gt;WRITE: / wa-carrid, wa-carrname. &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards.&lt;/P&gt;&lt;P&gt;Sowjanya.b&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2008 05:50:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/3410891#M819164</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-14T05:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/3410892#M819165</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;just do like this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first loop at itab1 into wa1.&lt;/P&gt;&lt;P&gt;move-corresponding wa1 to fwa. " final work area&lt;/P&gt;&lt;P&gt;read  table itab2 into wa2 with key pkey = wa1-pkey.&lt;/P&gt;&lt;P&gt;if sy-subrc =0.&lt;/P&gt;&lt;P&gt;move-corresponding wa2 to fwa&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;read  table itab3 into wa3 with key pkey = wa1-pkey.&lt;/P&gt;&lt;P&gt;if sy-subrc =0.&lt;/P&gt;&lt;P&gt;move-corresponding wa3 to fwa&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;append fwa to fitab.  " final itab&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;seshu.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 14, 2008 5:11 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2008 05:51:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/3410892#M819165</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-14T05:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/3410893#M819166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;create ine Final ITAB conains all fields of ur 3 ITABS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Loop the 1st ITAB
  MOVE CORRESPONDING FIELDS OF ITAB1 to FINALITAB
  read table ITAB2 with key fld1= itab1-fld1
  MOVE CORRESPONDING FIELDS OF ITAB2 to FINALITAB

  read table ITAB3 with key fld1= itab1-fld1
  MOVE CORRESPONDING FIELDS OF ITAB3 to FINALITAB

append finalita
endloop
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 14, 2008 5:11 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2008 05:57:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/3410893#M819166</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-14T05:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/3410894#M819167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;suppose u hav 3 int tables : i1 i2 i3&lt;/P&gt;&lt;P&gt;and u want to combine them into final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at internal table having maximum records.&lt;/P&gt;&lt;P&gt;first of al sort all the internal table based no the primary key.&lt;/P&gt;&lt;P&gt;sort i1 by fld1 fld2 fld3.&lt;/P&gt;&lt;P&gt;sort i2 by fld1 fld2 fld3.&lt;/P&gt;&lt;P&gt;sort i3 by fld1 fld2 fld3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from i1.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from i2.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from i3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at i1.&lt;/P&gt;&lt;P&gt;&amp;lt;move required fields from i1 into work area of final &amp;gt; &lt;/P&gt;&lt;P&gt;read table i2 with key fld1 = i1-fld1 fld2 = i1-fld2  fld3 = i1-fld3.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&amp;lt;move the required fields of i2 into work area of final&amp;gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table i3 with key fld1 = i1-fld1 fld2 = i1-fld2  fld3 = i1-fld3.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&amp;lt;move the required fields of i3 into work area of final&amp;gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&amp;lt;append final &amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;clear all work areas&amp;gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Kamini Rawat on Feb 14, 2008 6:59 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2008 05:57:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/3410894#M819167</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-14T05:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/3410895#M819168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your 3 tables are internal tables then you need to loop at the tables and for the common record(same primary keys) read the fields and populate the Target itab or Target Wa.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your 3 tables are not internal tables and they are SAP/Z tables then you need to use Inner Join.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2008 05:58:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/3410895#M819168</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-14T05:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/3410896#M819169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By making use of JOINS concepts we can combian two are more tables.There are 3 importent types of joins are there in SAP .&lt;/P&gt;&lt;P&gt;1 inner join 2 outer join 3 right outer join&lt;/P&gt;&lt;P&gt;you can use these joins depends on your requierment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 14, 2008 5:12 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2008 06:01:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/3410896#M819169</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-14T06:01:36Z</dc:date>
    </item>
  </channel>
</rss>

