<?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 To write a Generic Programming to accept any internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/to-write-a-generic-programming-to-accept-any-internal-table/m-p/2247910#M485513</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;By Generic Programming&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May I know how to write a form WRITE_TABLE which accepts any internal table and also to write the contents of the internal table to the ABAP list, line&lt;/P&gt;&lt;P&gt;by line and field by field?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 12 May 2007 00:27:41 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-12T00:27:41Z</dc:date>
    <item>
      <title>To write a Generic Programming to accept any internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/to-write-a-generic-programming-to-accept-any-internal-table/m-p/2247910#M485513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;By Generic Programming&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May I know how to write a form WRITE_TABLE which accepts any internal table and also to write the contents of the internal table to the ABAP list, line&lt;/P&gt;&lt;P&gt;by line and field by field?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 May 2007 00:27:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/to-write-a-generic-programming-to-accept-any-internal-table/m-p/2247910#M485513</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-12T00:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: To write a Generic Programming to accept any internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/to-write-a-generic-programming-to-accept-any-internal-table/m-p/2247911#M485514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="http://help.sap.com//saphelp_470/helpdata/EN/d1/803279454211d189710000e8322d00/content.htm" target="test_blank"&gt;http://help.sap.com//saphelp_470/helpdata/EN/d1/803279454211d189710000e8322d00/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, I would recommend to use USING or CHANGING by passing the 'body' of the table like this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*_ User selection&lt;/P&gt;&lt;P&gt;  PERFORM user_selection USING    s_bname[]&lt;/P&gt;&lt;P&gt;                         CHANGING wt_bname[].&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;FORM user_selection  USING    ps_bname  LIKE s_bname[]&lt;/P&gt;&lt;P&gt;                     CHANGING pt_bname  LIKE wt_bname[].&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; ...&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ENDFORM.                    " user_selection&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 May 2007 02:39:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/to-write-a-generic-programming-to-accept-any-internal-table/m-p/2247911#M485514</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-12T02:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: To write a Generic Programming to accept any internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/to-write-a-generic-programming-to-accept-any-internal-table/m-p/2247912#M485515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM display TABLES ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM display TABLES LT_TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT LT_ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  WRITE: / LT_ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 May 2007 03:44:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/to-write-a-generic-programming-to-accept-any-internal-table/m-p/2247912#M485515</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-12T03:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: To write a Generic Programming to accept any internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/to-write-a-generic-programming-to-accept-any-internal-table/m-p/2247913#M485516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you have input variable lt_itab type any table then you can do something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
field-symbols: &amp;lt;row&amp;gt; type any, &amp;lt;field&amp;gt; type any.

loop at lt_itab assigning &amp;lt;row&amp;gt;.

do.

  assign component sy-index of structure &amp;lt;row&amp;gt; to &amp;lt;field&amp;gt;.
  if sy-subrc ne 0. 
*  no more components left in row
  exit. "exit do
  endif.

  if sy-index eq 1.
    write / &amp;lt;field&amp;gt;.
  else.
   write &amp;lt;field&amp;gt;.
  endif.

enddo.

endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Björn&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 May 2007 19:10:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/to-write-a-generic-programming-to-accept-any-internal-table/m-p/2247913#M485516</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-12T19:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: To write a Generic Programming to accept any internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/to-write-a-generic-programming-to-accept-any-internal-table/m-p/2247914#M485517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi &lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;go through this link&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae" target="test_blank"&gt;https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;mrutyun^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2007 08:15:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/to-write-a-generic-programming-to-accept-any-internal-table/m-p/2247914#M485517</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-14T08:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: To write a Generic Programming to accept any internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/to-write-a-generic-programming-to-accept-any-internal-table/m-p/2247915#M485518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Raja&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The most generic form of an itab I can think of is a &amp;lt;b&amp;gt;data object&amp;lt;/b&amp;gt; referencing the internal table. Perhaps the following sample coding may be useful:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
  ldo_data    TYPE REF TO data.


" Fill you itab with data (any type)

" Get the data reference of your itab
  GET REFERENCE OF &amp;lt;itab&amp;gt; INTO ldo_data.

" Pass the itab as data reference to your FORM routine
  PERFORM write_table USING ldo_data.


FORM write_table using udo_data  TYPE REF TO data.
* define local data
  
  field-symbols:
    &amp;lt;lt_itab&amp;gt;    TYPE table,
   &amp;lt;ls_line&amp;gt;     TYPE any,
   &amp;lt;ld_fld&amp;gt;       TYPE any.

" De-reference your data object
  ASSIGN udo_data-&amp;gt;* to &amp;lt;lt_itab&amp;gt;.
  CHECK ( &amp;lt;lt_itab&amp;gt; IS ASSIGNED ).

  LOOP AT &amp;lt;lt_itab&amp;gt; ASSIGNING &amp;lt;ls_line&amp;gt;.
    DO.
      ASSIGN COMPONENT syst-index OF STRUCTURE &amp;lt;ls_line&amp;gt; TO &amp;lt;ld_fld&amp;gt;.
      IF ( syst-subrc ne 0 ).
        EXIT.
     ENDIF.

"    Do your write statement     
   ENDDO.
  ENDLOOP.

ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2007 09:43:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/to-write-a-generic-programming-to-accept-any-internal-table/m-p/2247915#M485518</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-05-14T09:43:40Z</dc:date>
    </item>
  </channel>
</rss>

