<?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: 'loop where' on dynamic hashed table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330570#M1538166</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;performance is critical: hence solutions with if-statements in the loop are not acceptable&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Sep 2010 16:16:48 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-09-21T16:16:48Z</dc:date>
    <item>
      <title>'loop where' on dynamic hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330568#M1538164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi everybody,&lt;/P&gt;&lt;P&gt;im having a problem reading selectively out of a dynamic hashed table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i_th_ref_data is a hashed table delivered by a SAP UExit filled with data. i wish to loop over it (several entries required) selectively (i.e. WHERE) for performance reasons.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i've treid:&lt;/P&gt;&lt;P&gt;  ...&lt;/P&gt;&lt;P&gt;  assign component '0COMPANY' of&lt;/P&gt;&lt;P&gt;              structure &amp;lt;f_ref_data&amp;gt;&lt;/P&gt;&lt;P&gt;              to &amp;lt;f_company&amp;gt;.&lt;/P&gt;&lt;P&gt;  ...&lt;/P&gt;&lt;P&gt;  loop at i_th_ref_data assigning &amp;lt;f_ref_data&amp;gt;&lt;/P&gt;&lt;P&gt;    where &amp;lt;f_company&amp;gt; = '4711'.&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;but get the error "the row type of the table must be statically defined"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;does anybody have an idea how to do a dynamic loop on a hashed table like this? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;performance is critical: hence solutions with if-statements in the loop are not acceptable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Sep 2010 15:30:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330568#M1538164</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-21T15:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: 'loop where' on dynamic hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330569#M1538165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at i_th_ref_data assigning &amp;lt;f_ref_data&amp;gt;.
if &amp;lt;f_company&amp;gt; = '4711'.
...
endif.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will work&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Sep 2010 15:57:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330569#M1538165</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-09-21T15:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: 'loop where' on dynamic hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330570#M1538166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;performance is critical: hence solutions with if-statements in the loop are not acceptable&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Sep 2010 16:16:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330570#M1538166</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-21T16:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: 'loop where' on dynamic hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330571#M1538167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For me this loop is not ok. Does &amp;lt;f_company&amp;gt; hold component name or its value? It should be the former:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at i_th_ref_data assigning &amp;lt;f_ref_data&amp;gt;
where ('COMPONENT_NAME') = '4711'.
...
endloop.

"not as in your case
loop at i_th_ref_data assigning &amp;lt;f_ref_data&amp;gt;
where some_value = '4711'. "&amp;lt;f_company&amp;gt; holds SOME_VALUE
...
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Sep 2010 16:35:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330571#M1538167</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-09-21T16:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: 'loop where' on dynamic hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330572#M1538168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Loop statement supports dynamic clauses in higher versions only  but read statement supports.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May be you have to do something like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
read table i_th_ref_data assigning &amp;lt;f_ref_data&amp;gt; with table key ('0COMPANY') = '4711'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also dynamically pass the fields to the read statement instead of harcoding it , but the problem is you can only get one line per read statement . So the possibility is go for if .. endif conditions&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Sep 2010 16:47:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330572#M1538168</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-09-21T16:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: 'loop where' on dynamic hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330573#M1538169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello marcin,&lt;/P&gt;&lt;P&gt;&amp;lt;f_company&amp;gt; hold the component name (not the value).&lt;/P&gt;&lt;P&gt;unfortunately if i hardcode it with '0COMPANY' the result is the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanx for ur answer though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Sep 2010 17:37:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330573#M1538169</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-21T17:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: 'loop where' on dynamic hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330574#M1538170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;keshav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what do you mean "Loop statement supports dynamic clauses in higher versions"?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which versions r u refering to?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u r read proposal does not work since i need several entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moderator message - Please do not use textspeak&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on Sep 21, 2010 1:51 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Sep 2010 17:40:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330574#M1538170</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-21T17:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: 'loop where' on dynamic hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330575#M1538171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I mean the syntax of loop with dynamic where clause is supported in higher releases of SAP. In your code the field seems to be dynamic in nature.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the link:[http://www.adfahrer.com/workplace/sem/2006-11-28-adsig-sbn-walldorfabap/horstkeller-cd200-sent-in.pdf] . Available after SAP NetWeaver 2004s under section preview of next release. I think so its available from SAP NetWeaver 7.0&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Sep 2010 18:02:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330575#M1538171</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-09-21T18:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: 'loop where' on dynamic hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330576#M1538172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Keshav,&lt;/P&gt;&lt;P&gt;this presentation is from 2006 and we are using 2004S so I cant imagine that it would not be possible for us to use conditional/dynamic  where's&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Our system profile:&lt;/P&gt;&lt;P&gt;SAP_ABA	700	0019	SAPKA70019	Cross-Application Component&lt;/P&gt;&lt;P&gt;SAP_BASIS	700	0019	SAPKB70019	SAP Basis Component&lt;/P&gt;&lt;P&gt;PI_BASIS	2006_1_700	0009	SAPKIPYM09	Basis Plug-In (PI_BASIS) 2006_1_700&lt;/P&gt;&lt;P&gt;ST-PI	2008_1_700	0002	SAPKITLRD2	SAP Solution Tools Plug-In&lt;/P&gt;&lt;P&gt;SAP_BW	700	0021	SAPKW70021	SAP NetWeaver BI 7.0&lt;/P&gt;&lt;P&gt;FINBASIS	602	0005	SAPK-60205INFINBASIS	FINBASIS&lt;/P&gt;&lt;P&gt;BI_CONT	703	0014	SAPKIBIIQ4	Business Intelligence Content&lt;/P&gt;&lt;P&gt;SEM-BW	602	0005	SAPK-60205INSEMBW	SEM-BW 600 : Add-On Installation&lt;/P&gt;&lt;P&gt;ST-A/PI	01M_BCO700	0000	     -	Servicetools for other App./Netweaver 04&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any other suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Sep 2010 19:31:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330576#M1538172</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-21T19:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: 'loop where' on dynamic hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330577#M1538173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF..ENDIF will do , but as you said performance will be the issue. I dont see any other solutions , also im not sure if there is any work around for this.&lt;/P&gt;&lt;P&gt;Or moving to a temp table and deleting the entries which are not equal to the condition ( Delete statements supports dynamic where clauses i Guess in lower versions ), But if .. endif will be better than a delete.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Sep 2010 19:39:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330577#M1538173</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-09-21T19:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: 'loop where' on dynamic hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330578#M1538174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Keshav,&lt;/P&gt;&lt;P&gt;are you saying that our system does not support dynamic where's ???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If yes: what system requirements are required?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAP_ABA	700	0019	SAPKA70019	Cross-Application Component&lt;/P&gt;&lt;P&gt;SAP_BASIS	700	0019	SAPKB70019	SAP Basis Component&lt;/P&gt;&lt;P&gt;PI_BASIS	2006_1_700	0009	SAPKIPYM09	Basis Plug-In (PI_BASIS) 2006_1_700&lt;/P&gt;&lt;P&gt;ST-PI	2008_1_700	0002	SAPKITLRD2	SAP Solution Tools Plug-In&lt;/P&gt;&lt;P&gt;SAP_BW	700	0021	SAPKW70021	SAP NetWeaver BI 7.0&lt;/P&gt;&lt;P&gt;FINBASIS	602	0005	SAPK-60205INFINBASIS	FINBASIS&lt;/P&gt;&lt;P&gt;BI_CONT	703	0014	SAPKIBIIQ4	Business Intelligence Content&lt;/P&gt;&lt;P&gt;SEM-BW	602	0005	SAPK-60205INSEMBW	SEM-BW 600 : Add-On Installation&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Sep 2010 20:02:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330578#M1538174</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-21T20:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: 'loop where' on dynamic hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330579#M1538175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAP NetWeaver 7.0 or higher.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Sep 2010 20:05:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330579#M1538175</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-09-21T20:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: 'loop where' on dynamic hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330580#M1538176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;/CODE&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;CODE&gt;
&amp;gt; loop at i_th_ref_data assigning &amp;lt;f_ref_data&amp;gt;.
&amp;gt; if &amp;lt;f_company&amp;gt; = '4711'.
&amp;gt; ...
&amp;gt; endif.
&amp;gt; endloop.
&amp;gt; &lt;/CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; This will work&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just a quick note about this. It &lt;STRONG&gt;won't&lt;/STRONG&gt; work. Why? Because the &amp;lt;f_ref_data&amp;gt; (and it's component) are assigned before the loop. When you're in the loop, the &amp;lt;f_ref_data&amp;gt; points to a different area of memory. In these situations you must either put the ASSIGN COMPONENT inside the loop, or (more efficiently) use LOOP AT i_th_ref_data INTO &amp;lt;f_ref_data&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To the original question:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dynamically create a STANDARD table of the same line type as i_th_ref_data with a key of 'COMPANY' (double check the name of the key - in my experience infoobject 0COMPANY relates to field COMPANY).&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: lr_data TYPE REF TO data.
CREATE DATA lr_data LIKE LINE OF i_th_ref_data.
ASSIGN lr_data-&amp;gt;* TO &amp;lt;ls_ref_data&amp;gt;.

CREATE DATA lr_data LIKE STANDARD TABLE OF &amp;lt;ls_ref_data&amp;gt;.
ASSIGN lr_data-&amp;gt;* TO &amp;lt;lt_ref_data&amp;gt;.

&amp;lt;lt_ref_data&amp;gt; = i_th_ref_data.

SORT &amp;lt;lt_ref_data&amp;gt; BY ('COMPANY').

READ TABLE &amp;lt;lt_ref_data&amp;gt; WITH KEY ('COMPANY') eq '4711' TRANSPORTING NO FIELDS BINARY SEARCH.
l_index = sy-tabix.
ASSIGN COMPONENT 'COMPANY' OF STRUCTURE &amp;lt;ls_ref_data&amp;gt; TO &amp;lt;l_company&amp;gt;.
LOOP AT &amp;lt;lt_ref_data&amp;gt; INTO &amp;lt;ls_ref_data&amp;gt; FROM l_index.
  IF &amp;lt;l_company&amp;gt; NE '4711'.
    EXIT.
  ENDIF.
* Do stuff
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You might be able to dynamically create a SORTED table, which would be better. But I can't remember how to dynamically define the key. You probably can do it via RTTS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Sep 2010 07:55:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-where-on-dynamic-hashed-table/m-p/7330580#M1538176</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2010-09-22T07:55:21Z</dc:date>
    </item>
  </channel>
</rss>

