<?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: Nested Select querry in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-select-querry/m-p/3219289#M767718</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Chandra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT mseg&lt;SUB&gt;charg mseg&lt;/SUB&gt;ebeln mseg&lt;SUB&gt;menge mseg&lt;/SUB&gt;bstmg&lt;/P&gt;&lt;P&gt;             mara&lt;SUB&gt;zmatnr1 mara&lt;/SUB&gt;zthndia mara~zcolor1&lt;/P&gt;&lt;P&gt;             makt~maktx&lt;/P&gt;&lt;P&gt;INTO TABLE itab "same structure like the fields above&lt;/P&gt;&lt;P&gt;FROM mseg AS mseg&lt;/P&gt;&lt;P&gt;INNER JOIN matnr AS matnr&lt;/P&gt;&lt;P&gt;ON mseg&lt;SUB&gt;matnr EQ mara&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;INNER JOIN makt AS makt&lt;/P&gt;&lt;P&gt;ON mara&lt;SUB&gt;matnr EQ makt&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;WHERE .... makt~langu EQ sy-langu.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if it is to slow, than you have to remove the INNER JOIN makt... (this can happen if material texts are maintained in more than one language) and make that in a separate selection and merge the two tables in the programs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;ec&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Jan 2008 07:48:53 GMT</pubDate>
    <dc:creator>JozsefSzikszai</dc:creator>
    <dc:date>2008-01-15T07:48:53Z</dc:date>
    <item>
      <title>Nested Select querry</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-select-querry/m-p/3219288#M767717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   I want to get records from 3 tables at a time. Those are MARA, MSEG and MAKT. The fields are &lt;/P&gt;&lt;P&gt;MSEG - charg   &lt;/P&gt;&lt;P&gt;             ebeln   &lt;/P&gt;&lt;P&gt;             menge  &lt;/P&gt;&lt;P&gt;             bstmg &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MARA - zmatnr1  (These are some z fields)&lt;/P&gt;&lt;P&gt;            zthndia &lt;/P&gt;&lt;P&gt;            zcolor1 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MAKT - maktx.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;send the solution with code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Points will be rewarded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards.&lt;/P&gt;&lt;P&gt;S Mahanta.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jan 2008 07:43:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-select-querry/m-p/3219288#M767717</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-15T07:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Select querry</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-select-querry/m-p/3219289#M767718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Chandra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT mseg&lt;SUB&gt;charg mseg&lt;/SUB&gt;ebeln mseg&lt;SUB&gt;menge mseg&lt;/SUB&gt;bstmg&lt;/P&gt;&lt;P&gt;             mara&lt;SUB&gt;zmatnr1 mara&lt;/SUB&gt;zthndia mara~zcolor1&lt;/P&gt;&lt;P&gt;             makt~maktx&lt;/P&gt;&lt;P&gt;INTO TABLE itab "same structure like the fields above&lt;/P&gt;&lt;P&gt;FROM mseg AS mseg&lt;/P&gt;&lt;P&gt;INNER JOIN matnr AS matnr&lt;/P&gt;&lt;P&gt;ON mseg&lt;SUB&gt;matnr EQ mara&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;INNER JOIN makt AS makt&lt;/P&gt;&lt;P&gt;ON mara&lt;SUB&gt;matnr EQ makt&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;WHERE .... makt~langu EQ sy-langu.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if it is to slow, than you have to remove the INNER JOIN makt... (this can happen if material texts are maintained in more than one language) and make that in a separate selection and merge the two tables in the programs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;ec&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jan 2008 07:48:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-select-querry/m-p/3219289#M767718</guid>
      <dc:creator>JozsefSzikszai</dc:creator>
      <dc:date>2008-01-15T07:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Select querry</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-select-querry/m-p/3219290#M767719</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;data: begin of g_t_intab occurs 0,&lt;/P&gt;&lt;P&gt;         charg &lt;/P&gt;&lt;P&gt;         ebeln &lt;/P&gt;&lt;P&gt;         menge &lt;/P&gt;&lt;P&gt;         bstmg&lt;/P&gt;&lt;P&gt;        zmatnr1 &lt;/P&gt;&lt;P&gt;        zthndia &lt;/P&gt;&lt;P&gt;        zcolor1&lt;/P&gt;&lt;P&gt;        end of g_t_intab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a&lt;SUB&gt;charg a&lt;/SUB&gt;ebeln a&lt;SUB&gt;menge a&lt;/SUB&gt;bstmg&lt;/P&gt;&lt;P&gt;b&lt;SUB&gt;zmatnr1 b&lt;/SUB&gt;zthndia b~zcolor1&lt;/P&gt;&lt;P&gt;c~maktx&lt;/P&gt;&lt;P&gt;INTO TABLE g_t_intab &lt;/P&gt;&lt;P&gt;FROM mseg AS a&lt;/P&gt;&lt;P&gt;INNER JOIN matnr AS b&lt;/P&gt;&lt;P&gt;ON a&lt;SUB&gt;matnr = b&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;OUTER JOIN&lt;/STRONG&gt; makt AS c&lt;/P&gt;&lt;P&gt;ON b&lt;SUB&gt;matnr = c&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;WHERE &lt;/P&gt;&lt;P&gt;   a~mblnr  =   ....&lt;/P&gt;&lt;P&gt;   c~langu = sy-langu.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use OUTER JOIN for MAKT as even if description doesnot exist material will be considered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jan 2008 08:14:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-select-querry/m-p/3219290#M767719</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-15T08:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Select querry</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-select-querry/m-p/3219291#M767720</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;check the below code and than change your code accordingly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Types: begin of ty_mesg_mkpf,&lt;/P&gt;&lt;P&gt;mblnr type mseg-mblnr,&lt;/P&gt;&lt;P&gt;matnr type mseg-matnr,&lt;/P&gt;&lt;P&gt;werks type mseg-werks,&lt;/P&gt;&lt;P&gt;charg type mseg-charg,&lt;/P&gt;&lt;P&gt;lifnr type mseg-lifnr,&lt;/P&gt;&lt;P&gt;bualt type mseg-bualt,&lt;/P&gt;&lt;P&gt;erfmg type mseg-erfmg,&lt;/P&gt;&lt;P&gt;ebeln type mseg-ebeln,&lt;/P&gt;&lt;P&gt;ebelp type mseg-ebelp,&lt;/P&gt;&lt;P&gt;budat type mkpf-budat,&lt;/P&gt;&lt;P&gt;end of ty_mseg_mkpf,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Begin og ty_mara_makt,&lt;/P&gt;&lt;P&gt;matnr type mara-matnr,&lt;/P&gt;&lt;P&gt;zzshelf_life type mara-zzshelf_life,&lt;/P&gt;&lt;P&gt;maktx type makt-maktx,&lt;/P&gt;&lt;P&gt;end of ty_mara_makt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data: it_mseg_mkpf type table of ty_mseg_mkpf,&lt;/P&gt;&lt;P&gt;wa_mseg_mkpf type ty_mseg_mkpf,&lt;/P&gt;&lt;P&gt;it_mara_makt type table of ty_mara_makt,&lt;/P&gt;&lt;P&gt;wa_mara_makt type ty_mara_makt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT m1~mblnr&lt;/P&gt;&lt;P&gt;m1~matnr&lt;/P&gt;&lt;P&gt;m1~werks&lt;/P&gt;&lt;P&gt;m1~charg&lt;/P&gt;&lt;P&gt;m1~lifnr&lt;/P&gt;&lt;P&gt;m1~bualt&lt;/P&gt;&lt;P&gt;m1~erfmg&lt;/P&gt;&lt;P&gt;m1~ebeln&lt;/P&gt;&lt;P&gt;m1~ebelp&lt;/P&gt;&lt;P&gt;m2~budat &lt;/P&gt;&lt;P&gt;FROM mseg&lt;/P&gt;&lt;P&gt;INTO TABLE it_mseg_mkpf&lt;/P&gt;&lt;P&gt;INNER JOIN mkpf&lt;/P&gt;&lt;P&gt;ON m1&lt;SUB&gt;mblnr EQ m2&lt;/SUB&gt;mblnr&lt;/P&gt;&lt;P&gt;WHERE m1~matnr IN s_matnr&lt;/P&gt;&lt;P&gt;AND m1~werks IN s_werks&lt;/P&gt;&lt;P&gt;AND m1~lifnr IN s_lifnr&lt;/P&gt;&lt;P&gt;AND m1~bwart EQ p_bwart&lt;/P&gt;&lt;P&gt;AND ( m1&lt;SUB&gt;ebeln NE ' ' AND m1&lt;/SUB&gt;ebeln IN s_ebeln )&lt;/P&gt;&lt;P&gt;AND m2~budat IN s_budat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;Select m3~matnr &lt;/P&gt;&lt;P&gt;m3~zzshelf_life &lt;/P&gt;&lt;P&gt;m4~maktx from mara as m3&lt;/P&gt;&lt;P&gt;INNER JOIN makt as m4&lt;/P&gt;&lt;P&gt;ON m3&lt;SUB&gt;matnr EQ m4&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;INTO TABLE it_mara_makt&lt;/P&gt;&lt;P&gt;where m3~mtart IN s_mtart&lt;/P&gt;&lt;P&gt;AND m4~spras EQ sy-langu.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_mseg_mkpf into wa_mseg_mkpf.&lt;/P&gt;&lt;P&gt;Move necessary field values from wa_mseg_mkpf to wa_mat_doc.&lt;/P&gt;&lt;P&gt;Read table it_mara_makt into wa_mara_makt with key matnr = wa_mseg_mkpf-matnr.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;move remaining field values to wa_mat_doc.&lt;/P&gt;&lt;P&gt;append wa_mat_doc to gt_mat_doc.&lt;/P&gt;&lt;P&gt;clear wa_mat_doc.&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;&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, 15 Jan 2008 08:49:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-select-querry/m-p/3219291#M767720</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-15T08:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Select querry</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-select-querry/m-p/3219292#M767721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi chandra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do one thing make 3 internal table&lt;/P&gt;&lt;P&gt;write one select query using join for 2 tables&lt;/P&gt;&lt;P&gt;and other for one more for the 3 table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;copy aall in one internal table&lt;/P&gt;&lt;P&gt;write the output table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;swaroop&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jan 2008 09:03:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-select-querry/m-p/3219292#M767721</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-15T09:03:06Z</dc:date>
    </item>
  </channel>
</rss>

