<?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>Question Re: Table Function/Query error inside a “cross-database queries” scenario in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/table-function-query-error-inside-a-cross-database-queries-scenario/qaa-p/496349#M90867</link>
    <description>&lt;P&gt;Solved by SAP Support.&lt;/P&gt;
  &lt;P&gt;This is the response:&lt;/P&gt;
  &lt;P&gt;This query error is identified as known issue for accessing temporary index with cross database access environment. And the bug was fixed in reversion 122.09&lt;/P&gt;
  &lt;P&gt;[Workaround]&lt;BR /&gt;Add "WITH HINT (NO_CS_JOIN)" at the end of the problematic query/select statement. Please note, using this Workaround can Impact performance.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Dec 2017 14:28:15 GMT</pubDate>
    <dc:creator>former_member283197</dc:creator>
    <dc:date>2017-12-22T14:28:15Z</dc:date>
    <item>
      <title>Table Function/Query error inside a “cross-database queries” scenario</title>
      <link>https://community.sap.com/t5/technology-q-a/table-function-query-error-inside-a-cross-database-queries-scenario/qaq-p/496348</link>
      <description>&lt;P&gt;Dear,&lt;/P&gt;
  &lt;P&gt;I’m asking your support for a problem regarding a Table Function inside a “cross-database queries” scenario.&lt;/P&gt;
  &lt;P&gt;This is our Hana landscape.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/67042-hte-landascape.png" /&gt;&lt;/P&gt;
  &lt;P&gt;This is the table function created in the BI Tentant HBQ.&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;FUNCTION "BIDEV"."dwh.mes.mes_tf::TF_TURNI_FERMATE" (IP_YEAR INTEGER) 


       RETURNS TABLE ("HANDLE_ID" NVARCHAR(412), "SITE" NVARCHAR(6), "RESRCE" NVARCHAR(36), "DATE_TIME" NVARCHAR(20), "TURNO" NVARCHAR(15), "DATA_ORA_INIZIO" NVARCHAR(20), "DATA_ORA_FINE" NVARCHAR(20))


       LANGUAGE SQLSCRIPT


       SQL SECURITY INVOKER AS


BEGIN


RETURN


SELECT DISTINCT 


              RLS.HANDLE AS HANDLE_ID,


              RLS.SITE,


              RES.RESRCE,


              RLS.DATE_TIME_END AS DATE_TIME,


              CAL.TURNO,


              CAL.DATA_ORA_INIZIO,


              CAL.DATA_ORA_FINE


        FROM HMQ.WIPUSER.ZME_RESRCE_LOG_STATE RLS 


        LEFT OUTER JOIN HMQ.WIPUSER.RESRCE RES


              ON RLS.HANDLE = RES.HANDLE


        LEFT OUTER JOIN HMQ.WIPUSER.ZME_CYB_CALENDAR CAL


           ON CAL.SITE = RLS.SITE 


           AND CAL.ZMACCHINA = RES.RESRCE


           AND RLS.DATE_TIME_END &amp;gt; CAL.DATA_ORA_INIZIO AND  RLS.DATE_TIME_END &amp;lt;= CAL.DATA_ORA_FINE


        WHERE YEAR(RLS.DATE_TIME_END) = :IP_YEAR;


END;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I have used this Table Function inside a Calculation View always, into the BI Tenant HBQ.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/67043-1.png" /&gt;&lt;/P&gt;
  &lt;P&gt;If I try to get a preview data, this error appears.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/67045-2.png" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/67046-3.png" /&gt;&lt;/P&gt;
  &lt;P&gt;The same Table Function, created directly in the MES Tentant HMQ, works well.&lt;/P&gt;
  &lt;P&gt;So, I tried to execute the core selection query of the table function directly into SQL Console, but the error persists.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/67047-4.png" /&gt;&lt;/P&gt;
  &lt;P&gt;By excecuting queries on single tables, all correctly work.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/67048-5.png" /&gt;&lt;/P&gt;
  &lt;P&gt;Below the structures of tables of the MES Tenant HMQ used by Table Function.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/67053-11.png" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;The environment of HANA is SPS 12 (1.00.122.08.1490178281)&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;Any suggestion?&lt;/P&gt;
  &lt;P&gt;Best regards,&lt;/P&gt;
  &lt;P&gt;Denis Peretto.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2017 09:40:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/table-function-query-error-inside-a-cross-database-queries-scenario/qaq-p/496348</guid>
      <dc:creator>former_member283197</dc:creator>
      <dc:date>2017-09-19T09:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Table Function/Query error inside a “cross-database queries” scenario</title>
      <link>https://community.sap.com/t5/technology-q-a/table-function-query-error-inside-a-cross-database-queries-scenario/qaa-p/496349#M90867</link>
      <description>&lt;P&gt;Solved by SAP Support.&lt;/P&gt;
  &lt;P&gt;This is the response:&lt;/P&gt;
  &lt;P&gt;This query error is identified as known issue for accessing temporary index with cross database access environment. And the bug was fixed in reversion 122.09&lt;/P&gt;
  &lt;P&gt;[Workaround]&lt;BR /&gt;Add "WITH HINT (NO_CS_JOIN)" at the end of the problematic query/select statement. Please note, using this Workaround can Impact performance.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 14:28:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/table-function-query-error-inside-a-cross-database-queries-scenario/qaa-p/496349#M90867</guid>
      <dc:creator>former_member283197</dc:creator>
      <dc:date>2017-12-22T14:28:15Z</dc:date>
    </item>
  </channel>
</rss>

