<?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: query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/query/m-p/1616725#M276188</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; The following code helps you to put item and header data into a final internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data:  begin of it_item occurs 0,
     vbeln like vbap-vbeln,
     posnr like vbap-posnr,
     matnr like vbap-matnr,
  end of it_item,
  begin of it_head occurs 0,
     vbeln like vbak-vbeln,
     vbtyp like vbak-vbtyp,
     auart like vbak-auart,
  end of it_head,
 
  begin of it_final occurs 0,
     vbeln like vbak-vbeln,
     vbtyp like vbak-vbtyp,
     auart like vbak-auart,
     vbeln like vbap-vbeln,
     posnr like vbap-posnr,
     matnr like vbap-matnr,
  end of it_final.
 
  loop at it_item.
    clear it_head.
    read table it_head with key vbeln = it_item-vbeln
                             binary search.
    if sy-subrc = 0.
       it_final-vbeln = it_head-vbeln.
       it_final-vbtyp = it_head-vbtyp.
       it_final-auart = it_head-auart.
    endif.
    it_final-posnr = it_item-posnr.
    it_final-matnr = it_item-matnr.
    append it_final.
    clear it_final.
  endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sailaja.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Oct 2006 08:59:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-10-03T08:59:03Z</dc:date>
    <item>
      <title>query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query/m-p/1616723#M276186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how to write the query for &lt;/P&gt;&lt;P&gt;  picking the item del date from table eket with respect to ebeln and ebelp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and how to move output fields of 3 itab to one itb. i.e &lt;/P&gt;&lt;P&gt;itab1, itab2, itab3 to dtab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Oct 2006 08:20:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query/m-p/1616723#M276186</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-03T08:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query/m-p/1616724#M276187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  if not itab[] is initial.&lt;/P&gt;&lt;P&gt;   1) select ebeln ebelp eindt from eket into i_eket&lt;/P&gt;&lt;P&gt;     for all entries in itab&lt;/P&gt;&lt;P&gt;    where ebeln = itab-ebeln&lt;/P&gt;&lt;P&gt;    and  ebelp = itab-ebelp.&lt;/P&gt;&lt;P&gt; endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  2) loop at itab1.&lt;/P&gt;&lt;P&gt;      loop at itab2 where f1 = itab1-f1.&lt;/P&gt;&lt;P&gt;       move-corresponding itab1 to itab3.&lt;/P&gt;&lt;P&gt;          move-corresponding itab2 to itab3.&lt;/P&gt;&lt;P&gt;       append itab3.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;       endloop.    &lt;/P&gt;&lt;P&gt;     endloop.  &lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;  insert db form table itab3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;amole&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Oct 2006 08:58:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query/m-p/1616724#M276187</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-03T08:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query/m-p/1616725#M276188</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; The following code helps you to put item and header data into a final internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data:  begin of it_item occurs 0,
     vbeln like vbap-vbeln,
     posnr like vbap-posnr,
     matnr like vbap-matnr,
  end of it_item,
  begin of it_head occurs 0,
     vbeln like vbak-vbeln,
     vbtyp like vbak-vbtyp,
     auart like vbak-auart,
  end of it_head,
 
  begin of it_final occurs 0,
     vbeln like vbak-vbeln,
     vbtyp like vbak-vbtyp,
     auart like vbak-auart,
     vbeln like vbap-vbeln,
     posnr like vbap-posnr,
     matnr like vbap-matnr,
  end of it_final.
 
  loop at it_item.
    clear it_head.
    read table it_head with key vbeln = it_item-vbeln
                             binary search.
    if sy-subrc = 0.
       it_final-vbeln = it_head-vbeln.
       it_final-vbtyp = it_head-vbtyp.
       it_final-auart = it_head-auart.
    endif.
    it_final-posnr = it_item-posnr.
    it_final-matnr = it_item-matnr.
    append it_final.
    clear it_final.
  endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sailaja.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Oct 2006 08:59:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query/m-p/1616725#M276188</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-03T08:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query/m-p/1616726#M276189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please note that from EKET table you can get multiple lines for the same purchase order line...basically one po line item can have schedule defined consisting of multiple lines. Hence the key of table EKET is EBELN&lt;EM&gt;EBELP&lt;/EM&gt;ETENR. So you can read the table as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ebeln ebelp etenr eindt into tablt itab&lt;/P&gt;&lt;P&gt;from eket&lt;/P&gt;&lt;P&gt;where ebeln = pebeln and ebelp = pebelp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here you can receive multiple lines for a single purchase line item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for the second query related to 3 itab into one itab.&lt;/P&gt;&lt;P&gt;You can define your itab with fields from all three internal tables and follow the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;  clear itab2.&lt;/P&gt;&lt;P&gt;  loop at itab2 where fields = itab1-fields.&lt;/P&gt;&lt;P&gt;    clear itab3.&lt;/P&gt;&lt;P&gt;    loop at itab3 where fields = itab2-fields.&lt;/P&gt;&lt;P&gt;      move-corresponding itab1 to itab.&lt;/P&gt;&lt;P&gt;      move-corresponding itab2 to itab.&lt;/P&gt;&lt;P&gt;      move-corresponding itab3 to itab.&lt;/P&gt;&lt;P&gt;      append itab.&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above is example where itab1-&amp;gt;itab2-&amp;gt;itab3 follow the hierarchy and have 1-many relationship.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Oct 2006 09:05:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query/m-p/1616726#M276189</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-03T09:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query/m-p/1616727#M276190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Query-&amp;gt;&lt;/P&gt;&lt;P&gt;Select EINDT from EKET into corresponding fields of table itab where ebeln EQ table name AND ebelp EQ tablename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;mrutyun^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Oct 2006 09:06:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query/m-p/1616727#M276190</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-03T09:06:22Z</dc:date>
    </item>
  </channel>
</rss>

