<?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 Re: Pass Structured table into dynamic table parameter in public method in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-structured-table-into-dynamic-table-parameter-in-public-method/m-p/6743947#M1458981</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes you can do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would change your interface to remove the IV_RECORD_STRUCTURE parameter and determine the structure of the table at runtime using Runtime Type Services (RTTS).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason that you are getting the syntax error is because IT_FILE_RECORD is defined as a reference to a data type, not a table itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will probably need to assign the dereferenced parameter to a field symbol.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FIELD-SYMBOLS: &amp;lt;table&amp;gt; TYPE ANY TABLE.

ASSIGN it_file_record-&amp;gt;* to &amp;lt;table&amp;gt;.

LOOP AT &amp;lt;table&amp;gt; into &amp;lt;fs_string&amp;gt;.
...
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I haven't tried this so apologies if you need to tweak the syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Graham Robbo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Mar 2010 05:08:05 GMT</pubDate>
    <dc:creator>GrahamRobbo</dc:creator>
    <dc:date>2010-03-17T05:08:05Z</dc:date>
    <item>
      <title>Pass Structured table into dynamic table parameter in public method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-structured-table-into-dynamic-table-parameter-in-public-method/m-p/6743946#M1458980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ladies and Gentlemen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a requiremet to pass (1 at a time) any number of tables into a reuseable method in a custom class.  The Method code is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; method CREATE_OUTBOUND_FILE.
*--------------------------------------------------------------------------------*
* Importing VALUE( IV_PATHNAME )  TYPE PATHEXTERN File Destination
* Importing VALUE( IT_FILE_RECORD ) TYPE REF TO DATA  Table with Output
* Importing VALUE( IV_RECORD_STRUCTURE )  TYPE STRING OPTIONAL  Record Structure
* Importing VALUE( IV_DELIMITER )	TYPE STRING	File Delimiter
* Exporting VALUE( EV_RECORD_CNT )  TYPE STRING Record Count
*--------------------------------------------------------------------------------*
  Data:
        ls_line_cnt(6) type n,
        lt_data_struc  type zty_ddic_struc_T,
        ls_string      type string.

  field-SYMBOLS: &amp;lt;fs_string&amp;gt; type any.

* Open Dataset for outputting file details
  Open dataset iv_pathname for output in text mode encoding default.

  Assign ls_string to &amp;lt;fs_string&amp;gt; CASTING TYPE (iv_record_structure).
  loop at it_file_record into &amp;lt;fs_string&amp;gt;.
    transfer &amp;lt;fs_string&amp;gt; to iv_pathname.
    Add 1 to ls_line_cnt.
    clear &amp;lt;fs_string&amp;gt;.
  endloop.

  ev_record_cnt = ls_line_cnt.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where IV_PATHNAME = output destination &amp;amp; filename&lt;/P&gt;&lt;P&gt;            IT_FILE_REC     = data table &lt;/P&gt;&lt;P&gt;            IV_RECORD_STRUCTURE = is ddic structure definition for the data table &lt;/P&gt;&lt;P&gt;            IV_DELIMITER = file delimiter, in this case, let's say it's C (for CSV)&lt;/P&gt;&lt;P&gt;     and EV_RECORD_CNT is a count of numbe of records processed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lets say, for example, I wish to load data from table SFLIGHT into the method when program A is executed.  Then another time I wish to excute Program B which is passing in data of table  SFLCONN2.  I hope that by using the "type ref to data" defintion, I can pass the table contents through. Is this true?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly, I'm getting a syntax error saying that "IT_FILE_RECORD" is not defined as a table (and therefore can't be looped at), and therefore can't be read.  How can I access the data in this table in preparation for output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any assistance or thoughts would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Mar 2010 04:46:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-structured-table-into-dynamic-table-parameter-in-public-method/m-p/6743946#M1458980</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-17T04:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Structured table into dynamic table parameter in public method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-structured-table-into-dynamic-table-parameter-in-public-method/m-p/6743947#M1458981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes you can do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would change your interface to remove the IV_RECORD_STRUCTURE parameter and determine the structure of the table at runtime using Runtime Type Services (RTTS).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason that you are getting the syntax error is because IT_FILE_RECORD is defined as a reference to a data type, not a table itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will probably need to assign the dereferenced parameter to a field symbol.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FIELD-SYMBOLS: &amp;lt;table&amp;gt; TYPE ANY TABLE.

ASSIGN it_file_record-&amp;gt;* to &amp;lt;table&amp;gt;.

LOOP AT &amp;lt;table&amp;gt; into &amp;lt;fs_string&amp;gt;.
...
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I haven't tried this so apologies if you need to tweak the syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Graham Robbo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Mar 2010 05:08:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-structured-table-into-dynamic-table-parameter-in-public-method/m-p/6743947#M1458981</guid>
      <dc:creator>GrahamRobbo</dc:creator>
      <dc:date>2010-03-17T05:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Structured table into dynamic table parameter in public method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-structured-table-into-dynamic-table-parameter-in-public-method/m-p/6743948#M1458982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stephen ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Graham already gve part of the solution. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you declare &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Importing VALUE( IT_FILE_RECORD ) TYPE REF TO DATA&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it does not make sense to declare to pass by VALUE because you will not change this refernce in the method. Calling this method, you must pass a refefernce.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt;  lr_ref type ref to data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;get reference of &amp;lt;your itab here&amp;gt; into lr_ref.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CREATE_OUTBOUND_FILE( ...IT_FILE_RECORD = lr_ref ... )&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the method, it goes as graham explained.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, I would declare the table parameter as &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Importing IT_FILE_RECORD TYPE TABLE&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The your code could work, but you will have troube with any non-character fields in the tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Mar 2010 16:02:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-structured-table-into-dynamic-table-parameter-in-public-method/m-p/6743948#M1458982</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2010-03-19T16:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Structured table into dynamic table parameter in public method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-structured-table-into-dynamic-table-parameter-in-public-method/m-p/6743949#M1458983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for your assistance.  The secret was to build up the table using RTTC methods, then pass out to a parameter defined as 'any table'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jun 2010 06:17:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-structured-table-into-dynamic-table-parameter-in-public-method/m-p/6743949#M1458983</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-24T06:17:30Z</dc:date>
    </item>
  </channel>
</rss>

