<?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 Sample code for itab in method in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-itab-in-method/m-p/1809295#M347122</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone provide me some inputs/sample code for passing an internal table &lt;/P&gt;&lt;P&gt;as importing parameter of a method in a class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Ricky&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Dec 2006 14:09:45 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-12-07T14:09:45Z</dc:date>
    <item>
      <title>Sample code for itab in method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-itab-in-method/m-p/1809295#M347122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone provide me some inputs/sample code for passing an internal table &lt;/P&gt;&lt;P&gt;as importing parameter of a method in a class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Ricky&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Dec 2006 14:09:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-itab-in-method/m-p/1809295#M347122</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-07T14:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Sample code for itab in method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-itab-in-method/m-p/1809296#M347123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you  need to type it as a table type.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Dec 2006 14:13:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-itab-in-method/m-p/1809296#M347123</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-12-07T14:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: Sample code for itab in method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-itab-in-method/m-p/1809297#M347124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is a short example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001.


*---------------------------------------------------------------------*
*       CLASS lcl_app DEFINITION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
class lcl_app definition.

  public section.

    types: tt001 type table of t001.

    class-data: itab type table of t001.

    class-methods: fill_itab importing im_itab type tt001.

endclass.


*---------------------------------------------------------------------*
*       CLASS lcl_app IMPLEMENTATION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
class lcl_app implementation.

  method fill_itab.
    itab = im_itab.
  endmethod.

endclass.

data: it001 type table of t001.

start-of-selection.

  select * into table it001 from t001.

  call method lcl_app=&amp;gt;fill_itab( it001 ).


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Dec 2006 14:18:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-itab-in-method/m-p/1809297#M347124</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-12-07T14:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Sample code for itab in method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-itab-in-method/m-p/1809298#M347125</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;for method definition.&lt;/P&gt;&lt;P&gt;types : ty_mara type table of mara.&lt;/P&gt;&lt;P&gt;data  : itab type ty_mara.&lt;/P&gt;&lt;P&gt;methods : get_data importing itab type ty_mara&lt;/P&gt;&lt;P&gt;for method implementation&lt;/P&gt;&lt;P&gt;method get_data.&lt;/P&gt;&lt;P&gt; " you can acess itab here.&lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;for calling method.&lt;/P&gt;&lt;P&gt;ob-&amp;gt;get_data exporting it_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A better way to do this is to pass all the user data from selection screen to the method and define table in the class that selects the data as per the selection crieteria. So you have the data in the form of table which is protected. Here is the sample code.&lt;/P&gt;&lt;P&gt;REPORT zfgli003.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.&lt;/P&gt;&lt;P&gt;*--         Ledger&lt;/P&gt;&lt;P&gt;PARAMETERS: p_rldnr  LIKE zzprodnt-rldnr DEFAULT 'NP'.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA : o_tm1_intf TYPE REF TO lcl_tm1_intf.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT o_tm1_intf.&lt;/P&gt;&lt;P&gt;    CALL METHOD o_tm1_intf-&amp;gt;get_data EXPORTING e_rldnr  = p_rldnr  .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_tm1_intf DEFINITION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;types : BEGIN OF ty_zzprodnt,            "Type-ledger summary table&lt;/P&gt;&lt;P&gt;              company       TYPE obukr,      "Company&lt;/P&gt;&lt;P&gt;              gl_acct       TYPE racct,      "GL Account&lt;/P&gt;&lt;P&gt;              cst_ctr       TYPE kostl,      "Cost Center&lt;/P&gt;&lt;P&gt;              prt_ctr       TYPE prctr,      "Profit Center&lt;/P&gt;&lt;P&gt;              rfarea        TYPE fkber,      "Functional Area&lt;/P&gt;&lt;P&gt;              wbs_ele       TYPE ps_posid,   "WBS Element&lt;/P&gt;&lt;P&gt;              prd_ass       TYPE rkeg_wwz01, "Product Assignment&lt;/P&gt;&lt;P&gt;              corp_bd       TYPE rkeg_wwz05, "Corporate Brand&lt;/P&gt;&lt;P&gt;            END OF ty_zzprodnt.&lt;/P&gt;&lt;P&gt;   data : itab type table of ty_zzprodnt.&lt;/P&gt;&lt;P&gt;    METHODS : get_data       IMPORTING e_rldnr  TYPE c.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.                    "lcl_tm1_intf DEFINITION&lt;/P&gt;&lt;P&gt;CLASS lcl_tm1_intf IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD get_data.&lt;/P&gt;&lt;P&gt;    SELECT robukrs&lt;/P&gt;&lt;P&gt;           racct&lt;/P&gt;&lt;P&gt;           rcntr&lt;/P&gt;&lt;P&gt;           rprctr&lt;/P&gt;&lt;P&gt;           rfarea&lt;/P&gt;&lt;P&gt;           rzzwbs_el&lt;/P&gt;&lt;P&gt;           rzzwwz01&lt;/P&gt;&lt;P&gt;           rzzwwz05&lt;/P&gt;&lt;P&gt;      FROM zzprodnt&lt;/P&gt;&lt;P&gt;      INTO TABLE it_zzprodnt&lt;/P&gt;&lt;P&gt;     WHERE rldnr    = e_rldnr.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "get_data&lt;/P&gt;&lt;P&gt;ENDCLASS.                    "lcl_tm1_intf IMPLEMENTATION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Richa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Dec 2006 15:28:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-itab-in-method/m-p/1809298#M347125</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-07T15:28:45Z</dc:date>
    </item>
  </channel>
</rss>

