<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5565205873085546505</id><updated>2026-11-03T14:53:21.731+00:00</updated><category term="Dynamics AX"/><category term="D365"/><category term="SQL Server"/><category term="D365O"/><category term="AIF"/><category term="AX Retail"/><category term="Dynamics 365"/><category term="Windows Server 2008"/><category term="System"/><category term="AX7"/><category term="DIXF"/><category term="Entity"/><category term="Windows 7"/><category term="Astro IPTV"/><category term="Asus RT-AC68U"/><category term="Asus router"/><category term="Biztalk Mapper"/><category term="Data Management"/><category term="IIS"/><category term="Laptop"/><category term="Logic App"/><category term="London"/><category term="London Protest"/><category term="Lync"/><category term="Maxis fiber"/><category term="Outlook"/><category term="Phone"/><category term="PowerShell"/><category term="Protest"/><category term="Query Optimization"/><category term="SFTP"/><category term="Trace Parser"/><category term="Visual Studio Team System"/><category term="Windows"/><title type='text'>bits here and there ...</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>114</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-2024884163697336480</id><published>2025-01-16T05:20:00.005+00:00</published><updated>2025-01-16T05:21:32.906+00:00</updated><title type='text'>Error on LogicApp HTTP request with file content update</title><content type='html'>&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Calibri&amp;quot;,sans-serif&quot; style=&quot;font-size: 11pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt; mso-bidi-theme-font: minor-bidi;&quot;&gt;For the following error message “&lt;span style=&quot;color: red;&quot;&gt;The response to partial content upload request is not valid.
The status code returned in the subsequent partial content response is
&#39;Created&#39;. Expected status code is &#39;OK&#39;.&lt;/span&gt;”, on my case, it happens due to data
chucking.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Calibri&amp;quot;,sans-serif&quot; style=&quot;font-size: 11pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt; mso-bidi-theme-font: minor-bidi;&quot;&gt;Turn off the “Allow chunking” on content
transfer, then it resolve the issue.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Calibri&amp;quot;,sans-serif&quot; style=&quot;font-size: 11pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt; mso-bidi-theme-font: minor-bidi;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Calibri&amp;quot;,sans-serif&quot; style=&quot;font-size: 11pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt; mso-bidi-theme-font: minor-bidi;&quot;&gt;Screenshot of the error message&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhi9EIs5PFLYaoU7S8wejj75qW7CCxr9xZ_9vSzwneWGnJva4YKWTv5XvdocN5mimrXemJ8KLS62bv07McWKFtP8zbxPVLZMAhoU8tPsW0QC2iIHBop1Ye7uA616mORNSzF1GXpMYMlUkVK4FDkb7QKq6IHoURtMEJ43Lmkq9fFLguUDjCOgKs0BFxrN_ex&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;493&quot; data-original-width=&quot;606&quot; height=&quot;325&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhi9EIs5PFLYaoU7S8wejj75qW7CCxr9xZ_9vSzwneWGnJva4YKWTv5XvdocN5mimrXemJ8KLS62bv07McWKFtP8zbxPVLZMAhoU8tPsW0QC2iIHBop1Ye7uA616mORNSzF1GXpMYMlUkVK4FDkb7QKq6IHoURtMEJ43Lmkq9fFLguUDjCOgKs0BFxrN_ex=w400-h325&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span face=&quot;Calibri, sans-serif&quot; style=&quot;font-size: 14.6667px;&quot;&gt;HTTP request with PUT method&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span face=&quot;Calibri, sans-serif&quot; style=&quot;font-size: 14.6667px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjueAt6LAVtTv4oD0btlVDrC8P6wl16cff5SY8mSv3fimE1AWXe8HyZKUqS7qJXUwPWDy0REFYK1oJsU_gAOWaiRidBgq2UQFqVaVmVZ-uISY2JlRk4uCnVAT8dUJSXFyba9qISFJorPEtn_Bn4sEkxWmKM5Ieqi9CYdg3BJZtqq-6ZhhXY3j8BA7cWE00w&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;526&quot; data-original-width=&quot;621&quot; height=&quot;339&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjueAt6LAVtTv4oD0btlVDrC8P6wl16cff5SY8mSv3fimE1AWXe8HyZKUqS7qJXUwPWDy0REFYK1oJsU_gAOWaiRidBgq2UQFqVaVmVZ-uISY2JlRk4uCnVAT8dUJSXFyba9qISFJorPEtn_Bn4sEkxWmKM5Ieqi9CYdg3BJZtqq-6ZhhXY3j8BA7cWE00w=w400-h339&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span face=&quot;Calibri, sans-serif&quot; style=&quot;font-size: 14.6667px;&quot;&gt;Turn off the &quot;Allow chunking&quot;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span face=&quot;Calibri, sans-serif&quot; style=&quot;font-size: 14.6667px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiJngNoQlGnKfR0HYa1pqTbVAP2xyVxO_ND0yUDnz4bXkqEPqtAg54OvGUTWkbKqZqEIVIkZiNSWZ37AFHuYAUy6K3NxlUKwSyA-wDAZPqMsFdMnJeinmQvwxnNtBrn4x_nzCyY83mnwwqS_pYjnhGWS5mGknG8LfbLPzGsg9UNyGsyUmKzz8VIdH8HSal4&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;398&quot; data-original-width=&quot;574&quot; height=&quot;278&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiJngNoQlGnKfR0HYa1pqTbVAP2xyVxO_ND0yUDnz4bXkqEPqtAg54OvGUTWkbKqZqEIVIkZiNSWZ37AFHuYAUy6K3NxlUKwSyA-wDAZPqMsFdMnJeinmQvwxnNtBrn4x_nzCyY83mnwwqS_pYjnhGWS5mGknG8LfbLPzGsg9UNyGsyUmKzz8VIdH8HSal4=w400-h278&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/2024884163697336480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2025/01/error-on-logicapp-http-request-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/2024884163697336480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/2024884163697336480'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2025/01/error-on-logicapp-http-request-with.html' title='Error on LogicApp HTTP request with file content update'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEhi9EIs5PFLYaoU7S8wejj75qW7CCxr9xZ_9vSzwneWGnJva4YKWTv5XvdocN5mimrXemJ8KLS62bv07McWKFtP8zbxPVLZMAhoU8tPsW0QC2iIHBop1Ye7uA616mORNSzF1GXpMYMlUkVK4FDkb7QKq6IHoURtMEJ43Lmkq9fFLguUDjCOgKs0BFxrN_ex=s72-w400-h325-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-7855882549844595240</id><published>2022-05-30T17:12:00.004+01:00</published><updated>2022-05-30T17:12:36.653+01:00</updated><title type='text'>Remove ns0 from BizTalk mapper / XSLT output</title><content type='html'>&lt;p&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;When using BizTalk mapper to do transformation, you might come across the output XML with ns0 in the root tag. To remove this, you may remove the &quot;Target Namespace&quot; of the schema itself.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;Double click on the schema file and under properties window, remove the value in &quot;Target Namespace&quot;.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiQqJzEtwaxkk0Q3Q9bylxFmUE3_26yHNR4M0ETJU1IYY90J62k9pQpBxpTmx9MnDjTc1bci5vxlzoVi9n8fbbjH__xxIAjgue43fuaYo4iPMtvDcfhBql4tLE3vK_hymgfeSRLIX5vzRmzcHPfwkbIC4eEVja9DN69_bJAcrJMZwlHRT1MjEvb9sbZTw&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;537&quot; data-original-width=&quot;328&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiQqJzEtwaxkk0Q3Q9bylxFmUE3_26yHNR4M0ETJU1IYY90J62k9pQpBxpTmx9MnDjTc1bci5vxlzoVi9n8fbbjH__xxIAjgue43fuaYo4iPMtvDcfhBql4tLE3vK_hymgfeSRLIX5vzRmzcHPfwkbIC4eEVja9DN69_bJAcrJMZwlHRT1MjEvb9sbZTw=s16000&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/7855882549844595240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2022/05/remove-ns0-from-biztalk-mapper-xslt.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/7855882549844595240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/7855882549844595240'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2022/05/remove-ns0-from-biztalk-mapper-xslt.html' title='Remove ns0 from BizTalk mapper / XSLT output'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEiQqJzEtwaxkk0Q3Q9bylxFmUE3_26yHNR4M0ETJU1IYY90J62k9pQpBxpTmx9MnDjTc1bci5vxlzoVi9n8fbbjH__xxIAjgue43fuaYo4iPMtvDcfhBql4tLE3vK_hymgfeSRLIX5vzRmzcHPfwkbIC4eEVja9DN69_bJAcrJMZwlHRT1MjEvb9sbZTw=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-5936023513699250757</id><published>2018-08-03T18:35:00.004+01:00</published><updated>2018-08-03T18:51:23.622+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="D365"/><category scheme="http://www.blogger.com/atom/ns#" term="D365O"/><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics 365"/><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics AX"/><category scheme="http://www.blogger.com/atom/ns#" term="Entity"/><title type='text'>FirstOnly in datasource and its alternative (using ROW_NUMBER())</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;When there’s a requirement to retrieve only the first record
from datasource, we might think the “FirstOnly” property under the datasource
table will comes in handy, b&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;ut unfortunately it doesn’t.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;I’ve created a View and set the datasource’s FirstOnly
property to Yes, then created a class to select from this View, it still returns
all the records.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Not sure how this property works, but that’s not the focus
of this article.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i style=&quot;mso-bidi-font-style: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Screenshot showing the
“FirstOnly” property&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqLo_HlONDznm5-7moZEZDDScn9ieAHlYHcIhxoo9HHMJLTAnVzxVq-b00Cam3Aa3WLa1gQCuJzeQMYst_tASyC_8_PrWGaLTIPKkpPf3rBW5kunacBvbxjUf3SKn3U5fWfPMllHXSBm0L/s1600/ViewRowNum01.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;756&quot; data-original-width=&quot;1500&quot; height=&quot;322&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqLo_HlONDznm5-7moZEZDDScn9ieAHlYHcIhxoo9HHMJLTAnVzxVq-b00Cam3Aa3WLa1gQCuJzeQMYst_tASyC_8_PrWGaLTIPKkpPf3rBW5kunacBvbxjUf3SKn3U5fWfPMllHXSBm0L/s640/ViewRowNum01.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;As an alternative, we can create an additional field (RowNumber)
and filter it using RowNumber = 1.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Eg. Given the sample tables below, the requirement is to
shows only one contact number for the customer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;border-collapse: collapse; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184; width: 339px;&quot;&gt;
 &lt;tbody&gt;
&lt;tr style=&quot;height: 14.25pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 14.25pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 88.0pt;&quot; valign=&quot;bottom&quot; width=&quot;117&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Customer&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 14.25pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 18.35pt;&quot; valign=&quot;bottom&quot; width=&quot;24&quot;&gt;&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; nowrap=&quot;&quot; style=&quot;border-bottom: solid windowtext 1.0pt; border: none; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 148.0pt;&quot; valign=&quot;bottom&quot; width=&quot;197&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Contact&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 14.25pt; mso-yfti-irow: 1;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;background: #BDD7EE; border: solid windowtext 1.0pt; height: 14.25pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 88.0pt;&quot; valign=&quot;bottom&quot; width=&quot;117&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;AccountNum&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 14.25pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 18.35pt;&quot; valign=&quot;bottom&quot; width=&quot;24&quot;&gt;&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;background: #BDD7EE; border-top: none; border: solid windowtext 1.0pt; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 92.35pt;&quot; valign=&quot;bottom&quot; width=&quot;123&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;AccountNum&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;background: #BDD7EE; border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 55.65pt;&quot; valign=&quot;bottom&quot; width=&quot;74&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Locator&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 14.25pt; mso-yfti-irow: 2;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 88.0pt;&quot; valign=&quot;bottom&quot; width=&quot;117&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;ABC&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 14.25pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 18.35pt;&quot; valign=&quot;bottom&quot; width=&quot;24&quot;&gt;&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 92.35pt;&quot; valign=&quot;bottom&quot; width=&quot;123&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;ABC&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 55.65pt;&quot; valign=&quot;bottom&quot; width=&quot;74&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;12345&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 14.25pt; mso-yfti-irow: 3;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 88.0pt;&quot; valign=&quot;bottom&quot; width=&quot;117&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;DEF&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 14.25pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 18.35pt;&quot; valign=&quot;bottom&quot; width=&quot;24&quot;&gt;&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 92.35pt;&quot; valign=&quot;bottom&quot; width=&quot;123&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;ABC&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 55.65pt;&quot; valign=&quot;bottom&quot; width=&quot;74&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;34567&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 14.25pt; mso-yfti-irow: 4;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 14.25pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 88.0pt;&quot; valign=&quot;bottom&quot; width=&quot;117&quot;&gt;&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 14.25pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 18.35pt;&quot; valign=&quot;bottom&quot; width=&quot;24&quot;&gt;&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 92.35pt;&quot; valign=&quot;bottom&quot; width=&quot;123&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;DEF&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 55.65pt;&quot; valign=&quot;bottom&quot; width=&quot;74&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;56789&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 14.25pt; mso-yfti-irow: 5;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 14.25pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 88.0pt;&quot; valign=&quot;bottom&quot; width=&quot;117&quot;&gt;&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 14.25pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 18.35pt;&quot; valign=&quot;bottom&quot; width=&quot;24&quot;&gt;&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 92.35pt;&quot; valign=&quot;bottom&quot; width=&quot;123&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;DEF&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 55.65pt;&quot; valign=&quot;bottom&quot; width=&quot;74&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;78901&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 14.25pt; mso-yfti-irow: 6; mso-yfti-lastrow: yes;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 14.25pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 88.0pt;&quot; valign=&quot;bottom&quot; width=&quot;117&quot;&gt;&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;height: 14.25pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 18.35pt;&quot; valign=&quot;bottom&quot; width=&quot;24&quot;&gt;&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 92.35pt;&quot; valign=&quot;bottom&quot; width=&quot;123&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;DEF&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 55.65pt;&quot; valign=&quot;bottom&quot; width=&quot;74&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;90123&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;We’ll start with creating the View method under the View.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;&lt;span style=&quot;color: dodgerblue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: dodgerblue;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; QTQ_CustNonPrimaryPhoneView &lt;/span&gt;&lt;span style=&quot;color: dodgerblue;&quot;&gt;extends&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: darkcyan;&quot;&gt;common&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: dodgerblue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: dodgerblue;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: dodgerblue;&quot;&gt;server&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: dodgerblue;&quot;&gt;str&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; rowNumByAccountNum()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: dodgerblue;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: darkred;&quot;&gt;&#39;ROW_NUMBER()
OVER (PARTITION BY T1.Partition, T1.AccountNum ORDER BY AccountNum)&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: small;&quot;&gt;&lt;span style=&quot;color: black; font-size: xx-small;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Then create a String computed column, set the View Method
with this method name.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQWzo8XOhtA_mjJGMsgoa3d7YHbd6lea0R_eXPtd6J78EhZqP4-1SxJpWNbc0p7xT-SwFSi_t6NFreZgGPvd_vBVur73A_8LK0IWV1RedrQA3mxHnFBWmMoF_dcbIV2mxIqp8eabiY7Pt0/s1600/ViewRowNum02.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;832&quot; data-original-width=&quot;1556&quot; height=&quot;342&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQWzo8XOhtA_mjJGMsgoa3d7YHbd6lea0R_eXPtd6J78EhZqP4-1SxJpWNbc0p7xT-SwFSi_t6NFreZgGPvd_vBVur73A_8LK0IWV1RedrQA3mxHnFBWmMoF_dcbIV2mxIqp8eabiY7Pt0/s640/ViewRowNum02.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Select from this View will product result as shown below.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;border-collapse: collapse; margin-left: .05pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-yfti-tbllook: 1184; width: 367px;&quot;&gt;
 &lt;tbody&gt;
&lt;tr style=&quot;height: 14.25pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;background: #BDD7EE; border: solid windowtext 1.0pt; height: 14.25pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 88.0pt;&quot; valign=&quot;bottom&quot; width=&quot;117&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;AccountNum&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;background: #BDD7EE; border-left: none; border: solid windowtext 1.0pt; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 60.0pt;&quot; valign=&quot;bottom&quot; width=&quot;80&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Locator&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;background: #BDD7EE; border-left: none; border: solid windowtext 1.0pt; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 150.0pt;&quot; valign=&quot;bottom&quot; width=&quot;210&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;RowNumByAccountNum&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 14.25pt; mso-yfti-irow: 1;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 88.0pt;&quot; valign=&quot;bottom&quot; width=&quot;117&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;ABC&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 60.0pt;&quot; valign=&quot;bottom&quot; width=&quot;80&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;12345&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 127.0pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 14.25pt; mso-yfti-irow: 2;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 88.0pt;&quot; valign=&quot;bottom&quot; width=&quot;117&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;ABC&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 60.0pt;&quot; valign=&quot;bottom&quot; width=&quot;80&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;34567&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 127.0pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 14.25pt; mso-yfti-irow: 3;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 88.0pt;&quot; valign=&quot;bottom&quot; width=&quot;117&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;DEF&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 60.0pt;&quot; valign=&quot;bottom&quot; width=&quot;80&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;56789&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 127.0pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 14.25pt; mso-yfti-irow: 4;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 88.0pt;&quot; valign=&quot;bottom&quot; width=&quot;117&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;DEF&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 60.0pt;&quot; valign=&quot;bottom&quot; width=&quot;80&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;78901&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 127.0pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;height: 14.25pt; mso-yfti-irow: 5; mso-yfti-lastrow: yes;&quot;&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-top: none; border: solid windowtext 1.0pt; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 88.0pt;&quot; valign=&quot;bottom&quot; width=&quot;117&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;DEF&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 60.0pt;&quot; valign=&quot;bottom&quot; width=&quot;80&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;90123&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td nowrap=&quot;&quot; style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 14.25pt; mso-border-bottom-alt: solid windowtext .5pt; mso-border-right-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 127.0pt;&quot; valign=&quot;bottom&quot; width=&quot;169&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right;&quot;&gt;
&lt;span style=&quot;color: black; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-hansi-font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;3&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;You can easily filter it with “RowNumByAccountNum = 1” to
retrieve only the first contact.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Eg.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;When using it in code&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;&lt;span style=&quot;color: dodgerblue;&quot;&gt;select&lt;/span&gt; &lt;span style=&quot;color: dodgerblue;&quot;&gt;from&lt;/span&gt;
QTQ_CustNonPrimaryPhoneView &lt;span style=&quot;color: dodgerblue;&quot;&gt;where&lt;/span&gt;
QTQ_CustNonPrimaryPhoneView.RowNumByAccountNum = &lt;span style=&quot;color: red;&quot;&gt;1&lt;/span&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;When using it in Query/View, set the Range by putting in the
field ‘RowNumByAccountNum’ and set the value to 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMZjJEealg4RhKuP8oI04EefxP7dLAZsfcmp71vcBDwtjt2R8J6OydTGaOH7ozn007DRIWKf91PCqkJwhfG52CciYwxgyMDSRmU7j8_V-pSAkASjEgwcjByrObEzhR4XgiqtxpMBbNZIZr/s1600/ViewRowNum03.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;492&quot; data-original-width=&quot;1408&quot; height=&quot;223&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMZjJEealg4RhKuP8oI04EefxP7dLAZsfcmp71vcBDwtjt2R8J6OydTGaOH7ozn007DRIWKf91PCqkJwhfG52CciYwxgyMDSRmU7j8_V-pSAkASjEgwcjByrObEzhR4XgiqtxpMBbNZIZr/s640/ViewRowNum03.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/5936023513699250757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2018/08/firstonly-in-datasource-and-its.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/5936023513699250757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/5936023513699250757'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2018/08/firstonly-in-datasource-and-its.html' title='FirstOnly in datasource and its alternative (using ROW_NUMBER())'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqLo_HlONDznm5-7moZEZDDScn9ieAHlYHcIhxoo9HHMJLTAnVzxVq-b00Cam3Aa3WLa1gQCuJzeQMYst_tASyC_8_PrWGaLTIPKkpPf3rBW5kunacBvbxjUf3SKn3U5fWfPMllHXSBm0L/s72-c/ViewRowNum01.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-7506964174088296154</id><published>2018-06-25T14:57:00.002+01:00</published><updated>2018-06-25T14:57:36.199+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Logic App"/><category scheme="http://www.blogger.com/atom/ns#" term="SFTP"/><title type='text'>SFTP setup and Logic App testing</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: 14.6667px;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;A short article regarding setting up an SFTP for testing.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;It covers:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Rebex Tiny SFTP Server&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Add inbound/outbound rules in Windows Firewall&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Add inbound/outbound port rules in VM Networking&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Setup Inbound NAT rules in Azure load balancer&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Configure Logic App SFTP connection&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;mso-list: l0 level1 lfo1; tab-stops: 28.0cm; text-indent: -18.0pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Rebex Tiny SFTP Server&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;In my case, I’m using Rebex Tiny SFTP Server (&lt;i&gt;Free&lt;/i&gt;) and running it in Azure hosted VM.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;You may download it from: &lt;a href=&quot;https://labs.rebex.net/tiny-sftp-server&quot;&gt;https://labs.rebex.net/tiny-sftp-server&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;It doesn’t requires installation, just download and unzip it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 11pt;&quot;&gt;You may change the username, password, and root
directory in the config file&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 11pt;&quot;&gt;“RebexTinySftpServer.exe.config”.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSWU-3b-HyocAXZEhwlyZWUPeDoQb-BFBGX9IaYOGCB1cVMx-cmIHT1h25UH7TNp7fYrEoVoTW7ZFHyXOySgUpPDl4LJi11HNHUN0Ym4YqkTLG-UjZ6NVkCM7zN4AezImPrMXrAqjV12eo/s1600/SFTP_LogicApp_01.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1156&quot; data-original-width=&quot;1398&quot; height=&quot;528&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSWU-3b-HyocAXZEhwlyZWUPeDoQb-BFBGX9IaYOGCB1cVMx-cmIHT1h25UH7TNp7fYrEoVoTW7ZFHyXOySgUpPDl4LJi11HNHUN0Ym4YqkTLG-UjZ6NVkCM7zN4AezImPrMXrAqjV12eo/s640/SFTP_LogicApp_01.png&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;u&gt;Windows Firewall&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Before running the application (&lt;i&gt;RebexTinySftpServer.exe&lt;/i&gt;), we’ll need to get the ports opened.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Inbound rules for SFTP&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyxTm_ejyhw26vF8zzhIrXHEmZEhTQLrnKICWyfNnNNKmt3L_jF9ThXwq9jhTxPv1GesATMnkcxTkXOxZugj2GrAm0t7xOUOI119LwE1GfVYc-3snIzA3chDJ_DggZ4VGxztq71YPx2gzQ/s1600/SFTP_LogicApp_02.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;289&quot; data-original-width=&quot;1600&quot; height=&quot;115&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyxTm_ejyhw26vF8zzhIrXHEmZEhTQLrnKICWyfNnNNKmt3L_jF9ThXwq9jhTxPv1GesATMnkcxTkXOxZugj2GrAm0t7xOUOI119LwE1GfVYc-3snIzA3chDJ_DggZ4VGxztq71YPx2gzQ/s640/SFTP_LogicApp_02.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Outbound rules for SFTP&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTkoT7OoCuFB8FdkIvdl5UsF2W8QKOxN8pV5-PAku4_ejRc6YODh2WEvxL4wXQxf4ezwFHazTPbYmGXOfpgmeDWkENoWiqCsbYp7rDnYkouS9ZN5OkBq7_Ikw-K7OFK5n-AAqCNvbsjAs5/s1600/SFTP_LogicApp_03.png&quot; imageanchor=&quot;1&quot; style=&quot;font-size: 14.6667px; margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;289&quot; data-original-width=&quot;1600&quot; height=&quot;115&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTkoT7OoCuFB8FdkIvdl5UsF2W8QKOxN8pV5-PAku4_ejRc6YODh2WEvxL4wXQxf4ezwFHazTPbYmGXOfpgmeDWkENoWiqCsbYp7rDnYkouS9ZN5OkBq7_Ikw-K7OFK5n-AAqCNvbsjAs5/s640/SFTP_LogicApp_03.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;u&gt;Azure networking&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Go to: Virtual machines (&lt;i&gt;select the VM&lt;/i&gt;) &amp;gt; Networking&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0cm;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoListParagraph&quot; style=&quot;margin-left: 0cm; mso-list: l0 level1 lfo1;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Add
     inbound port rule&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoListParagraph&quot; style=&quot;margin-left: 0cm; mso-list: l0 level1 lfo1;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Add
     outbound port rule&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlmQHJN028bgi2o22nGuB0MHVxm8eLhyfWcaStXO_oBeS-thwVaXZsHm9qfMCOs8wGxku1Se6su17dSfhHNQD_EMQ7Wlztf3cVTU7j5Iqtb3ROlzu-5M-bVolZgzPyHJYb2k5F65pgrozW/s1600/SFTP_LogicApp_04.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;976&quot; data-original-width=&quot;1600&quot; height=&quot;390&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlmQHJN028bgi2o22nGuB0MHVxm8eLhyfWcaStXO_oBeS-thwVaXZsHm9qfMCOs8wGxku1Se6su17dSfhHNQD_EMQ7Wlztf3cVTU7j5Iqtb3ROlzu-5M-bVolZgzPyHJYb2k5F65pgrozW/s640/SFTP_LogicApp_04.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;o:p&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;u&gt;Load balancer&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Go to: : Virtual machines (&lt;i&gt;select the VM&lt;/i&gt;) &amp;gt; Overview&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Click on the link under the “DNS name”, take note of the
name of the load balancer in the Configuration screen.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAa43j_qdJqovGa98aNOWSNOUDcgq4NBNfDkYrIw_jrE7Gw-ylauUMqWmAwYDyrAVhk45442ezGEyAxRCIqPN8upPPR01QjW7gXOyJ9wSMwfcu1Lp3nNW-lrizH05C61yv6_2STmUmFZ8a/s1600/SFTP_LogicApp_05.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;534&quot; data-original-width=&quot;1600&quot; height=&quot;212&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAa43j_qdJqovGa98aNOWSNOUDcgq4NBNfDkYrIw_jrE7Gw-ylauUMqWmAwYDyrAVhk45442ezGEyAxRCIqPN8upPPR01QjW7gXOyJ9wSMwfcu1Lp3nNW-lrizH05C61yv6_2STmUmFZ8a/s640/SFTP_LogicApp_05.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Go to: Load balancer (&lt;i&gt;Select the load balancer as you’ve
taken note of in previous step&lt;/i&gt;) &amp;gt; Settings &amp;gt; Inbound NAT rules&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaD6UrPAaOjBmcn6Z8KFQJUfxfJ6lJwBmzcInU7FGQdVUzen97vvtCIkdQNybr-E27aHva1TwJtoB0sfh9TTGPKZ_mi63l5LLv9xobYUPo4B_aUISLRnfFC1q6InXyzmue84o5v5xAOCLo/s1600/SFTP_LogicApp_06.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;573&quot; data-original-width=&quot;1600&quot; height=&quot;228&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaD6UrPAaOjBmcn6Z8KFQJUfxfJ6lJwBmzcInU7FGQdVUzen97vvtCIkdQNybr-E27aHva1TwJtoB0sfh9TTGPKZ_mi63l5LLv9xobYUPo4B_aUISLRnfFC1q6InXyzmue84o5v5xAOCLo/s640/SFTP_LogicApp_06.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Add the SFTP rule&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8BXQ2xPqmROwVV8GgZ62ra3vvKAL_8ngiNKgyQZpq7k4IYYXkfCf13yMX944QDX0YU2TmsjYES_ANEYz6y2Otulsn23lHG9udtvsUUFOQm6IIvmtj7xA3HKqxKTACgx8RuzG_zCl4AoEF/s1600/SFTP_LogicApp_07.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1255&quot; data-original-width=&quot;1169&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8BXQ2xPqmROwVV8GgZ62ra3vvKAL_8ngiNKgyQZpq7k4IYYXkfCf13yMX944QDX0YU2TmsjYES_ANEYz6y2Otulsn23lHG9udtvsUUFOQm6IIvmtj7xA3HKqxKTACgx8RuzG_zCl4AoEF/s640/SFTP_LogicApp_07.png&quot; width=&quot;596&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Run the Rebex Tiny SFTP Server and try connect to it using
your SFTP client (&lt;i&gt;Eg. FileZilla&lt;/i&gt;).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Confirm it is working before testing your Logic App.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijf0_SQWRnS1nqFB2fte5v-HhvvGO9RZ8FwsjmgnpVc_qh13S-u1_45srgQws0IUTtaXCX_xPmN6YasZyf1Sm08gR7dLa_DBpQLK0oB8mTkFjeMllZ-sVt480M-XgvYbBNRV3ii4u5JEho/s1600/SFTP_LogicApp_08.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;866&quot; data-original-width=&quot;1476&quot; height=&quot;374&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijf0_SQWRnS1nqFB2fte5v-HhvvGO9RZ8FwsjmgnpVc_qh13S-u1_45srgQws0IUTtaXCX_xPmN6YasZyf1Sm08gR7dLa_DBpQLK0oB8mTkFjeMllZ-sVt480M-XgvYbBNRV3ii4u5JEho/s640/SFTP_LogicApp_08.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Configure Logic App SFTP connection&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;You may configure Logic App SFTP connection for testing.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Below is an example of the screen creating the SFTP
connection (&lt;i&gt;Replace the value in the
Connection Name, Host Server Address, and User Name as setup in your Rebex Tiny
SFTP server&lt;/i&gt;).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh64JeT0eQsRm_Xw9wactJMBxCeV57G_psUez_i6yPJmlT3UdH5gbGB_22KwRPdOHxNsvnr_PaXSxEBgKRlFlUytD9Spo7pC65SnjRphZDKR6KiyIedO9vou8DxNaGZzWhGKL_XDzyzRzQI/s1600/SFTP_LogicApp_09.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;912&quot; data-original-width=&quot;1212&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh64JeT0eQsRm_Xw9wactJMBxCeV57G_psUez_i6yPJmlT3UdH5gbGB_22KwRPdOHxNsvnr_PaXSxEBgKRlFlUytD9Spo7pC65SnjRphZDKR6KiyIedO9vou8DxNaGZzWhGKL_XDzyzRzQI/s640/SFTP_LogicApp_09.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;You can then test create file via the SFTP connection you’ve
just setup&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2zdkIHbHagjPC4V7Do-On7S0LFActoriSXdEM9pOPF7NZgh-I-mcXNaW783MLL-TDYbVoV1ox_2F54ER1qVQ_v18VrlcyrA2mXgSlVYWHbkzvzy1hu6VoUZadkU_u0haQtwKUi1-RxPbE/s1600/SFTP_LogicApp_10.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;382&quot; data-original-width=&quot;1212&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2zdkIHbHagjPC4V7Do-On7S0LFActoriSXdEM9pOPF7NZgh-I-mcXNaW783MLL-TDYbVoV1ox_2F54ER1qVQ_v18VrlcyrA2mXgSlVYWHbkzvzy1hu6VoUZadkU_u0haQtwKUi1-RxPbE/s640/SFTP_LogicApp_10.png&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Calibri, sans-serif; font-size: 11pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/7506964174088296154/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2018/06/sftp-setup-and-logic-app-testing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/7506964174088296154'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/7506964174088296154'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2018/06/sftp-setup-and-logic-app-testing.html' title='SFTP setup and Logic App testing'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSWU-3b-HyocAXZEhwlyZWUPeDoQb-BFBGX9IaYOGCB1cVMx-cmIHT1h25UH7TNp7fYrEoVoTW7ZFHyXOySgUpPDl4LJi11HNHUN0Ym4YqkTLG-UjZ6NVkCM7zN4AezImPrMXrAqjV12eo/s72-c/SFTP_LogicApp_01.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-8832248609801840418</id><published>2018-04-13T11:47:00.000+01:00</published><updated>2018-04-13T11:55:59.418+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="D365"/><category scheme="http://www.blogger.com/atom/ns#" term="D365O"/><title type='text'>Object Server Azure: Exception 3762504530 occurred in session 2, process: w3wp.exe, thread: 6396 (After restore Azure db to local VM)</title><content type='html'>&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Ref:&amp;nbsp;&lt;a href=&quot;https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/database/copy-database-from-azure-sql-to-sql-server&quot;&gt;https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/database/copy-database-from-azure-sql-to-sql-server&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;While trying to update local Dynamics 365 VM to use a database backup from Azure environment, I&#39;m getting the error &quot;&lt;span style=&quot;color: red;&quot;&gt;Object Server Azure: Exception 3762504530 occurred in session 2, process: w3wp.exe, thread: 6396&lt;/span&gt;&quot;. This happens after I rename the database and start up the services again.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;What happens is that the *.bacpac file has not been prepared for SQL Server yet, it is a direct backup of the Azure SQL database.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;In ref. link above, one of the step is to prepare the database which include an important settings changes:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: #f9f9f9; font-size: 14px; white-space: pre;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;update sysglobalconfiguration
set value = &#39;SQLSERVER&#39;
where name = &#39;BACKENDDB&#39;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;This statement will prepare the database for SQL Server environment.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;To resolve this issue, run the script under the &quot;Prepare the database&quot; section (in the ref. link above), then restart the services again.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Before the error is resolved, if you&#39;re running the Admin user provisioning tool, you&#39;ll get &quot;&lt;span style=&quot;font-size: 11pt;&quot;&gt;Time out has expired and the operation has not
been completed&lt;/span&gt;&quot; error.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYObRlh3WTZ-GsbEaeRvKtkyThaSH1QNsyWTUnZJPThyphenhyphenKaENLDrCkDkFTxJEw02i2yh9_B07dUY-ZpZbNuF8RZmR9BDz8IJ48XoGThae2BrRFUUyHJDkXts2kMJhYqrSVeYb4rPaUu_vHj/s1600/AdminUserProvisioningError.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;406&quot; data-original-width=&quot;995&quot; height=&quot;160&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYObRlh3WTZ-GsbEaeRvKtkyThaSH1QNsyWTUnZJPThyphenhyphenKaENLDrCkDkFTxJEw02i2yh9_B07dUY-ZpZbNuF8RZmR9BDz8IJ48XoGThae2BrRFUUyHJDkXts2kMJhYqrSVeYb4rPaUu_vHj/s400/AdminUserProvisioningError.png&quot; width=&quot;400&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Below is the screenshot from Event Viewer for the error in title&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2MWYVUwefMaHN62cjws-CcNHRw1sjew8dOi9CayKMBhSICdTWK85ddqZ-NbszIN1_ckIpQBd2Ry0YJAck8FLlcFxZhUUAp2Vd5uUVpb5uJeUALRNRyBzLLHbqXkdmu-f-Aaqp0Iim1b_z/s1600/D365_AOS_Error.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1479&quot; data-original-width=&quot;1600&quot; height=&quot;588&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2MWYVUwefMaHN62cjws-CcNHRw1sjew8dOi9CayKMBhSICdTWK85ddqZ-NbszIN1_ckIpQBd2Ry0YJAck8FLlcFxZhUUAp2Vd5uUVpb5uJeUALRNRyBzLLHbqXkdmu-f-Aaqp0Iim1b_z/s640/D365_AOS_Error.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;------------------------------------------------&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;segoe ui&amp;quot; , sans-serif; font-size: 9.0pt;&quot;&gt;The description for Event ID 180 from source Dynamics Server Azure
cannot be found. Either the component that raises this event is not installed
on your local computer or the installation is corrupted. You can install or
repair the component on the local computer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;segoe ui&amp;quot; , sans-serif; font-size: 9.0pt;&quot;&gt;If the event originated on another computer, the display information had
to be saved with the event.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;segoe ui&amp;quot; , sans-serif; font-size: 9.0pt;&quot;&gt;The following information was included with the event: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;segoe ui&amp;quot; , sans-serif; font-size: 9.0pt;&quot;&gt;Object Server Azure: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;segoe ui&amp;quot; , sans-serif; font-size: 9.0pt;&quot;&gt;Exception
3762504530 occurred in session 2,process: w3wp.exe ,thread: 6396&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: black; font-family: &amp;quot;Times New Roman&amp;quot;; font-size: medium; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: black; font-family: &amp;quot;Times New Roman&amp;quot;; font-size: medium; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;------------------------------------------------&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/8832248609801840418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2018/04/object-server-azure-exception.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/8832248609801840418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/8832248609801840418'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2018/04/object-server-azure-exception.html' title='Object Server Azure: Exception 3762504530 occurred in session 2, process: w3wp.exe, thread: 6396 (After restore Azure db to local VM)'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYObRlh3WTZ-GsbEaeRvKtkyThaSH1QNsyWTUnZJPThyphenhyphenKaENLDrCkDkFTxJEw02i2yh9_B07dUY-ZpZbNuF8RZmR9BDz8IJ48XoGThae2BrRFUUyHJDkXts2kMJhYqrSVeYb4rPaUu_vHj/s72-c/AdminUserProvisioningError.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-1918159241570292680</id><published>2018-04-03T07:54:00.000+01:00</published><updated>2018-04-03T07:54:15.831+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Biztalk Mapper"/><title type='text'>Biztalk mapper and Functoid (columns to rows tranformation)</title><content type='html'>&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;This article demo the use of Table Looping and Table Extractor functoid to transform columns to rows. The scenario is there&#39;s a source schema which has 3 dates fields. These dates needs to be transformed into rows in the destination schema. A date type field in the destination schema will indicate the purpose of the date (&lt;i&gt;Eg. An enum value&lt;/i&gt;).&lt;/span&gt;&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;1. Create an Integration Account project&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgR6IShQ0hlfSWPJgXCwTo7P4xz4KiCmWSItTE6fYLU8bKhHn5CqmaMCwSBlKjTeJp2nxM3NIq-9zkVmjqKgFjWpeCfpZ-VrQ-cA_IATnLSdzXg-rQ48OGPGRxJciAIr86qs8wCUGyjrtnH/s1600/01_CreateIntegrationAccountProject.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1110&quot; data-original-width=&quot;1600&quot; height=&quot;444&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgR6IShQ0hlfSWPJgXCwTo7P4xz4KiCmWSItTE6fYLU8bKhHn5CqmaMCwSBlKjTeJp2nxM3NIq-9zkVmjqKgFjWpeCfpZ-VrQ-cA_IATnLSdzXg-rQ48OGPGRxJciAIr86qs8wCUGyjrtnH/s640/01_CreateIntegrationAccountProject.png&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;2. Add the source and destination schema&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;3. Add a new Map&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpLGW2TgifLxzWdNqdFROD2ph1tLo8z9iZylfHvtr58405VQWe3faFGcMyvrnjWCN_nK-Nojc-hX4bK5OScvgYLgeztHIDjcn4Drbsd11-rX3uVgLkoputJ3ghdgVtcLxW2bBh8-Ln-t-1/s1600/02_AddMap.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1110&quot; data-original-width=&quot;1600&quot; height=&quot;444&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpLGW2TgifLxzWdNqdFROD2ph1tLo8z9iZylfHvtr58405VQWe3faFGcMyvrnjWCN_nK-Nojc-hX4bK5OScvgYLgeztHIDjcn4Drbsd11-rX3uVgLkoputJ3ghdgVtcLxW2bBh8-Ln-t-1/s640/02_AddMap.png&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;4. Open the map and select the source and destination schema&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;5. Add a &quot;Table Looping&quot; functoid to the grid&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;6. Drag the parent node to the functoid to connect them&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRrb_iON0yHWc7V9caBNb3ywBWKuciy61IFPNJWPVZbHYMt8WTD01nz_GnJk-tHBWJ60G0KAyYzUHaDwLRp6VAtc782d91_koDA5e2HLPTMxIA4NmN6PiQK8tLan-sBJE3vQp2IJQclRKm/s1600/04_TableLoopingFunctoid.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;533&quot; data-original-width=&quot;1600&quot; height=&quot;212&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRrb_iON0yHWc7V9caBNb3ywBWKuciy61IFPNJWPVZbHYMt8WTD01nz_GnJk-tHBWJ60G0KAyYzUHaDwLRp6VAtc782d91_koDA5e2HLPTMxIA4NmN6PiQK8tLan-sBJE3vQp2IJQclRKm/s640/04_TableLoopingFunctoid.png&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;7. Double click on the &quot;Table Looping&quot; functoid in the grid and enter the number of columns to generate (In my example, 2)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfli2C6UWvLxtBOicmxZdO2bQ_U-9rRzX4kl3nUBWeMt-9KaeGDdVOUrsusscoddpJxBxwQQlX6snlfajMta7MGneNA8P9XjrRbio0f7ZyjPLFEwszZxh9qff4k571WBbxQBX2LLZjQs7l/s1600/03_TableLoopingFunctoid.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1030&quot; data-original-width=&quot;918&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfli2C6UWvLxtBOicmxZdO2bQ_U-9rRzX4kl3nUBWeMt-9KaeGDdVOUrsusscoddpJxBxwQQlX6snlfajMta7MGneNA8P9XjrRbio0f7ZyjPLFEwszZxh9qff4k571WBbxQBX2LLZjQs7l/s640/03_TableLoopingFunctoid.png&quot; width=&quot;570&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;8. Then drag all the date fields to the table looping functoid&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; *Double click on it will shows the input as shown below.&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNSPkMYlWCjJv4_GaPkYfDnhGm_jD2ODv9CmdmwnSJUMpmFi0qrjC2yQQxwB4unZnMbMaF2xlxGLmSIkMsVNZ12MfIIhsBv0wBHgiaFmJ0jPZmj_zzwNZXPN6GNVWd9RTUlkxX3LopI99A/s1600/05_TableLoopingFunctoidWithDateFields.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1030&quot; data-original-width=&quot;918&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNSPkMYlWCjJv4_GaPkYfDnhGm_jD2ODv9CmdmwnSJUMpmFi0qrjC2yQQxwB4unZnMbMaF2xlxGLmSIkMsVNZ12MfIIhsBv0wBHgiaFmJ0jPZmj_zzwNZXPN6GNVWd9RTUlkxX3LopI99A/s640/05_TableLoopingFunctoidWithDateFields.png&quot; width=&quot;570&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;9. In my scenario, I&#39;ll need date type, so I&#39;ll be adding in 3 constant value as the date type (&lt;i&gt;POD, DLD, DCD&lt;/i&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKTkfqr3KnGgUIPaP1oU1WRD6gLzGoVTpGVOuUA5rthKnHEA-e8gzUKbRREHPY-ngxyU2nvIWMEsGm_OP5Sk7CpbGGETiBnQ783Sa7htGVAKuPKQoWXwvvx9wYfSeXPAhPgR1064CxE3KB/s1600/05_TableLoopingFunctoidWithConstant.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1030&quot; data-original-width=&quot;918&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKTkfqr3KnGgUIPaP1oU1WRD6gLzGoVTpGVOuUA5rthKnHEA-e8gzUKbRREHPY-ngxyU2nvIWMEsGm_OP5Sk7CpbGGETiBnQ783Sa7htGVAKuPKQoWXwvvx9wYfSeXPAhPgR1064CxE3KB/s640/05_TableLoopingFunctoidWithConstant.png&quot; width=&quot;570&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;10. Click on the &quot;Table Looping Grid&quot; in the screenshot above and set the rows, then click &quot;OK&quot; to close it&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgax7NXCZZqk3ZrApwNDfi3cgdYNiGMPxHPlh8SdM1DscjIBB825HvqLDAjpFdrzAW3pX9HfV9bOq5nygH-_IcMifidyWI14-T_yiApIQT-SctcDpwo04yOQGaSdHbwY4m_zfkIDcfqt1L-/s1600/06_TableLoopingFunctoidColumns.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1030&quot; data-original-width=&quot;918&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgax7NXCZZqk3ZrApwNDfi3cgdYNiGMPxHPlh8SdM1DscjIBB825HvqLDAjpFdrzAW3pX9HfV9bOq5nygH-_IcMifidyWI14-T_yiApIQT-SctcDpwo04yOQGaSdHbwY4m_zfkIDcfqt1L-/s640/06_TableLoopingFunctoidColumns.png&quot; width=&quot;570&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;11. Drag a line from the &quot;Table Looping&quot; functoid to the parent node of the date&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqnBsJKKPXzWpo2k_lJOYcam4HrDp0Y1d2pMOG-DjM082kaenuWP7Rumq-uey0gRtMEd7QGbKthYsn_YdBk-l_xWCIvxiDs-n-KhmYMOy1vTKkCzLtYZ8AJI1YSaMQpvyesLLH1mmBkzeu/s1600/07_FunctoidToDestParentNode.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;542&quot; data-original-width=&quot;1560&quot; height=&quot;222&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqnBsJKKPXzWpo2k_lJOYcam4HrDp0Y1d2pMOG-DjM082kaenuWP7Rumq-uey0gRtMEd7QGbKthYsn_YdBk-l_xWCIvxiDs-n-KhmYMOy1vTKkCzLtYZ8AJI1YSaMQpvyesLLH1mmBkzeu/s640/07_FunctoidToDestParentNode.png&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;12. Drag 2x &quot;Table Extractor&quot; functoid to the grid&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;13. Drag a line from the &quot;Table Looping&quot; functoid to the first &quot;Table Extractor&quot; functoid. Then drag another line from the &quot;Table Looping&quot; functoid to the second &quot;Table Extractor&quot; functoid.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;14. Drag a line from first &quot;Table Extractor&quot; functoid to the &quot;DateType&quot; field.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;15. Drag a line from the second &quot;Table Extractor&quot; functoid to the &quot;DateValue&quot; field.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; It should now looks like the screenshot below.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyWoQaZKHyZG2TfSn5d4dN9ccDg4zeVZakJ7po_UGJh8dCz2_95R9lpDOudW67vMyU6gGdo_0TqDILEgBYqw-HW3IknBfCEH1IlUnlI-Y_Juqqz6RI4A6C02D0AgsgIyfnOCXJoNnVVcnL/s1600/08_FunctoidTableExtractor.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;549&quot; data-original-width=&quot;1560&quot; height=&quot;224&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyWoQaZKHyZG2TfSn5d4dN9ccDg4zeVZakJ7po_UGJh8dCz2_95R9lpDOudW67vMyU6gGdo_0TqDILEgBYqw-HW3IknBfCEH1IlUnlI-Y_Juqqz6RI4A6C02D0AgsgIyfnOCXJoNnVVcnL/s640/08_FunctoidTableExtractor.png&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;16. Double click on the first &quot;Table Extractor&quot; functoid and set &quot;1&quot; as shown in screenshot below.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;This value indicate the table extractor should extract the 1st column in the Table Looping output. In our example, it extract the first column from the Table Looping functoid and map it to DateType.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Do the same setup to the second &quot;Table Extractor&quot; functoid by setting it to &quot;2&quot; (which indicate it should extract the 2nd column from the Table Looping output, which eventually mapped to &quot;DateValue&quot;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG2GhkTN5XdDf8_v-wrtrAAvhhORHJ2WZDMJ6M-2CJBCXhnRx53aDl2yRGQKhvLpiOLupdHrLQ6BuKwMekaJ3IMCjABcnlL5JcfpiXVNFz4DRoQ8q6c257eSeE_sAe7nDzzocUSoVPmMn_/s1600/09_TableExtractor.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1030&quot; data-original-width=&quot;918&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG2GhkTN5XdDf8_v-wrtrAAvhhORHJ2WZDMJ6M-2CJBCXhnRx53aDl2yRGQKhvLpiOLupdHrLQ6BuKwMekaJ3IMCjABcnlL5JcfpiXVNFz4DRoQ8q6c257eSeE_sAe7nDzzocUSoVPmMn_/s640/09_TableExtractor.png&quot; width=&quot;570&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;17. Run a test on the map with a sample input XML as shown in the screenshot below&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeS8owRI6YHSOq1N6MxHCeoO2yOuCnqPVSSE9HrCgnpujOHnC-ap22FB_EWD8HeA0aa08yMjAcS0ESuQgFyARckEBruUHxeBUuT8A8y9Yu5PJplklmztEl9_Tm87HQCnuNpcqNlWSDDV1c/s1600/10_SampleInputXML.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;402&quot; data-original-width=&quot;864&quot; height=&quot;296&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeS8owRI6YHSOq1N6MxHCeoO2yOuCnqPVSSE9HrCgnpujOHnC-ap22FB_EWD8HeA0aa08yMjAcS0ESuQgFyARckEBruUHxeBUuT8A8y9Yu5PJplklmztEl9_Tm87HQCnuNpcqNlWSDDV1c/s640/10_SampleInputXML.png&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;18. The output will be as shown in the screenshot below&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIuYbbFrl6ZdNPnw5vLiQWi2fI4l71oTb68nDXUeUfenIZNZJEnXBTYRqABy7N_xHfY4eE1S8OqQAO8GzvH9rYa2Zv9UI7JhvSnO5Bz7kxwF4dAqynAphdwNsAiEIUgr5NgxdKuHyMadWU/s1600/11_SampleOutputXML.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;736&quot; data-original-width=&quot;860&quot; height=&quot;546&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIuYbbFrl6ZdNPnw5vLiQWi2fI4l71oTb68nDXUeUfenIZNZJEnXBTYRqABy7N_xHfY4eE1S8OqQAO8GzvH9rYa2Zv9UI7JhvSnO5Bz7kxwF4dAqynAphdwNsAiEIUgr5NgxdKuHyMadWU/s640/11_SampleOutputXML.png&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/1918159241570292680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2018/04/biztalk-mapper-and-functoid-columns-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/1918159241570292680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/1918159241570292680'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2018/04/biztalk-mapper-and-functoid-columns-to.html' title='Biztalk mapper and Functoid (columns to rows tranformation)'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgR6IShQ0hlfSWPJgXCwTo7P4xz4KiCmWSItTE6fYLU8bKhHn5CqmaMCwSBlKjTeJp2nxM3NIq-9zkVmjqKgFjWpeCfpZ-VrQ-cA_IATnLSdzXg-rQ48OGPGRxJciAIr86qs8wCUGyjrtnH/s72-c/01_CreateIntegrationAccountProject.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-64421261701087759</id><published>2018-03-06T18:56:00.002+00:00</published><updated>2018-03-06T18:57:52.512+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics AX"/><title type='text'>Error - You are not authorized to access table &#39;&#39; (). Contact your system administrator.</title><content type='html'>&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;When getting this error &quot;&lt;span style=&quot;color: red;&quot;&gt;You are not authorized to access table &#39;&#39; (). Contact your system administrator.&lt;/span&gt;&quot;, two of the possible reasons would be:&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;The configuration key for the table is not enabled (&lt;i&gt;Check it under System administration &amp;gt; Setup &amp;gt; Licensing &amp;gt; License configuration)&lt;br /&gt;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;The View does not have any field (&lt;i&gt;Expand the &quot;Field&quot; node under the View to check it&lt;/i&gt;)&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/64421261701087759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2018/03/error-you-are-not-authorized-to-access.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/64421261701087759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/64421261701087759'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2018/03/error-you-are-not-authorized-to-access.html' title='Error - You are not authorized to access table &#39;&#39; (). Contact your system administrator.'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-1950184601992329246</id><published>2018-01-23T12:43:00.001+00:00</published><updated>2018-01-23T12:43:16.776+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="D365"/><category scheme="http://www.blogger.com/atom/ns#" term="D365O"/><title type='text'>Default model when create Dynamics 365 project</title><content type='html'>&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;A quick tips on how to set default model in Dynamics 365.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;The default model for the VM is Fleet Management, this can
be a bit annoying each time you create a new project, it default to this model
and have to open up the project properties to change it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;To change the default model:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;1. Open the config file located at: C:\Users\&lt;youruserid&gt;\Documents\Visual Studio 2015\Settings\DynamicsDevConfig.xml&lt;/youruserid&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJSyhvssO3XQdSoLkHUw3yMTPdWBDBzifyOc-C6KCaT1ukKkZuuuY4tWJx22isweT2S4MrVzB9pLOOhkLvDjdWRM6WB51eY4mcbWf8VISdfGIDetf29ysaf3jGlKHauCUCR0w03BeBNF0i/s1600/Dynamics365DefaultModel_01.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;360&quot; data-original-width=&quot;1314&quot; height=&quot;174&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJSyhvssO3XQdSoLkHUw3yMTPdWBDBzifyOc-C6KCaT1ukKkZuuuY4tWJx22isweT2S4MrVzB9pLOOhkLvDjdWRM6WB51eY4mcbWf8VISdfGIDetf29ysaf3jGlKHauCUCR0w03BeBNF0i/s640/Dynamics365DefaultModel_01.png&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;2. Change the ‘DefaultModelForNewProjects’ element value to ‘YourModelName’ and save the file&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwYhEv_8GAGLUNsekTiR5ZSGI4hIKN5AbyB_hkzQFzLVYIL9c6FRrWD57bv0ax_u78jhnUeG1JVoMjkgVPVEKkshhbCJDns3Yd9CLQ1E1h49Y2Ls35ifSvhLXr_EY3lrWnno-BX6c1abOe/s1600/Dynamics365DefaultModel_02.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1032&quot; data-original-width=&quot;1504&quot; height=&quot;438&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwYhEv_8GAGLUNsekTiR5ZSGI4hIKN5AbyB_hkzQFzLVYIL9c6FRrWD57bv0ax_u78jhnUeG1JVoMjkgVPVEKkshhbCJDns3Yd9CLQ1E1h49Y2Ls35ifSvhLXr_EY3lrWnno-BX6c1abOe/s640/Dynamics365DefaultModel_02.png&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;There&#39;re other options you can set here, one of the useful one will be the &lt;dbsyncinbuild&gt;, set this to &quot;true&quot; if you want the &quot;Synchronize Database on Build&quot; default to true.&lt;/dbsyncinbuild&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/1950184601992329246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2018/01/default-model-when-create-dynamics-365.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/1950184601992329246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/1950184601992329246'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2018/01/default-model-when-create-dynamics-365.html' title='Default model when create Dynamics 365 project'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJSyhvssO3XQdSoLkHUw3yMTPdWBDBzifyOc-C6KCaT1ukKkZuuuY4tWJx22isweT2S4MrVzB9pLOOhkLvDjdWRM6WB51eY4mcbWf8VISdfGIDetf29ysaf3jGlKHauCUCR0w03BeBNF0i/s72-c/Dynamics365DefaultModel_01.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-998972925433688373</id><published>2017-10-16T21:11:00.001+01:00</published><updated>2017-10-16T21:11:42.306+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="D365"/><category scheme="http://www.blogger.com/atom/ns#" term="D365O"/><category scheme="http://www.blogger.com/atom/ns#" term="Entity"/><title type='text'>Create new entity error - The natural key for the table CustPackingSlipTrans was not found</title><content type='html'>&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;When create new entity for D365, the wizard will prompt developer to select the table name, the rest is just the matter of selecting fields and finish off the wizard. But sometimes we&#39;ll get error for table without a Replacement key.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Eg. CustPackingSlipTrans.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Unfortunately you can&#39;t change the &quot;Replacement key&quot; for standard table unless you &quot;Customize&quot; it.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Table extension doesn&#39;t allow the change of this property either.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;If you use the wizard to create entity for CustPackingSlipTrans, you&#39;ll get the &quot;The natural key for the table
CustPackingSlipTrans was not found&quot; error.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8MIASNm6_YL56zYHqYZvyYz51-eyk25s9MaIjfUNaIYsGUYnwbVlAxuJoYqgjE23kUekTbDksK3SbclqlXwImuuglN2gxkoCS6dqyi3mXuBJUROsyQbsInc2s5uJpzI1OTzVZ99Ylhv8q/s1600/CreateEntityCustPackingSlip01.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;165&quot; data-original-width=&quot;452&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8MIASNm6_YL56zYHqYZvyYz51-eyk25s9MaIjfUNaIYsGUYnwbVlAxuJoYqgjE23kUekTbDksK3SbclqlXwImuuglN2gxkoCS6dqyi3mXuBJUROsyQbsInc2s5uJpzI1OTzVZ99Ylhv8q/s1600/CreateEntityCustPackingSlip01.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;To create the entity for this table, there&#39;re two choices:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Manually create them (including the child datasources)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Temporarily &quot;Customize&quot; it, then remove the &quot;Customize&quot; element after the entity is created&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Below are the steps for Option 2 (&lt;i&gt;less effort and quicker than Option 1&lt;/i&gt;).&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;1. Create a temporary index at CustPackingSlipTrans&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Allow Duplicates = No&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Alternate Key = Yes&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2B5CaN_Un-izFd6uxaTFnnKCnQRFCOb5As2kbPWUxjbAzi4Q1pLGbBCA6Jh7NpU5NZC7r4Z6bJmNRePlv_6YODrMtyfY-5hJIIQcM2Xx6CJ__NbuGc13u66vqaT0-3b_QkHzP208pnqTq/s1600/CreateEntityCustPackingSlip02.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;423&quot; data-original-width=&quot;497&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2B5CaN_Un-izFd6uxaTFnnKCnQRFCOb5As2kbPWUxjbAzi4Q1pLGbBCA6Jh7NpU5NZC7r4Z6bJmNRePlv_6YODrMtyfY-5hJIIQcM2Xx6CJ__NbuGc13u66vqaT0-3b_QkHzP208pnqTq/s1600/CreateEntityCustPackingSlip02.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;i&gt;*NOTE: Do not include RecId in the temp index&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;2. Set the temporary index as Replacement key&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvUOMelOP2EUcbggBFIMi1xqh-No7My8pBI-NXhufmaNaV2VBTmwtbPi7Q5noHhh0a_1FNxUiYOaYzdXHL90ioDXQzjpQ4l_9t89dyDkZ9bBS7hL7Q9MKxP7Tk3JZ1Ngu6qMlvmqyU_IR3/s1600/CreateEntityCustPackingSlip03.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;423&quot; data-original-width=&quot;497&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvUOMelOP2EUcbggBFIMi1xqh-No7My8pBI-NXhufmaNaV2VBTmwtbPi7Q5noHhh0a_1FNxUiYOaYzdXHL90ioDXQzjpQ4l_9t89dyDkZ9bBS7hL7Q9MKxP7Tk3JZ1Ngu6qMlvmqyU_IR3/s1600/CreateEntityCustPackingSlip03.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;3. Create the new entity (&lt;i&gt;Right click on the project &amp;gt; Add &amp;gt; New item &amp;gt; Data Model &amp;gt; Data entity&lt;/i&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;4. At the wizard, select &quot;CustPackingSlipTrans&quot; as Primary datasource&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhO-bq68hVeRiiUHbQz_53rFlBP-IHG8-hyFteOMZbv2SMawt9-BMi_oueiWSsKWMykHKRphE1t8V2QCz9duwcRDb8YlTAf0cgJZlohRULExvcvMZ2x6mNzMebqvnMRhbmc4qpcnqEottTu/s1600/CreateEntityCustPackingSlip04.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;452&quot; data-original-width=&quot;622&quot; height=&quot;464&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhO-bq68hVeRiiUHbQz_53rFlBP-IHG8-hyFteOMZbv2SMawt9-BMi_oueiWSsKWMykHKRphE1t8V2QCz9duwcRDb8YlTAf0cgJZlohRULExvcvMZ2x6mNzMebqvnMRhbmc4qpcnqEottTu/s640/CreateEntityCustPackingSlip04.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;5. Click &quot;Next&quot;, select the required fields and finish off the wizard&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmr2JVLpduy5JpnlAWN6XWez9y1g83aXp0xCs4u0v4OiUzR9L3uNDkxe6ITstAhb2a6v2PrjaKB8VTEhTsYMiA3DdgyGlfe2Gf94U4ELFTNtysFmXDo75nt0NdJuaLTyQFJLGCgaVx-uTU/s1600/CreateEntityCustPackingSlip05.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;628&quot; data-original-width=&quot;1555&quot; height=&quot;257&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmr2JVLpduy5JpnlAWN6XWez9y1g83aXp0xCs4u0v4OiUzR9L3uNDkxe6ITstAhb2a6v2PrjaKB8VTEhTsYMiA3DdgyGlfe2Gf94U4ELFTNtysFmXDo75nt0NdJuaLTyQFJLGCgaVx-uTU/s640/CreateEntityCustPackingSlip05.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;6. After the new entity is created, delete the &quot;Customized&quot; CustPackingSlipTrans&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;7. Update the EntityKey with other key field that&#39;s appropriate&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;(&lt;i&gt;If Data Management property has been set to Yes, then update the staging table as well&lt;/i&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8tIPZ1Sipk3Dchnw14JeExxNcfMYt1NbL-GexYzWU_Q3V365mCCvjiqE44HDklKhK3Pwy74GqnF6p5hbZttaM9lLstUS1rPD4Pzdx1RaSmujoxjhp0-kxyzbEfo0el_2JXDSGo_DDh0UB/s1600/CreateEntityCustPackingSlip06.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;362&quot; data-original-width=&quot;691&quot; height=&quot;334&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8tIPZ1Sipk3Dchnw14JeExxNcfMYt1NbL-GexYzWU_Q3V365mCCvjiqE44HDklKhK3Pwy74GqnF6p5hbZttaM9lLstUS1rPD4Pzdx1RaSmujoxjhp0-kxyzbEfo0el_2JXDSGo_DDh0UB/s640/CreateEntityCustPackingSlip06.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/998972925433688373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2017/10/create-new-entity-error-natural-key-for.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/998972925433688373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/998972925433688373'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2017/10/create-new-entity-error-natural-key-for.html' title='Create new entity error - The natural key for the table CustPackingSlipTrans was not found'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8MIASNm6_YL56zYHqYZvyYz51-eyk25s9MaIjfUNaIYsGUYnwbVlAxuJoYqgjE23kUekTbDksK3SbclqlXwImuuglN2gxkoCS6dqyi3mXuBJUROsyQbsInc2s5uJpzI1OTzVZ99Ylhv8q/s72-c/CreateEntityCustPackingSlip01.jpg" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-2737324654062792858</id><published>2017-07-26T17:53:00.001+01:00</published><updated>2017-07-26T17:53:21.533+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AX7"/><category scheme="http://www.blogger.com/atom/ns#" term="D365"/><category scheme="http://www.blogger.com/atom/ns#" term="D365O"/><category scheme="http://www.blogger.com/atom/ns#" term="Data Management"/><category scheme="http://www.blogger.com/atom/ns#" term="DIXF"/><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics 365"/><title type='text'>Data Management Entity export for all companies</title><content type='html'>&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;In D365O, by default if you create an entity for a company specific table, the &quot;Primary Company Context&quot; property is set to DataAreaId. This affect what data is exported when the Entity is used for exporting data.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Eg.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;All rows from table AAA_TestTable.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiVPN3_WeCaThx0EJkDs8FQ4cKz2jjvfJjVONcr-B66zbyqyxi1vfyJ2fNWTRO_dC65atcKeL3hH0Ay04qYeEkOEcL6NmyRTRHGBwNrRJVemB3X2Qn6kQcnP0v-dTbhOWj39AxPp2EMcBM/s1600/AAA_TestTableData.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;237&quot; data-original-width=&quot;564&quot; height=&quot;133&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiVPN3_WeCaThx0EJkDs8FQ4cKz2jjvfJjVONcr-B66zbyqyxi1vfyJ2fNWTRO_dC65atcKeL3hH0Ay04qYeEkOEcL6NmyRTRHGBwNrRJVemB3X2Qn6kQcnP0v-dTbhOWj39AxPp2EMcBM/s320/AAA_TestTableData.jpg&quot; width=&quot;320&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;AAA_TestTable entity where the &quot;Primary Company Context&quot; property is set to &quot;DataAreaId&quot;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;NOTE: The &quot;CompanyId&quot; field is mapped to &quot;DataAreaId&quot; of the source table.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhi06vnIMURFulKv_nqVqYvUwJ9EEzdtVDkTEXMB6gJgaAr9oGIYLZyMGpJrF-MPqV6AtuO2cKCbieWV8vsqTRthQwKu7EtdlDZNsbozGl5i664TMzrYqmFqtq5s7JB6lpokdZoOIQ3aAPW/s1600/AAA_TestTableEntity_CompanySpecific.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;549&quot; data-original-width=&quot;1051&quot; height=&quot;332&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhi06vnIMURFulKv_nqVqYvUwJ9EEzdtVDkTEXMB6gJgaAr9oGIYLZyMGpJrF-MPqV6AtuO2cKCbieWV8vsqTRthQwKu7EtdlDZNsbozGl5i664TMzrYqmFqtq5s7JB6lpokdZoOIQ3aAPW/s640/AAA_TestTableEntity_CompanySpecific.jpg&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;When an Export job is setup using this Entity, it will export the rows base on the company context.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj819KUhUaOkeiqj86-BwmWfjzoQnPcRPf13x6tsBcnYj532fyQRO37Qlv00dhGeHEq_XFROlg-LnuCzqxl5eefWfiNF2foJM_q7QtPzeggchIbh8CGgMUEuPdEyxAO60mR7lRJvWXjccSb/s1600/AAA_TestTable_ExportJob.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1129&quot; data-original-width=&quot;1411&quot; height=&quot;512&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj819KUhUaOkeiqj86-BwmWfjzoQnPcRPf13x6tsBcnYj532fyQRO37Qlv00dhGeHEq_XFROlg-LnuCzqxl5eefWfiNF2foJM_q7QtPzeggchIbh8CGgMUEuPdEyxAO60mR7lRJvWXjccSb/s640/AAA_TestTable_ExportJob.jpg&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Eg.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Current company = USMF, then only records from USMF company is exported.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhItLGB43qzrszwV44N0Y8G1fLzHN1NJIfe90wPbKMY5YxysMFHH9YhcT3X3ZQF8COR2cBg4pc0mKCVw6XKntx0PfX_AW8jlKpIvnTPfulZg1xggeKsuhUSDVQHiqQ0Alz4A3gW2OgJadHQ/s1600/AAA_TestTableData_CompanySpecific.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;61&quot; data-original-width=&quot;271&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhItLGB43qzrszwV44N0Y8G1fLzHN1NJIfe90wPbKMY5YxysMFHH9YhcT3X3ZQF8COR2cBg4pc0mKCVw6XKntx0PfX_AW8jlKpIvnTPfulZg1xggeKsuhUSDVQHiqQ0Alz4A3gW2OgJadHQ/s1600/AAA_TestTableData_CompanySpecific.jpg&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;If the &quot;Primary Company Context&quot; is cleared out (&lt;i&gt;empty&lt;/i&gt;), it will export all records regardless of the company.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4qJhmN44jmbz-1F7WX2XiRA0zmDzXNlVimVpw52QkrvRkf0_rWZyNaupBbC0N1F-SJehqNuWB9p_kbY9x973KevovVZzgjaGqI8YOaElMtjGLK018VJrSV3DYlPBD1VSg1lfvxxYkPVub/s1600/AAA_TestTableData_NotCompanySpecific.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;546&quot; data-original-width=&quot;1048&quot; height=&quot;332&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4qJhmN44jmbz-1F7WX2XiRA0zmDzXNlVimVpw52QkrvRkf0_rWZyNaupBbC0N1F-SJehqNuWB9p_kbY9x973KevovVZzgjaGqI8YOaElMtjGLK018VJrSV3DYlPBD1VSg1lfvxxYkPVub/s640/AAA_TestTableData_NotCompanySpecific.jpg&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Eg.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;It exported all records regardless of the company context.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEig689u2DhxP9dSB46pwqVrZVkdVSxRj4pFMksy1zlHG2Cck_xdc3u1UF8s6Fz0Xf7LTQfDnDb90jLbr6NS9Yet-F9bShmTSZIYXx7ihQCcQcGDMDM6NHTjURGMuhidlnqy6gbGa_Dd9_S1/s1600/AAA_TestTableData_All.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;101&quot; data-original-width=&quot;268&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEig689u2DhxP9dSB46pwqVrZVkdVSxRj4pFMksy1zlHG2Cck_xdc3u1UF8s6Fz0Xf7LTQfDnDb90jLbr6NS9Yet-F9bShmTSZIYXx7ihQCcQcGDMDM6NHTjURGMuhidlnqy6gbGa_Dd9_S1/s1600/AAA_TestTableData_All.jpg&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;If the Entity is used through OData service call, then the above changes is not required to make the data export cross-company. It just need to add the &quot;cross-company=true&quot; parameter to the service URL. Eg.&amp;nbsp;https://demoaos.cloudax.dynamics.com/data/AAA_TestTable?cross-company=true.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;For more details, refers to&amp;nbsp;https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/data-entities/cross-company-behavior&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/2737324654062792858/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2017/07/data-management-entity-export-for-all.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/2737324654062792858'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/2737324654062792858'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2017/07/data-management-entity-export-for-all.html' title='Data Management Entity export for all companies'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiVPN3_WeCaThx0EJkDs8FQ4cKz2jjvfJjVONcr-B66zbyqyxi1vfyJ2fNWTRO_dC65atcKeL3hH0Ay04qYeEkOEcL6NmyRTRHGBwNrRJVemB3X2Qn6kQcnP0v-dTbhOWj39AxPp2EMcBM/s72-c/AAA_TestTableData.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-699135693954362057</id><published>2017-07-14T13:23:00.003+01:00</published><updated>2017-07-14T13:23:50.651+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DIXF"/><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics AX"/><title type='text'>DIXF - System.Security.Cryptography.CryptographicException: Key not valid for use in specified state</title><content type='html'>&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Had this error each time we replaced the business database in our Test environment.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;It occur at the Data Import Export Framework &amp;gt; Setup &amp;gt; Source data format &amp;gt; Validate (button).&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Took a quick look at the code which causes this error, it came from&amp;nbsp;\Data Dictionary\Tables\DMFDataSourceProperties\Methods\validateConnectionString - Ln 49, on the statement &quot;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;cryptoblob2str(WinAPIServer::cryptUnProtectData(_dmfDataSourceProperties.Password))&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&quot;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;It is trying to decrypt data that&#39;s encrypted from another environment, which will cause error in this case. The &quot;Password&quot; field in the table is storing the encrypted data. Our setup is to use &quot;System DSN &quot; from the &quot;AOS&quot;, so there&#39;re two way for us to fix it:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;1. Clear the &quot;Password&quot; field from back-end (Eg.&amp;nbsp;DMFDataSourceProperties.Password = conNull();&amp;nbsp;DMFDataSourceProperties.update();)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;2. Delete the existing record and create a new one with the exact same setup&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;It works in our case due to we just need this field to be empty as it won&#39;t be used.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;u&gt;Detail error message&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;System.Reflection.TargetInvocationException: Exception has
been thrown by the target of an invocation. ---&amp;gt;
System.Security.Cryptography.CryptographicException: Key not valid for use in
specified state.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; at
System.Security.Cryptography.ProtectedData.Unprotect(Byte[] encryptedData,
Byte[] optionalEntropy, DataProtectionScope scope)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; --- End of inner
exception stack trace ---&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; at System.RuntimeMethodHandle.InvokeMethod(Object
target, Object[] arguments, Signature sig, Boolean constructor)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; at
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[]
parameters, Object[] arguments)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; at
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr,
Binder binder, Object[] parameters, CultureInfo culture)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; at
Microsoft.Dynamics.AX.ManagedInterop.ClrBridgeCore.InvokeClrStaticMethod(Char*
pszClassName, Char* pszMethodName, Char* assemblyName, Int32 argsLength,
ObjectWrapper** arguments, Boolean* argsAreByRef, Boolean* isException)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/699135693954362057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2017/07/dixf-systemsecuritycryptographycryptogr.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/699135693954362057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/699135693954362057'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2017/07/dixf-systemsecuritycryptographycryptogr.html' title='DIXF - System.Security.Cryptography.CryptographicException: Key not valid for use in specified state'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-2705115222618263503</id><published>2017-07-09T02:15:00.001+01:00</published><updated>2017-07-09T02:15:32.445+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="D365"/><category scheme="http://www.blogger.com/atom/ns#" term="D365O"/><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics 365"/><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics AX"/><title type='text'>Error - The field &#39;FieldName&#39; on the extension &#39;ExtensionName.Extension&#39; already exists. This extension cannot be applied to the base element.</title><content type='html'>&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;In a recent D365O development, I came across this error when moving fields from a model to another model.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: red; font-family: Verdana, sans-serif;&quot;&gt;The field &#39;FieldName&#39; on the extension &#39;ExtensionName.Extension&#39; already exists. This extension cannot be applied to the base element.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;The scenario is that while doing testing on development, some fields have been moved to the standard element (overlayered it by &quot;Customize&quot;) [Eg. This is in ModelA]. When the test is done, these field are then moved back to the extension [Eg. This is in ModelB]. Unfortunately after moved it back to the extension, this error occur during the build of the solution.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;This is what has been derived:&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;When the fields are moved to the base element, a build is done and the assembly is updated&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;After the testing is done, the change on the base element is deleted (deleting the whole overlayered element)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Then used the &quot;Get latest&quot; to restore the extension (it is where the fields are originally created)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Then build solution again and error occur&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;I&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;t is suspected that after the change in base element is deleted, the reference to the assembly still there. Hence, when building the solution of the extension, it found that the same fields already exist in the base element.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;u&gt;Solution&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;In Visual Studio, go to Dynamics 365 &amp;gt; Build models&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Select only the model where the base element sit (Eg. Application suite)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Build it&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Then build the solution again&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;/span&gt;&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/2705115222618263503/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2017/07/error-field-fieldname-on-extension.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/2705115222618263503'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/2705115222618263503'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2017/07/error-field-fieldname-on-extension.html' title='Error - The field &#39;FieldName&#39; on the extension &#39;ExtensionName.Extension&#39; already exists. This extension cannot be applied to the base element.'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-4316363843479537660</id><published>2017-05-03T10:34:00.004+01:00</published><updated>2017-06-22T05:30:36.620+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AX7"/><category scheme="http://www.blogger.com/atom/ns#" term="D365"/><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics 365"/><title type='text'>D365 - You are not authorized to login with your current credentials</title><content type='html'>&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;If you&#39;re restoring Dynamics 365 for Operation database with a backup from another environment, one of the error you might get is &quot;&lt;span style=&quot;color: red;&quot;&gt;You are not authorized to login with your current credentials. You will be redirected to the login page in a few seconds.&lt;/span&gt;&quot;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9qUGPDc_wf2on5FirpIt6FqbvjLN0se8JT9efZE1tbQC7MD47FvzC2qnzXInrt7fTr9mdeZmB28_ulvJE47R66RacB4hhU7IuqYE1w_oJACwd1DntY9HlrPA3CthALqlWrzIi1fP9UFuo/s1600/D365_LoginError.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;211&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9qUGPDc_wf2on5FirpIt6FqbvjLN0se8JT9efZE1tbQC7MD47FvzC2qnzXInrt7fTr9mdeZmB28_ulvJE47R66RacB4hhU7IuqYE1w_oJACwd1DntY9HlrPA3CthALqlWrzIi1fP9UFuo/s640/D365_LoginError.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;To fix that, you just need to rerun the &quot;AdminUserProvisioning&quot; tool again.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;If you&#39;re still getting the error after running the provisioning tool, check the event log.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;One of the possible cause would be this database from another environment hasn&#39;t been sync with your environment yet, hence, giving some error of this or that field is not found, etc.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Try synchronize the DB, then do an iisreset.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/4316363843479537660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2017/05/d365-you-are-not-authorized-to-login.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/4316363843479537660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/4316363843479537660'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2017/05/d365-you-are-not-authorized-to-login.html' title='D365 - You are not authorized to login with your current credentials'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9qUGPDc_wf2on5FirpIt6FqbvjLN0se8JT9efZE1tbQC7MD47FvzC2qnzXInrt7fTr9mdeZmB28_ulvJE47R66RacB4hhU7IuqYE1w_oJACwd1DntY9HlrPA3CthALqlWrzIi1fP9UFuo/s72-c/D365_LoginError.jpg" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-7417038949698477299</id><published>2017-02-21T14:43:00.000+00:00</published><updated>2017-02-21T14:43:25.109+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Query Optimization"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Ineffective execution plan due to outdated statistics</title><content type='html'>Recently encounter a performance issue where the query plan generated is ineffective due to outdated statistics.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;There&#39;a batch job periodically updating a table (&lt;i&gt;recurrence job&lt;/i&gt;) based on the daily activities on another table&lt;/li&gt;
&lt;li&gt;External call from web - calling a stored proc and executed a query (&lt;i&gt;generated the execution plan and cached it&lt;/i&gt;)&lt;/li&gt;
&lt;li&gt;One of the occurrence has made large number of record update but not large enough to hit the threshold to trigger statistic update&lt;/li&gt;
&lt;li&gt;External call from web - calling the same stored proc&lt;/li&gt;
&lt;li&gt;Due to the large update on #3 has cause the data changes, the query plan no longer effective&lt;/li&gt;
&lt;li&gt;The query in the stored proc is running extremely long&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
TableA: ~16m records&lt;/div&gt;
&lt;div&gt;
TableB: ~1m records&lt;/div&gt;
&lt;div&gt;
TableC: ~100k records&lt;/div&gt;
&lt;div&gt;
TableD: ~10k records&lt;/div&gt;
&lt;div&gt;
TableE: ~5 records&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The query in the stored proc is joining a few table (&lt;i&gt;Eg. TableA - E&lt;/i&gt;), one of the table always has very few records (between 1 to 10), on normal circumstances, the query always generated a query plan which join TableE first to other table so that it reduce the number of records required on the next join to the rest of the table.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
But somehow the first run of the stored proc has generated a query plan which use TableC as first join, joining it to TableA, then to TableB, TableD, and TableE. This appear to be correct on that run itself due to the parameter value passed in does run (&lt;i&gt;slightly&lt;/i&gt;) better with this plan. But the next time when it run, unfortunately the previously cached plan is bad for that parameter, it has cause the query run much longer.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
TableE is specifically designed to reduce the join operation, but unfortunately on the bad query plan, it put it to the last join operation, hence doing a lot of unnecessary join.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The solution we put in is to make the TableE join with TableA as subquery.&lt;/div&gt;
&lt;div&gt;
All other join has where condition which correlated to TableA, so this will make the subquery being executed first, this then achieve our initial purpose, to ensure the join order always has the TableE first, then the rest of the order does not matter, they can be join as SQL optimizer feel appropriate.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/7417038949698477299/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2017/02/ineffective-execution-plan-due-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/7417038949698477299'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/7417038949698477299'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2017/02/ineffective-execution-plan-due-to.html' title='Ineffective execution plan due to outdated statistics'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-5670886143732696321</id><published>2017-02-21T14:30:00.002+00:00</published><updated>2017-02-21T14:30:58.833+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics AX"/><title type='text'>Performance improvement on sp_WHSOnHand / sp_WHSOnHandWithDelta</title><content type='html'>&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;These two stored procedure are generated by AX during synchronization (&lt;i&gt;there&#39;re others as well, but not the focus of this post&lt;/i&gt;).&lt;/span&gt;&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- sp_WHSOnHand&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- sp_WHSOnHandWithDelta&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;In our environment (&lt;i&gt;with certain amount of data&lt;/i&gt;), it tooks around 250ms to execute, although this number looks small, but when you have 100 of them being executed, that&#39;s 25,000ms (25 seconds), it is a different story then. A wait of 25s isn&#39;t something nice for the user.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Analyzing the query plan shows that it starts from InventDim, getting a large number of records and then nested loop to WHSInventReserve and so on. Looking at the thickness of the arrow next to InventDim, that&#39;s an indicator that a large number of rows are returned from that operator. That means it is operating that large number of rows against the WHSInventReserve.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;This is the major bottleneck of the query.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;We&#39;ve tried update statistics and reindex and clear the cache to make sure it generate a new plan, but it still generate the same execution plan.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Due to this stored procedure has an ItemId provided, it should limit the number of rows from the WHSInventReserve, using this limited number of rows and nested loop against the InventDim would be much quicker, but somehow the optimizer didn&#39;t think so.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjar8_gZQyTeD9kEYPtzUulFB5uQLjQt4rdT-ALYiVfLDmD3WxbmouNSxBay9ZjrfJABGcaA7oIOAZ3IXMAUhh2r2oJ23L0Pv8GYq019Oc4yiuhqWD_mB4y-usIIBVyMWRlqPrA7fLd6Gss/s1600/sp_WHSOnHand_BadQueryPlan.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;373&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjar8_gZQyTeD9kEYPtzUulFB5uQLjQt4rdT-ALYiVfLDmD3WxbmouNSxBay9ZjrfJABGcaA7oIOAZ3IXMAUhh2r2oJ23L0Pv8GYq019Oc4yiuhqWD_mB4y-usIIBVyMWRlqPrA7fLd6Gss/s640/sp_WHSOnHand_BadQueryPlan.jpg&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Bad query plan&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;To resolve this problem, I&#39;m splitting this query into two parts.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;First, filter the WHSInventReserve with the ItemId provided and insert it into a table variable.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Then join this table variable to the InventDim. Although the sum of the estimated subtree cost of the original query and the new 2-parts query is similar, but it runs much quicker than the original version.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9T3uC4QbiEOIgTmvo9LAd8PBwqtzks-OW74SaRbxzueuNj4zxdbM69t0ZKcm4er7qfG5EHZIfMYk7Rcoto9TvUl45pP-Tbjx3LAlMcTQ9jH31jMuAu_OBl0kg10b1bZChbduyRswADfpq/s1600/sp_WHSOnHand_BetterQueryPlan.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;232&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9T3uC4QbiEOIgTmvo9LAd8PBwqtzks-OW74SaRbxzueuNj4zxdbM69t0ZKcm4er7qfG5EHZIfMYk7Rcoto9TvUl45pP-Tbjx3LAlMcTQ9jH31jMuAu_OBl0kg10b1bZChbduyRswADfpq/s640/sp_WHSOnHand_BetterQueryPlan.jpg&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Better query plan&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;With this new change, the stored procedure completed in 7ms instead of 250ms.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlEBzE4mh3FJyHd7uL_QCD93-nZS9klcFfl8tOu0zp8yeAiqRwNVWPfZfLWFpvz9cF8Z4PJUkPdpKFPcPLhqoED8_kzjAQFXpwkeuHWAh24iulv1RXfrinRB5DjYuUH7BZ58gmlkhQcGH9/s1600/sp_WHSOnHand_OriginalQueryJoin.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;220&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlEBzE4mh3FJyHd7uL_QCD93-nZS9klcFfl8tOu0zp8yeAiqRwNVWPfZfLWFpvz9cF8Z4PJUkPdpKFPcPLhqoED8_kzjAQFXpwkeuHWAh24iulv1RXfrinRB5DjYuUH7BZ58gmlkhQcGH9/s640/sp_WHSOnHand_OriginalQueryJoin.jpg&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Original query join&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxSkCCE5atjZP_wyUYiU7O998Wng4Bv4fLkFYliF43hBFasqOx04n7pcxTFAEwZxC8U7bSIRrpDmjbX9Cw3RBnxTbFHpEh2apXPv4ed47IyRSKwRqfutjo6z2oK0ZMzhlb2o3cZ2njv3T3/s1600/sp_WHSOnHand_NewQueryJoin.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;453&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxSkCCE5atjZP_wyUYiU7O998Wng4Bv4fLkFYliF43hBFasqOx04n7pcxTFAEwZxC8U7bSIRrpDmjbX9Cw3RBnxTbFHpEh2apXPv4ed47IyRSKwRqfutjo6z2oK0ZMzhlb2o3cZ2njv3T3/s640/sp_WHSOnHand_NewQueryJoin.jpg&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;New query join&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;The stored procedure should be changed from within AX at the &#39;WHSOnHandSPHelper&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&#39; class. When synchronization is run, it regenerate this stored procedure. It also regenerate when stock dimension setup is changed.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Below is a sample of complete stored procedure code generated by the &#39;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;WHSOnHandSPHelper&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&#39; class (&lt;i&gt;Do take note, the selection field changed based on the stock dimension setup&lt;/i&gt;).&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;=================================================&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;PROCEDURE&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;[dbo]&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;[sp_WHSOnHand]&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;

&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@PARTITION&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;bigint&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@DATAAREAID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;4&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@ITEMID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;20&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSITEID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSITEIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; 1024&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTLOCATIONID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: teal;&quot;&gt;@INVENTLOCATIONIDLEVEL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;
&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; 1024&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@WMSLOCATIONID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@WMSLOCATIONIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; 1024&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@WMSPALLETID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;18&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@WMSPALLETIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; 1024&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSTATUSID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSTATUSIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; 1024&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@LICENSEPLATEID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;25&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@LICENSEPLATEIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; 1024&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTBATCHID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;20&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTBATCHIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; 1024&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSERIALID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;20&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSERIALIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; 1024&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTPROFILEID_RU&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTPROFILEID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; 1024&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTOWNERID_RU&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;20&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTOWNERID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; 1024&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTGTDID_RU&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;30&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTGTDID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; 1024&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@CONFIGID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSIZEID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTCOLORID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSTYLEID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;-- Output
parameters&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@AVAILPHYSICAL&lt;/span&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;numeric&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;32&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; 16&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;OUTPUT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@AVAILORDERED&lt;/span&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;numeric&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;32&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; 16&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;OUTPUT&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;AS&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;--
Without nocount on the procedure will return number of affected rows in the
result set which is&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;--
harmful to performance and requires us to adjust field retrieval when calling
the stored procedure&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;NOCOUNT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ON&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;-- We
need to supress warnings when trying to aggregate NULL columns. This is a valid
business scenario&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;-- and
happens e.g. for a non-LP controlled location with batch below item.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;ANSI_WARNINGS&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;OFF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;-- The
@RESULT table variable is used to store intermediate quantities.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@RESULT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICALRESULT&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;numeric&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;32&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; 16&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;-- Aggregated minimum qtys from lower level in @RESULT&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;AVAILORDEREDRESULT&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;numeric&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;32&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; 16&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;-- Aggregated minimum qtys from lower level in @RESULT&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICALFOUND&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;numeric&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;32&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; 16&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;-- Aggregated qty for current level in WHSInventReserve&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;AVAILORDEREDFOUND&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;numeric&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;32&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; 16&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;-- Aggregated qty for current level in WHSInventReserve&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;HIERARCHYLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;CONFIGID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSIZEID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTCOLORID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSTYLEID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSITEID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTLOCATIONID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;WMSLOCATIONID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;WMSPALLETID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;18&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSTATUSID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;LICENSEPLATEID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;25&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTBATCHID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;20&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSERIALID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;20&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTPROFILEID_RU&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTOWNERID_RU&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;20&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTGTDID_RU&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;30&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@DIMLIST&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIMID&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;nvarchar &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;20&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICAL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;numeric&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;32&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; 16&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;AVAILORDERED&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;numeric&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;32&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; 16&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;-- The
algorithm of the stored procedure is as follows:&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;-- 1. Initialize
the @RESULT table with aggregated qtys in WHSInventReserve for the level
requested by user&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;-- 2.
Traverse the hierarchy up and for each level:&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;--&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1) Aggregate qtys from previous level in
@RESULT grouping by dimensions of current hierarchy level&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;--&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2) Aggregate qtys from current level in
WHSInventReserve grouping by dimensions of current hierarchy level&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;--&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3) Select the minimum of the above qtys
and insert into @RESULT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;-- 3.
When hierarchy level 0 is reached, return the sum of aggregated qtys in @RESULT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;-- In the
original query (the one after below query), it is joining InventDim and
WHSInventReserve and filter records based on some criteria.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;-- But in
the execution plan, it doesn&#39;t seems to generate a good plan (even after UPDATE
STATISTICS). In the original execution plan, it always&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;-- Get
records from InventDim first, which returns lot of rows, then only join it to
WHSInventReserve and continue filter from there.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;-- If we
makes it get records from WHSInventReserve first, filter it, then with lesser
rows from here, join it to InventDim, it will be quicker.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;-- So the
optimization is to filter WHSInventResreve first, then use this result at the
original query. In the test, this has reduce the execution&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;-- time
from ~250ms to ~7ms&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;INSERT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;INTO&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@DIMLIST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTDIMID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICAL&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILORDERED&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIMID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICAL&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILORDERED&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WHSINVENTRESERVE&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WHSINVENTRESERVE&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WHSINVENTRESERVE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ITEMID&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@ITEMID&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WHSINVENTRESERVE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;PARTITION&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@PARTITION&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WHSINVENTRESERVE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;DATAAREAID&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@DATAAREAID&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WHSINVENTRESERVE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;HIERARCHYLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;--
Initialize the @RESULT variable.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;-- Loads
aggregated data for the lowest level requested by user.&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;INSERT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;INTO&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@RESULT&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICALRESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILORDEREDRESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICALFOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILORDEREDFOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;HIERARCHYLEVEL&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;CONFIGID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSIZEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTCOLORID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSTYLEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSITEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTLOCATIONID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WMSLOCATIONID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WMSPALLETID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSTATUSID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;LICENSEPLATEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTBATCHID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSERIALID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTPROFILEID_RU&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTOWNERID_RU&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTGTDID_RU&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: magenta;&quot;&gt;SUM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;DIMLIST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICAL&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;SUM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;DIMLIST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;AVAILORDERED&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;NULL,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;CONFIGID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSIZEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTCOLORID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTYLEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSITEIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSITEID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTLOCATIONIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSLOCATIONIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSPALLETIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSPALLETID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSTATUSIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTATUSID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LICENSEPLATEIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;LICENSEPLATEID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTBATCHIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTBATCHID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSERIALIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSERIALID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTPROFILEID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTPROFILEID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTOWNERID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTOWNERID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTGTDID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTGTDID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;JOIN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@DIMLIST&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;DIMLIST&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;ON&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTDIMID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;DIMLIST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTDIMID&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;DATAAREAID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@DATAAREAID&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;PARTITION&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@PARTITION&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@CONFIGID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;CONFIGID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@CONFIGID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@INVENTSIZEID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSIZEID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSIZEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@INVENTCOLORID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTCOLORID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTCOLORID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@INVENTSTYLEID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTYLEID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSTYLEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSITEIDLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;@INVENTSITEID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt;
&lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSITEID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSITEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTLOCATIONIDLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;@INVENTLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt;
&lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTLOCATIONID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSLOCATIONIDLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;@WMSLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt;
&lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSLOCATIONID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSPALLETIDLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSPALLETID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSPALLETID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSPALLETID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSTATUSIDLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;@INVENTSTATUSID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt;
&lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSTATUSID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTATUSID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LICENSEPLATEIDLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;@LICENSEPLATEID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt;
&lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LICENSEPLATEID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;LICENSEPLATEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTBATCHIDLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;@INVENTBATCHID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt;
&lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTBATCHID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTBATCHID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSERIALIDLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;@INVENTSERIALID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt;
&lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSERIALID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSERIALID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTPROFILEID_RULEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;@INVENTPROFILEID_RU&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt;
&lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTPROFILEID_RU&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTPROFILEID_RU&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTOWNERID_RULEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;@INVENTOWNERID_RU&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt;
&lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTOWNERID_RU&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTOWNERID_RU&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTGTDID_RULEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;@INVENTGTDID_RU&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt;
&lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTGTDID_RU&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTGTDID_RU&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;GROUP&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;CONFIGID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSIZEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTCOLORID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTYLEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSITEIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSITEID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTLOCATIONIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSLOCATIONIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSPALLETIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSPALLETID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSTATUSIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTATUSID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LICENSEPLATEIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;LICENSEPLATEID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTBATCHIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTBATCHID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSERIALIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSERIALID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTPROFILEID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTPROFILEID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTOWNERID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTOWNERID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTGTDID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTGTDID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;WHILE &lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;@LEVEL&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt; 0&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;BEGIN&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;DELETE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@DIMLIST&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;INSERT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;INTO&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@DIMLIST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTDIMID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICAL&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILORDERED&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIMID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICAL&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILORDERED&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WHSINVENTRESERVE&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WHSINVENTRESERVE&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WHSINVENTRESERVE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;HIERARCHYLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WHSINVENTRESERVE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ITEMID&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@ITEMID&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WHSINVENTRESERVE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;PARTITION&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@PARTITION&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WHSINVENTRESERVE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;DATAAREAID&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@DATAAREAID&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;INSERT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;INTO&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@RESULT&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICALRESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILORDEREDRESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICALFOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILORDEREDFOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;HIERARCHYLEVEL&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;CONFIGID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSIZEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTCOLORID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSTYLEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSITEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTLOCATIONID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WMSLOCATIONID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WMSPALLETID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSTATUSID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;LICENSEPLATEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTBATCHID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSERIALID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTPROFILEID_RU&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTOWNERID_RU&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTGTDID_RU&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: magenta;&quot;&gt;SUM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICALFOUND&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICALRESULT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICALFOUND&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICALRESULT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;SUM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;AVAILORDEREDFOUND&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;AVAILORDEREDRESULT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;AVAILORDEREDFOUND&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;AVAILORDEREDRESULT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;SUM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICAL&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;SUM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;AVAILORDERED&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;CONFIGID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;CONFIGID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSIZEID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSIZEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTCOLORID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTCOLORID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTYLEID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSTYLEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSITEIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSITEID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTLOCATIONIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSLOCATIONIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSPALLETIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSPALLETID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSTATUSIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTATUSID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LICENSEPLATEIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;LICENSEPLATEID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTBATCHIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTBATCHID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSERIALIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSERIALID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTPROFILEID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTPROFILEID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTOWNERID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTOWNERID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTGTDID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTGTDID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@RESULT&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;LEFT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;OUTER&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;JOIN&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: magenta;&quot;&gt;SUM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;DIMLIST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICAL&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICAL&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;SUM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;DIMLIST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;AVAILORDERED&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILORDERED&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;CONFIGID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;CONFIGID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSIZEID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSIZEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTCOLORID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTCOLORID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTYLEID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSTYLEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSITEIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSITEID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSITEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTLOCATIONIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTLOCATIONID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSLOCATIONIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WMSLOCATIONID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSPALLETIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSPALLETID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;WMSPALLETID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSTATUSIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTATUSID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSTATUSID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LICENSEPLATEIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;LICENSEPLATEID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;LICENSEPLATEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTBATCHIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTBATCHID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTBATCHID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSERIALIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSERIALID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTSERIALID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTPROFILEID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTPROFILEID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTPROFILEID_RU&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTOWNERID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTOWNERID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTOWNERID_RU&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTGTDID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTGTDID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTGTDID_RU&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;JOIN&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@DIMLIST&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;DIMLIST&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;ON&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;PARTITION&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@PARTITION&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;DATAAREAID&lt;/span&gt;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@DATAAREAID&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTDIMID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;DIMLIST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTDIMID&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;GROUP&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;CONFIGID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSIZEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTCOLORID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTYLEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSITEIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSITEID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTLOCATIONIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSLOCATIONIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSPALLETIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSPALLETID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSTATUSIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTATUSID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LICENSEPLATEIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;LICENSEPLATEID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTBATCHIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTBATCHID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSERIALIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSERIALID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTPROFILEID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTPROFILEID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTOWNERID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTOWNERID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTGTDID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;INVENTDIM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTGTDID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ON &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;CONFIGID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;CONFIGID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSIZEID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSIZEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTCOLORID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTCOLORID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTYLEID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTYLEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSITEIDLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSITEID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSITEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTLOCATIONIDLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTLOCATIONID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSLOCATIONIDLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSLOCATIONID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSPALLETIDLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSPALLETID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSPALLETID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSTATUSIDLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTATUSID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTATUSID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LICENSEPLATEIDLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;LICENSEPLATEID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;LICENSEPLATEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTBATCHIDLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTBATCHID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTBATCHID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSERIALIDLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSERIALID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSERIALID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTPROFILEID_RULEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTPROFILEID_RU&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTPROFILEID_RU&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTOWNERID_RULEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTOWNERID_RU&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTOWNERID_RU&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTGTDID_RULEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTGTDID_RU&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;FOUND&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTGTDID_RU&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;HIERARCHYLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;GROUP&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;CONFIGID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSIZEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTCOLORID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTYLEID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSITEIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSITEID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTLOCATIONIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSLOCATIONIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSLOCATIONID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@WMSPALLETIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;WMSPALLETID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSTATUSIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSTATUSID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LICENSEPLATEIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;LICENSEPLATEID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTBATCHIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTBATCHID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTSERIALIDLEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTSERIALID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTPROFILEID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTPROFILEID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTOWNERID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTOWNERID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;1 &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@INVENTGTDID_RULEVEL&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;RESULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;INVENTGTDID_RU&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@LEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt; 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: green;&quot;&gt;-- WHILE&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@AVAILPHYSICAL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: magenta;&quot;&gt;SUM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICALFOUND&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICALRESULT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICALFOUND&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;AVAILPHYSICALRESULT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;@AVAILORDERED&lt;/span&gt;
&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: magenta;&quot;&gt;SUM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILORDEREDFOUND&lt;/span&gt;
&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILORDEREDRESULT&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILORDEREDFOUND&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;AVAILORDEREDRESULT&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@RESULT&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;HIERARCHYLEVEL&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; 0&lt;span style=&quot;color: grey;&quot;&gt;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;GO&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;=================================================&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Below is the XPO extract of the updated &#39;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;WHSOnHandSPHelper&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&#39; class&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;=================================================&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;Exportfile for AOT version 1.0 or later&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;Formatversion: 1&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;***Element: CLS&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;; Microsoft Dynamics AX Class: WHSOnHandSPHelper unloaded&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;; --------------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; CLSVERSION 1&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; CLASS #WHSOnHandSPHelper&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; PROPERTIES&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Name &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#WHSOnHandSPHelper&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Origin &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#{E0CDDBB5-8AE5-4BEF-9B5B-A41A300F36E5}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; ENDPROPERTIES&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; METHODS&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SOURCE #buildCreateSPStmt&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #private str buildCreateSPStmt(boolean _includeDelta)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ret = &#39;&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ListEnumerator &amp;nbsp;enabledDimsEnumerator;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ListEnumerator &amp;nbsp;productDimensionsEnumerator;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;FieldId &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dimFieldId;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dimFieldName;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;boolean &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; isSerialEnabled;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;if(useOptimizedVersion)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret = this.TEC_buildCreateSPStmt(_includeDelta);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;else&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;InventDimMetaDataCache::clearCache(); //in some cases the cache is not updated before sync making below SP&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;enabledDimsEnumerator = this.enabledDimensions().getEnumerator();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;productDimensionsEnumerator = this.productDimensions().getEnumerator();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;isSerialEnabled = this.getEnabledDimsParametersMap().exists(fieldNum(InventDim, InventSerialId));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/*&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #CREATE PROCEDURE [sp_WHSOnHand]&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@PARTITION bigint,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@LEVEL int,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@DATAAREAID nvarchar (4),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@ITEMID nvarchar (20),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTSITEID nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTSITEIDLEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTLOCATIONID nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTLOCATIONIDLEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@WMSLOCATIONID nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@WMSLOCATIONIDLEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@WMSPALLETID nvarchar (18) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@WMSPALLETIDLEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTSTATUSID nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTSTATUSIDLEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@LICENSEPLATEID nvarchar (25) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@LICENSEPLATEIDLEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTBATCHID nvarchar (20) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTBATCHIDLEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTSERIALID nvarchar (20) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTSERIALIDLEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTPROFILEID_RU nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTPROFILEID_RULEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTOWNERID_RU nvarchar (20) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTOWNERID_RULEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTGTDID_RU nvarchar (30) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTGTDID_RULEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@CONFIGID nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTSIZEID nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTCOLORID nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTSTYLEID nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;-- Output parameters&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@AVAILPHYSICAL &amp;nbsp;numeric(32, 16) OUTPUT,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@AVAILORDERED &amp;nbsp;numeric(32, 16) OUTPUT&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #AS&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- Without nocount on the procedure will return number of affected rows in the result set which is&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- harmful to performance and requires us to adjust field retrieval when calling the stored procedure&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #SET NOCOUNT ON;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- We need to supress warnings when trying to aggregate NULL columns. This is a valid business scenario&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- and happens e.g. for a non-LP controlled location with batch below item.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #SET ANSI_WARNINGS OFF;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- The @RESULT table variable is used to store intermediate quantities.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #DECLARE @RESULT TABLE(&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;AVAILPHYSICALRESULT numeric(32, 16) NOT NULL, -- Aggregated minimum qtys from lower level in @RESULT&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;AVAILORDEREDRESULT numeric(32, 16) NOT NULL, -- Aggregated minimum qtys from lower level in @RESULT&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;AVAILPHYSICALFOUND numeric(32, 16), -- Aggregated qty for current level in WHSInventReserve&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;AVAILORDEREDFOUND numeric(32, 16), -- Aggregated qty for current level in WHSInventReserve&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;HIERARCHYLEVEL int NOT NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CONFIGID nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTSIZEID nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTCOLORID nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTSTYLEID nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTSITEID nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTLOCATIONID nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;WMSLOCATIONID nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;WMSPALLETID nvarchar (18) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTSTATUSID nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;LICENSEPLATEID nvarchar (25) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTBATCHID nvarchar (20) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTSERIALID nvarchar (20) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTPROFILEID_RU nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTOWNERID_RU nvarchar (20) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTGTDID_RU nvarchar (30) NULL);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- The algorithm of the stored procedure is as follows:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- 1. Initialize the @RESULT table with aggregated qtys in WHSInventReserve for the level requested by user&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- 2. Traverse the hierarchy up and for each level:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- &amp;nbsp; &amp;nbsp; 1) Aggregate qtys from previous level in @RESULT grouping by dimensions of current hierarchy level&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- &amp;nbsp; &amp;nbsp; 2) Aggregate qtys from current level in WHSInventReserve grouping by dimensions of current hierarchy level&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- &amp;nbsp; &amp;nbsp; 3) Select the minimum of the above qtys and insert into @RESULT&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- 3. When hierarchy level 0 is reached, return the sum of aggregated qtys in @RESULT&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- Initialize the @RESULT variable.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- Loads aggregated data for the lowest level requested by user.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #INSERT INTO @RESULT (AVAILPHYSICALRESULT, AVAILORDEREDRESULT, AVAILPHYSICALFOUND, AVAILORDEREDFOUND, HIERARCHYLEVEL, CONFIGID, INVENTSIZEID, INVENTCOLORID, INVENTSTYLEID, INVENTSITEID, INVENTLOCATIONID, WMSLOCATIONID, WMSPALLETID, INVENTSTATUSID, LICENSEPLATEID, INVENTBATCHID, INVENTSERIALID, INVENTPROFILEID_RU, INVENTOWNERID_RU, INVENTGTDID_RU)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #SELECT SUM(WHSINVENTRESERVE.AVAILPHYSICAL),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;SUM(WHSINVENTRESERVE.AVAILORDERED),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@LEVEL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.CONFIGID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTSIZEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTCOLORID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTSTYLEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSITEIDLEVEL THEN INVENTDIM.INVENTSITEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTLOCATIONIDLEVEL THEN INVENTDIM.INVENTLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSLOCATIONIDLEVEL THEN INVENTDIM.WMSLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSPALLETIDLEVEL THEN INVENTDIM.WMSPALLETID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSTATUSIDLEVEL THEN INVENTDIM.INVENTSTATUSID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @LICENSEPLATEIDLEVEL THEN INVENTDIM.LICENSEPLATEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTBATCHIDLEVEL THEN INVENTDIM.INVENTBATCHID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSERIALIDLEVEL THEN INVENTDIM.INVENTSERIALID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTPROFILEID_RULEVEL THEN INVENTDIM.INVENTPROFILEID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTOWNERID_RULEVEL THEN INVENTDIM.INVENTOWNERID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTGTDID_RULEVEL THEN INVENTDIM.INVENTGTDID_RU ELSE NULL END&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;FROM WHSINVENTRESERVE WHSINVENTRESERVE&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;JOIN INVENTDIM ON INVENTDIM.INVENTDIMID = WHSINVENTRESERVE.INVENTDIMID AND INVENTDIM.DATAAREAID = WHSINVENTRESERVE.DATAAREAID AND INVENTDIM.PARTITION = WHSINVENTRESERVE.PARTITION&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;WHERE WHSINVENTRESERVE.ITEMID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = @ITEMID&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND WHSINVENTRESERVE.PARTITION &amp;nbsp; &amp;nbsp; &amp;nbsp;= @PARTITION&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND WHSINVENTRESERVE.DATAAREAID &amp;nbsp; &amp;nbsp; = @DATAAREAID&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND WHSINVENTRESERVE.HIERARCHYLEVEL = @LEVEL&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@CONFIGID IS NULL OR INVENTDIM.CONFIGID = @CONFIGID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@INVENTSIZEID IS NULL OR INVENTDIM.INVENTSIZEID = @INVENTSIZEID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@INVENTCOLORID IS NULL OR INVENTDIM.INVENTCOLORID = @INVENTCOLORID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@INVENTSTYLEID IS NULL OR INVENTDIM.INVENTSTYLEID = @INVENTSTYLEID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @INVENTSITEIDLEVEL OR @INVENTSITEID IS NULL OR @INVENTSITEID = INVENTDIM.INVENTSITEID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @INVENTLOCATIONIDLEVEL OR @INVENTLOCATIONID IS NULL OR @INVENTLOCATIONID = INVENTDIM.INVENTLOCATIONID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @WMSLOCATIONIDLEVEL OR @WMSLOCATIONID IS NULL OR @WMSLOCATIONID = INVENTDIM.WMSLOCATIONID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @WMSPALLETIDLEVEL OR @WMSPALLETID IS NULL OR @WMSPALLETID = INVENTDIM.WMSPALLETID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @INVENTSTATUSIDLEVEL OR @INVENTSTATUSID IS NULL OR @INVENTSTATUSID = INVENTDIM.INVENTSTATUSID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @LICENSEPLATEIDLEVEL OR @LICENSEPLATEID IS NULL OR @LICENSEPLATEID = INVENTDIM.LICENSEPLATEID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @INVENTBATCHIDLEVEL OR @INVENTBATCHID IS NULL OR @INVENTBATCHID = INVENTDIM.INVENTBATCHID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @INVENTSERIALIDLEVEL OR @INVENTSERIALID IS NULL OR @INVENTSERIALID = INVENTDIM.INVENTSERIALID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @INVENTPROFILEID_RULEVEL OR @INVENTPROFILEID_RU IS NULL OR @INVENTPROFILEID_RU = INVENTDIM.INVENTPROFILEID_RU)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @INVENTOWNERID_RULEVEL OR @INVENTOWNERID_RU IS NULL OR @INVENTOWNERID_RU = INVENTDIM.INVENTOWNERID_RU)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @INVENTGTDID_RULEVEL OR @INVENTGTDID_RU IS NULL OR @INVENTGTDID_RU = INVENTDIM.INVENTGTDID_RU)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #GROUP BY&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.CONFIGID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTSIZEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTCOLORID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTSTYLEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSITEIDLEVEL THEN INVENTDIM.INVENTSITEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTLOCATIONIDLEVEL THEN INVENTDIM.INVENTLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSLOCATIONIDLEVEL THEN INVENTDIM.WMSLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSPALLETIDLEVEL THEN INVENTDIM.WMSPALLETID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSTATUSIDLEVEL THEN INVENTDIM.INVENTSTATUSID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @LICENSEPLATEIDLEVEL THEN INVENTDIM.LICENSEPLATEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTBATCHIDLEVEL THEN INVENTDIM.INVENTBATCHID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSERIALIDLEVEL THEN INVENTDIM.INVENTSERIALID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTPROFILEID_RULEVEL THEN INVENTDIM.INVENTPROFILEID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTOWNERID_RULEVEL THEN INVENTDIM.INVENTOWNERID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTGTDID_RULEVEL THEN INVENTDIM.INVENTGTDID_RU ELSE NULL END;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #WHILE (@LEVEL &amp;gt; 0)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #BEGIN&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INSERT INTO @RESULT (AVAILPHYSICALRESULT, AVAILORDEREDRESULT, AVAILPHYSICALFOUND, AVAILORDEREDFOUND, HIERARCHYLEVEL, CONFIGID, INVENTSIZEID, INVENTCOLORID, INVENTSTYLEID, INVENTSITEID, INVENTLOCATIONID, WMSLOCATIONID, WMSPALLETID, INVENTSTATUSID, LICENSEPLATEID, INVENTBATCHID, INVENTSERIALID, INVENTPROFILEID_RU, INVENTOWNERID_RU, INVENTGTDID_RU)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #SELECT SUM(CASE WHEN RESULT.AVAILPHYSICALFOUND &amp;lt; RESULT.AVAILPHYSICALRESULT THEN RESULT.AVAILPHYSICALFOUND ELSE RESULT.AVAILPHYSICALRESULT END),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;SUM(CASE WHEN RESULT.AVAILORDEREDFOUND &amp;lt; RESULT.AVAILORDEREDRESULT THEN RESULT.AVAILORDEREDFOUND ELSE RESULT.AVAILORDEREDRESULT END),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;SUM(FOUND.AVAILPHYSICAL),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;SUM(FOUND.AVAILORDERED),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@LEVEL + -1,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;RESULT.CONFIGID AS CONFIGID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;RESULT.INVENTSIZEID AS INVENTSIZEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;RESULT.INVENTCOLORID AS INVENTCOLORID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;RESULT.INVENTSTYLEID AS INVENTSTYLEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSITEIDLEVEL THEN RESULT.INVENTSITEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTLOCATIONIDLEVEL THEN RESULT.INVENTLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSLOCATIONIDLEVEL THEN RESULT.WMSLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSPALLETIDLEVEL THEN RESULT.WMSPALLETID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSTATUSIDLEVEL THEN RESULT.INVENTSTATUSID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @LICENSEPLATEIDLEVEL THEN RESULT.LICENSEPLATEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTBATCHIDLEVEL THEN RESULT.INVENTBATCHID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSERIALIDLEVEL THEN RESULT.INVENTSERIALID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTPROFILEID_RULEVEL THEN RESULT.INVENTPROFILEID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTOWNERID_RULEVEL THEN RESULT.INVENTOWNERID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTGTDID_RULEVEL THEN RESULT.INVENTGTDID_RU ELSE NULL END&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #FROM @RESULT RESULT&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #LEFT OUTER JOIN (&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #SELECT SUM(WHSINVENTRESERVE.AVAILPHYSICAL) AS AVAILPHYSICAL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;SUM(WHSINVENTRESERVE.AVAILORDERED) AS AVAILORDERED,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.CONFIGID AS CONFIGID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTSIZEID AS INVENTSIZEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTCOLORID AS INVENTCOLORID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTSTYLEID AS INVENTSTYLEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSITEIDLEVEL THEN INVENTDIM.INVENTSITEID ELSE NULL END AS INVENTSITEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTLOCATIONIDLEVEL THEN INVENTDIM.INVENTLOCATIONID ELSE NULL END AS INVENTLOCATIONID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSLOCATIONIDLEVEL THEN INVENTDIM.WMSLOCATIONID ELSE NULL END AS WMSLOCATIONID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSPALLETIDLEVEL THEN INVENTDIM.WMSPALLETID ELSE NULL END AS WMSPALLETID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSTATUSIDLEVEL THEN INVENTDIM.INVENTSTATUSID ELSE NULL END AS INVENTSTATUSID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @LICENSEPLATEIDLEVEL THEN INVENTDIM.LICENSEPLATEID ELSE NULL END AS LICENSEPLATEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTBATCHIDLEVEL THEN INVENTDIM.INVENTBATCHID ELSE NULL END AS INVENTBATCHID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSERIALIDLEVEL THEN INVENTDIM.INVENTSERIALID ELSE NULL END AS INVENTSERIALID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTPROFILEID_RULEVEL THEN INVENTDIM.INVENTPROFILEID_RU ELSE NULL END AS INVENTPROFILEID_RU,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTOWNERID_RULEVEL THEN INVENTDIM.INVENTOWNERID_RU ELSE NULL END AS INVENTOWNERID_RU,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTGTDID_RULEVEL THEN INVENTDIM.INVENTGTDID_RU ELSE NULL END AS INVENTGTDID_RU&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #FROM WHSINVENTRESERVE WHSINVENTRESERVE&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #JOIN INVENTDIM ON INVENTDIM.PARTITION = WHSINVENTRESERVE.PARTITION&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;AND INVENTDIM.DATAAREAID &amp;nbsp;= WHSINVENTRESERVE.DATAAREAID&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;AND INVENTDIM.INVENTDIMID = WHSINVENTRESERVE.INVENTDIMID&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #WHERE WHSINVENTRESERVE.HIERARCHYLEVEL = @LEVEL + -1&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;AND WHSINVENTRESERVE.ITEMID &amp;nbsp; &amp;nbsp; &amp;nbsp; = @ITEMID&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;AND WHSINVENTRESERVE.PARTITION &amp;nbsp; &amp;nbsp;= @PARTITION&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;AND WHSINVENTRESERVE.DATAAREAID &amp;nbsp; = @DATAAREAID&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #GROUP BY&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.CONFIGID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTSIZEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTCOLORID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTSTYLEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSITEIDLEVEL THEN INVENTDIM.INVENTSITEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTLOCATIONIDLEVEL THEN INVENTDIM.INVENTLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSLOCATIONIDLEVEL THEN INVENTDIM.WMSLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSPALLETIDLEVEL THEN INVENTDIM.WMSPALLETID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSTATUSIDLEVEL THEN INVENTDIM.INVENTSTATUSID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @LICENSEPLATEIDLEVEL THEN INVENTDIM.LICENSEPLATEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTBATCHIDLEVEL THEN INVENTDIM.INVENTBATCHID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSERIALIDLEVEL THEN INVENTDIM.INVENTSERIALID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTPROFILEID_RULEVEL THEN INVENTDIM.INVENTPROFILEID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTOWNERID_RULEVEL THEN INVENTDIM.INVENTOWNERID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTGTDID_RULEVEL THEN INVENTDIM.INVENTGTDID_RU ELSE NULL END&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;) AS FOUND ON (RESULT.CONFIGID = FOUND.CONFIGID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (RESULT.INVENTSIZEID = FOUND.INVENTSIZEID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (RESULT.INVENTCOLORID = FOUND.INVENTCOLORID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (RESULT.INVENTSTYLEID = FOUND.INVENTSTYLEID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @INVENTSITEIDLEVEL OR RESULT.INVENTSITEID = FOUND.INVENTSITEID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @INVENTLOCATIONIDLEVEL OR RESULT.INVENTLOCATIONID = FOUND.INVENTLOCATIONID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @WMSLOCATIONIDLEVEL OR RESULT.WMSLOCATIONID = FOUND.WMSLOCATIONID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @WMSPALLETIDLEVEL OR RESULT.WMSPALLETID = FOUND.WMSPALLETID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @INVENTSTATUSIDLEVEL OR RESULT.INVENTSTATUSID = FOUND.INVENTSTATUSID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @LICENSEPLATEIDLEVEL OR RESULT.LICENSEPLATEID = FOUND.LICENSEPLATEID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @INVENTBATCHIDLEVEL OR RESULT.INVENTBATCHID = FOUND.INVENTBATCHID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @INVENTSERIALIDLEVEL OR RESULT.INVENTSERIALID = FOUND.INVENTSERIALID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @INVENTPROFILEID_RULEVEL OR RESULT.INVENTPROFILEID_RU = FOUND.INVENTPROFILEID_RU)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @INVENTOWNERID_RULEVEL OR RESULT.INVENTOWNERID_RU = FOUND.INVENTOWNERID_RU)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @INVENTGTDID_RULEVEL OR RESULT.INVENTGTDID_RU = FOUND.INVENTGTDID_RU)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #WHERE RESULT.HIERARCHYLEVEL = @LEVEL&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #GROUP BY&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;RESULT.CONFIGID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;RESULT.INVENTSIZEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;RESULT.INVENTCOLORID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;RESULT.INVENTSTYLEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSITEIDLEVEL THEN RESULT.INVENTSITEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTLOCATIONIDLEVEL THEN RESULT.INVENTLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSLOCATIONIDLEVEL THEN RESULT.WMSLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSPALLETIDLEVEL THEN RESULT.WMSPALLETID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSTATUSIDLEVEL THEN RESULT.INVENTSTATUSID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @LICENSEPLATEIDLEVEL THEN RESULT.LICENSEPLATEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTBATCHIDLEVEL THEN RESULT.INVENTBATCHID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSERIALIDLEVEL THEN RESULT.INVENTSERIALID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTPROFILEID_RULEVEL THEN RESULT.INVENTPROFILEID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTOWNERID_RULEVEL THEN RESULT.INVENTOWNERID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTGTDID_RULEVEL THEN RESULT.INVENTGTDID_RU ELSE NULL END;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;SET @LEVEL = @LEVEL - 1&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #END; -- WHILE&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #SELECT @AVAILPHYSICAL = SUM(CASE WHEN AVAILPHYSICALFOUND &amp;lt; AVAILPHYSICALRESULT THEN AVAILPHYSICALFOUND ELSE AVAILPHYSICALRESULT END),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@AVAILORDERED = SUM(CASE WHEN AVAILORDEREDFOUND &amp;lt; AVAILORDEREDRESULT THEN AVAILORDEREDFOUND ELSE AVAILORDEREDRESULT END)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #FROM @RESULT&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #WHERE HIERARCHYLEVEL = 0;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39;CREATE PROCEDURE [%1]\n&#39;, WhsOnHandSPHelper::storedProcedureName(_includeDelta));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39; &amp;nbsp; &amp;nbsp;@PARTITION bigint,\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1 int,\n&#39;, this.levelExpression(0));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;@DATAAREAID %1,\n&#39;, this.sqlTypeNameForField(tableNum(InventTable), fieldNum(InventTable, DataAreaId)));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;@ITEMID %1,\n&#39;, this.sqlTypeNameForField(tableNum(InventTable), fieldNum(InventTable, ItemId)));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (_includeDelta)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1 %2,\n&#39;, #TTSIdParmName, this.sqlTypeNameForField(tableNum(WHSInventReserveDelta), fieldNum(WHSInventReserveDelta, TTSId)));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Generate parameters for supported dimensions&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;enabledDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while (enabledDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[dimFieldId, dimFieldName] = enabledDimsEnumerator.current();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1 %2 = NULL,\n&#39;, this.dimensionParm(dimFieldName), this.sqlTypeNameForField(tableNum(InventDim), dimFieldId));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1 int = %2,\n&#39;, this.dimensionLevelParm(dimFieldName), #INVALIDHIERARCHYLEVEL);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Generate parameters for product dimensions&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;productDimensionsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while (productDimensionsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[dimFieldId, dimFieldName] = productDimensionsEnumerator.current();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1 %2 = NULL,\n&#39;, this.dimensionParm(dimFieldName), this.sqlTypeNameForField(tableNum(InventDim), dimFieldId));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39; &amp;nbsp; &amp;nbsp;-- Output parameters\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1 &amp;nbsp;numeric(32, 16) OUTPUT,\n&#39;, #AvailPhysicalParmName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1 &amp;nbsp;numeric(32, 16) OUTPUT\n&#39;, #AvailOrderedParmName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;AS\n\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- Without nocount on the procedure will return number of affected rows in the result set which is\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- harmful to performance and requires us to adjust field retrieval when calling the stored procedure\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;SET NOCOUNT ON;\n\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- We need to supress warnings when trying to aggregate NULL columns. This is a valid business scenario\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- and happens e.g. for a non-LP controlled location with batch below item.\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;SET ANSI_WARNINGS OFF;\n\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += this.declareResultTableVariable() + &#39;\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- The algorithm of the stored procedure is as follows:\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- 1. Initialize the @RESULT table with aggregated qtys in WHSInventReserve for the level requested by user\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- 2. Traverse the hierarchy up and for each level:\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- &amp;nbsp; &amp;nbsp; 1) Aggregate qtys from previous level in @RESULT grouping by dimensions of current hierarchy level\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- &amp;nbsp; &amp;nbsp; 2) Aggregate qtys from current level in WHSInventReserve grouping by dimensions of current hierarchy level\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- &amp;nbsp; &amp;nbsp; 3) Select the minimum of the above qtys and insert into @RESULT\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- 3. When hierarchy level 0 is reached, return the sum of aggregated qtys in @RESULT\n\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- Initialize the @RESULT variable.\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- Loads aggregated data for the lowest level requested by user.\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;INSERT INTO @RESULT (&#39; + this.resultTableVariableFields() + &#39;)\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += this.selectFromWHSInventReserveStmt(_includeDelta) + &#39;\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39;WHILE (%1 &amp;gt; 0)\n&#39;, this.levelExpression(0));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;BEGIN\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;INSERT INTO @RESULT (%1)\n&#39;, this.resultTableVariableFields());&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += this.selectFromResultJoinWHSInventReserveStmt(_includeDelta) + &#39;\n\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;SET %1 = %1 - 1\n&#39;, this.levelExpression(0));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;END; -- WHILE\n\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39;SELECT %1 = SUM(CASE WHEN %2 &amp;lt; %3 THEN %2 ELSE %3 END),\n&#39;,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#AvailPhysicalParmName,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#AVAILPHYSICALFOUNDFieldName,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#AVAILPHYSICALRESULTFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1 = SUM(CASE WHEN %2 &amp;lt; %3 THEN %2 ELSE %3 END)\n&#39;,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#AvailOrderedParmName,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#AVAILORDEREDFOUNDFieldName,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#AVAILORDEREDRESULTFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;FROM @RESULT\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39;WHERE %1 = 0;\n&#39;, #HIERARCHYLEVELFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;return ret;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ENDSOURCE&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SOURCE #classDeclaration&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #/// &lt;summary&gt;&lt;/summary&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #/// &amp;nbsp; &amp;nbsp; The &lt;c&gt;WHSOnHandSPHelper&lt;/c&gt; class contains helper methods to manipulate the WHS on-hand stored procedure.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #/// &lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #public class WhsOnHandSPHelper&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;#Define.CacheScope(&#39;WHSOnHandSPHelper&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;#Define.EnabledDimsParametersCacheKey(&#39;EnabledDimensionsCache&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;#Define.ProductDimsParametersCacheKey(&#39;ProductDimensionsCache&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;#Define.AvailPhysicalParmName(&#39;@AVAILPHYSICAL&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;#Define.AvailPhysicalMinName(&#39;@AVAILPHYSICALMIN&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;#Define.AvailOrderedParmName(&#39;@AVAILORDERED&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;#Define.AvailOrderedMinName(&#39;@AVAILORDERMIN&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;#Define.TTSIdParmName(&#39;@TTSId&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;#Define.AVAILPHYSICALRESULTFieldName(&#39;AVAILPHYSICALRESULT&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;#Define.AVAILORDEREDRESULTFieldName(&#39;AVAILORDEREDRESULT&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;#Define.AVAILPHYSICALFOUNDFieldName(&#39;AVAILPHYSICALFOUND&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;#Define.AVAILORDEREDFOUNDFieldName(&#39;AVAILORDEREDFOUND&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;#Define.HIERARCHYLEVELFieldName(&#39;HIERARCHYLEVEL&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;#WHSOnHandSP&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;#WHSReservationHierarchy&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str resultTableVariableFields; // access using the resultTableVariableFields() method&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;boolean &amp;nbsp; &amp;nbsp; useOptimizedVersion;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ENDSOURCE&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SOURCE #new&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #protected void new()&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;resultTableVariableFields = &#39;&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;useOptimizedVersion = true;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ENDSOURCE&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SOURCE #selectFromWHSInventReserveStmt&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #private str selectFromWHSInventReserveStmt(boolean _includeDelta)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ret = &#39;&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ListEnumerator &amp;nbsp;enabledDimsEnumerator = this.enabledDimensions().getEnumerator();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ListEnumerator &amp;nbsp;productDimsEnumerator = this.productDimensions().getEnumerator();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dimFieldName;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; levelExpr = this.levelExpression(-1);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inventReserveAlias = this.whsInventReserveTableAlias(_includeDelta);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;boolean &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hasDoneFirstIteration;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;if(useOptimizedVersion)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret = this.TEC_selectFromWHSInventReserveStmt(_includeDelta);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;else&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39;SELECT SUM(%1.AVAILPHYSICAL),\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;SUM(%1.AVAILORDERED),\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39; &amp;nbsp; &amp;nbsp;NULL,\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39; &amp;nbsp; &amp;nbsp;NULL,\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1,\n&#39;, this.levelExpression(0));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Select product dimensions&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;productDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while (productDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(productDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;INVENTDIM.%1,\n&#39;, dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Select enabled dimensions&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;enabledDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hasDoneFirstIteration = false;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while (enabledDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (hasDoneFirstIteration)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &#39;,\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(enabledDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;CASE WHEN %1 &amp;gt;= %2 THEN INVENTDIM.%3 ELSE NULL END&#39;,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.levelExpression(-1),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.dimensionLevelParm(dimFieldName),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hasDoneFirstIteration = true;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &#39;\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;FROM %1 %2\n&#39;, this.whsInventReserveTableName(_includeDelta), inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;JOIN INVENTDIM ON INVENTDIM.INVENTDIMID = %1.INVENTDIMID AND INVENTDIM.DATAAREAID = %1.DATAAREAID AND INVENTDIM.PARTITION = %1.PARTITION\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;WHERE %1.ITEMID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = @ITEMID\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND %1.PARTITION &amp;nbsp; &amp;nbsp; &amp;nbsp;= @PARTITION\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND %1.DATAAREAID &amp;nbsp; &amp;nbsp; = @DATAAREAID\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND %1.HIERARCHYLEVEL = %2\n&#39;, inventReserveAlias, this.levelExpression(0));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Add product dimensions range&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;productDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while (productDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(productDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (%2 IS NULL OR INVENTDIM.%1 = %2)\n&#39;,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.dimensionParm(dimFieldName));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Add enabled dimensions range&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;enabledDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while (enabledDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(enabledDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (%1 &amp;lt; %2 OR %3 IS NULL OR %3 = INVENTDIM.%4)\n&#39;,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.levelExpression(0),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.dimensionLevelParm(dimFieldName),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.dimensionParm(dimFieldName),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;GROUP BY\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Add grouping by product dimensions&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;productDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while (productDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(productDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;INVENTDIM.%1,\n&#39;, dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Add grouping by enabled dimensions&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;enabledDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hasDoneFirstIteration = false;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while (enabledDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (hasDoneFirstIteration)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &#39;,\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(enabledDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;CASE WHEN %1 &amp;gt;= %2 THEN INVENTDIM.%3 ELSE NULL END&#39;,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.levelExpression(-1),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.dimensionLevelParm(dimFieldName),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hasDoneFirstIteration = true;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &#39;;\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;return ret;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ENDSOURCE&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SOURCE #selectInnerFromWHSInventReserveStmt&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #private str selectInnerFromWHSInventReserveStmt(boolean _includeDelta)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ret = &#39;&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ListEnumerator &amp;nbsp;enabledDimsEnumerator = this.enabledDimensions().getEnumerator();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ListEnumerator &amp;nbsp;productDimsEnumerator = this.productDimensions().getEnumerator();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dimFieldName;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; levelExpr = this.levelExpression(-1);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inventReserveAlias = this.whsInventReserveTableAlias(_includeDelta);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;boolean &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hasDoneFirstIteration;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;if(useOptimizedVersion)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret = this.TEC_selectInnerFromWHSInventReserveStmt(_includeDelta);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;else&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39;SELECT SUM(%1.AVAILPHYSICAL) AS AVAILPHYSICAL,\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;SUM(%1.AVAILORDERED) AS AVAILORDERED,\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;productDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while (productDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(productDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;INVENTDIM.%1 AS %1,\n&#39;, dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;enabledDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hasDoneFirstIteration = false;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while (enabledDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (hasDoneFirstIteration)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &#39;,\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(enabledDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;CASE WHEN %1 &amp;gt;= %2 THEN INVENTDIM.%3 ELSE NULL END AS %3&#39;,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;levelExpr,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.dimensionLevelParm(dimFieldName),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hasDoneFirstIteration = true;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &#39;\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39;FROM %1 %2\n&#39;, this.whsInventReserveTableName(_includeDelta), inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39;JOIN INVENTDIM ON INVENTDIM.PARTITION = %1.PARTITION\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;AND INVENTDIM.DATAAREAID &amp;nbsp;= %1.DATAAREAID\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;AND INVENTDIM.INVENTDIMID = %1.INVENTDIMID\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39;WHERE %1.HIERARCHYLEVEL = %2\n&#39;, inventReserveAlias, levelExpr);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;AND %1.ITEMID &amp;nbsp; &amp;nbsp; &amp;nbsp; = @ITEMID\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;AND %1.PARTITION &amp;nbsp; &amp;nbsp;= @PARTITION\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;AND %1.DATAAREAID &amp;nbsp; = @DATAAREAID\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;GROUP BY\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Add groupping by product dimensions&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;productDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while (productDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(productDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;INVENTDIM.%1,\n&#39;, dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Add groupping by enabled dimensions&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;enabledDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hasDoneFirstIteration = false;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while (enabledDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (hasDoneFirstIteration)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &#39;,\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(enabledDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;CASE WHEN %1 &amp;gt;= %2 THEN INVENTDIM.%3 ELSE NULL END&#39;,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;levelExpr,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.dimensionLevelParm(dimFieldName),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hasDoneFirstIteration = true;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &#39;\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;return ret;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ENDSOURCE&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SOURCE #TEC_buildCreateSPStmt&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #private str TEC_buildCreateSPStmt(boolean _includeDelta)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ret = &#39;&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ListEnumerator &amp;nbsp;enabledDimsEnumerator;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ListEnumerator &amp;nbsp;productDimensionsEnumerator;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;FieldId &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dimFieldId;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dimFieldName;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;boolean &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; isSerialEnabled;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inventReserveAlias = this.whsInventReserveTableAlias(_includeDelta);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;InventDimMetaDataCache::clearCache(); //in some cases the cache is not updated before sync making below SP&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;enabledDimsEnumerator = this.enabledDimensions().getEnumerator();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;productDimensionsEnumerator = this.productDimensions().getEnumerator();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;isSerialEnabled = this.getEnabledDimsParametersMap().exists(fieldNum(InventDim, InventSerialId));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;/*&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #CREATE PROCEDURE [dbo].[sp_WHSOnHand]&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@PARTITION bigint,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@LEVEL int,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@DATAAREAID nvarchar (4),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@ITEMID nvarchar (20),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTSITEID nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTSITEIDLEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTLOCATIONID nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTLOCATIONIDLEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@WMSLOCATIONID nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@WMSLOCATIONIDLEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@WMSPALLETID nvarchar (18) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@WMSPALLETIDLEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTSTATUSID nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTSTATUSIDLEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@LICENSEPLATEID nvarchar (25) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@LICENSEPLATEIDLEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTBATCHID nvarchar (20) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTBATCHIDLEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTSERIALID nvarchar (20) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTSERIALIDLEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTPROFILEID_RU nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTPROFILEID_RULEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTOWNERID_RU nvarchar (20) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTOWNERID_RULEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTGTDID_RU nvarchar (30) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTGTDID_RULEVEL int = 1024,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@CONFIGID nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTSIZEID nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTCOLORID nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@INVENTSTYLEID nvarchar (10) = NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;-- Output parameters&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@AVAILPHYSICAL &amp;nbsp;numeric(32, 16) OUTPUT,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@AVAILORDERED &amp;nbsp;numeric(32, 16) OUTPUT&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #AS&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- Without nocount on the procedure will return number of affected rows in the result set which is&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- harmful to performance and requires us to adjust field retrieval when calling the stored procedure&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #SET NOCOUNT ON;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- We need to supress warnings when trying to aggregate NULL columns. This is a valid business scenario&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- and happens e.g. for a non-LP controlled location with batch below item.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #SET ANSI_WARNINGS OFF;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- The @RESULT table variable is used to store intermediate quantities.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #DECLARE @RESULT TABLE(&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;AVAILPHYSICALRESULT numeric(32, 16) NOT NULL, -- Aggregated minimum qtys from lower level in @RESULT&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;AVAILORDEREDRESULT numeric(32, 16) NOT NULL, -- Aggregated minimum qtys from lower level in @RESULT&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;AVAILPHYSICALFOUND numeric(32, 16), -- Aggregated qty for current level in WHSInventReserve&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;AVAILORDEREDFOUND numeric(32, 16), -- Aggregated qty for current level in WHSInventReserve&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;HIERARCHYLEVEL int NOT NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CONFIGID nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTSIZEID nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTCOLORID nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTSTYLEID nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTSITEID nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTLOCATIONID nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;WMSLOCATIONID nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;WMSPALLETID nvarchar (18) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTSTATUSID nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;LICENSEPLATEID nvarchar (25) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTBATCHID nvarchar (20) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTSERIALID nvarchar (20) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTPROFILEID_RU nvarchar (10) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTOWNERID_RU nvarchar (20) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTGTDID_RU nvarchar (30) NULL);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #DECLARE @DIMLIST TABLE(&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIMID nvarchar (20) NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;AVAILPHYSICAL numeric(32, 16) NOT NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;AVAILORDERED numeric(32, 16) NOT NULL);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- The algorithm of the stored procedure is as follows:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- 1. Initialize the @RESULT table with aggregated qtys in WHSInventReserve for the level requested by user&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- 2. Traverse the hierarchy up and for each level:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- &amp;nbsp; &amp;nbsp; 1) Aggregate qtys from previous level in @RESULT grouping by dimensions of current hierarchy level&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- &amp;nbsp; &amp;nbsp; 2) Aggregate qtys from current level in WHSInventReserve grouping by dimensions of current hierarchy level&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- &amp;nbsp; &amp;nbsp; 3) Select the minimum of the above qtys and insert into @RESULT&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- 3. When hierarchy level 0 is reached, return the sum of aggregated qtys in @RESULT&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- In the original query (the one after below query), it is joining InventDim and WHSInventReserve and filter records based on some criteria.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- But in the execution plan, it doesn&#39;t seems to generate a good plan (even after UPDATE STATISTICS). In the original execution plan, it always&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- Get records from InventDim first, which returns lot of rows, then only join it to WHSInventReserve and continue filter from there.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- If we makes it get records from WHSInventReserve first, filter it, then with lesser rows from here, join it to InventDim, it will be quicker.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- So the optimization is to filter WHSInventResreve first, then use this result at the original query. In the test, this has reduce the execution&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- time from ~250ms to ~7ms&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp;INSERT INTO @DIMLIST(INVENTDIMID, AVAILPHYSICAL, AVAILORDERED)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp;SELECT INVENTDIMID, AVAILPHYSICAL, AVAILORDERED&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;FROM WHSINVENTRESERVE WHSINVENTRESERVE&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; WHERE WHSINVENTRESERVE.ITEMID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = @ITEMID&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; AND WHSINVENTRESERVE.PARTITION &amp;nbsp; &amp;nbsp; &amp;nbsp;= @PARTITION&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; AND WHSINVENTRESERVE.DATAAREAID &amp;nbsp; &amp;nbsp; = @DATAAREAID&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; AND WHSINVENTRESERVE.HIERARCHYLEVEL = @LEVEL&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- Initialize the @RESULT variable.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #-- Loads aggregated data for the lowest level requested by user.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #INSERT INTO @RESULT (AVAILPHYSICALRESULT, AVAILORDEREDRESULT, AVAILPHYSICALFOUND, AVAILORDEREDFOUND, HIERARCHYLEVEL, CONFIGID, INVENTSIZEID, INVENTCOLORID, INVENTSTYLEID, INVENTSITEID, INVENTLOCATIONID, WMSLOCATIONID, WMSPALLETID, INVENTSTATUSID, LICENSEPLATEID, INVENTBATCHID, INVENTSERIALID, INVENTPROFILEID_RU, INVENTOWNERID_RU, INVENTGTDID_RU)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #SELECT SUM(DIMLIST.AVAILPHYSICAL),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;SUM(DIMLIST.AVAILORDERED),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;NULL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@LEVEL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.CONFIGID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTSIZEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTCOLORID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTSTYLEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSITEIDLEVEL THEN INVENTDIM.INVENTSITEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTLOCATIONIDLEVEL THEN INVENTDIM.INVENTLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSLOCATIONIDLEVEL THEN INVENTDIM.WMSLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSPALLETIDLEVEL THEN INVENTDIM.WMSPALLETID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSTATUSIDLEVEL THEN INVENTDIM.INVENTSTATUSID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @LICENSEPLATEIDLEVEL THEN INVENTDIM.LICENSEPLATEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTBATCHIDLEVEL THEN INVENTDIM.INVENTBATCHID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSERIALIDLEVEL THEN INVENTDIM.INVENTSERIALID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTPROFILEID_RULEVEL THEN INVENTDIM.INVENTPROFILEID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTOWNERID_RULEVEL THEN INVENTDIM.INVENTOWNERID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTGTDID_RULEVEL THEN INVENTDIM.INVENTGTDID_RU ELSE NULL END&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;FROM INVENTDIM INVENTDIM&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;JOIN @DIMLIST DIMLIST&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp;ON INVENTDIM.INVENTDIMID = DIMLIST.INVENTDIMID&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;WHERE &amp;nbsp; INVENTDIM.DATAAREAID = @DATAAREAID&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND INVENTDIM.PARTITION = @PARTITION&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@CONFIGID IS NULL OR INVENTDIM.CONFIGID = @CONFIGID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@INVENTSIZEID IS NULL OR INVENTDIM.INVENTSIZEID = @INVENTSIZEID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@INVENTCOLORID IS NULL OR INVENTDIM.INVENTCOLORID = @INVENTCOLORID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@INVENTSTYLEID IS NULL OR INVENTDIM.INVENTSTYLEID = @INVENTSTYLEID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @INVENTSITEIDLEVEL OR @INVENTSITEID IS NULL OR @INVENTSITEID = INVENTDIM.INVENTSITEID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @INVENTLOCATIONIDLEVEL OR @INVENTLOCATIONID IS NULL OR @INVENTLOCATIONID = INVENTDIM.INVENTLOCATIONID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @WMSLOCATIONIDLEVEL OR @WMSLOCATIONID IS NULL OR @WMSLOCATIONID = INVENTDIM.WMSLOCATIONID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @WMSPALLETIDLEVEL OR @WMSPALLETID IS NULL OR @WMSPALLETID = INVENTDIM.WMSPALLETID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @INVENTSTATUSIDLEVEL OR @INVENTSTATUSID IS NULL OR @INVENTSTATUSID = INVENTDIM.INVENTSTATUSID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @LICENSEPLATEIDLEVEL OR @LICENSEPLATEID IS NULL OR @LICENSEPLATEID = INVENTDIM.LICENSEPLATEID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @INVENTBATCHIDLEVEL OR @INVENTBATCHID IS NULL OR @INVENTBATCHID = INVENTDIM.INVENTBATCHID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @INVENTSERIALIDLEVEL OR @INVENTSERIALID IS NULL OR @INVENTSERIALID = INVENTDIM.INVENTSERIALID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @INVENTPROFILEID_RULEVEL OR @INVENTPROFILEID_RU IS NULL OR @INVENTPROFILEID_RU = INVENTDIM.INVENTPROFILEID_RU)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @INVENTOWNERID_RULEVEL OR @INVENTOWNERID_RU IS NULL OR @INVENTOWNERID_RU = INVENTDIM.INVENTOWNERID_RU)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL &amp;lt; @INVENTGTDID_RULEVEL OR @INVENTGTDID_RU IS NULL OR @INVENTGTDID_RU = INVENTDIM.INVENTGTDID_RU)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #GROUP BY&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.CONFIGID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTSIZEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTCOLORID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTSTYLEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSITEIDLEVEL THEN INVENTDIM.INVENTSITEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTLOCATIONIDLEVEL THEN INVENTDIM.INVENTLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSLOCATIONIDLEVEL THEN INVENTDIM.WMSLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSPALLETIDLEVEL THEN INVENTDIM.WMSPALLETID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSTATUSIDLEVEL THEN INVENTDIM.INVENTSTATUSID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @LICENSEPLATEIDLEVEL THEN INVENTDIM.LICENSEPLATEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTBATCHIDLEVEL THEN INVENTDIM.INVENTBATCHID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSERIALIDLEVEL THEN INVENTDIM.INVENTSERIALID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTPROFILEID_RULEVEL THEN INVENTDIM.INVENTPROFILEID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTOWNERID_RULEVEL THEN INVENTDIM.INVENTOWNERID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTGTDID_RULEVEL THEN INVENTDIM.INVENTGTDID_RU ELSE NULL END;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #WHILE (@LEVEL &amp;gt; 0)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #BEGIN&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp;DELETE FROM @DIMLIST&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp;INSERT INTO @DIMLIST(INVENTDIMID, AVAILPHYSICAL, AVAILORDERED)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp;SELECT INVENTDIMID, AVAILPHYSICAL, AVAILORDERED&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;FROM WHSINVENTRESERVE WHSINVENTRESERVE&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; WHERE WHSINVENTRESERVE.HIERARCHYLEVEL = @LEVEL + -1&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; AND WHSINVENTRESERVE.ITEMID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = @ITEMID&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; AND WHSINVENTRESERVE.PARTITION &amp;nbsp; &amp;nbsp; &amp;nbsp;= @PARTITION&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; AND WHSINVENTRESERVE.DATAAREAID &amp;nbsp; &amp;nbsp; = @DATAAREAID&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #INSERT INTO @RESULT (AVAILPHYSICALRESULT, AVAILORDEREDRESULT, AVAILPHYSICALFOUND, AVAILORDEREDFOUND, HIERARCHYLEVEL, CONFIGID, INVENTSIZEID, INVENTCOLORID, INVENTSTYLEID, INVENTSITEID, INVENTLOCATIONID, WMSLOCATIONID, WMSPALLETID, INVENTSTATUSID, LICENSEPLATEID, INVENTBATCHID, INVENTSERIALID, INVENTPROFILEID_RU, INVENTOWNERID_RU, INVENTGTDID_RU)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #SELECT SUM(CASE WHEN RESULT.AVAILPHYSICALFOUND &amp;lt; RESULT.AVAILPHYSICALRESULT THEN RESULT.AVAILPHYSICALFOUND ELSE RESULT.AVAILPHYSICALRESULT END),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;SUM(CASE WHEN RESULT.AVAILORDEREDFOUND &amp;lt; RESULT.AVAILORDEREDRESULT THEN RESULT.AVAILORDEREDFOUND ELSE RESULT.AVAILORDEREDRESULT END),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;SUM(FOUND.AVAILPHYSICAL),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;SUM(FOUND.AVAILORDERED),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@LEVEL + -1,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;RESULT.CONFIGID AS CONFIGID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;RESULT.INVENTSIZEID AS INVENTSIZEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;RESULT.INVENTCOLORID AS INVENTCOLORID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;RESULT.INVENTSTYLEID AS INVENTSTYLEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSITEIDLEVEL THEN RESULT.INVENTSITEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTLOCATIONIDLEVEL THEN RESULT.INVENTLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSLOCATIONIDLEVEL THEN RESULT.WMSLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSPALLETIDLEVEL THEN RESULT.WMSPALLETID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSTATUSIDLEVEL THEN RESULT.INVENTSTATUSID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @LICENSEPLATEIDLEVEL THEN RESULT.LICENSEPLATEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTBATCHIDLEVEL THEN RESULT.INVENTBATCHID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSERIALIDLEVEL THEN RESULT.INVENTSERIALID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTPROFILEID_RULEVEL THEN RESULT.INVENTPROFILEID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTOWNERID_RULEVEL THEN RESULT.INVENTOWNERID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTGTDID_RULEVEL THEN RESULT.INVENTGTDID_RU ELSE NULL END&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #FROM @RESULT RESULT&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #LEFT OUTER JOIN (&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #SELECT SUM(DIMLIST.AVAILPHYSICAL) AS AVAILPHYSICAL,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;SUM(DIMLIST.AVAILORDERED) AS AVAILORDERED,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.CONFIGID AS CONFIGID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTSIZEID AS INVENTSIZEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTCOLORID AS INVENTCOLORID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTSTYLEID AS INVENTSTYLEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSITEIDLEVEL THEN INVENTDIM.INVENTSITEID ELSE NULL END AS INVENTSITEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTLOCATIONIDLEVEL THEN INVENTDIM.INVENTLOCATIONID ELSE NULL END AS INVENTLOCATIONID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSLOCATIONIDLEVEL THEN INVENTDIM.WMSLOCATIONID ELSE NULL END AS WMSLOCATIONID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSPALLETIDLEVEL THEN INVENTDIM.WMSPALLETID ELSE NULL END AS WMSPALLETID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSTATUSIDLEVEL THEN INVENTDIM.INVENTSTATUSID ELSE NULL END AS INVENTSTATUSID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @LICENSEPLATEIDLEVEL THEN INVENTDIM.LICENSEPLATEID ELSE NULL END AS LICENSEPLATEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTBATCHIDLEVEL THEN INVENTDIM.INVENTBATCHID ELSE NULL END AS INVENTBATCHID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSERIALIDLEVEL THEN INVENTDIM.INVENTSERIALID ELSE NULL END AS INVENTSERIALID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTPROFILEID_RULEVEL THEN INVENTDIM.INVENTPROFILEID_RU ELSE NULL END AS INVENTPROFILEID_RU,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTOWNERID_RULEVEL THEN INVENTDIM.INVENTOWNERID_RU ELSE NULL END AS INVENTOWNERID_RU,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTGTDID_RULEVEL THEN INVENTDIM.INVENTGTDID_RU ELSE NULL END AS INVENTGTDID_RU&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #FROM INVENTDIM INVENTDIM&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #JOIN @DIMLIST DIMLIST&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; ON INVENTDIM.PARTITION = @PARTITION&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;AND INVENTDIM.DATAAREAID &amp;nbsp;= @DATAAREAID&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;AND INVENTDIM.INVENTDIMID = DIMLIST.INVENTDIMID&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #GROUP BY&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.CONFIGID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTSIZEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTCOLORID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;INVENTDIM.INVENTSTYLEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSITEIDLEVEL THEN INVENTDIM.INVENTSITEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTLOCATIONIDLEVEL THEN INVENTDIM.INVENTLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSLOCATIONIDLEVEL THEN INVENTDIM.WMSLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSPALLETIDLEVEL THEN INVENTDIM.WMSPALLETID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSTATUSIDLEVEL THEN INVENTDIM.INVENTSTATUSID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @LICENSEPLATEIDLEVEL THEN INVENTDIM.LICENSEPLATEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTBATCHIDLEVEL THEN INVENTDIM.INVENTBATCHID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSERIALIDLEVEL THEN INVENTDIM.INVENTSERIALID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTPROFILEID_RULEVEL THEN INVENTDIM.INVENTPROFILEID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTOWNERID_RULEVEL THEN INVENTDIM.INVENTOWNERID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTGTDID_RULEVEL THEN INVENTDIM.INVENTGTDID_RU ELSE NULL END&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;) AS FOUND ON (RESULT.CONFIGID = FOUND.CONFIGID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (RESULT.INVENTSIZEID = FOUND.INVENTSIZEID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (RESULT.INVENTCOLORID = FOUND.INVENTCOLORID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (RESULT.INVENTSTYLEID = FOUND.INVENTSTYLEID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @INVENTSITEIDLEVEL OR RESULT.INVENTSITEID = FOUND.INVENTSITEID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @INVENTLOCATIONIDLEVEL OR RESULT.INVENTLOCATIONID = FOUND.INVENTLOCATIONID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @WMSLOCATIONIDLEVEL OR RESULT.WMSLOCATIONID = FOUND.WMSLOCATIONID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @WMSPALLETIDLEVEL OR RESULT.WMSPALLETID = FOUND.WMSPALLETID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @INVENTSTATUSIDLEVEL OR RESULT.INVENTSTATUSID = FOUND.INVENTSTATUSID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @LICENSEPLATEIDLEVEL OR RESULT.LICENSEPLATEID = FOUND.LICENSEPLATEID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @INVENTBATCHIDLEVEL OR RESULT.INVENTBATCHID = FOUND.INVENTBATCHID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @INVENTSERIALIDLEVEL OR RESULT.INVENTSERIALID = FOUND.INVENTSERIALID)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @INVENTPROFILEID_RULEVEL OR RESULT.INVENTPROFILEID_RU = FOUND.INVENTPROFILEID_RU)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @INVENTOWNERID_RULEVEL OR RESULT.INVENTOWNERID_RU = FOUND.INVENTOWNERID_RU)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (@LEVEL + -1 &amp;lt; @INVENTGTDID_RULEVEL OR RESULT.INVENTGTDID_RU = FOUND.INVENTGTDID_RU)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #WHERE RESULT.HIERARCHYLEVEL = @LEVEL&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #GROUP BY&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;RESULT.CONFIGID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;RESULT.INVENTSIZEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;RESULT.INVENTCOLORID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;RESULT.INVENTSTYLEID,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSITEIDLEVEL THEN RESULT.INVENTSITEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTLOCATIONIDLEVEL THEN RESULT.INVENTLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSLOCATIONIDLEVEL THEN RESULT.WMSLOCATIONID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @WMSPALLETIDLEVEL THEN RESULT.WMSPALLETID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSTATUSIDLEVEL THEN RESULT.INVENTSTATUSID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @LICENSEPLATEIDLEVEL THEN RESULT.LICENSEPLATEID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTBATCHIDLEVEL THEN RESULT.INVENTBATCHID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTSERIALIDLEVEL THEN RESULT.INVENTSERIALID ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTPROFILEID_RULEVEL THEN RESULT.INVENTPROFILEID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTOWNERID_RULEVEL THEN RESULT.INVENTOWNERID_RU ELSE NULL END,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;CASE WHEN @LEVEL + -1 &amp;gt;= @INVENTGTDID_RULEVEL THEN RESULT.INVENTGTDID_RU ELSE NULL END;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;SET @LEVEL = @LEVEL - 1&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #END; -- WHILE&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #SELECT @AVAILPHYSICAL = SUM(CASE WHEN AVAILPHYSICALFOUND &amp;lt; AVAILPHYSICALRESULT THEN AVAILPHYSICALFOUND ELSE AVAILPHYSICALRESULT END),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;@AVAILORDERED = SUM(CASE WHEN AVAILORDEREDFOUND &amp;lt; AVAILORDEREDRESULT THEN AVAILORDEREDFOUND ELSE AVAILORDEREDRESULT END)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #FROM @RESULT&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #WHERE HIERARCHYLEVEL = 0;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39;CREATE PROCEDURE [%1]\n&#39;, WhsOnHandSPHelper::storedProcedureName(_includeDelta));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39; &amp;nbsp; &amp;nbsp;@PARTITION bigint,\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1 int,\n&#39;, this.levelExpression(0));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;@DATAAREAID %1,\n&#39;, this.sqlTypeNameForField(tableNum(InventTable), fieldNum(InventTable, DataAreaId)));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;@ITEMID %1,\n&#39;, this.sqlTypeNameForField(tableNum(InventTable), fieldNum(InventTable, ItemId)));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;if (_includeDelta)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1 %2,\n&#39;, #TTSIdParmName, this.sqlTypeNameForField(tableNum(WHSInventReserveDelta), fieldNum(WHSInventReserveDelta, TTSId)));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;// Generate parameters for supported dimensions&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;enabledDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;while (enabledDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[dimFieldId, dimFieldName] = enabledDimsEnumerator.current();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1 %2 = NULL,\n&#39;, this.dimensionParm(dimFieldName), this.sqlTypeNameForField(tableNum(InventDim), dimFieldId));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1 int = %2,\n&#39;, this.dimensionLevelParm(dimFieldName), #INVALIDHIERARCHYLEVEL);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;// Generate parameters for product dimensions&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;productDimensionsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;while (productDimensionsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[dimFieldId, dimFieldName] = productDimensionsEnumerator.current();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1 %2 = NULL,\n&#39;, this.dimensionParm(dimFieldName), this.sqlTypeNameForField(tableNum(InventDim), dimFieldId));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39; &amp;nbsp; &amp;nbsp;-- Output parameters\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1 &amp;nbsp;numeric(32, 16) OUTPUT,\n&#39;, #AvailPhysicalParmName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1 &amp;nbsp;numeric(32, 16) OUTPUT\n&#39;, #AvailOrderedParmName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;AS\n\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- Without nocount on the procedure will return number of affected rows in the result set which is\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- harmful to performance and requires us to adjust field retrieval when calling the stored procedure\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;SET NOCOUNT ON;\n\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- We need to supress warnings when trying to aggregate NULL columns. This is a valid business scenario\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- and happens e.g. for a non-LP controlled location with batch below item.\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;SET ANSI_WARNINGS OFF;\n\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += this.declareResultTableVariable() + &#39;\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;DECLARE @DIMLIST TABLE(\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39; &amp;nbsp; &amp;nbsp;INVENTDIMID nvarchar (20) NULL,\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39; &amp;nbsp; &amp;nbsp;AVAILPHYSICAL numeric(32, 16) NOT NULL,\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39; &amp;nbsp; &amp;nbsp;AVAILORDERED numeric(32, 16) NOT NULL);\n\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- The algorithm of the stored procedure is as follows:\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- 1. Initialize the @RESULT table with aggregated qtys in WHSInventReserve for the level requested by user\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- 2. Traverse the hierarchy up and for each level:\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- &amp;nbsp; &amp;nbsp; 1) Aggregate qtys from previous level in @RESULT grouping by dimensions of current hierarchy level\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- &amp;nbsp; &amp;nbsp; 2) Aggregate qtys from current level in WHSInventReserve grouping by dimensions of current hierarchy level\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- &amp;nbsp; &amp;nbsp; 3) Select the minimum of the above qtys and insert into @RESULT\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- 3. When hierarchy level 0 is reached, return the sum of aggregated qtys in @RESULT\n\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- In the original query (the one after below query), it is joining InventDim and WHSInventReserve and filter records based on some criteria.\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- But in the execution plan, it doesn\&#39;t seems to generate a good plan (even after UPDATE STATISTICS). In the original execution plan, it always\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- Get records from InventDim first, which returns lot of rows, then only join it to WHSInventReserve and continue filter from there.\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- If we makes it get records from WHSInventReserve first, filter it, then with lesser rows from here, join it to InventDim, it will be quicker.\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- So the optimization is to filter WHSInventResreve first, then use this result at the original query. In the test, this has reduce the execution\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- time from ~250ms to ~7ms\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39; &amp;nbsp;INSERT INTO @DIMLIST(INVENTDIMID, AVAILPHYSICAL, AVAILORDERED)\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39; &amp;nbsp;SELECT INVENTDIMID, AVAILPHYSICAL, AVAILORDERED\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;FROM %1 %2\n&#39;, this.whsInventReserveTableName(_includeDelta), inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; WHERE %1.ITEMID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = @ITEMID\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; AND %1.PARTITION &amp;nbsp; &amp;nbsp; &amp;nbsp;= @PARTITION\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; AND %1.DATAAREAID &amp;nbsp; &amp;nbsp; = @DATAAREAID\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; AND %1.HIERARCHYLEVEL = %2\n\n&#39;, inventReserveAlias, this.levelExpression(0));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- Initialize the @RESULT variable.\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;-- Loads aggregated data for the lowest level requested by user.\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;INSERT INTO @RESULT (&#39; + this.resultTableVariableFields() + &#39;)\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += this.selectFromWHSInventReserveStmt(_includeDelta) + &#39;\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39;WHILE (%1 &amp;gt; 0)\n&#39;, this.levelExpression(0));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;BEGIN\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp;DELETE FROM @DIMLIST\n\n&#39;);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp;INSERT INTO @DIMLIST(INVENTDIMID, AVAILPHYSICAL, AVAILORDERED)\n&#39;);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp;SELECT INVENTDIMID, AVAILPHYSICAL, AVAILORDERED\n&#39;);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;FROM %1 %2\n&#39;, this.whsInventReserveTableName(_includeDelta), inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; WHERE %1.HIERARCHYLEVEL = %2 + -1\n&#39;, inventReserveAlias, this.levelExpression(0));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; AND %1.ITEMID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = @ITEMID\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; AND %1.PARTITION &amp;nbsp; &amp;nbsp; &amp;nbsp;= @PARTITION\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; AND %1.DATAAREAID &amp;nbsp; &amp;nbsp; = @DATAAREAID\n\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;INSERT INTO @RESULT (%1)\n&#39;, this.resultTableVariableFields());&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += this.selectFromResultJoinWHSInventReserveStmt(_includeDelta) + &#39;\n\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;SET %1 = %1 - 1\n&#39;, this.levelExpression(0));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;END; -- WHILE\n\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39;SELECT %1 = SUM(CASE WHEN %2 &amp;lt; %3 THEN %2 ELSE %3 END),\n&#39;,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#AvailPhysicalParmName,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#AVAILPHYSICALFOUNDFieldName,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#AVAILPHYSICALRESULTFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1 = SUM(CASE WHEN %2 &amp;lt; %3 THEN %2 ELSE %3 END)\n&#39;,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#AvailOrderedParmName,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#AVAILORDEREDFOUNDFieldName,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;#AVAILORDEREDRESULTFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;FROM @RESULT\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39;WHERE %1 = 0;\n&#39;, #HIERARCHYLEVELFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;return ret;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ENDSOURCE&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SOURCE #TEC_selectFromWHSInventReserveStmt&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #private str TEC_selectFromWHSInventReserveStmt(boolean _includeDelta)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ret = &#39;&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ListEnumerator &amp;nbsp;enabledDimsEnumerator = this.enabledDimensions().getEnumerator();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ListEnumerator &amp;nbsp;productDimsEnumerator = this.productDimensions().getEnumerator();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dimFieldName;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; levelExpr = this.levelExpression(-1);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inventReserveAlias = this.whsInventReserveTableAlias(_includeDelta);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dimList = &#39;DIMLIST&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;boolean &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hasDoneFirstIteration;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39;SELECT SUM(%1.AVAILPHYSICAL),\n&#39;, dimList);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;SUM(%1.AVAILORDERED),\n&#39;, dimList);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39; &amp;nbsp; &amp;nbsp;NULL,\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39; &amp;nbsp; &amp;nbsp;NULL,\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;%1,\n&#39;, this.levelExpression(0));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;// Select product dimensions&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;productDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;while (productDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(productDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;INVENTDIM.%1,\n&#39;, dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;// Select enabled dimensions&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;enabledDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;hasDoneFirstIteration = false;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;while (enabledDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (hasDoneFirstIteration)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &#39;,\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(enabledDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;CASE WHEN %1 &amp;gt;= %2 THEN INVENTDIM.%3 ELSE NULL END&#39;,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.levelExpression(-1),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.dimensionLevelParm(dimFieldName),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hasDoneFirstIteration = true;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &#39;\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;//ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;FROM %1 %2\n&#39;, this.whsInventReserveTableName(_includeDelta), inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;//ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;JOIN INVENTDIM ON INVENTDIM.INVENTDIMID = %1.INVENTDIMID AND INVENTDIM.DATAAREAID = %1.DATAAREAID AND INVENTDIM.PARTITION = %1.PARTITION\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;//ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;WHERE %1.ITEMID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = @ITEMID\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;//ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND %1.PARTITION &amp;nbsp; &amp;nbsp; &amp;nbsp;= @PARTITION\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;//ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND %1.DATAAREAID &amp;nbsp; &amp;nbsp; = @DATAAREAID\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;//ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND %1.HIERARCHYLEVEL = %2\n&#39;, inventReserveAlias, this.levelExpression(0));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;FROM INVENTDIM INVENTDIM\n&#39;);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;JOIN @DIMLIST %1\n&#39;, dimList);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp;ON INVENTDIM.INVENTDIMID = %1.INVENTDIMID\n&#39;, dimList);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;WHERE &amp;nbsp; INVENTDIM.DATAAREAID = @DATAAREAID\n&#39;);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND INVENTDIM.PARTITION = @PARTITION\n&#39;);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;// Add product dimensions range&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;productDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;while (productDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(productDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (%2 IS NULL OR INVENTDIM.%1 = %2)\n&#39;,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.dimensionParm(dimFieldName));&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;// Add enabled dimensions range&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;enabledDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;while (enabledDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(enabledDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (%1 &amp;lt; %2 OR %3 IS NULL OR %3 = INVENTDIM.%4)\n&#39;,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.levelExpression(0),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.dimensionLevelParm(dimFieldName),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.dimensionParm(dimFieldName),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;GROUP BY\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;// Add grouping by product dimensions&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;productDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;while (productDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(productDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;INVENTDIM.%1,\n&#39;, dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;// Add grouping by enabled dimensions&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;enabledDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;hasDoneFirstIteration = false;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;while (enabledDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (hasDoneFirstIteration)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &#39;,\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(enabledDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;CASE WHEN %1 &amp;gt;= %2 THEN INVENTDIM.%3 ELSE NULL END&#39;,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.levelExpression(-1),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.dimensionLevelParm(dimFieldName),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hasDoneFirstIteration = true;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &#39;;\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;return ret;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ENDSOURCE&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SOURCE #TEC_selectInnerFromWHSInventReserveStmt&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #private str TEC_selectInnerFromWHSInventReserveStmt(boolean _includeDelta)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ret = &#39;&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ListEnumerator &amp;nbsp;enabledDimsEnumerator = this.enabledDimensions().getEnumerator();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ListEnumerator &amp;nbsp;productDimsEnumerator = this.productDimensions().getEnumerator();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dimFieldName;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; levelExpr = this.levelExpression(-1);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inventReserveAlias = this.whsInventReserveTableAlias(_includeDelta);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;str &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dimList = &#39;DIMLIST&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;boolean &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hasDoneFirstIteration;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39;SELECT SUM(%1.AVAILPHYSICAL) AS AVAILPHYSICAL,\n&#39;, dimList);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;SUM(%1.AVAILORDERED) AS AVAILORDERED,\n&#39;, dimList);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;productDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;while (productDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(productDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;INVENTDIM.%1 AS %1,\n&#39;, dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;enabledDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;hasDoneFirstIteration = false;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;while (enabledDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (hasDoneFirstIteration)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &#39;,\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(enabledDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;CASE WHEN %1 &amp;gt;= %2 THEN INVENTDIM.%3 ELSE NULL END AS %3&#39;,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;levelExpr,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.dimensionLevelParm(dimFieldName),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hasDoneFirstIteration = true;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &#39;\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;//ret += strFmt(&#39;FROM %1 %2\n&#39;, this.whsInventReserveTableName(includeDelta), inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;//ret += strFmt(&#39;JOIN INVENTDIM ON INVENTDIM.PARTITION = %1.PARTITION\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;//ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;AND INVENTDIM.DATAAREAID &amp;nbsp;= %1.DATAAREAID\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;//ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;AND INVENTDIM.INVENTDIMID = %1.INVENTDIMID\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;//ret += strFmt(&#39;WHERE %1.HIERARCHYLEVEL = %2\n&#39;, inventReserveAlias, levelExpr);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;//ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;AND %1.ITEMID &amp;nbsp; &amp;nbsp; &amp;nbsp; = @ITEMID\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;//ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;AND %1.PARTITION &amp;nbsp; &amp;nbsp;= @PARTITION\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;//ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;AND %1.DATAAREAID &amp;nbsp; = @DATAAREAID\n&#39;, inventReserveAlias);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39;FROM INVENTDIM INVENTDIM\n&#39;);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39;JOIN @DIMLIST %1\n&#39;, dimList);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp; ON INVENTDIM.PARTITION = @PARTITION\n&#39;);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;AND INVENTDIM.DATAAREAID &amp;nbsp;= @DATAAREAID\n&#39;);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;AND INVENTDIM.INVENTDIMID = DIMLIST.INVENTDIMID\n&#39;);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;GROUP BY\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;// Add groupping by product dimensions&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;productDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;while (productDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(productDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;INVENTDIM.%1,\n&#39;, dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;// Add groupping by enabled dimensions&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;enabledDimsEnumerator.reset();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;hasDoneFirstIteration = false;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;while (enabledDimsEnumerator.moveNext())&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (hasDoneFirstIteration)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += &#39;,\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName = conPeek(enabledDimsEnumerator.current(), 2);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret += strFmt(&#39; &amp;nbsp; &amp;nbsp;CASE WHEN %1 &amp;gt;= %2 THEN INVENTDIM.%3 ELSE NULL END&#39;,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;levelExpr,&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.dimensionLevelParm(dimFieldName),&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dimFieldName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hasDoneFirstIteration = true;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;ret += &#39;\n&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # &amp;nbsp; &amp;nbsp;return ret;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ENDSOURCE&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; ENDMETHODS&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; ENDCLASS&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: xx-small;&quot;&gt;***Element: END&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;=================================================&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/5670886143732696321/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2017/02/performance-improvement-on-spwhsonhand.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/5670886143732696321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/5670886143732696321'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2017/02/performance-improvement-on-spwhsonhand.html' title='Performance improvement on sp_WHSOnHand / sp_WHSOnHandWithDelta'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjar8_gZQyTeD9kEYPtzUulFB5uQLjQt4rdT-ALYiVfLDmD3WxbmouNSxBay9ZjrfJABGcaA7oIOAZ3IXMAUhh2r2oJ23L0Pv8GYq019Oc4yiuhqWD_mB4y-usIIBVyMWRlqPrA7fLd6Gss/s72-c/sp_WHSOnHand_BadQueryPlan.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-3555897391771288221</id><published>2016-12-16T10:07:00.001+00:00</published><updated>2016-12-16T10:07:11.605+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics AX"/><title type='text'>Cannot alter &#39;PURCHLINEVIEW_IN&#39; because it is not a table</title><content type='html'>&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;We hit this issue in DEV environment, not sure how it happenned in the first place, but this table &quot;PurchLineView_IN&quot; has been created as a View in SQL.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgHoliM8FYNDbakqyCQl2dY_JzjWzYHEMfFI-anpK9a8z7FvleLTHikPGI2dUbXlPS-x26eGpEWSS644Y8Jk8AqZoRjTR5NjowQ0cIVVCXKjJaqJf4zwWpN3oJCBjwF120McA6srkzXMVR/s1600/AlterIssueOnPurchLineView_IN.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgHoliM8FYNDbakqyCQl2dY_JzjWzYHEMfFI-anpK9a8z7FvleLTHikPGI2dUbXlPS-x26eGpEWSS644Y8Jk8AqZoRjTR5NjowQ0cIVVCXKjJaqJf4zwWpN3oJCBjwF120McA6srkzXMVR/s1600/AlterIssueOnPurchLineView_IN.jpg&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVSYa-Xs4mLhZfoYXXNzaNigvakVyd-BvhM22fTn-7jKTefyxGxZlWBN7pdh47ITiX41QDYiKyq2taKXObtb0m5HxGiPZ3ePmZXhobMbYT9Atosg4cQ7qsKuA4ZTr_0wne0-2mNo3PMaZE/s1600/PurchLineView_IN.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVSYa-Xs4mLhZfoYXXNzaNigvakVyd-BvhM22fTn-7jKTefyxGxZlWBN7pdh47ITiX41QDYiKyq2taKXObtb0m5HxGiPZ3ePmZXhobMbYT9Atosg4cQ7qsKuA4ZTr_0wne0-2mNo3PMaZE/s1600/PurchLineView_IN.jpg&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Due to it shouldn&#39;t appear as View in the first place, so I deleted it straight away from SQL, then rerun the sync from AX. It then created the &quot;PurchLineView_IN&quot; as table in SQL instead of as a View. The sync issue is resolved.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/3555897391771288221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2016/12/cannot-alter-purchlineviewin-because-it.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/3555897391771288221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/3555897391771288221'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2016/12/cannot-alter-purchlineviewin-because-it.html' title='Cannot alter &#39;PURCHLINEVIEW_IN&#39; because it is not a table'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgHoliM8FYNDbakqyCQl2dY_JzjWzYHEMfFI-anpK9a8z7FvleLTHikPGI2dUbXlPS-x26eGpEWSS644Y8Jk8AqZoRjTR5NjowQ0cIVVCXKjJaqJf4zwWpN3oJCBjwF120McA6srkzXMVR/s72-c/AlterIssueOnPurchLineView_IN.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-385355675450975805</id><published>2016-09-28T17:15:00.004+01:00</published><updated>2016-09-28T17:15:51.530+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics AX"/><title type='text'>Unable to edit AX7 element properties (dimmed/grayed out)</title><content type='html'>&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Quick tips: In AX2012 and the version before, when you click on an element in the AOT, (&lt;i&gt;assuming the properties window is opened&lt;/i&gt;) they&#39;re editable right away. But in AX7, if you click on an element in your project, the properties is not editable (&lt;i&gt;grayed out, read only&lt;/i&gt;). You&#39;ll need to double click to open the element in the editor window, then the properties will be enabled for editing.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/385355675450975805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2016/09/unable-to-edit-ax7-element-properties.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/385355675450975805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/385355675450975805'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2016/09/unable-to-edit-ax7-element-properties.html' title='Unable to edit AX7 element properties (dimmed/grayed out)'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-1772889820880337673</id><published>2016-09-20T16:54:00.002+01:00</published><updated>2016-09-21T10:23:30.591+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics AX"/><title type='text'>Workflow error - The condition could not be evaluated. No data has been returned</title><content type='html'>&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt;Error&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Stopped (error): X++ Exception: The condition could not be evaluated. No data has been returned.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;at SysWorkflowEvaluationProvider-evaluateCondition&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;SysWorkflowEvaluationProvider-evaluate&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;SysWorkflowQueue-resume&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt;Details&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;During one of the workflow development, the requirement is to have a batch job to auto-submit all records that meet certain condition. Let&#39;s call this TableA for now, auto-submit all records where FieldA == 12. Then workflow configuration is set to auto-approve records if certain conditions are met.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;The development started with creating a query object.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Then use this query in the Workflow wizard and created all the related classes, menu item, etc.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Then a batch job created to auto-submit all TableA records which FieldA == 12.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;The batch job uses the same query object created earlier.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;And the &lt;span style=&quot;background-color: #fff2cc;&quot;&gt;mistake is the FieldA is added into the query object as a range field&lt;/span&gt; with fixed enum value 12.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;This is due to during the workflow approval process, this FieldA will be updated into other status.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;When it is updated to other status than 12, this causes the record doesn&#39;t meet the criteria (&lt;i&gt;Range&lt;/i&gt;) in the query object, hence, the error &quot;&lt;span style=&quot;color: red;&quot;&gt;The condition could not be evaluated. No data has been returned.&lt;/span&gt;&quot;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;The query object (&lt;i&gt;used in workflow document class&lt;/i&gt;) is used throughout the approval process, not just the initial submission. So the query shouldn&#39;t have any conditions added to it, especially those field which the value will change throughout the process. To fix this, the range (&lt;i&gt;FieldA = 12&lt;/i&gt;) has been removed from the query object. Then added during runtime of the batch job. Eg.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;SysQuery::findOrCreateRange(qbds, fieldNum(TableA,FieldA)).value(...)&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;For my scenario, the error can be replicated from: (Module) &amp;gt; Setup &amp;gt; **** workflows &amp;gt; (Select the related workflow&amp;gt; Edit &amp;gt; Properties &amp;gt; Automatic actions &amp;gt; Test.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/1772889820880337673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2016/09/workflow-error-condition-could-not-be.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/1772889820880337673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/1772889820880337673'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2016/09/workflow-error-condition-could-not-be.html' title='Workflow error - The condition could not be evaluated. No data has been returned'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-4696101258402001967</id><published>2016-06-29T21:10:00.004+01:00</published><updated>2016-06-29T21:17:39.684+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics AX"/><title type='text'>SysQueryRangeUtil - Custom query function</title><content type='html'>&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;In one of old post (&lt;a href=&quot;http://mybhat.blogspot.my/2011/09/dynamics-ax-batch-job-relative-day.html&quot;&gt;Dynamics AX batch job relative day parameter&lt;/a&gt;), I&#39;ve mention regarding using function in query range. There&#39;re a set of standard functions available in the&amp;nbsp;SysQueryRangeUtil class. But if you happen to need a custom function (especially with more complex logic), you can develop it in this class and use it just like you&#39;ll do with the standard methods.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Example:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;


&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD9yP_b5tk1NVHGr7UZXuXxWfoOrJqqQ4ReBX1cnU_6l7CCFS0Nhobe7V5HA85jEKTQQEi3Btb8N_df8RoLiQ9rfcSy94fMTMWO_r-mM_Y62yctyOT6GXTAt93AEQw-uZIPYd3BaXxYqS2/s1600/sysQueryRangeUtil_SampleCode.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD9yP_b5tk1NVHGr7UZXuXxWfoOrJqqQ4ReBX1cnU_6l7CCFS0Nhobe7V5HA85jEKTQQEi3Btb8N_df8RoLiQ9rfcSy94fMTMWO_r-mM_Y62yctyOT6GXTAt93AEQw-uZIPYd3BaXxYqS2/s1600/sysQueryRangeUtil_SampleCode.jpg&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDTh-sF7lhrEtz6nscxrxsN7EiJMK74vqtZRPn7lLvbEbFQ8aFA3lX0jJOliF5jVv5oN6G57YcZuaUN2uOaHRvDhLplvfVrHFzqykfo8EzgYal5bZPS09RssZ3NIIeOHcPJTduJcTusx6L/s1600/SysQueryRangeUtil_TableBrowser_CustTable.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDTh-sF7lhrEtz6nscxrxsN7EiJMK74vqtZRPn7lLvbEbFQ8aFA3lX0jJOliF5jVv5oN6G57YcZuaUN2uOaHRvDhLplvfVrHFzqykfo8EzgYal5bZPS09RssZ3NIIeOHcPJTduJcTusx6L/s1600/SysQueryRangeUtil_TableBrowser_CustTable.jpg&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;You can use this function in query object, under the &quot;Range&quot; node, or anywhere that provides filtering functionality.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWxZBdpUn-zL5Iys2LdYNFOIBsOOcz47Y0yhCKzgucE4nYxngeAohlEazW7IQYS5DEWEJ9gmLmTPPZohvnhB6N35Skb0yxpP1c1kcBs3hM5_kmFLcXaRtI7Z3LIdIQOhKoBnqZlOJR-Zyf/s1600/SysQueryRangeUtil_Range.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWxZBdpUn-zL5Iys2LdYNFOIBsOOcz47Y0yhCKzgucE4nYxngeAohlEazW7IQYS5DEWEJ9gmLmTPPZohvnhB6N35Skb0yxpP1c1kcBs3hM5_kmFLcXaRtI7Z3LIdIQOhKoBnqZlOJR-Zyf/s1600/SysQueryRangeUtil_Range.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/4696101258402001967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2016/06/sysqueryrangeutil-custom-query-function.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/4696101258402001967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/4696101258402001967'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2016/06/sysqueryrangeutil-custom-query-function.html' title='SysQueryRangeUtil - Custom query function'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD9yP_b5tk1NVHGr7UZXuXxWfoOrJqqQ4ReBX1cnU_6l7CCFS0Nhobe7V5HA85jEKTQQEi3Btb8N_df8RoLiQ9rfcSy94fMTMWO_r-mM_Y62yctyOT6GXTAt93AEQw-uZIPYd3BaXxYqS2/s72-c/sysQueryRangeUtil_SampleCode.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-5336441413550963689</id><published>2016-06-21T19:09:00.002+01:00</published><updated>2016-06-21T19:10:35.437+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics AX"/><title type='text'>Replenishment error - Location xxxxxx failed due to the strategy</title><content type='html'>&lt;span style=&quot;background-color: white; color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 13px; line-height: 18.2px;&quot;&gt;Just a quick post for non-developer who hit this error and looking for solution.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 13px; line-height: 18.2px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 13px; line-height: 18.2px;&quot;&gt;Path to functionality:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 13px; line-height: 18.2px;&quot;&gt;Warehouse management &amp;gt; Periodic &amp;gt; Replenishments&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 13px; line-height: 18.2px;&quot;&gt;Warehouse management &amp;gt; Inquiries &amp;gt; History &amp;gt; Work creation history log&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 13px; line-height: 18.2px;&quot;&gt;The error message &quot;&lt;/span&gt;&lt;span style=&quot;font-size: 13px; line-height: 18.2px;&quot;&gt;Location xxxxxx failed due to the strategy&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 13px; line-height: 18.2px;&quot;&gt;&quot; in &quot;Work creation history log&quot; is due to the &quot;Total available&quot; is less than &quot;Physical stock&quot;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 13px; line-height: 18.2px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 13px; line-height: 18.2px;&quot;&gt;&lt;b&gt;&lt;u&gt;Examples&lt;/u&gt;:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13px; line-height: 18.2px;&quot;&gt;Before replenishment run:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13px; line-height: 18.2px;&quot;&gt;-&amp;nbsp;License plate 90, Physical stock = 106, Total available = 96&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13px; line-height: 18.2px;&quot;&gt;-&amp;nbsp;License plate 91, Physical stock = 100, Total available = 100&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13px; line-height: 18.2px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13px; line-height: 18.2px;&quot;&gt;When the replenishment run, it check whether it can locate a full license plate, if it can’t, then it give the “Location xxxxxx failed due to the strategy.” error.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13px; line-height: 18.2px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13px; line-height: 18.2px;&quot;&gt;The way it finds the full license plate is by checking the Total available against the Physical stock (&lt;i&gt;this is a simplified explanation of the logic, it does much more than these two checking&lt;/i&gt;).&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13px; line-height: 18.2px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13px; line-height: 18.2px;&quot;&gt;In this instance, LP 01C02E is not fully available (&lt;i&gt;Physical stock is 106, but Total available is only 96&lt;/i&gt;), hence, error.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13px; line-height: 18.2px;&quot;&gt;Then it check next LP, 01C03E, this is fully available (&lt;i&gt;Physical stock is 100, Total available is 100&lt;/i&gt;), hence, successfully use it.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnado9uB71dH9hHwkzLA8L2gdLsezOApr7IXYYJjVrAFmP1SryCcznw61u5AEnHMmGV7krZfRmCTFF2VGw5CGfPgnWfFRUfg1Xu-z_sqOeXJ8K8VDh9Zcr-Zz7n7adZzBZDZag-x6kFMx6/s1600/Replenishment_Onhand.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;72&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnado9uB71dH9hHwkzLA8L2gdLsezOApr7IXYYJjVrAFmP1SryCcznw61u5AEnHMmGV7krZfRmCTFF2VGw5CGfPgnWfFRUfg1Xu-z_sqOeXJ8K8VDh9Zcr-Zz7n7adZzBZDZag-x6kFMx6/s640/Replenishment_Onhand.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 13px; line-height: 18.2px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjh5IAhc0ghswShC2gR4n7HGR5YkMVe2aHR3Ixu_qaEWY0zeMvTmhrUrv2rGEuHdWmrktTAmhyphenhyphenvcxBU-UDvMPWkIgyavAY-YsadBIn39VVNAmJBN71dPC47Sia3LNHQtwM2E7icyZWvdSeg/s1600/Replenishment_WorkCreationHistory.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjh5IAhc0ghswShC2gR4n7HGR5YkMVe2aHR3Ixu_qaEWY0zeMvTmhrUrv2rGEuHdWmrktTAmhyphenhyphenvcxBU-UDvMPWkIgyavAY-YsadBIn39VVNAmJBN71dPC47Sia3LNHQtwM2E7icyZWvdSeg/s1600/Replenishment_WorkCreationHistory.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 13px; line-height: 18.2px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 13px; line-height: 18.2px;&quot;&gt;The code which checks and produce the error is location at this path:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13px; line-height: 18.2px;&quot;&gt;\Classes\WHSLocationDirective\performStrategyLPLocate&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4DcrPMS6FXNv8Q8DOfP4k2Oskrh1AhYK_D6FHVRkrnku7QNN_IxaXjnPfLMZN1dWJVuipMAM8SxfRL9-qbcSc60mt3cfkzCX2paMaVKJC8giQF5zqJZkgntgGn9CWkFtXoS8C3uLRxjpr/s1600/Replenishment_Code.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4DcrPMS6FXNv8Q8DOfP4k2Oskrh1AhYK_D6FHVRkrnku7QNN_IxaXjnPfLMZN1dWJVuipMAM8SxfRL9-qbcSc60mt3cfkzCX2paMaVKJC8giQF5zqJZkgntgGn9CWkFtXoS8C3uLRxjpr/s1600/Replenishment_Code.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; color: #444444; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 13px; line-height: 18.2px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/5336441413550963689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2016/06/replenishment-error-location-xxxxxx.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/5336441413550963689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/5336441413550963689'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2016/06/replenishment-error-location-xxxxxx.html' title='Replenishment error - Location xxxxxx failed due to the strategy'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnado9uB71dH9hHwkzLA8L2gdLsezOApr7IXYYJjVrAFmP1SryCcznw61u5AEnHMmGV7krZfRmCTFF2VGw5CGfPgnWfFRUfg1Xu-z_sqOeXJ8K8VDh9Zcr-Zz7n7adZzBZDZag-x6kFMx6/s72-c/Replenishment_Onhand.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-4302397393046333560</id><published>2016-06-15T11:48:00.000+01:00</published><updated>2016-06-21T18:48:47.103+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AIF"/><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics AX"/><title type='text'>&quot;The endpoint does not exist or the action is not allowed&quot; on Payment journal voucher send</title><content type='html'>&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Just a quick post for non-developer who hit this error and looking for solution.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;If you&#39;re setting up AIF Outbound port for Payment journal, you&#39;ll need to add the &quot;LedgerVendorPaymentService.find&quot; operation to the port.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Without this port, when you click on the &quot;Send...&quot; button on the Payment journal voucher, you&#39;ll first get the error &quot;No endPoints are configured for the action&quot;.&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZOge9TtA_jPxKr6wIl9wVqsnNET53Gyo9bqkFqkhR0JiYyOETUErGnjfaUJ2-G8o7vyC8GxElYIt35cvFAQMIqgEnOtAMhG-T2lY8BNqQ33QeWFa9Ww3UArNuiEIWHzQs0ui_VIbim1ZC/s1600/PaymentAdvice_Voucher.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;77&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZOge9TtA_jPxKr6wIl9wVqsnNET53Gyo9bqkFqkhR0JiYyOETUErGnjfaUJ2-G8o7vyC8GxElYIt35cvFAQMIqgEnOtAMhG-T2lY8BNqQ33QeWFa9Ww3UArNuiEIWHzQs0ui_VIbim1ZC/s640/PaymentAdvice_Voucher.jpg&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;But the &quot;Send document...&quot; dialog will still shows up, and if you continue to select the Port name and click &quot;OK&quot;, you&#39;ll get the error &quot;The endpoint does not exist or the action is not allowed&quot;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8cQ7z7KwhhF_T5ZHT_4CibicKuB1xrmE9vBY9uf4q7PPHM2eDFXZ7nMQTBuZk1RYgj9puD8IBpoHIo47RaK8T5RRtbd7d-JRaXJEf6Nr6Tgs9lo7d8z-FKnOyAeTkj09asBB4D1lShPjz/s1600/PaymentAdvice_AIF_Send.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8cQ7z7KwhhF_T5ZHT_4CibicKuB1xrmE9vBY9uf4q7PPHM2eDFXZ7nMQTBuZk1RYgj9puD8IBpoHIo47RaK8T5RRtbd7d-JRaXJEf6Nr6Tgs9lo7d8z-FKnOyAeTkj09asBB4D1lShPjz/s1600/PaymentAdvice_AIF_Send.jpg&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;To fix this issue:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Go to:&amp;nbsp;System administration &amp;gt; Setup &amp;gt; Services and Application Integration Framework &amp;gt; Outbound ports&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Select the respective&amp;nbsp;port name and click “Deactivate”&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Click on “Service operations” button under the “Service contract customizations” FastTab&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Double click on the “LedgerVendorPaymentService.find” service operation under the “Remaining service operations” list to add it into the “Selected service operations”&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Close the form&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Click “Activate” button to activate the Outbound port again&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/4302397393046333560/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2016/06/the-endpoint-does-not-exist-or-action.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/4302397393046333560'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/4302397393046333560'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2016/06/the-endpoint-does-not-exist-or-action.html' title='&quot;The endpoint does not exist or the action is not allowed&quot; on Payment journal voucher send'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZOge9TtA_jPxKr6wIl9wVqsnNET53Gyo9bqkFqkhR0JiYyOETUErGnjfaUJ2-G8o7vyC8GxElYIt35cvFAQMIqgEnOtAMhG-T2lY8BNqQ33QeWFa9Ww3UArNuiEIWHzQs0ui_VIbim1ZC/s72-c/PaymentAdvice_Voucher.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-2566267862365012725</id><published>2016-05-20T21:33:00.001+01:00</published><updated>2016-05-20T21:35:01.281+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AIF"/><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics AX"/><title type='text'>Find AIF service class name by Axd document class name</title><content type='html'>&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Just a quick snippet to find&amp;nbsp;AIF service class name by Axd document class name.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: darkblue; font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;static&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt; &lt;b&gt;&lt;span style=&quot;color: darkblue;&quot;&gt;void&lt;/span&gt;&lt;/b&gt;
GetAxdClassNameByServiceName(Args _args)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
#avifiles&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;b&gt;&lt;span style=&quot;color: darkblue;&quot;&gt;str&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mySearchAxdName = &lt;span style=&quot;color: darkred;&quot;&gt;&quot;&lt;span style=&quot;background-color: yellow;&quot;&gt;AxdCountingJournal&lt;/span&gt;&quot;&lt;/span&gt;; &lt;i&gt;&lt;span style=&quot;color: green;&quot;&gt;//Change this to your Axd class name&lt;/span&gt;&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
List&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; list;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
ListEnumerator&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
listEnumerator;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
SysDictClass&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
sysDictClass, serviceDictClass;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
AxdWizardParameters&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
axdWizardParameters;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;b&gt;&lt;span style=&quot;color: darkblue;&quot;&gt;int&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; progressTotal,
progressCount;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
SysOperationProgress&amp;nbsp;&amp;nbsp;&amp;nbsp;
progressBar;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
sysDictClass = &lt;b&gt;&lt;span style=&quot;color: darkblue;&quot;&gt;new&lt;/span&gt;&lt;/b&gt;
SysDictClass(&lt;b&gt;&lt;span style=&quot;color: darkblue;&quot;&gt;classnum&lt;/span&gt;&lt;/b&gt;(AifDocumentService));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
list = sysDictClass.extendedBy();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
progressTotal = list.elements();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
progressBar&amp;nbsp;&amp;nbsp; =
SysOperationProgress::newGeneral(#aviUpdate, &lt;span style=&quot;color: darkred;&quot;&gt;&#39;Axd/service
class search&#39;&lt;/span&gt;, progressTotal);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
listEnumerator = list.getEnumerator();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;b&gt;&lt;span style=&quot;color: darkblue;&quot;&gt;while&lt;/span&gt;&lt;/b&gt;
(listEnumerator.moveNext())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; serviceDictClass = &lt;b&gt;&lt;span style=&quot;color: darkblue;&quot;&gt;new&lt;/span&gt;&lt;/b&gt; SysDictClass(listEnumerator.current());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; progressCount++;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; progressBar.incCount();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; progressBar.setText(&lt;b&gt;&lt;span style=&quot;color: darkblue;&quot;&gt;strfmt&lt;/span&gt;&lt;/b&gt;(&lt;span style=&quot;color: darkred;&quot;&gt;&quot;Searching:
%1 of %2 (%3)&quot;&lt;/span&gt;, progressCount, progressTotal,
serviceDictClass.name()));&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; progressBar.update(&lt;b&gt;&lt;span style=&quot;color: darkblue;&quot;&gt;true&lt;/span&gt;&lt;/b&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: darkblue;&quot;&gt;if&lt;/span&gt;&lt;/b&gt;
(serviceDictClass.id() != &lt;b&gt;&lt;span style=&quot;color: darkblue;&quot;&gt;classNum&lt;/span&gt;&lt;/b&gt;(AifGenericDocumentService))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; axdWizardParameters =
AifServiceClassGenerator::getServiceParameters(serviceDictClass.name());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: darkblue;&quot;&gt;if&lt;/span&gt;&lt;/b&gt;(axdWizardParameters
&amp;amp;&amp;amp; axdWizardParameters.parmName() == mySearchAxdName)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; info(&lt;b&gt;&lt;span style=&quot;color: darkblue;&quot;&gt;strFmt&lt;/span&gt;&lt;/b&gt;(&lt;span style=&quot;color: darkred;&quot;&gt;&quot;Aif service class
name: %1&quot;&lt;/span&gt;, axdWizardParameters.parmAifServiceClassName()));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; info(&lt;b&gt;&lt;span style=&quot;color: darkblue;&quot;&gt;strFmt&lt;/span&gt;&lt;/b&gt;(&lt;span style=&quot;color: darkred;&quot;&gt;&quot;Document name:
%1&quot;&lt;/span&gt;, axdWizardParameters.parmAifEntityClassName()));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; info(&lt;b&gt;&lt;span style=&quot;color: darkblue;&quot;&gt;strFmt&lt;/span&gt;&lt;/b&gt;(&lt;span style=&quot;color: darkred;&quot;&gt;&quot;Axd name:
%1&quot;&lt;/span&gt;, axdWizardParameters.parmName()));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;info(&lt;b&gt;&lt;span style=&quot;color: darkblue;&quot;&gt;strFmt&lt;/span&gt;&lt;/b&gt;(&lt;span style=&quot;color: darkred;&quot;&gt;&quot;Query name: %1&quot;&lt;/span&gt;,
axdWizardParameters.parmQueryName()));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: darkblue;&quot;&gt;break&lt;/span&gt;&lt;/b&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;i&gt;&lt;span style=&quot;color: green;&quot;&gt;/*&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Use this if you know the Document class
name and wanted to find the Axd class name&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; str&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; documentClassName =
&quot;LedgerGeneralJournal&quot;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SysDictClass&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; documentDictClass;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AifDocument&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; documentInstance;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AxdBase&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; axdBase;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; documentDictClass = new
SysDictClass(className2Id(documentClassName));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; documentInstance =
documentDictClass.makeObject();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; axdBase =
documentInstance.getAxdInstance();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; info(strFmt(&quot;Document name: %1&quot;,
documentClassName));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; info(strFmt(&quot;Axd name: %1&quot;,
classId2Name(classIdGet(axdBase))));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; info(strFmt(&quot;Query name: %1&quot;,
axdBase.getQueryName()));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 8.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: consolas; font-size: 8pt;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/2566267862365012725/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2016/05/find-aif-service-class-name-by-axd.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/2566267862365012725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/2566267862365012725'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2016/05/find-aif-service-class-name-by-axd.html' title='Find AIF service class name by Axd document class name'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-1727997423755522062</id><published>2016-04-26T17:23:00.000+01:00</published><updated>2016-04-26T17:23:18.747+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics AX"/><title type='text'>UTCDateTime field in AX &amp; daylight saving</title><content type='html'>&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;This is an addition to an old post &quot;UTCDateTime field in AX &amp;amp; filtering&quot; (&lt;a href=&quot;http://mybhat.blogspot.my/2011/10/utcdatetime-field-in-ax-filtering.html&quot;&gt;http://mybhat.blogspot.my/2011/10/utcdatetime-field-in-ax-filtering.html&lt;/a&gt;).&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;When using the&amp;nbsp;DateTimeUtil::newDateTime() method to create a datetime value, if you&#39;re using daylight saving, then you&#39;ll probably need to take extra care with the optional parameter in this method - Timezone.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Let&#39;s walk-through with an example.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Today is 26/04/2016, and this year the daylight saving ends on 30 Oct for UK.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;The job below generate datetime value from 25 Oct to 5 Nov, with the time a minute before midnight (11:59:59pm). One with the Timezone parameter and the other one without.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2vsvvGumGIMtQ9O5xQ1XoNAzhTJRCyRlOnySzudeQEmzxBITX1g11tB6JtQ8f1_sFcJzjFb-cOrBmA48x_EzqubFAQ6qiQ_oWKVefIFrMBKNqehDsASn9g1yv6ExKJ7F1-t17K6iE_voa/s1600/UTCDateTimeCode.jpg&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2vsvvGumGIMtQ9O5xQ1XoNAzhTJRCyRlOnySzudeQEmzxBITX1g11tB6JtQ8f1_sFcJzjFb-cOrBmA48x_EzqubFAQ6qiQ_oWKVefIFrMBKNqehDsASn9g1yv6ExKJ7F1-t17K6iE_voa/s1600/UTCDateTimeCode.jpg&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Below is the data if you view it in AX.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;You&#39;ll notice the field &quot;DateTimeTest&quot; for records between 26/10 - 30/10 isn&#39;t showing 11:59:59pm, instead, it is showing 12:59:59am, Then looking at the field &quot;DateTimeTestWithTimezone&quot;, it correctly display all the time value at 11:59:59pm.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhczlSrdaOw1lttx-lTQ2gqxDty2zHOXIMolKM_jz_879hcGwWbZsm-ycbHgQlLwZvHwbFGymozO6gOpiIG8nitXiMVojmvQX6o_yHmPehTyzfY237kFMCrkXNJQwqJmP4iHlWLnkEfo7dx/s1600/UTCDateTimeTableBrowser.jpg&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhczlSrdaOw1lttx-lTQ2gqxDty2zHOXIMolKM_jz_879hcGwWbZsm-ycbHgQlLwZvHwbFGymozO6gOpiIG8nitXiMVojmvQX6o_yHmPehTyzfY237kFMCrkXNJQwqJmP4iHlWLnkEfo7dx/s1600/UTCDateTimeTableBrowser.jpg&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;And if you look at the backend data in SQL, it was the other way round, the &quot;DateTimeTest&quot; field saved in all the record has the time value of 23:59:59.000, which is different from how it is shown in AX. If you look at the &quot;DateTimeTestWithTimezone&quot;, for records between 25/10 - 29/10, it is saved with 22:59:59.000 and records after 29/10 is saved with 23:59:59.000.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDLZV-9NBNXYZCoV9qEJUREMBJUwVFecYRpGj95spabSBY9eKeatAhYYYNAHvhLuOm1U679UCzQnnE6x-GcoWzVivvxc3eYdCNvFraUpP-voorYj1bgHoHTn1WHIjNCYRMiQ2iq4DKdoX5/s1600/UTCDateTimeTableSQL.jpg&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDLZV-9NBNXYZCoV9qEJUREMBJUwVFecYRpGj95spabSBY9eKeatAhYYYNAHvhLuOm1U679UCzQnnE6x-GcoWzVivvxc3eYdCNvFraUpP-voorYj1bgHoHTn1WHIjNCYRMiQ2iq4DKdoX5/s1600/UTCDateTimeTableSQL.jpg&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;AX will show time value based on your computer settings.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;If you use daylight saving, it will automatically convert the time accordingly.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;In the above example, the field &quot;DateTimeTest&quot; is assigned with a datetime value generated without the timezone parameter, so it is saved as 23:59:59.000 in SQL, when this value is shown in AX at a machine with daylight saving, it automatically fast forward an hour for the dates before the daylight saving ends, hence, 23:59:59 (11:59:59pm) becomes the next day 00:59:59 (12:59:59am).&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;It works the same way if user enter a datetime value. Says, user enter 01/05/2016, 5:00:00pm with a machine with daylight saving on, this value will be saved as 01/05/2016, 4:00:00pm in SQL.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Enjoy playing around with UTCDateTime!!!&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/1727997423755522062/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2016/04/utcdatetime-field-in-ax-daylight-saving.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/1727997423755522062'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/1727997423755522062'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2016/04/utcdatetime-field-in-ax-daylight-saving.html' title='UTCDateTime field in AX &amp; daylight saving'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2vsvvGumGIMtQ9O5xQ1XoNAzhTJRCyRlOnySzudeQEmzxBITX1g11tB6JtQ8f1_sFcJzjFb-cOrBmA48x_EzqubFAQ6qiQ_oWKVefIFrMBKNqehDsASn9g1yv6ExKJ7F1-t17K6iE_voa/s72-c/UTCDateTimeCode.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-802357340594050741</id><published>2015-10-02T18:13:00.001+01:00</published><updated>2015-10-02T18:29:37.969+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics AX"/><title type='text'>Unable to move or delete files after reading it</title><content type='html'>&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Applies to: AX2012&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;u&gt;Scenario&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- Open file and read&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;- Move the file to another folder after reading is completed&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;u&gt;Issue&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;While not running it in CIL, the code works, but once run it in CIL, it give the error &quot;&lt;span style=&quot;color: red;&quot;&gt;System.IO.IOException: The process cannot access the file because it is being used by another process&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&quot;.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Those who came from AX 2009 used to depends on AX to finalize an object by just leaving the scope. Ref:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;https://msdn.microsoft.com/en-us/library/io.finalize.aspx&quot;&gt;https://msdn.microsoft.com/en-us/library/io.finalize.aspx&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;But when running in CIL, the finalize needs to be called manually.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Below is a sample service class called by a controller, when running the code in CIL, if the &#39;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;finalize()&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&#39; is called, no error occur. But if the &#39;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;finalize()&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&#39; is not called, it give the error as shown above.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;=================================================&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;class DemoService extends SysOperationServiceBase&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;=================================================&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;public void processDemo(DemoDataContract _contract)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; ;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; this.processFile(_contract.parmFileNameFrom());&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; this.moveFile(_contract.parmFileNameFrom(), _contract.parmFileNameTo());&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;=================================================&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;void processFile(Filename _fileNameFrom)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; #File&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; FileIoPermission &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;perm;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; TextIo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;importFile;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; container &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; record;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; int &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; totalRecords;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; ;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; perm = new FileIoPermission(_fileNameFrom, #io_read);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; perm.assert();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; importFile = new TextIo(_fileNameFrom, #io_read);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; while(importFile.status() == &amp;nbsp;IO_Status::Ok)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; record = importFile.read();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; totalRecords++;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; if(totalRecords)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; info(strFmt(&quot;Row count: %1&quot;, totalRecords));&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; //&lt;span style=&quot;background-color: yellow;&quot;&gt;importFile.finalize();&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;//Enable and disable this comment to test the effect&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;=================================================&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;void moveFile(Filename _sourceFile, Filename _destinationFile)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; #File&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; FileIoPermission &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;perm;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; ;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; perm = new FileIoPermission(_destinationFile, #io_write);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; perm.assert();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; System.IO.File::Move(_sourceFile, _destinationFile);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/802357340594050741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2015/10/unable-to-delete-files-after-reading-it.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/802357340594050741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/802357340594050741'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2015/10/unable-to-delete-files-after-reading-it.html' title='Unable to move or delete files after reading it'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5565205873085546505.post-418101017465631534</id><published>2015-05-08T18:08:00.000+01:00</published><updated>2015-05-08T18:08:19.143+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AIF"/><category scheme="http://www.blogger.com/atom/ns#" term="Dynamics AX"/><title type='text'>AIF process stuck / never ending (due to AIFResponse deletion)</title><content type='html'>&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;u&gt;Scenario of the issue&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Created a document service (Eg. TableA) and Inbound port to test it&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;While running the test, the receive (AifGateWayReceiveService) is OK, but the processing (AifInboundProcessingService) seems to stuck there / never ending&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;u&gt;In details&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Start up 2 AX client, Eg ClientA and ClientB.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;ClientA: The testing starts with getting the Inbound port (file adaptor) and XML file ready&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Dump the XML into the inbound folder&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;ClientA: Run a simple job which contain this line &lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc; font-family: Courier New, Courier, monospace;&quot;&gt;new AifGateWayReceiveService().run();&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;ClientA: Check &quot;Queue manager&quot; (Path: System administration &amp;gt; Periodic &amp;gt; Service and AIF) and confirmed the message has gone in&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;ClientB: Run another simple job which contain this line &lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc; font-family: Courier New, Courier, monospace;&quot;&gt;new AifInboundProcessingService().run();&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;ClientA: Check the &quot;Queue manager&quot; and confirmed the line is gone and a new record has been inserted into the table used by the document service (Eg. TableA)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;ClientB: The job seems not finishing, AX is frozen and not responding&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Below is a sample of the simple job used in above steps (just toggle around the options).&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;boolean runReceive = true,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; runProcess = false;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;if(runReceive)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; new AifGateWayReceiveService().run();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;if(runProcess)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; new AifInboundProcessingService().run();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;u&gt;Investigation result&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;The frozen isn&#39;t actually hanging, instead, it is running some record deletion, which took AGES, hence, not responding.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Below is the Trace Parser screenshot showing the trace file captured for around 30 seconds.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Within this short period, there&#39;re thousands of calls to database server for a DELETE statement.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;This DELETE statement came from the AIF which tries to delete the expired AIFResponse records.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjejuLRejC37r7W4DTVnOSCLgOek1wUAZa7eLGWnkM7uWyntgkT_UpHV4W5C8aJGlw0xJc9emldohHQDqdbEnGrV1UrxRl6ddHlIyioRl3KW_DQOeOsz1GMnp0SD1yQF5eK4E47DTZnTyZT/s1600/TraceParser_Delete_AIFResponse_01.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjejuLRejC37r7W4DTVnOSCLgOek1wUAZa7eLGWnkM7uWyntgkT_UpHV4W5C8aJGlw0xJc9emldohHQDqdbEnGrV1UrxRl6ddHlIyioRl3KW_DQOeOsz1GMnp0SD1yQF5eK4E47DTZnTyZT/s1600/TraceParser_Delete_AIFResponse_01.png&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPKmR_0GXSIMoam8qKa_Vfl-D30D1KPWObCdDsYMM6naFqQIuICVHp_4r-cmx6HTXdg1iUgtNINJd7xWgKWumGF0terwF_pMq9h3rhk11f0ZovieamH1DizSBoPO39kUKwFt8Q5geXM1md/s1600/TraceParser_Delete_AIFResponse_02.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPKmR_0GXSIMoam8qKa_Vfl-D30D1KPWObCdDsYMM6naFqQIuICVHp_4r-cmx6HTXdg1iUgtNINJd7xWgKWumGF0terwF_pMq9h3rhk11f0ZovieamH1DizSBoPO39kUKwFt8Q5geXM1md/s1600/TraceParser_Delete_AIFResponse_02.png&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;This DELETE statement supposed to delete any records that&#39;s older than the expired datetime (used today&#39;s datetime minus the AIFGlobalSettings.ResponseCacheLifetime value). Typically a 24 hours timeframe is a common value. But this table contains millions of records (&lt;i&gt;up to 2 years old of data is in this table&lt;/i&gt;).&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;The solution is to get rid to this data from SQL. Since this is development environment, truncate table would do. But if this production environment, it would need more care on how the data is deleted (&lt;i&gt;performance, time of performing the deletion, recover mode &amp;amp; backup chain, etc&lt;/i&gt;).&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mybhat.blogspot.com/feeds/418101017465631534/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mybhat.blogspot.com/2015/05/aif-process-stuck-never-ending-due-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/418101017465631534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5565205873085546505/posts/default/418101017465631534'/><link rel='alternate' type='text/html' href='http://mybhat.blogspot.com/2015/05/aif-process-stuck-never-ending-due-to.html' title='AIF process stuck / never ending (due to AIFResponse deletion)'/><author><name>Peter Chan</name><uri>http://www.blogger.com/profile/00530378304115915277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjejuLRejC37r7W4DTVnOSCLgOek1wUAZa7eLGWnkM7uWyntgkT_UpHV4W5C8aJGlw0xJc9emldohHQDqdbEnGrV1UrxRl6ddHlIyioRl3KW_DQOeOsz1GMnp0SD1yQF5eK4E47DTZnTyZT/s72-c/TraceParser_Delete_AIFResponse_01.png" height="72" width="72"/><thr:total>0</thr:total></entry></feed>