<?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: help to remove select statement from loop in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518289#M1424705</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;but i want to remove select statements and keep outside loop , so give example for how to proceed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Jan 2010 12:37:40 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-01-21T12:37:40Z</dc:date>
    <item>
      <title>help to remove select statement from loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518287#M1424703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;please help me in removing select statements within loop statement from the below program,&lt;/P&gt;&lt;P&gt;please give me the code changes to be done&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM 200_select_data_cont.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT itab_cargo.&lt;/P&gt;&lt;P&gt;    CLEAR: ekko, ekpo, eket, ekes.&lt;/P&gt;&lt;P&gt;    CLEAR gr_quantity.&lt;/P&gt;&lt;P&gt;    SELECT  h&lt;SUB&gt;bsart h&lt;/SUB&gt;verkf i&lt;SUB&gt;netpr i&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;      INTO (ekko-bsart, ekko-verkf, ekpo-netpr, ekpo-matnr)&lt;/P&gt;&lt;P&gt;         FROM   ekko AS h&lt;/P&gt;&lt;P&gt;           INNER JOIN ekpo AS i&lt;/P&gt;&lt;P&gt;            ON h&lt;SUB&gt;ebeln = i&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;         WHERE h~ebeln = itab_cargo-vgbel&lt;/P&gt;&lt;P&gt;           AND i~ebelp = itab_cargo-vgpos&lt;/P&gt;&lt;P&gt;           AND h~bsart IN s_bsart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      itab_cargo-bsart = ekko-bsart.&lt;/P&gt;&lt;P&gt;      itab_cargo-netpr = ekpo-netpr.                        " * 100.&lt;/P&gt;&lt;P&gt;      itab_cargo-matnr = ekpo-matnr.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     itab_cargo-dept = ekko-verkf+9(3).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    ENDSELECT.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      SELECT MIN( eindt ) INTO eket-eindt&lt;/P&gt;&lt;P&gt;        FROM  eket&lt;/P&gt;&lt;P&gt;           WHERE  ebeln = itab_cargo-vgbel&lt;/P&gt;&lt;P&gt;             AND  ebelp = itab_cargo-vgpos.&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        itab_cargo-eindt = eket-eindt.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Change by request of M.Soyama to get GR quantity (not PO quantity)&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     select bpmng into ekbe-bpmng&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        from ekbe&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;             where  ebeln = itab_cargo-vgbel&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                and  ebelp = itab_cargo-vgpos.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       gr_quantity = gr_quantity + ekbe-bpmng.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     endselect.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      SELECT dabmg INTO ekes-dabmg&lt;/P&gt;&lt;P&gt;          FROM ekes&lt;/P&gt;&lt;P&gt;              WHERE  ebeln = itab_cargo-vgbel&lt;/P&gt;&lt;P&gt;                 AND  ebelp = itab_cargo-vgpos&lt;/P&gt;&lt;P&gt;                 AND  xblnr = itab_cargo-charg.&lt;/P&gt;&lt;P&gt;        gr_quantity = gr_quantity + ekes-dabmg.&lt;/P&gt;&lt;P&gt;      ENDSELECT.&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        itab_cargo-dabmg = gr_quantity.&lt;/P&gt;&lt;P&gt;        itab_cargo-tot_price = gr_quantity * itab_cargo-netpr.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      CLEAR mvke.&lt;/P&gt;&lt;P&gt;      SELECT SINGLE mvgr2 FROM mvke&lt;/P&gt;&lt;P&gt;         INTO mvke-mvgr2&lt;/P&gt;&lt;P&gt;        WHERE matnr = itab_cargo-matnr&lt;/P&gt;&lt;P&gt;          AND vkorg = 'CRJP'&lt;/P&gt;&lt;P&gt;          AND vtweg = '00'.&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        itab_cargo-dept = mvke-mvgr2.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      MODIFY itab_cargo.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;      DELETE itab_cargo.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DESCRIBE TABLE itab_cargo LINES lin_cnt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " 200_SELECT_DATA_CONT&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 12:29:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518287#M1424703</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T12:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: help to remove select statement from loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518288#M1424704</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;you can use for all entries instead of joins within the loop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 12:32:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518288#M1424704</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T12:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: help to remove select statement from loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518289#M1424705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;but i want to remove select statements and keep outside loop , so give example for how to proceed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 12:37:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518289#M1424705</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T12:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: help to remove select statement from loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518290#M1424706</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;1.First select statement using for all entries &lt;/P&gt;&lt;P&gt;2.Loop it&lt;/P&gt;&lt;P&gt;3.with in loop use Read statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from ekko &amp;lt;condition&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;seletc * from ekpo for all entries in it_ekko into table lt_ekpo where &amp;lt;condition&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;seletc * from ekbe for all entries in it_ekko into table lt_ekbe where &amp;lt;condition&amp;gt;&lt;/P&gt;&lt;P&gt;SELECT mvgr2 FROM mvke INTO  table lt_mvke WHERE matnr = itab_cargo-matnr AND vkorg = 'CRJP' AND vtweg = '00'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at lt_ekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table lt_ekko with key ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table lt_ekbe into le_ekbr with key &amp;lt;condition&lt;/P&gt;&lt;P&gt;read table lt_mvke into wa_mvke index 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: dharma raj on Jan 21, 2010 6:12 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 12:39:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518290#M1424706</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T12:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: help to remove select statement from loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518291#M1424707</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 suppose you want to fetch the data from table1 for every entry in internal table itab_cargo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is how you proceed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is no need to use Loop endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT PGMID OBJECT OBJ_NAME FROM TADIR
                    INTO TABLE IT_TADIR
                    FOR ALL ENTRIES IN it_objname
                    WHERE OBJ_NAME = it_objname-obj_name AND
                    OBJECT IN ('REPS','PROG').&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 12:40:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518291#M1424707</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T12:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: help to remove select statement from loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518292#M1424708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Veeru,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Is it so mandate for you to keep select inside loop. Hope you worry about performance.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fetch the data first from the primary table and use for all entries for all others as per requirement.&lt;/P&gt;&lt;P&gt;Next loop the main internal table and read all the values from different tables using keys&lt;/P&gt;&lt;P&gt;You can also use binary search and sorting in your code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt; Manas M.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 12:43:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518292#M1424708</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T12:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: help to remove select statement from loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518293#M1424709</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;Do the below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select data from EKKO for all entries in itab_cargo into table it_ekko &amp;lt;add where conditions&amp;gt;.&lt;/P&gt;&lt;P&gt;Select data from EKPO for all entries in it_ekko into table it_ekpo &amp;lt;add where conditions&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hence you can avoid loop &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 12:45:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518293#M1424709</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T12:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: help to remove select statement from loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518294#M1424710</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;Use for all entries to populate data. define one more internal table in which you can store data(ekko-bsart, ekko-verkf, ekpo-netpr, ekpo-matnr). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT h~ebeln h~bsart h~verkf i~netpr i~matnr
INTO itab_new
FROM ekko AS h
INNER JOIN ekpo AS i
ON h~ebeln = i~ebeln
for all entries in itab_cargo
WHERE h~ebeln = itab_cargo-vgbel
AND i~ebelp = itab_cargo-vgpos
AND h~bsart IN s_bsart.

Loop at itab_cargo into wa_cargo.
Read table itab_new into wa_new where ebeln = itab_cargo-vgbel.   

wa_cargo-bsart = wa_new-bsart.
wa_cargo-netpr = wa_new-netpr. " * 100.
wa_cargo-matnr = wa_new-matnr.
wa_cargo-dept = wa_new-verkf+9(3).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then modify table using 'Modify' transporting bsart netpr matnr dept.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Archana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 12:46:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518294#M1424710</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T12:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: help to remove select statement from loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518295#M1424711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;please give example for this and for using  binary search and sorting&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 12:47:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518295#M1424711</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T12:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: help to remove select statement from loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518296#M1424712</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;Sample code for FOR ALL ENTRIES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* Selecting data from EKKO on the basis of BUKRS,BSTYP,BSART and LIFNR
  SELECT EBELN BUKRS BSTYP BSART LIFNR RESWK EKGRP KUNNR
     FROM EKKO
     INTO TABLE IT_EKKO
     WHERE BUKRS IN S_BUKRS
     AND BSTYP IN S_BSTYP
     AND BSART IN S_BSART
     AND LIFNR IN S_LIFNR
     AND RESWK EQ P_WERKS.

  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    V_CHECK = 'X'.
    MESSAGE I009.
    STOP.
  ENDIF.
*---------For selecting company code &amp;amp; name
  IT_EKKO_TEMP[] = IT_EKKO[].                              "Populating temporary table
  SORT IT_EKKO_TEMP BY BUKRS.                                   "Sorting the table by BUKRS
  DELETE ADJACENT DUPLICATES FROM IT_EKKO_TEMP COMPARING BUKRS. "deleting adjacent BUKRS duplicates

  IF IT_EKKO_TEMP[] IS NOT INITIAL.
    SELECT BUKRS BUTXT                    "populating compnay code &amp;amp; name in IT_T001
      FROM T001
      INTO TABLE IT_T001
      FOR ALL ENTRIES IN IT_EKKO_TEMP
      WHERE BUKRS = IT_EKKO_TEMP-BUKRS.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 12:48:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518296#M1424712</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T12:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: help to remove select statement from loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518297#M1424713</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;sort intenal table on that field which you are going to use in binary search &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR Example:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SORT IT_T001 BY BUKRS.

  LOOP AT IT_EKKO INTO WA_EKKO.

 READ TABLE IT_T001 INTO WA_T001 WITH KEY BUKRS = WA_EKKO-BUKRS
                                                     BINARY SEARCH.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards &lt;/P&gt;&lt;P&gt;Gaurav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 12:53:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518297#M1424713</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T12:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: help to remove select statement from loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518298#M1424714</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;For reading table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. sort the table first&lt;/P&gt;&lt;P&gt;2. read table with key&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT ITAB1 INTO WA1.
SORT ITAB BY FIELD. "Fieldname
READ TABLE ITAB INTO WA WITH KEY FIELD = WA1-FIELD1 BINARY SEARCH.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Radhika Parag Rajopadhye on Jan 21, 2010 1:53 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 12:53:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518298#M1424714</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T12:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: help to remove select statement from loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518299#M1424715</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;You can use FOR ALL ENTRIES clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the first select statement, declare a seperate internal table it_temp that will hold your values.&lt;/P&gt;&lt;P&gt;Bring it outside the LOOP....ENDLOOP and use FOR ALL ENTRIES addition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to modify your internal table itab_cargo contents from it_temp, then Loop at itab_cargo table, read the record of the other table and modify the content.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for the second select statement, select ebeln along with MIN(EINDT) and use FOR ALL ENTRIES addition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess, the same applies for the others too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bottom Line: F1 on FOR ALL ENTRIES. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. Probably, I should have posted just the last statement &lt;span class="lia-unicode-emoji" title=":neutral_face:"&gt;😐&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 12:58:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518299#M1424715</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T12:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: help to remove select statement from loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518300#M1424716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is a sample code:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT werks lgort iblnr gjahr zldat sobkz bldat gidat budat
  FROM ikpf
  INTO CORRESPONDING FIELDS OF TABLE it_ikpf
  WHERE werks IN s_werks AND
        lgort IN s_lgort AND
        iblnr IN s_iblnr AND
        gjahr IN s_gjahr AND
        zldat IN s_zldat .

  DESCRIBE TABLE it_ikpf LINES res.
  IF res = 0.
    WRITE:/ 'No records matching the selection criteria'.
    EXIT.
  ENDIF.

  IF NOT it_ikpf[] IS INITIAL.
    SELECT iblnr zeili matnr abcin bstar buchm menge meins dmbtr
    waers mblnr mjahr wrtzl wrtbm
    FROM iseg
    INTO CORRESPONDING FIELDS OF TABLE it_iseg
    FOR ALL ENTRIES IN it_ikpf
    WHERE iblnr = it_ikpf-iblnr
    AND   matnr IN s_matnr
    AND   abcin IN s_abcin.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT matnr matkl
  FROM mara
  INTO CORRESPONDING FIELDS OF TABLE it_mara
  FOR ALL ENTRIES IN it_iseg
  WHERE matnr = it_iseg-matnr.
SELECT matnr maktx
  FROM makt
  INTO CORRESPONDING FIELDS OF TABLE it_makt
  FOR ALL ENTRIES IN it_iseg
  WHERE matnr = it_iseg-matnr.

  SELECT werks abcin aninv ininv
  FROM t159c
  INTO CORRESPONDING FIELDS OF TABLE it_t159c
  FOR ALL ENTRIES IN it_iseg
  WHERE abcin = it_iseg-abcin
  AND   werks IN s_werks.

  SELECT matnr bwkey stprs
  FROM mbew
  INTO CORRESPONDING FIELDS OF TABLE it_mbew
  FOR ALL ENTRIES IN it_iseg
  WHERE matnr = it_iseg-matnr.

  SORT it_iseg BY matnr ASCENDING.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; LOOP AT it_iseg INTO wa_iseg.
    MOVE-CORRESPONDING wa_iseg TO wa_output.

    READ TABLE it_ikpf INTO wa_ikpf
                       WITH KEY iblnr = wa_iseg-iblnr
                       BINARY SEARCH.
    IF sy-subrc = 0.
      MOVE:   wa_ikpf-werks  TO  wa_output-werks,
              wa_ikpf-lgort  TO  wa_output-lgort,
              wa_ikpf-iblnr  TO  wa_output-iblnr,
              wa_ikpf-gjahr  TO  wa_output-gjahr,
              wa_ikpf-zldat  TO  wa_output-zldat,
              wa_ikpf-sobkz  TO  wa_output-sobkz,
              wa_ikpf-bldat  TO  wa_output-bldat,
              wa_ikpf-gidat  TO  wa_output-gidat,
              wa_ikpf-budat  TO  wa_output-budat.
    ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;READ TABLE it_makt INTO wa_makt
                       WITH KEY matnr = wa_iseg-matnr.

    IF sy-subrc = 0.
      MOVE: wa_makt-maktx TO wa_output-maktx.
    ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and sooonnnnnnnnnnnnnnnnnnnnnnnnnnn.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Manas M.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 13:01:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-to-remove-select-statement-from-loop/m-p/6518300#M1424716</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T13:01:59Z</dc:date>
    </item>
  </channel>
</rss>

