<?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: join command in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-command/m-p/2474515#M556862</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi in addition to Ms.Roja's thread,&lt;/P&gt;&lt;P&gt;Let the tables be A,B,C.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select a&lt;SUB&gt;f1 a&lt;/SUB&gt;f2 a&lt;SUB&gt;f3 a&lt;/SUB&gt;f4 b&lt;SUB&gt;f1 b&lt;/SUB&gt;f2 c~f1&lt;/P&gt;&lt;P&gt;from( ekko as a join ekpo as b) join eket as c&lt;/P&gt;&lt;P&gt;into table itab&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;ON a&lt;SUB&gt;f1 = b&lt;/SUB&gt;f1&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;where a&lt;SUB&gt;f1 = b&lt;/SUB&gt;f1&lt;/P&gt;&lt;P&gt;and b&lt;SUB&gt;f1 = c&lt;/SUB&gt;f1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Jul 2007 09:29:08 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-03T09:29:08Z</dc:date>
    <item>
      <title>join command</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-command/m-p/2474509#M556856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i want to select all items from table say table1, 2 items from another table say table2, 1 item from another table say table3 using the joiin command. how can i achieve this&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2007 09:17:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-command/m-p/2474509#M556856</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-03T09:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: join command</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-command/m-p/2474510#M556857</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;See how these three tables are related...based on that, you can form the join conditions...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2007 09:19:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-command/m-p/2474510#M556857</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-03T09:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: join command</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-command/m-p/2474511#M556858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;take help of the below code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SELECT  a&lt;SUB&gt;mblnr a&lt;/SUB&gt;cpudt a&lt;SUB&gt;bldat a&lt;/SUB&gt;usnam a~xblnr&lt;/P&gt;&lt;P&gt;          b&lt;SUB&gt;bwart b&lt;/SUB&gt;matnr b&lt;SUB&gt;werks b&lt;/SUB&gt;insmk b~lifnr&lt;/P&gt;&lt;P&gt;          c~ekgrp&lt;/P&gt;&lt;P&gt;          INTO  CORRESPONDING FIELDS OF TABLE it_final&lt;/P&gt;&lt;P&gt;          FROM mkpf AS a INNER JOIN&lt;/P&gt;&lt;P&gt;               mseg AS b ON a&lt;SUB&gt;mblnr = b&lt;/SUB&gt;mblnr&lt;/P&gt;&lt;P&gt;               INNER JOIN ekko AS c ON b&lt;SUB&gt;ebeln = c&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;               WHERE a~mblnr IN  s_mblnr  AND&lt;/P&gt;&lt;P&gt;                     a~cpudt IN  s_cpudt  AND&lt;/P&gt;&lt;P&gt;                     a~usnam IN  s_usnam  AND&lt;/P&gt;&lt;P&gt;                     a~xblnr IN  s_xblnr  AND&lt;/P&gt;&lt;P&gt;                     b~matnr  IN  s_matnr  AND&lt;/P&gt;&lt;P&gt;                     b~werks  IN  s_werks   AND&lt;/P&gt;&lt;P&gt;                     b~lgort  IN  s_lgort  AND&lt;/P&gt;&lt;P&gt;                     b~charg  IN  s_charg  AND&lt;/P&gt;&lt;P&gt;                     b~lifnr  IN  s_lifnr  AND&lt;/P&gt;&lt;P&gt;                     b~ps_psp_pnr IN s_wbs AND&lt;/P&gt;&lt;P&gt;                     b~bwart  IN  s_bwart  AND&lt;/P&gt;&lt;P&gt;                     b~insmk  IN  s_insmk  AND&lt;/P&gt;&lt;P&gt;                     c~ekgrp IN s_ekgrp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;sudha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2007 09:20:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-command/m-p/2474511#M556858</guid>
      <dc:creator>S0025444845</dc:creator>
      <dc:date>2007-07-03T09:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: join command</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-command/m-p/2474512#M556859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&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;Reward points for useful Answers&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2007 09:20:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-command/m-p/2474512#M556859</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-03T09:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: join command</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-command/m-p/2474513#M556860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;Let the tables be A,B,C.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select a&lt;SUB&gt;f1 a&lt;/SUB&gt;f2 a&lt;SUB&gt;f3 a&lt;/SUB&gt;f4 b&lt;SUB&gt;f1 b&lt;/SUB&gt;f2 c~f1&lt;/P&gt;&lt;P&gt;from( ekko as a join ekpo as b) join eket as c&lt;/P&gt;&lt;P&gt;into table itab&lt;/P&gt;&lt;P&gt;where a&lt;SUB&gt;f1 = b&lt;/SUB&gt;f1&lt;/P&gt;&lt;P&gt;and b&lt;SUB&gt;f1 = c&lt;/SUB&gt;f1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2007 09:21:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-command/m-p/2474513#M556860</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-03T09:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: join command</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-command/m-p/2474514#M556861</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;HAVE A LOOK .......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT demo_select_inner_join.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF wa,&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;fldate TYPE sflight-fldate,&lt;/P&gt;&lt;P&gt;bookid TYPE sbook-bookid,&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 UNIQUE KEY carrid connid fldate bookid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT &lt;/P&gt;&lt;P&gt;p~carrid &lt;/P&gt;&lt;P&gt;p~connid &lt;/P&gt;&lt;P&gt;f~fldate&lt;/P&gt;&lt;P&gt; b~bookid&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE itab&lt;/P&gt;&lt;P&gt;FROM ( ( spfli AS p&lt;/P&gt;&lt;P&gt;INNER JOIN sflight AS f ON p&lt;SUB&gt;carrid = f&lt;/SUB&gt;carrid AND&lt;/P&gt;&lt;P&gt;p&lt;SUB&gt;connid = f&lt;/SUB&gt;connid )&lt;/P&gt;&lt;P&gt;INNER JOIN sbook AS b ON b&lt;SUB&gt;carrid = f&lt;/SUB&gt;carrid AND&lt;/P&gt;&lt;P&gt;b&lt;SUB&gt;connid = f&lt;/SUB&gt;connid AND&lt;/P&gt;&lt;P&gt;b&lt;SUB&gt;fldate = f&lt;/SUB&gt;fldate )&lt;/P&gt;&lt;P&gt;WHERE p~cityfrom = 'FRANKFURT' AND&lt;/P&gt;&lt;P&gt;p~cityto = 'NEW YORK' AND&lt;/P&gt;&lt;P&gt;f&lt;SUB&gt;seatsmax &amp;gt; f&lt;/SUB&gt;seatsocc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab INTO wa.&lt;/P&gt;&lt;P&gt;AT NEW fldate.&lt;/P&gt;&lt;P&gt;WRITE: / wa-carrid, wa-connid, wa-fldate.&lt;/P&gt;&lt;P&gt;ENDAT.&lt;/P&gt;&lt;P&gt;WRITE / wa-bookid.&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;Padmam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2007 09:22:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-command/m-p/2474514#M556861</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-03T09:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: join command</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-command/m-p/2474515#M556862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi in addition to Ms.Roja's thread,&lt;/P&gt;&lt;P&gt;Let the tables be A,B,C.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select a&lt;SUB&gt;f1 a&lt;/SUB&gt;f2 a&lt;SUB&gt;f3 a&lt;/SUB&gt;f4 b&lt;SUB&gt;f1 b&lt;/SUB&gt;f2 c~f1&lt;/P&gt;&lt;P&gt;from( ekko as a join ekpo as b) join eket as c&lt;/P&gt;&lt;P&gt;into table itab&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;ON a&lt;SUB&gt;f1 = b&lt;/SUB&gt;f1&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;where a&lt;SUB&gt;f1 = b&lt;/SUB&gt;f1&lt;/P&gt;&lt;P&gt;and b&lt;SUB&gt;f1 = c&lt;/SUB&gt;f1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2007 09:29:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-command/m-p/2474515#M556862</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-03T09:29:08Z</dc:date>
    </item>
  </channel>
</rss>

