<?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: pass column in select query through input parameter logic supported in READ ONLY procedure/function in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/pass-column-in-select-query-through-input-parameter-logic-supported-in-read/qaa-p/376011#M30956</link>
    <description>&lt;P&gt;Hi Danish&lt;/P&gt;
  &lt;P&gt;It's quite late, but if you haven't found a solution yet, then the only way through I see is to call this procedure inside an XSJS. Expose this XSJS with parameters as a service for the reporting layer.&lt;/P&gt;</description>
    <pubDate>Sat, 22 Jul 2017 12:16:13 GMT</pubDate>
    <dc:creator>former_member208449</dc:creator>
    <dc:date>2017-07-22T12:16:13Z</dc:date>
    <item>
      <title>pass column in select query through input parameter logic supported in READ ONLY procedure/function</title>
      <link>https://community.sap.com/t5/technology-q-a/pass-column-in-select-query-through-input-parameter-logic-supported-in-read/qaq-p/376010</link>
      <description>&lt;P&gt;Dear Experts,&lt;/P&gt;&lt;P&gt;The below procedure takes column name(s) in input and select column(s) that user entered from table also pass them in group by clause &lt;/P&gt;&lt;P&gt;and at the end generate final result set always in two columns.&lt;/P&gt;&lt;P&gt;-----------------&lt;/P&gt;&lt;P&gt;Example: Procedure Snippet&lt;/P&gt;&lt;P&gt;CREATE PROCEDURE "SCHEMA_NAME"."PROC_TEMP"(IN COL VARCHAR(100), OUT
TAB "SCHEMA_NAME"."TABLE_TYPE1" ) &lt;/P&gt;&lt;P&gt;LANGUAGE SQLSCRIPT &lt;/P&gt;&lt;P&gt;AS&lt;/P&gt;&lt;P&gt;BEGIN&lt;/P&gt;&lt;P&gt;declare COL1 varchar(100);&lt;/P&gt;&lt;P&gt;create local temporary table #temp (QUANTITY INTEGER, CONFIG VARCHAR(100));&lt;/P&gt;&lt;P&gt;COL1 = replace(:col,',','||'' ; '' ||');&lt;/P&gt;&lt;P&gt;EXECUTE IMMEDIATE 'insert into #temp (QUANTITY , CONFIG)&lt;/P&gt;&lt;P&gt; select QUANTITY, ' || :COL1 || ' as CONFIG from (select&lt;/P&gt;&lt;P&gt; sum(QUANTITY) as "QUANTITY",&lt;/P&gt;&lt;P&gt;  '||:COL||'&lt;/P&gt;&lt;P&gt; from "SCHEMA_NAME"."TABLE1"&lt;/P&gt;&lt;P&gt;group by '||:COL||'&lt;/P&gt;&lt;P&gt;order by QUANTITY desc)';&lt;/P&gt;&lt;P&gt;TAB = select QUANTITY, CONFIG from #temp;&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;----------------------&lt;/P&gt;&lt;P&gt;Sample Table: TABLE1&lt;/P&gt;&lt;P&gt;QUANTITY  
COLUMN_A  COLUMN_B  
COLUMN_C&lt;/P&gt;&lt;P&gt;   50                        CA1                    CB1                     CC2&lt;/P&gt;&lt;P&gt;   20                    CA2               CB1                    CC1&lt;/P&gt;&lt;P&gt;   25                  CA1               CB2                     CC2&lt;/P&gt;&lt;P&gt;   45                        CA1               CB1                CC1&lt;/P&gt;&lt;P&gt;------------------------&lt;/P&gt;&lt;P&gt;CALL "SCHEMA_NAME"."PROC_TEMP"('COLUMN_A,COLUMN_C',?);&lt;/P&gt;&lt;P&gt;Procedure output:&lt;/P&gt;&lt;P&gt;QUANTITY     CONFIG&lt;/P&gt;&lt;P&gt;   75               CA1;CC2&lt;/P&gt;&lt;P&gt;  45                  CA1;CC1&lt;/P&gt;&lt;P&gt;  20                  CA2;CC1&lt;/P&gt;&lt;P&gt;-------------------------&lt;/P&gt;&lt;P&gt;Now I wanted to incorporate above procedure in calculation view and take it further to reporting layer however as read-write
 procedure and Dynamic SQL is not supported in READ ONLY 
procedure/function therefore I am not able to call above procedure in 
Table Function / SQL Script calculation view.&lt;/P&gt;&lt;P&gt;So Is there any other way to achieve above functionality in READ ONLY procedure/function/SQL Script calculation view? &lt;/P&gt;&lt;P&gt;If not then how should one pass required column(s) dynamically in select query from reporting layer and get desired aggregated data at run time?&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;BR /&gt;
Danish Abdullah&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 18:36:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/pass-column-in-select-query-through-input-parameter-logic-supported-in-read/qaq-p/376010</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-01-16T18:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: pass column in select query through input parameter logic supported in READ ONLY procedure/function</title>
      <link>https://community.sap.com/t5/technology-q-a/pass-column-in-select-query-through-input-parameter-logic-supported-in-read/qaa-p/376011#M30956</link>
      <description>&lt;P&gt;Hi Danish&lt;/P&gt;
  &lt;P&gt;It's quite late, but if you haven't found a solution yet, then the only way through I see is to call this procedure inside an XSJS. Expose this XSJS with parameters as a service for the reporting layer.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jul 2017 12:16:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/pass-column-in-select-query-through-input-parameter-logic-supported-in-read/qaa-p/376011#M30956</guid>
      <dc:creator>former_member208449</dc:creator>
      <dc:date>2017-07-22T12:16:13Z</dc:date>
    </item>
  </channel>
</rss>

