<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Error when adding date parameter to SAP B1 Query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-adding-date-parameter-to-sap-b1-query/m-p/12127220#M1974826</link>
    <description>&lt;P&gt;Hello all, I am trying to create a query between two databases (one non SAP) that are on the same server that includes a date parameter.&lt;/P&gt;
  &lt;P&gt;The query on its own runs fine, however, whenever I try to &lt;STRONG&gt;add a date parameter&lt;/STRONG&gt; ( Using &lt;STRONG&gt;T1.FileDateB&lt;/STRONG&gt;)&lt;STRONG&gt; &lt;/STRONG&gt;to the query from the non SAP Database, I receive the following error &lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;'Blanket Agreement' (OOAT)&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;I have included the query below. Any help is greatly appreciated. &lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;select distinct(T1.transid) , &lt;/P&gt;
  &lt;P&gt;T1.vendor as 'Vendor',&lt;/P&gt;
  &lt;P&gt; T1.vendorstatus as 'Vendor Status', &lt;/P&gt;
  &lt;P&gt;T1.FileDate as 'File Date', &lt;/P&gt;
  &lt;P&gt;T1.VendorFileName as 'File Name', &lt;/P&gt;
  &lt;P&gt;Case when isnull(T1.TargetDevice,'')&amp;lt;&amp;gt;'' then T1.TargetDevice else T1.ItemCode end '3rd Party ItemCode', &lt;/P&gt;
  &lt;P&gt; T1.Targetdevice as '3rd Party Target Device', &lt;/P&gt;
  &lt;P&gt; T1.itemcode '3rd party ItemCode', &lt;/P&gt;
  &lt;P&gt;T0.itemcode as 'SAP Item Code', &lt;/P&gt;
  &lt;P&gt;T1.LotNum '3rd Party Lot', &lt;/P&gt;
  &lt;P&gt; T0.DistNumber as 'SAP Lot Number', &lt;/P&gt;
  &lt;P&gt;T1.ParentLot '3rd Party Parent Lot', &lt;/P&gt;
  &lt;P&gt; cast(T0.Notes as nvarchar) 'SAP ParentLot',&lt;/P&gt;
  &lt;P&gt; T1.RecvQty '3rd Party Received Qty',&lt;/P&gt;
  &lt;P&gt; T0.Quantity-T0.Quantout 'SAP Onhand', &lt;/P&gt;
  &lt;P&gt; ((T1.recvQty)-(T0.Quantity-T0.QuantOut)) as 'Variance', &lt;/P&gt;
  &lt;P&gt;T1.CurrentQty as '3rd Party Quantity', &lt;/P&gt;
  &lt;P&gt; T1.Stage as '3rd Party Stage', &lt;/P&gt;
  &lt;P&gt;Case when T5.QryGroup1 = 'Y' then 'FAB' when T5.QryGroup2 = 'Y' then 'FAB' when T5.QryGroup3 = 'Y' then 'EWS' when T5.QryGroup4 = 'Y' then 'ASSEM' when T5.QryGroup5 = 'Y' then 'FT' when T5.QryGroup6 = 'Y' then 'FG' when T5.QryGroup7 = 'Y' then 'FG' when T5.QryGroup8 = 'Y' then 'FAB' When T5.Qrygroup9 = 'Y' then 'EWS' end as 'SAP Stage' , T5.FrgnName as 'SAP Item Family', Case when (T0.Quantity-T0.Quantout) = '0' then '0' --else '0' end as 'Price Per Unit' else (T0.CostTotal/T0.Quantity) end as 'SAP Price Per Unit' &lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;from TEST.dbo.THIRD_PARTY_FILES T1 with(nolock) &lt;/P&gt;
  &lt;P&gt; left join SAPDATABASE.dbo.OBTN T0 With(nolock) on T0.DistNumber = T1.LotNum collate Database_default and T0.ItemCode = Case when isnull(T1.TargetDevice,'')&amp;lt;&amp;gt;'' then T1.TargetDevice else T1.ItemCode end collate database_default left join SAPDATABASE.dbo.ITL1 T3 with(nolock) on T3.ItemCode = T0.itemcode and T3.SysNumber = T0.SysNumber&lt;/P&gt;
  &lt;P&gt; Left Join SAPDATABASE.dbo.OITL T4 with(nolock) on T4.LogEntry = T3.LogEntry&lt;/P&gt;
  &lt;P&gt; Left join SAPDATABASE.dbo.OITM T5 with(noLock) on T5.itemcode = T1.itemcode collate Database_default &lt;/P&gt;
  &lt;P&gt;Where T1.RecvQty &amp;lt;&amp;gt; 0 and T1.IsValid = 'Y' and -- and (T0.Quantity - T0.QuantOut) = T1.RecvQty and (T0.Quantity - T0.QuantOut) &amp;lt;&amp;gt; '0' where T1.filename = '[%0]' Order By T1.transid asc&lt;/P&gt;</description>
    <pubDate>Tue, 08 Oct 2019 18:26:16 GMT</pubDate>
    <dc:creator>former_member609818</dc:creator>
    <dc:date>2019-10-08T18:26:16Z</dc:date>
    <item>
      <title>Error when adding date parameter to SAP B1 Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-adding-date-parameter-to-sap-b1-query/m-p/12127220#M1974826</link>
      <description>&lt;P&gt;Hello all, I am trying to create a query between two databases (one non SAP) that are on the same server that includes a date parameter.&lt;/P&gt;
  &lt;P&gt;The query on its own runs fine, however, whenever I try to &lt;STRONG&gt;add a date parameter&lt;/STRONG&gt; ( Using &lt;STRONG&gt;T1.FileDateB&lt;/STRONG&gt;)&lt;STRONG&gt; &lt;/STRONG&gt;to the query from the non SAP Database, I receive the following error &lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;'Blanket Agreement' (OOAT)&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;I have included the query below. Any help is greatly appreciated. &lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;select distinct(T1.transid) , &lt;/P&gt;
  &lt;P&gt;T1.vendor as 'Vendor',&lt;/P&gt;
  &lt;P&gt; T1.vendorstatus as 'Vendor Status', &lt;/P&gt;
  &lt;P&gt;T1.FileDate as 'File Date', &lt;/P&gt;
  &lt;P&gt;T1.VendorFileName as 'File Name', &lt;/P&gt;
  &lt;P&gt;Case when isnull(T1.TargetDevice,'')&amp;lt;&amp;gt;'' then T1.TargetDevice else T1.ItemCode end '3rd Party ItemCode', &lt;/P&gt;
  &lt;P&gt; T1.Targetdevice as '3rd Party Target Device', &lt;/P&gt;
  &lt;P&gt; T1.itemcode '3rd party ItemCode', &lt;/P&gt;
  &lt;P&gt;T0.itemcode as 'SAP Item Code', &lt;/P&gt;
  &lt;P&gt;T1.LotNum '3rd Party Lot', &lt;/P&gt;
  &lt;P&gt; T0.DistNumber as 'SAP Lot Number', &lt;/P&gt;
  &lt;P&gt;T1.ParentLot '3rd Party Parent Lot', &lt;/P&gt;
  &lt;P&gt; cast(T0.Notes as nvarchar) 'SAP ParentLot',&lt;/P&gt;
  &lt;P&gt; T1.RecvQty '3rd Party Received Qty',&lt;/P&gt;
  &lt;P&gt; T0.Quantity-T0.Quantout 'SAP Onhand', &lt;/P&gt;
  &lt;P&gt; ((T1.recvQty)-(T0.Quantity-T0.QuantOut)) as 'Variance', &lt;/P&gt;
  &lt;P&gt;T1.CurrentQty as '3rd Party Quantity', &lt;/P&gt;
  &lt;P&gt; T1.Stage as '3rd Party Stage', &lt;/P&gt;
  &lt;P&gt;Case when T5.QryGroup1 = 'Y' then 'FAB' when T5.QryGroup2 = 'Y' then 'FAB' when T5.QryGroup3 = 'Y' then 'EWS' when T5.QryGroup4 = 'Y' then 'ASSEM' when T5.QryGroup5 = 'Y' then 'FT' when T5.QryGroup6 = 'Y' then 'FG' when T5.QryGroup7 = 'Y' then 'FG' when T5.QryGroup8 = 'Y' then 'FAB' When T5.Qrygroup9 = 'Y' then 'EWS' end as 'SAP Stage' , T5.FrgnName as 'SAP Item Family', Case when (T0.Quantity-T0.Quantout) = '0' then '0' --else '0' end as 'Price Per Unit' else (T0.CostTotal/T0.Quantity) end as 'SAP Price Per Unit' &lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;from TEST.dbo.THIRD_PARTY_FILES T1 with(nolock) &lt;/P&gt;
  &lt;P&gt; left join SAPDATABASE.dbo.OBTN T0 With(nolock) on T0.DistNumber = T1.LotNum collate Database_default and T0.ItemCode = Case when isnull(T1.TargetDevice,'')&amp;lt;&amp;gt;'' then T1.TargetDevice else T1.ItemCode end collate database_default left join SAPDATABASE.dbo.ITL1 T3 with(nolock) on T3.ItemCode = T0.itemcode and T3.SysNumber = T0.SysNumber&lt;/P&gt;
  &lt;P&gt; Left Join SAPDATABASE.dbo.OITL T4 with(nolock) on T4.LogEntry = T3.LogEntry&lt;/P&gt;
  &lt;P&gt; Left join SAPDATABASE.dbo.OITM T5 with(noLock) on T5.itemcode = T1.itemcode collate Database_default &lt;/P&gt;
  &lt;P&gt;Where T1.RecvQty &amp;lt;&amp;gt; 0 and T1.IsValid = 'Y' and -- and (T0.Quantity - T0.QuantOut) = T1.RecvQty and (T0.Quantity - T0.QuantOut) &amp;lt;&amp;gt; '0' where T1.filename = '[%0]' Order By T1.transid asc&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 18:26:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-adding-date-parameter-to-sap-b1-query/m-p/12127220#M1974826</guid>
      <dc:creator>former_member609818</dc:creator>
      <dc:date>2019-10-08T18:26:16Z</dc:date>
    </item>
  </channel>
</rss>

