<?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: internal tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/4618815#M1088177</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to bring to your notice...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(1)when we do a select with respect to for all entries on a table we need to check if that table is empty or not&lt;/P&gt;&lt;P&gt; eg:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if it_sales[]  is not initial.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT inco1 inco2&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE &lt;STRONG&gt;it_sales&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;FROM vbkd&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN &lt;STRONG&gt;it_sales&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;WHERE vbeln EQ it_sales-vbeln&lt;/P&gt;&lt;P&gt;AND posnr EQ it_sales-posnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select XX from XX into XX FOR ALL ENTRIES IN it_sales&lt;/P&gt;&lt;P&gt;where XX and XX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endif.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if it is not checked,what happens is that , if the table it_sales[] is empty, it will fetch all the records..so this checking should be done for all the 'select' statements with respect to the table on which 'for all entries' fetch is done&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(2) For all your select statements the destination is it_sales.........&lt;/P&gt;&lt;P&gt;    check in the debugger what is happening in the it_sales table after each select statement&lt;/P&gt;&lt;P&gt;   (to activate debugger use '/h' or write 'Break-point' in your code at required location) ,i believe the records are overwritten after each select...there are numerous approach to obtain the desired output like..&lt;/P&gt;&lt;P&gt;(a)we can fetch all data into differernt internal tables and get them together in a loop based on key fields/relations or(b) we can keep modifying existing table with the required data based on key fields etc...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps,&lt;/P&gt;&lt;P&gt;Pls check &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Byju&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Oct 2008 04:52:20 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-10-12T04:52:20Z</dc:date>
    <item>
      <title>internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/4618814#M1088176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sap gurus,&lt;/P&gt;&lt;P&gt;im making a code for getting sales order shipping data, i have several requirements..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my 1st requirement is to retrieve details of the selection-screen..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is what i did..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;retrieve details of the selection screen for sales order&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  SELECT  a~vbeln&lt;/P&gt;&lt;P&gt;          a~kunnr&lt;/P&gt;&lt;P&gt;   	   a~ernam&lt;/P&gt;&lt;P&gt;          a~auart&lt;/P&gt;&lt;P&gt;  	   b~posnr&lt;/P&gt;&lt;P&gt;  	   b~vstel&lt;/P&gt;&lt;P&gt;  	   b~route&lt;/P&gt;&lt;P&gt;          c~maktx&lt;/P&gt;&lt;P&gt;  INTO CORRESPONDING FIELDS OF TABLE it_sales&lt;/P&gt;&lt;P&gt; FROM ( ( vbak AS a&lt;/P&gt;&lt;P&gt;         INNER JOIN vbap AS b ON a&lt;SUB&gt;vbeln   = b&lt;/SUB&gt;vbeln )&lt;/P&gt;&lt;P&gt;         INNER JOIN makt AS c ON b&lt;SUB&gt;matnr = c&lt;/SUB&gt;matnr )&lt;/P&gt;&lt;P&gt;  WHERE a~vbeln = p_vbeln&lt;/P&gt;&lt;P&gt;  AND&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  a&lt;SUB&gt;auart = 'CPF1' OR a&lt;/SUB&gt;auart = 'CPF2'.&lt;/P&gt;&lt;P&gt;  IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;    WRITE: 'wala'.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2nd requirement, get the shipping details from several tables..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;select shipping details from vbkd&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  SELECT inco1&lt;/P&gt;&lt;P&gt;         inco2&lt;/P&gt;&lt;P&gt;  INTO CORRESPONDING FIELDS OF TABLE it_sales&lt;/P&gt;&lt;P&gt;  FROM vbkd&lt;/P&gt;&lt;P&gt;  FOR ALL ENTRIES IN it_sales&lt;/P&gt;&lt;P&gt;  WHERE vbeln EQ it_sales-vbeln&lt;/P&gt;&lt;P&gt;  AND posnr EQ it_sales-posnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;get description of shipping point&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  SELECT vtext&lt;/P&gt;&lt;P&gt;  INTO CORRESPONDING FIELDS OF TABLE it_sales&lt;/P&gt;&lt;P&gt;  FROM tvstt&lt;/P&gt;&lt;P&gt;  FOR ALL ENTRIES IN it_sales&lt;/P&gt;&lt;P&gt;  WHERE spras = 'en'&lt;/P&gt;&lt;P&gt;  AND vstel = it_sales-vstel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;get description of incoterms&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  SELECT bezei&lt;/P&gt;&lt;P&gt;  INTO CORRESPONDING FIELDS OF TABLE it_sales&lt;/P&gt;&lt;P&gt;  FROM tinct&lt;/P&gt;&lt;P&gt;  FOR ALL ENTRIES IN it_sales&lt;/P&gt;&lt;P&gt; WHERE inco1 = it_sales-inco1.&lt;/P&gt;&lt;P&gt;AND&lt;/P&gt;&lt;P&gt;      inco1 = it_sales-inco2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT bezei&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE it_sales&lt;/P&gt;&lt;P&gt;FROM tinct.&lt;/P&gt;&lt;P&gt; WHERE inco1 = it_sales-inco2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;get description route&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  SELECT bezei&lt;/P&gt;&lt;P&gt;  INTO CORRESPONDING FIELDS OF TABLE it_sales&lt;/P&gt;&lt;P&gt;  FROM tvrot&lt;/P&gt;&lt;P&gt;  FOR ALL ENTRIES IN it_sales&lt;/P&gt;&lt;P&gt;  WHERE route = it_sales-route.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3rd requirement, i have to get the customer details and update it_sales based on the customer to include the address.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is this correct?&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get customer details&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  SELECT kunnr&lt;/P&gt;&lt;P&gt;         name1&lt;/P&gt;&lt;P&gt;         name2&lt;/P&gt;&lt;P&gt;         ort01&lt;/P&gt;&lt;P&gt;         pstlz&lt;/P&gt;&lt;P&gt;         regio&lt;/P&gt;&lt;P&gt;         pfach&lt;/P&gt;&lt;P&gt;         INTO CORRESPONDING FIELDS OF TABLE it_sales&lt;/P&gt;&lt;P&gt;        FROM kna1&lt;/P&gt;&lt;P&gt;        FOR ALL ENTRIES IN it_sales&lt;/P&gt;&lt;P&gt;        WHERE kunnr EQ it_sales-kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4th requirement is after i have extracted all the data from the tables i have to store it in it_detail..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how will i do that..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im just a beginner and i need help if the code i wrote is correct..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Oct 2008 04:10:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/4618814#M1088176</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-12T04:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/4618815#M1088177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to bring to your notice...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(1)when we do a select with respect to for all entries on a table we need to check if that table is empty or not&lt;/P&gt;&lt;P&gt; eg:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if it_sales[]  is not initial.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT inco1 inco2&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE &lt;STRONG&gt;it_sales&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;FROM vbkd&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN &lt;STRONG&gt;it_sales&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;WHERE vbeln EQ it_sales-vbeln&lt;/P&gt;&lt;P&gt;AND posnr EQ it_sales-posnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select XX from XX into XX FOR ALL ENTRIES IN it_sales&lt;/P&gt;&lt;P&gt;where XX and XX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endif.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if it is not checked,what happens is that , if the table it_sales[] is empty, it will fetch all the records..so this checking should be done for all the 'select' statements with respect to the table on which 'for all entries' fetch is done&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(2) For all your select statements the destination is it_sales.........&lt;/P&gt;&lt;P&gt;    check in the debugger what is happening in the it_sales table after each select statement&lt;/P&gt;&lt;P&gt;   (to activate debugger use '/h' or write 'Break-point' in your code at required location) ,i believe the records are overwritten after each select...there are numerous approach to obtain the desired output like..&lt;/P&gt;&lt;P&gt;(a)we can fetch all data into differernt internal tables and get them together in a loop based on key fields/relations or(b) we can keep modifying existing table with the required data based on key fields etc...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps,&lt;/P&gt;&lt;P&gt;Pls check &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Byju&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Oct 2008 04:52:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/4618815#M1088177</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-12T04:52:20Z</dc:date>
    </item>
  </channel>
</rss>

