<?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 select statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3721557#M895949</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;when you are using 2 internal table in program, you have decided to use for all entries statement to retrieve data but unfortunately there are no records in the first internal table. What will be the result? (2nd internal table contains records).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;give one example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Apr 2008 18:00:43 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-04-29T18:00:43Z</dc:date>
    <item>
      <title>select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3721557#M895949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;when you are using 2 internal table in program, you have decided to use for all entries statement to retrieve data but unfortunately there are no records in the first internal table. What will be the result? (2nd internal table contains records).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;give one example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2008 18:00:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3721557#M895949</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-29T18:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3721558#M895950</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;ALL records from the second table will be recovered. To avoid this, you need to check if the table used in the FOR ALL ENTRIES is filled with some data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  IF itab1 IS NOT INITIAL.
   SELECT * FROM sflight INTO TABLE itab2 FOR ALL ENTRIES IN itab1 WHERE carrid = itab1-carrid.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2008 18:02:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3721558#M895950</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-29T18:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3721559#M895951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi u need to make this check .. when ever u use for all entries..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  if not i_mseg[] is initial.

    select pspnr fkokr fkstl posid stort
           from prps
           into table i_prps
           for all entries in i_mseg
           where pspnr eq i_mseg-ps_psp_pnr.

endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2008 18:05:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3721559#M895951</guid>
      <dc:creator>former_member156446</dc:creator>
      <dc:date>2008-04-29T18:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3721560#M895952</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;It's the same when you use a select options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you have a select options with no data and use this in a select statement, all possibilities in this select options are selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex:select options so_bukrs is initial&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and you have this select:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so_bukrs for t001-bukrs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from t001&lt;/P&gt;&lt;P&gt;   into table t_t001&lt;/P&gt;&lt;P&gt;   where bukrs in so_burks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_t001 will have all records of table t001&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same happens with for all entries:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you have two internal tables: itab1(initial) and itab2&lt;/P&gt;&lt;P&gt;and you need to select from table bsad using for all entries in itab1 into table itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you will select all data in the bsad table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is very important check the internal table (itab1) before use any for all entries with this table.&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;Fernando&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2008 18:20:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3721560#M895952</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-29T18:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3721561#M895953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi the for all entries is the best way to add the two tables..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;suppose you want to relate the two table they must had at lease one field common ...ckeck this example ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZZZZ000000.&lt;/P&gt;&lt;P&gt;tables:mara,marc,mard,makt.&lt;/P&gt;&lt;P&gt;data:begin of it_mara occurs 0,&lt;/P&gt;&lt;P&gt;     matnr like mara-matnr,&lt;/P&gt;&lt;P&gt;     mtart like mara-mtart,&lt;/P&gt;&lt;P&gt;     meins like mara-meins,&lt;/P&gt;&lt;P&gt;     end of it_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:begin of it_marc occurs 0,&lt;/P&gt;&lt;P&gt;     matnr like marc-matnr,&lt;/P&gt;&lt;P&gt;     pstat like marc-pstat,&lt;/P&gt;&lt;P&gt;     werks like marc-werks,&lt;/P&gt;&lt;P&gt;     end of it_marc.&lt;/P&gt;&lt;P&gt;data:begin of it_mard occurs 0,&lt;/P&gt;&lt;P&gt;     werks like mard-werks,&lt;/P&gt;&lt;P&gt;     lgort like mard-lgort,&lt;/P&gt;&lt;P&gt;     labst like mard-labst,&lt;/P&gt;&lt;P&gt;     end of it_mard.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:begin of it_final occurs 0,&lt;/P&gt;&lt;P&gt;     matnr like mara-matnr,&lt;/P&gt;&lt;P&gt;     mtart like mara-mtart,&lt;/P&gt;&lt;P&gt;     meins like mara-meins,&lt;/P&gt;&lt;P&gt;     pstat like marc-pstat,&lt;/P&gt;&lt;P&gt;     werks like marc-werks,&lt;/P&gt;&lt;P&gt;     lgort like mard-lgort,&lt;/P&gt;&lt;P&gt;     labst like mard-labst,&lt;/P&gt;&lt;P&gt;     maktx like makt-maktx,&lt;/P&gt;&lt;P&gt;     end of it_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select-options:s_matnr for mara-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select  matnr&lt;/P&gt;&lt;P&gt;        mtart&lt;/P&gt;&lt;P&gt;        meins&lt;/P&gt;&lt;P&gt;        from mara&lt;/P&gt;&lt;P&gt;        into table it_mara&lt;/P&gt;&lt;P&gt;        where matnr in s_matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        if not it_mara[] is initial.&lt;/P&gt;&lt;P&gt;        select matnr&lt;/P&gt;&lt;P&gt;               pstat&lt;/P&gt;&lt;P&gt;               werks&lt;/P&gt;&lt;P&gt;               from marc&lt;/P&gt;&lt;P&gt;               into table it_marc&lt;/P&gt;&lt;P&gt;               for all entries in it_mara&lt;/P&gt;&lt;P&gt;               where matnr = it_mara-matnr.&lt;/P&gt;&lt;P&gt;               if not it_marc[] is initial.&lt;/P&gt;&lt;P&gt;               select werks&lt;/P&gt;&lt;P&gt;                      lgort&lt;/P&gt;&lt;P&gt;                      labst&lt;/P&gt;&lt;P&gt;                      from mard&lt;/P&gt;&lt;P&gt;                      into table it_mard&lt;/P&gt;&lt;P&gt;                      for all entries in it_marc&lt;/P&gt;&lt;P&gt;                      where werks = it_marc-werks.&lt;/P&gt;&lt;P&gt;               endif.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;loop at it_mara.&lt;/P&gt;&lt;P&gt;it_final-matnr = it_mara-matnr.&lt;/P&gt;&lt;P&gt;it_final-mtart = it_mara-mtart.&lt;/P&gt;&lt;P&gt;it_final-meins = it_mara-meins.&lt;/P&gt;&lt;P&gt;read table it_marc with key matnr = it_mara-matnr.&lt;/P&gt;&lt;P&gt;it_final-werks = it_marc-werks.&lt;/P&gt;&lt;P&gt;it_final-pstat = it_marc-pstat.&lt;/P&gt;&lt;P&gt;read table it_mard with key werks = it_marc-werks.&lt;/P&gt;&lt;P&gt;it_final-lgort = it_mard-lgort.&lt;/P&gt;&lt;P&gt;it_final-labst = it_mard-labst.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;select maktx from makt into it_final-maktx where matnr = it_final-matnr.&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;append it_final.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_final.&lt;/P&gt;&lt;P&gt;write:/ it_final-matnr under 'material',&lt;/P&gt;&lt;P&gt;        it_final-mtart under 'material type',&lt;/P&gt;&lt;P&gt;        it_final-meins under 'unit of measure',&lt;/P&gt;&lt;P&gt;        it_final-werks under 'plant' ,&lt;/P&gt;&lt;P&gt;        it_final-pstat under 'status',&lt;/P&gt;&lt;P&gt;        it_final-lgort under 'storage loc',&lt;/P&gt;&lt;P&gt;        it_final-labst under 'stock',&lt;/P&gt;&lt;P&gt;        it_final-maktx.&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;venkat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2008 18:32:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3721561#M895953</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-29T18:32:29Z</dc:date>
    </item>
  </channel>
</rss>

