<?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 Declaring an internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-an-internal-table/m-p/2559837#M583739</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;I have to declare an internal table referring to a standard structure, but excluding some fields in the structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Example, note in the below declaration:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: lv_dtab type p0002.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my requirement is that, lv_dtab should have the same structure as of p0002, but ommitting  2 or 3 fields. ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; i.e.if the structure p0002 has 20 fields of type 'c' and 10 fields of type 'p' , lv_dtab should be declared such a way that it has only 20 fields ( type 'c' fields only).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to declare the lv_dtab , to match my requirement.&lt;/P&gt;&lt;P&gt;Or is there any other way to achieve this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance,&lt;/P&gt;&lt;P&gt;Vijay Raghavendra S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Jul 2007 11:28:30 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-10T11:28:30Z</dc:date>
    <item>
      <title>Declaring an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-an-internal-table/m-p/2559837#M583739</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;I have to declare an internal table referring to a standard structure, but excluding some fields in the structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Example, note in the below declaration:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: lv_dtab type p0002.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my requirement is that, lv_dtab should have the same structure as of p0002, but ommitting  2 or 3 fields. ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; i.e.if the structure p0002 has 20 fields of type 'c' and 10 fields of type 'p' , lv_dtab should be declared such a way that it has only 20 fields ( type 'c' fields only).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to declare the lv_dtab , to match my requirement.&lt;/P&gt;&lt;P&gt;Or is there any other way to achieve this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance,&lt;/P&gt;&lt;P&gt;Vijay Raghavendra S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 11:28:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-an-internal-table/m-p/2559837#M583739</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-10T11:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Declaring an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-an-internal-table/m-p/2559838#M583740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to specify each field individually.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 11:32:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-an-internal-table/m-p/2559838#M583740</guid>
      <dc:creator>amit_khare</dc:creator>
      <dc:date>2007-07-10T11:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: Declaring an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-an-internal-table/m-p/2559839#M583741</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;This is technically not feasiable, but if you just want to ommit only 2 or 3 fields then you can as well use p0002 itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will not cause much performance problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 11:50:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-an-internal-table/m-p/2559839#M583741</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2007-07-10T11:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: Declaring an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-an-internal-table/m-p/2559840#M583742</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;it is not possible to creation of iinternal table as per your requirement, you must go with creation of internal table manually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while creating internal table, perfomance point of view you declare internal table with all the required fields in SE11 by using LINE TYPE and ROW TYPE.&lt;/P&gt;&lt;P&gt;LINE TYPE -&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt;&amp;gt; behaves like work area&lt;/P&gt;&lt;P&gt;ROW TYPE-----&amp;gt; behaves like internal table body.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Ashok Reddy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 12:11:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-an-internal-table/m-p/2559840#M583742</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-10T12:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: Declaring an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-an-internal-table/m-p/2559841#M583743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Vijay&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assuming that you have the &amp;lt;b&amp;gt;RTTI &amp;lt;/b&amp;gt;classes available in your SAP system you can use the following sample coding. You may also have a look at thread:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="416210"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZUS_SDN_RTTI_CREATE_ITAB
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; NOTE: create specific itab based on given structure/table
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

REPORT  zus_sdn_rtti_create_itab.


TYPE-POOLS: abap.




DATA:
  gd_tabnam        TYPE string,
  gd_tabfield      TYPE string,
  go_table         TYPE REF TO cl_salv_table,
  go_sdescr        TYPE REF TO cl_abap_structdescr,
  go_sdescr_new    TYPE REF TO cl_abap_structdescr,
  go_tdescr        TYPE REF TO cl_abap_tabledescr,
  go_typedescr     TYPE REF TO cl_abap_typedescr,
  gdo_handle       TYPE REF TO data,
  gs_component     TYPE abap_compdescr,
  gt_components    TYPE abap_compdescr_tab,
*
  gs_comp          TYPE abap_componentdescr,
  gt_comp          TYPE abap_component_tab.
*


FIELD-SYMBOLS:

  &amp;lt;gt_p0002x&amp;gt;        TYPE STANDARD TABLE.


PARAMETER:
  p_tabnam      TYPE tabname  DEFAULT 'P0002'.




START-OF-SELECTION.



  " Describe structure
  go_sdescr ?= cl_abap_structdescr=&amp;gt;describe_by_name( p_tabnam ).
  gt_components = go_sdescr-&amp;gt;components.

  DELETE gt_components
      WHERE ( type_kind = cl_abap_typedescr=&amp;gt;typekind_packed
      OR      type_kind = cl_abap_typedescr=&amp;gt;typekind_hex
      OR      type_kind = cl_abap_typedescr=&amp;gt;typekind_float ).
  " OR:
  DELETE gt_components
      WHERE NOT ( type_kind = cl_abap_typedescr=&amp;gt;typekind_num  OR
                  type_kind = cl_abap_typedescr=&amp;gt;typekind_char OR
                  type_kind = cl_abap_typedescr=&amp;gt;typekind_date ).



  REFRESH: gt_comp.
  LOOP AT gt_components INTO gs_component.
    "   Build fieldname
    CONCATENATE p_tabnam gs_component-name INTO gd_tabfield
                                            SEPARATED BY '-'.

    CLEAR: gs_comp.
    gs_comp-type ?= cl_abap_datadescr=&amp;gt;describe_by_name( gd_tabfield ).
    gs_comp-name  = gs_component-name.
    APPEND gs_comp TO gt_comp.
  ENDLOOP.


  go_sdescr_new  = cl_abap_structdescr=&amp;gt;create( gt_comp ).
  go_tdescr      = cl_abap_tabledescr=&amp;gt;create( go_sdescr_new ).
  "   Create data refence followed by table creation
  CREATE DATA gdo_handle TYPE HANDLE go_tdescr.

  ASSIGN gdo_handle-&amp;gt;* TO &amp;lt;gt_p0002x&amp;gt;.




* Dynamic select
  " P0002 -&amp;gt; PA0002
  CONCATENATE p_tabnam+0(1) 'A' p_tabnam+1 INTO gd_tabnam.
  CONDENSE gd_tabnam NO-GAPS.

  SELECT        * FROM  (gd_tabnam) UP TO 10 ROWS
    INTO CORRESPONDING FIELDS OF TABLE &amp;lt;gt_p0002x&amp;gt;.



  TRY.
      CALL METHOD cl_salv_table=&amp;gt;factory
        IMPORTING
          r_salv_table = go_table
        CHANGING
          t_table      = &amp;lt;gt_p0002x&amp;gt;.
      go_table-&amp;gt;display( ).
    CATCH cx_salv_msg .
  ENDTRY.


  " Display component list in order to prove that indeed the field names
  " are used (instead of the data element names)
  TRY.
      CALL METHOD cl_salv_table=&amp;gt;factory
        IMPORTING
          r_salv_table = go_table
        CHANGING
          t_table      = gt_comp.
      go_table-&amp;gt;display( ).
    CATCH cx_salv_msg .
  ENDTRY.


END-OF-SELECTION.&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;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2007 12:54:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-an-internal-table/m-p/2559841#M583743</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-07-10T12:54:01Z</dc:date>
    </item>
  </channel>
</rss>

