<?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 RFC WHICH CAN USE DYNAMIC SQL AS INPUT AND SHOW COMPLETE DATA FOR TABLE in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/rfc-which-can-use-dynamic-sql-as-input-and-show-complete-data-for-table/m-p/7689668#M1576775</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Expert,&lt;/P&gt;&lt;P&gt;I am trying to create a FM like RFC_READ_TABLE. In this table we put table name and the field name for which we write a query and option for query we get the out put only for that field in this case.&lt;/P&gt;&lt;P&gt;My requirement is very similar to this. But here i want to enter any table name and in option i want to write dynamic sql query for any filed of table then i want data based on this so that it will display the entire table entries.&lt;/P&gt;&lt;P&gt;Like TABNAMELIKE     EKKO &lt;/P&gt;&lt;P&gt;OTHERCON     bukrs_k = 3000.&lt;/P&gt;&lt;P&gt;Based on this selection it has to show the entire table fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To make this easy to understand i made a custom FM which are getting data from table or view and i select any field and put query it will show the result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION ZDYNSQL_EKKO_EKPO.&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Local Interface:&lt;/P&gt;&lt;P&gt;*"  IMPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(ERNAMLIKE) TYPE  CHAR15 OPTIONAL&lt;/P&gt;&lt;P&gt;*"     VALUE(OTHERCON) TYPE  CHAR50 OPTIONAL&lt;/P&gt;&lt;P&gt;*"  TABLES&lt;/P&gt;&lt;P&gt;*"      VALUE STRUCTURE  V_EKKO_EKPO&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;*TABLES : V_EKKO_EKPO, EKKO, EKPO.&lt;/P&gt;&lt;P&gt;DATA: STR_WHERE TYPE TABLE OF EDPLINE.&lt;/P&gt;&lt;P&gt;DATA: STR_LINE TYPE EDPLINE.&lt;/P&gt;&lt;P&gt;*CONCATENATE 'EBELN LIKE''' EBELNLIKE '%''' INTO STR_LINE.&lt;/P&gt;&lt;P&gt;        CONCATENATE 'ERNAM LIKE ''' ERNAMLIKE '%''' INTO STR_LINE.&lt;/P&gt;&lt;P&gt;        IF OTHERCON &amp;lt;&amp;gt; '            '.&lt;/P&gt;&lt;P&gt;        CONCATENATE STR_LINE 'AND' OTHERCON '            ' INTO STR_LINE SEPARATED BY SPACE.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;      APPEND STR_LINE TO STR_WHERE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      SELECT * FROM  V_EKKO_EKPO INTO CORRESPONDING FIELDS OF TABLE VALUE WHERE (STR_WHERE).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFUNCTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;/P&gt;&lt;P&gt;Now here is sample code of exact requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION ZDYNSQL_TABLE_READ.&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Local Interface:&lt;/P&gt;&lt;P&gt;*"  IMPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(TABNAMELIKE) TYPE  DD02L-TABNAME&lt;/P&gt;&lt;P&gt;*"     VALUE(OTHERCON) TYPE  CHAR80 OPTIONAL&lt;/P&gt;&lt;P&gt;*"  TABLES&lt;/P&gt;&lt;P&gt;*"      VALUE STRUCTURE  DD02L&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;DATA: STR_WHERE TYPE TABLE OF EDPLINE.&lt;/P&gt;&lt;P&gt;DATA: STR_LINE TYPE STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        CONCATENATE 'TABNAME LIKE ''' TABNAMELIKE '%' 'DD02L' 'TABNAME' INTO STR_LINE.&lt;/P&gt;&lt;P&gt;        IF OTHERCON &amp;lt;&amp;gt; '            '.&lt;/P&gt;&lt;P&gt;        CONCATENATE STR_LINE 'AND' OTHERCON '            ' INTO STR_LINE SEPARATED BY SPACE.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;      APPEND STR_LINE TO STR_WHERE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      SELECT * FROM DD02L INTO CORRESPONDING FIELDS OF TABLE VALUE WHERE (STR_WHERE).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFUNCTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this i put table name as EKKO and put sql query as bukrs_k = 3000 it provide a short dump.&lt;/P&gt;&lt;P&gt;How can i solve this problem. Please provide some input or modification&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks And Regards&lt;/P&gt;&lt;P&gt;Ranjeet Singh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Feb 2011 13:38:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-02-10T13:38:03Z</dc:date>
    <item>
      <title>RFC WHICH CAN USE DYNAMIC SQL AS INPUT AND SHOW COMPLETE DATA FOR TABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rfc-which-can-use-dynamic-sql-as-input-and-show-complete-data-for-table/m-p/7689668#M1576775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Expert,&lt;/P&gt;&lt;P&gt;I am trying to create a FM like RFC_READ_TABLE. In this table we put table name and the field name for which we write a query and option for query we get the out put only for that field in this case.&lt;/P&gt;&lt;P&gt;My requirement is very similar to this. But here i want to enter any table name and in option i want to write dynamic sql query for any filed of table then i want data based on this so that it will display the entire table entries.&lt;/P&gt;&lt;P&gt;Like TABNAMELIKE     EKKO &lt;/P&gt;&lt;P&gt;OTHERCON     bukrs_k = 3000.&lt;/P&gt;&lt;P&gt;Based on this selection it has to show the entire table fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To make this easy to understand i made a custom FM which are getting data from table or view and i select any field and put query it will show the result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION ZDYNSQL_EKKO_EKPO.&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Local Interface:&lt;/P&gt;&lt;P&gt;*"  IMPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(ERNAMLIKE) TYPE  CHAR15 OPTIONAL&lt;/P&gt;&lt;P&gt;*"     VALUE(OTHERCON) TYPE  CHAR50 OPTIONAL&lt;/P&gt;&lt;P&gt;*"  TABLES&lt;/P&gt;&lt;P&gt;*"      VALUE STRUCTURE  V_EKKO_EKPO&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;*TABLES : V_EKKO_EKPO, EKKO, EKPO.&lt;/P&gt;&lt;P&gt;DATA: STR_WHERE TYPE TABLE OF EDPLINE.&lt;/P&gt;&lt;P&gt;DATA: STR_LINE TYPE EDPLINE.&lt;/P&gt;&lt;P&gt;*CONCATENATE 'EBELN LIKE''' EBELNLIKE '%''' INTO STR_LINE.&lt;/P&gt;&lt;P&gt;        CONCATENATE 'ERNAM LIKE ''' ERNAMLIKE '%''' INTO STR_LINE.&lt;/P&gt;&lt;P&gt;        IF OTHERCON &amp;lt;&amp;gt; '            '.&lt;/P&gt;&lt;P&gt;        CONCATENATE STR_LINE 'AND' OTHERCON '            ' INTO STR_LINE SEPARATED BY SPACE.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;      APPEND STR_LINE TO STR_WHERE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      SELECT * FROM  V_EKKO_EKPO INTO CORRESPONDING FIELDS OF TABLE VALUE WHERE (STR_WHERE).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFUNCTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;/P&gt;&lt;P&gt;Now here is sample code of exact requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION ZDYNSQL_TABLE_READ.&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Local Interface:&lt;/P&gt;&lt;P&gt;*"  IMPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(TABNAMELIKE) TYPE  DD02L-TABNAME&lt;/P&gt;&lt;P&gt;*"     VALUE(OTHERCON) TYPE  CHAR80 OPTIONAL&lt;/P&gt;&lt;P&gt;*"  TABLES&lt;/P&gt;&lt;P&gt;*"      VALUE STRUCTURE  DD02L&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;DATA: STR_WHERE TYPE TABLE OF EDPLINE.&lt;/P&gt;&lt;P&gt;DATA: STR_LINE TYPE STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        CONCATENATE 'TABNAME LIKE ''' TABNAMELIKE '%' 'DD02L' 'TABNAME' INTO STR_LINE.&lt;/P&gt;&lt;P&gt;        IF OTHERCON &amp;lt;&amp;gt; '            '.&lt;/P&gt;&lt;P&gt;        CONCATENATE STR_LINE 'AND' OTHERCON '            ' INTO STR_LINE SEPARATED BY SPACE.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;      APPEND STR_LINE TO STR_WHERE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      SELECT * FROM DD02L INTO CORRESPONDING FIELDS OF TABLE VALUE WHERE (STR_WHERE).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFUNCTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this i put table name as EKKO and put sql query as bukrs_k = 3000 it provide a short dump.&lt;/P&gt;&lt;P&gt;How can i solve this problem. Please provide some input or modification&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks And Regards&lt;/P&gt;&lt;P&gt;Ranjeet Singh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2011 13:38:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rfc-which-can-use-dynamic-sql-as-input-and-show-complete-data-for-table/m-p/7689668#M1576775</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-10T13:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: RFC WHICH CAN USE DYNAMIC SQL AS INPUT AND SHOW COMPLETE DATA FOR TABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rfc-which-can-use-dynamic-sql-as-input-and-show-complete-data-for-table/m-p/7689669#M1576776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ranjeet,&lt;/P&gt;&lt;P&gt;There are multiple threads in SDN for dynamic query.. Please check out the following wiki code gallery to see if it would suit your requirement, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://wiki.sdn.sap.com/wiki/display/Snippets/Dynamic" target="test_blank"&gt;http://wiki.sdn.sap.com/wiki/display/Snippets/Dynamic&lt;/A&gt;&lt;EM&gt;Creation&lt;/EM&gt;and&lt;EM&gt;Display&lt;/EM&gt;of&lt;EM&gt;SQL&lt;/EM&gt;Queries&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2011 17:11:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rfc-which-can-use-dynamic-sql-as-input-and-show-complete-data-for-table/m-p/7689669#M1576776</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-10T17:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: RFC WHICH CAN USE DYNAMIC SQL AS INPUT AND SHOW COMPLETE DATA FOR TABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rfc-which-can-use-dynamic-sql-as-input-and-show-complete-data-for-table/m-p/7689670#M1576777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kris,&lt;/P&gt;&lt;P&gt;I tried to make sample using that link you provide to me. How can i declare Global Interface in FM and in import parameter references like "REFERENCE(I_INTERFACE_CHECK) DEFAULT SPACE".&lt;/P&gt;&lt;P&gt;Also it uses a function-pool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me tell you about my exact requirement about FM.&lt;/P&gt;&lt;P&gt;I want in import parameter input as any SAP Table name like&lt;/P&gt;&lt;P&gt;TABNAME TYPE EKKO&lt;/P&gt;&lt;P&gt;OPTIONS TYPE CHAR80&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want my output to be stored in TABLES attributes as per the table name entered in import parameter. In import parameter Table name can be any one of SAP tables and Option based on that particular table. Like if i go with table EKKO and put OPTIONS as&lt;/P&gt;&lt;P&gt;ebelp = 4 then TABLES attributes Tab  contains all the relevant data for input.&lt;/P&gt;&lt;P&gt;Is there any way with the help of that i can put my data into internal tables. I tried to put in TABLES as VALUE LIKE ANY but it shows that generic are not allowed. Can you provide some sample on this.&lt;/P&gt;&lt;P&gt;I also getting exceptions like CX_SY_DYNAMIC_OSQL_SEMANTICS, SAPSQL_INVALID_FIELDNAME. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Waiting for your valuable reply.&lt;/P&gt;&lt;P&gt;Thanks And Regards&lt;/P&gt;&lt;P&gt;Ranjeet Singh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Feb 2011 08:52:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rfc-which-can-use-dynamic-sql-as-input-and-show-complete-data-for-table/m-p/7689670#M1576777</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-15T08:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: RFC WHICH CAN USE DYNAMIC SQL AS INPUT AND SHOW COMPLETE DATA FOR TABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rfc-which-can-use-dynamic-sql-as-input-and-show-complete-data-for-table/m-p/7689671#M1576778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kris,&lt;/P&gt;&lt;P&gt;Now the requirement is more clear like this.  We need to give input as complete Select query. Like below are examples.&lt;/P&gt;&lt;P&gt;1) Select * from ekko into table it_data where bukrs = 3000. or&lt;/P&gt;&lt;P&gt;2) select fld1 fld2 fld3 from tablename into it_data up to 10 rows where fld4 = XXXXX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We want to pass only such query as input and want result according to them. User can put any table name, can chose any table fields, also he can use inner join group by statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters: option type string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Option we need to wright that select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ranjeet Singh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2011 05:03:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rfc-which-can-use-dynamic-sql-as-input-and-show-complete-data-for-table/m-p/7689671#M1576778</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-03T05:03:29Z</dc:date>
    </item>
  </channel>
</rss>

