<?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: Logic for Select in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678487#M1449205</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;Put the INNER JOIN on the table 1 and table 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ritesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Mar 2010 10:08:40 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-03-09T10:08:40Z</dc:date>
    <item>
      <title>Logic for Select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678486#M1449204</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;I have two internal tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table 1:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shipment       Reason Codes           Delivery Number&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                            D1                          77789&lt;/P&gt;&lt;P&gt;                            D2                          77789&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table 2:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shipment        Delivery Number&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;120                   77789&lt;/P&gt;&lt;P&gt;121                   77789&lt;/P&gt;&lt;P&gt;122                  77790&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One of the table is in vertical and the other table is in horizontal records.  I need to loop table 2 in table 1 where I am expecting my records to be as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;120             D1                 77789&lt;/P&gt;&lt;P&gt;121            D2                  77789&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know the logic of achieving this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Krish on Mar 9, 2010 9:58 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 09:58:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678486#M1449204</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T09:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Logic for Select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678487#M1449205</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;Put the INNER JOIN on the table 1 and table 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ritesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 10:08:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678487#M1449205</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T10:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Logic for Select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678488#M1449206</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;As you have delivery number in common you can loop the two tables and then modify the second table..... is this what you want??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nagaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 10:19:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678488#M1449206</guid>
      <dc:creator>former_member404244</dc:creator>
      <dc:date>2010-03-09T10:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: Logic for Select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678489#M1449207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please try this code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_tab1 into wa_tab1.&lt;/P&gt;&lt;P&gt;read table it_tab2 into wa_tab2 with key fld1 = wa_tab1-fld1 &lt;/P&gt;&lt;P&gt;                                                                  fld2 = wa_tab1-fld2&lt;/P&gt;&lt;P&gt;                                                                  BINARY SEARCH.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;move-corresponding fields wa_tab1 to wa_tab.&lt;/P&gt;&lt;P&gt;move-corresponding fields wa_tab2 to wa_tab.&lt;/P&gt;&lt;P&gt;append wa_tab to it_tab.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 10:56:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678489#M1449207</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T10:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: Logic for Select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678490#M1449208</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;I was not clear about the requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table 1 would be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shipment 1        Shipment 2            Shipment 3          Shipment 4           Delivery Number&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table 2 would be &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Delivery Number         Shipment Number&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;11000                              101&lt;/P&gt;&lt;P&gt;11000                              102&lt;/P&gt;&lt;P&gt;11000                              103&lt;/P&gt;&lt;P&gt;11090                              104&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Based on the delivery number, I need my table 1 to be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shipment 1        Shipment 2            Shipment 3          Shipment 4           Delivery Number&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;101                      102                         103                                                 11000&lt;/P&gt;&lt;P&gt;104                                                                                11090&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know the code for the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Krish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 10:57:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678490#M1449208</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T10:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: Logic for Select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678491#M1449209</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;Are you getting values in both the internal tables.... aslo the shipment 1 to 4 is this constant??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nagaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 11:13:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678491#M1449209</guid>
      <dc:creator>former_member404244</dc:creator>
      <dc:date>2010-03-09T11:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: Logic for Select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678492#M1449210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, it is always constant.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 11:34:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678492#M1449210</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T11:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: Logic for Select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678493#M1449211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are assuming that the connecting field between the two tables is delivery number. now based on the delivery number you need to populate the table1 with values of shipment number from table2 into shipment1,shipment2 etc.&lt;/P&gt;&lt;P&gt;maybe try something like&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: itabix type sy-tabix,
         otabix type sy-tabix.
loop at table1.
 otabix = sy-tabix
 loop at table 2 where delverynumber = table1-deliverynumber.
 itabix = sy-tabix.  
 case itabix.
  when 1.
    table1-shipment1 = table2-shipment number
  when 2.
    table1-shipment2 = table2-shipment number
  when 3.
    table1-shipment3 = table2-shipment number
  when 4.
    table1-shipment4 = table2-shipment number
  endcase.
 endloop.
 modify table1 index otabix.
endloop
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sachin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 11:38:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678493#M1449211</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T11:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Logic for Select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678494#M1449212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this sample code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: begin of itab1 OCCURS 0,
      s1(10) type c,
      s2(10) type c,
      s3(10) type c,
      s4(10) type c,
      dn(10) type c,
     end of itab1.

data: begin of itab2 occurs 0,
      dn(10) type c,
      s1(10) type c,
     end of itab2.

FIELD-SYMBOLS: &amp;lt;wa&amp;gt; like LINE OF itab2,
               &amp;lt;comp&amp;gt; type any.


itab1-dn = '11000'.
append itab1.


itab1-dn = '11090'.
append itab1.


itab2-dn = '11000'.
itab2-s1 = '101'.
append itab2.

itab2-dn = '11000'.
itab2-s1 = '102'.
append itab2.

itab2-dn = '11000'.
itab2-s1 = '103'.
append itab2.

itab2-dn = '11090'.
itab2-s1 = '104'.
append itab2.

data: i type c,
      temp type string.


loop at itab1.
do 4 times.
  i = i + 1.
CONCATENATE 's' i into temp.
CONCATENATE 'itab1-' temp INTO temp.
assign (temp) to &amp;lt;comp&amp;gt;.
read TABLE itab2 INDEX i.
  ASSIGN itab2 to &amp;lt;wa&amp;gt;.
  &amp;lt;comp&amp;gt; = &amp;lt;wa&amp;gt;-s1.
ENDDO.

modify itab1.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vikranth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 11:50:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678494#M1449212</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T11:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: Logic for Select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678495#M1449213</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;Table 1 would be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shipment 1 Shipment 2 Shipment 3 Shipment 4 Delivery Number&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of itab1 occurs 0,&lt;/P&gt;&lt;P&gt;        shipment1,&lt;/P&gt;&lt;P&gt;        shipment2  &lt;/P&gt;&lt;P&gt;        shipment3&lt;/P&gt;&lt;P&gt;        shipment4,&lt;/P&gt;&lt;P&gt;        delivery number,&lt;/P&gt;&lt;P&gt;      end of itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table 2 would be &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Delivery Number Shipment Number&lt;/P&gt;&lt;P&gt;11000 101&lt;/P&gt;&lt;P&gt;11000 102&lt;/P&gt;&lt;P&gt;11000 103&lt;/P&gt;&lt;P&gt;11090 104&lt;/P&gt;&lt;P&gt;data: begin of itab2 occurs 0,&lt;/P&gt;&lt;P&gt;        delivery number,&lt;/P&gt;&lt;P&gt;        shipment number,  &lt;/P&gt;&lt;P&gt;      end of itab2.&lt;/P&gt;&lt;P&gt;data: itab3 like itab2 occurs 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     itab3[] = itab2[].&lt;/P&gt;&lt;P&gt;     sort itab3 by delivery number.&lt;/P&gt;&lt;P&gt;     delete adjucent duplicates from table itab3 comparing delivery number.&lt;/P&gt;&lt;P&gt;     loop at itab3.&lt;/P&gt;&lt;P&gt;        loop at itab2 where delivery number = itab3-delivery number.&lt;/P&gt;&lt;P&gt;         case itab2-shipment number.&lt;/P&gt;&lt;P&gt;         when '101'.&lt;/P&gt;&lt;P&gt;          itab1-shipment number1 = itab2-shipment number.&lt;/P&gt;&lt;P&gt;         when '102'.&lt;/P&gt;&lt;P&gt;          itab1-shipment number2 = itab2-shipment number.&lt;/P&gt;&lt;P&gt;         when '103'.&lt;/P&gt;&lt;P&gt;          itab1-shipment number3 = itab2-shipment number.&lt;/P&gt;&lt;P&gt;         when '104'.&lt;/P&gt;&lt;P&gt;          itab1-shipment number4 = itab2-shipment number.&lt;/P&gt;&lt;P&gt;        endloop.&lt;/P&gt;&lt;P&gt;        itab1-delivery number = itab3-delivery number.&lt;/P&gt;&lt;P&gt;        append itab1.&lt;/P&gt;&lt;P&gt;        clear itab1.  &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;ashok&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 12:14:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678495#M1449213</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T12:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Logic for Select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678496#M1449214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Krish,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to my understanding you can achieve your query result by this method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
types: begin of ty_table1,
          ship type char255,
         delivery type delivery " your delivery dataelement.
           end of ty_table1,

          begin of ty_table2,
         delivery type delivery " your delivery dataelement.
         shipmentnumber      type shipment number"your shipment data element
           end of ty_table1,

data: wa_table2 type ty_table2,
        wa_table1 type ty_table1,
       i_table2 type table of ty_table2,
      i_table1 type table of ty_table1, 
     con_tab                TYPE c VALUE cl_abap_char_utilities=&amp;gt;horizontal_tab.
       ship                        type char255.
loop at i_table2 into wa_table2.
 CONCATENATE: wa_table2-shipmentnumber
                          into ship
                          SEPARATED BY con_tab.
at end of delivery.
wa_table1-ship = ship.
wa_table1-delivery = wa_table2-delivery.
append wa_table2 to i_table2. 
ship = space.
clear wa_table1.
endat.
endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i think this should help you since you have many shipment numebr for a single delivery you can concatenate it in string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;tanmaya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 13:16:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-select/m-p/6678496#M1449214</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T13:16:48Z</dc:date>
    </item>
  </channel>
</rss>

