<?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: Regarding source code evaluation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097194#M1615972</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 could replace your code like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF NOT i_poinfo IS  INITIAL.
    SELECT name1
           stras
           INTO TABLE i_t001w
           FROM t001w
           FOR ALL ENTRIES IN i_poinfo 
           WHERE werks = i_poinfo-werks.
    IF NOT i_t001w IS NOT INITIAL.
    SELECT
           str_suppl2
           tel_number
           fax_number
           INTO TABLE i_adrc
           FROM t001w 
           FOR ALL ENTRIES IN i_t001w 
           WHERE adrnr = i_t001w-addrnumber.
    ENDIF.
    ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Dep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Aug 2011 12:06:23 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-08-08T12:06:23Z</dc:date>
    <item>
      <title>Regarding source code evaluation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097193#M1615971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please suggest me whether below statements has any logical or performance problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Get address information of PO items and save it to internal table "address information".&lt;/P&gt;&lt;P&gt;Is the below logic is correct to fetch the address information?&lt;/P&gt;&lt;P&gt;Join with T001W buffered table is not good way to write code? pls confirm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT 
T001W~NAME1								
T001W~STRAS								
ADRC~STR_SUPPL2							
ADRC~TEL_NUMBER								
ADRC~FAX_NUMBER						
FROM T001W
JOIN ADRC
ON T001W~ADRNR = ADRC~ADDRNUMBER
FOR ALL ENTRIES IN Internal table "PO information"
INTO Internal table "address information"
WHERE T001W~WERKS = "PO information"-WERKS&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;2)Using Sort command before Read table binary search.&lt;/P&gt;&lt;P&gt;Gives error that "SORT does not exist before ( READ TABLE U_TG_ADDRESS ) or was not found."&lt;/P&gt;&lt;P&gt;is this incorrect logic error? should i have to use SORT command just before line of Read ....Binary search statement.?&lt;/P&gt;&lt;P&gt;or can i use anywhere before and go with below statement. pls confirm&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;i sorted below internal tables in Previous Subroutine Perform.
  SORT C_TG_ADDRESS   BY WERKS      ASCENDING.
  SORT C_TG_DRAW_NO   BY MATNR      ASCENDING.
  SORT C_TG_PO_MASTER BY EBELN      ASCENDING

In next subroutine Perform i used like this
  LOOP AT U_TG_PO_MASTER INTO WL_PO_MASTER.

*   Read PO address information
    READ TABLE U_TG_ADDRESS INTO WL_ADDRESS
    WITH KEY WERKS = WL_PO_MASTER-WERKS
    BINARY SEARCH.

*   Read Drawing No.
    READ TABLE U_TG_DRAW_NO INTO WL_DRAW_NO
    WITH KEY MATNR = WL_PO_MASTER-MATNR
    BINARY SEARCH.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kumar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: princeck on Aug 8, 2011 1:39 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: princeck on Aug 8, 2011 1:48 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Aug 2011 10:39:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097193#M1615971</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-08T10:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding source code evaluation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097194#M1615972</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 could replace your code like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF NOT i_poinfo IS  INITIAL.
    SELECT name1
           stras
           INTO TABLE i_t001w
           FROM t001w
           FOR ALL ENTRIES IN i_poinfo 
           WHERE werks = i_poinfo-werks.
    IF NOT i_t001w IS NOT INITIAL.
    SELECT
           str_suppl2
           tel_number
           fax_number
           INTO TABLE i_adrc
           FROM t001w 
           FOR ALL ENTRIES IN i_t001w 
           WHERE adrnr = i_t001w-addrnumber.
    ENDIF.
    ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Dep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Aug 2011 12:06:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097194#M1615972</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-08T12:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding source code evaluation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097195#M1615973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello deepak&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;Any idea about Sort statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate your response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Aug 2011 12:10:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097195#M1615973</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-08T12:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding source code evaluation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097196#M1615974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For my previous post:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF NOT i_poinfo IS  INITIAL.
    SELECT name1
           stras
           INTO TABLE i_t001w
           FROM t001w
           FOR ALL ENTRIES IN i_poinfo 
           WHERE werks = i_poinfo-werks.
    IF NOT i_t001w IS NOT INITIAL.
    SELECT str_suppl2
           tel_number
           fax_number
           INTO TABLE i_adrc
           FROM adrc
           FOR ALL ENTRIES IN i_t001w 
           WHERE adrnr = i_t001w-addrnumber.
    ENDIF.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding SORT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SORT U_TG_ADDRESS by werks ascending.
  SORT U_TG_DRAW_NO by matnr ascending.

  LOOP AT U_TG_PO_MASTER INTO WL_PO_MASTER.
 
*   Read PO address information
    READ TABLE U_TG_ADDRESS INTO WL_ADDRESS
    WITH KEY WERKS = WL_PO_MASTER-WERKS
    BINARY SEARCH.
 
*   Read Drawing No.
    READ TABLE U_TG_DRAW_NO INTO WL_DRAW_NO
    WITH KEY MATNR = WL_PO_MASTER-MATNR
    BINARY SEARCH.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or Just remove keyword BINARY SEARCH if the internal table you are reading is huge because this keyword BINARY SEARCH causes issues in Production with sy-subrc values 6 or 8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Dep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Aug 2011 12:19:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097196#M1615974</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-08T12:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding source code evaluation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097197#M1615975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kumar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if you require any more info.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Dep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Aug 2011 12:21:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097197#M1615975</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-08T12:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding source code evaluation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097198#M1615976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi  deepak&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you mean to say my above usage of sort statement is wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you explain why Binary search will give sy-subrc 6 or 8.&lt;/P&gt;&lt;P&gt;I thaught Read statement have binary search will increase performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Chandra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Aug 2011 13:28:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097198#M1615976</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-08T13:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding source code evaluation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097199#M1615977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or Just remove keyword BINARY SEARCH if the internal table you are reading is huge because this keyword BINARY SEARCH causes issues in Production with sy-subrc values 6 or 8.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;How does this make sense?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Aug 2011 14:05:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097199#M1615977</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-08T14:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding source code evaluation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097200#M1615978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; How does this make sense?&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Rob&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It really does not !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Can you explain why Binary search will give sy-subrc 6 or 8.&lt;/P&gt;&lt;P&gt;&amp;gt; I thaught Read statement have binary search will increase performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, BINARY SEARCH option dramatically increases performance. But in order to work correctly, your internal table must be sorted first. If this is not the case, the READ statement can't find the correct record and you'll get SY-SUBRC = 8.&lt;/P&gt;&lt;P&gt;You can also try to use HASHED TABLES which are very fast to read but require an unique key defined on them.&lt;/P&gt;&lt;P&gt;See F1 help on READ statement for more details.&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;&lt;/P&gt;&lt;P&gt;Nicolas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Nicolas Saulnier on Aug 8, 2011 5:00 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Aug 2011 15:00:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097200#M1615978</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-08T15:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding source code evaluation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097201#M1615979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I faced this issue for one of my developments where I used:&lt;/P&gt;&lt;P&gt;Sort Itab by f1 f2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then within the loop I used&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read table itab into wa with key a1 = loop-a1 BINARY SEARCH.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;*do something.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the above was creating problem as sy-subrc was set to 6 0r 8. So, I refered to my collegues and searched fourms where they suggested to remove the keyword BINARY SEARCH for some anonymous reason( I would really like to know why ). But did not remove SORT statement before entering loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I made changes accordingly and it worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;type declaation which I used for internal table was TYPE STANDARD TABLE of.. well I hear people of suggesting to use TYPE SORTED or HASHED.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But with very short period to complete the report such suggestions go unnoticed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Probably when using TYPE STANDARD TABLE OF and using BINARY SEARCH there should be a :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ITAB BY F1 F2.&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICATES FROM ITAB COMPARING F1 F2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ITAB BY F1 F2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at itab2 into wa2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table itab into wa with key a1 = wa2-a1  BINARY SEARCH.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;*do something.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would &lt;STRONG&gt;not&lt;/STRONG&gt; result sy-subrc value to 6 or 8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Dep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Aug 2011 11:52:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097201#M1615979</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-09T11:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding source code evaluation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097202#M1615980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, I think a READ statement can only return sy-subrc of 0, 4 or 8, but not 6.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For standard tables, removing the binary search option from a read statement will certainly work, but it will force a linear search, so depending on the number of entries, it may be prohobitavely expensive. It's better to get the binary search option working. Remember to use all aof the sort fileds in the keys. Better still to used sorted or hashed tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Aug 2011 13:33:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097202#M1615980</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-09T13:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding source code evaluation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097203#M1615981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank You Rob.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Dep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Aug 2011 08:14:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-source-code-evaluation/m-p/8097203#M1615981</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-10T08:14:34Z</dc:date>
    </item>
  </channel>
</rss>

