<?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: Declaring internal table names dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-internal-table-names-dynamically/m-p/2113556#M442115</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;chk this code:&lt;/P&gt;&lt;P&gt;method GET_ITABLE_OF_TYPE_NAME . &lt;/P&gt;&lt;P&gt;*IMPORTING IM_ITABLE_TYPE_NAME TYPE STRING &lt;/P&gt;&lt;P&gt;*RETURNING RE_ITABLE_REF_TO_DATA type ref to data &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: &lt;/P&gt;&lt;P&gt;  alv_field_catalog TYPE lvc_t_fcat, &lt;/P&gt;&lt;P&gt;  alv_field LIKE LINE OF alv_field_catalog, &lt;/P&gt;&lt;P&gt;  curr_col_pos LIKE alv_field-col_pos, &lt;/P&gt;&lt;P&gt;  tmp_itable_type_name TYPE DD02L-TABNAME. &lt;/P&gt;&lt;P&gt;curr_col_pos = 1. &lt;/P&gt;&lt;P&gt;*the interface of function "LVC_FIELDCATALOG_MERGE" expect the name with this type &lt;/P&gt;&lt;P&gt;tmp_itable_type_name = im_itable_type_name. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*creating fieldcatalog &lt;/P&gt;&lt;P&gt;CALL FUNCTION 'LVC_FIELDCATALOG_MERGE' &lt;/P&gt;&lt;P&gt;  EXPORTING &lt;/P&gt;&lt;P&gt;    i_structure_name = tmp_itable_type_name &lt;/P&gt;&lt;P&gt;  CHANGING &lt;/P&gt;&lt;P&gt;    ct_fieldcat      = alv_field_catalog &lt;/P&gt;&lt;P&gt;  EXCEPTIONS &lt;/P&gt;&lt;P&gt;    inconsistent_interface = 1 &lt;/P&gt;&lt;P&gt;    program_error          = 2 &lt;/P&gt;&lt;P&gt;    OTHERS                 = 3. &lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0. &lt;/P&gt;&lt;P&gt;*here jour error handling &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table &lt;/P&gt;&lt;P&gt;  EXPORTING &lt;/P&gt;&lt;P&gt;    it_fieldcatalog = alv_field_catalog &lt;/P&gt;&lt;P&gt;  IMPORTING &lt;/P&gt;&lt;P&gt;    ep_table = RE_ITABLE_REF_TO_DATA. &lt;/P&gt;&lt;P&gt;*Now ist in re_itable_ref_to_data a pointer to a internal table with the *wished type &lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To call the method: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: &lt;/P&gt;&lt;P&gt;table_type_name type String, &lt;/P&gt;&lt;P&gt;ref_to_internal_table type ref to data. &lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS : &amp;lt;internal_Table&amp;gt; type standard table. &lt;/P&gt;&lt;P&gt;table_type_name = 'LIKP'. &lt;/P&gt;&lt;P&gt;CALL METHOD ZCL_MYCLASS=&amp;gt;GET_ITABLE_OF_TYPE_NAME &lt;/P&gt;&lt;P&gt;      EXPORTING &lt;/P&gt;&lt;P&gt;              im_itable_type_name   = table_type_name &lt;/P&gt;&lt;P&gt;            receiving &lt;/P&gt;&lt;P&gt;              re_itable_ref_to_data = ref_to_internal_table. &lt;/P&gt;&lt;P&gt;ASSIGN ref_to_internal_table-&amp;gt;* to &amp;lt;internal_Table&amp;gt;. &lt;/P&gt;&lt;P&gt;SELECT * FROM (table_type_name) INTO CORRESPONDING FIELDS OF TABLE &amp;lt;internal_Table&amp;gt;. &lt;/P&gt;&lt;P&gt;etc. etc. &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;keerthi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Apr 2007 05:19:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-04T05:19:50Z</dc:date>
    <item>
      <title>Declaring internal table names dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-internal-table-names-dynamically/m-p/2113553#M442112</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;Iam selecting the tablenames from dd03l so based on the table names i have to declare internal table names.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select tabname from dd03l into t_dd03l &lt;/P&gt;&lt;P&gt;where tabname in s_tabname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at t_dd03l &lt;/P&gt;&lt;P&gt;if t_dd03l-tabname = 'MARA'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then i want to declare a internal table T_MARA type standard table of MARA.&lt;/P&gt;&lt;P&gt;or can i declare multiple  dynamic internal table names where dynamic internal table name should keep changing at runtime based on the dd03l-tabname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2007 04:57:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-internal-table-names-dynamically/m-p/2113553#M442112</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-04T04:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Declaring internal table names dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-internal-table-names-dynamically/m-p/2113554#M442113</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 example may help u.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Example: how to create a dynamic internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;**&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The dynamic internal table stucture&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DATA: BEGIN OF STRUCT OCCURS 10,&lt;/P&gt;&lt;P&gt;    FILDNAME(8) TYPE C,&lt;/P&gt;&lt;P&gt;    ABPTYPE TYPE C,&lt;/P&gt;&lt;P&gt;    LENGTH TYPE I,&lt;/P&gt;&lt;P&gt;END OF STRUCT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: itab TYPE STANDARD TABLE OF string,&lt;/P&gt;&lt;P&gt;      mess TYPE string,&lt;/P&gt;&lt;P&gt;      lin  TYPE i,&lt;/P&gt;&lt;P&gt;      wrd  TYPE string,&lt;/P&gt;&lt;P&gt;      dir  TYPE trdir.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The dynamic program source table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DATA: BEGIN OF INCTABL OCCURS 10,&lt;/P&gt;&lt;P&gt;    LINE(72),&lt;/P&gt;&lt;P&gt;END OF INCTABL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: LNG TYPE I, TYPESRTING(6).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sample dynamic internal table stucture&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;STRUCT-FILDNAME = 'field1'. STRUCT-ABPTYPE = 'c'. STRUCT-LENGTH = '6'.&lt;/P&gt;&lt;P&gt;APPEND STRUCT. CLEAR STRUCT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STRUCT-FILDNAME = 'field2'. STRUCT-ABPTYPE = 'd'.&lt;/P&gt;&lt;P&gt;APPEND STRUCT. CLEAR STRUCT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*STRUCT-FILDNAME = 'field3'. STRUCT-ABPTYPE = 'i'.&lt;/P&gt;&lt;P&gt;*APPEND STRUCT. CLEAR STRUCT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create the dynamic internal table definition in the dyn. program&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;INCTABL-LINE = 'Report zdynpro.'. APPEND INCTABL.&lt;/P&gt;&lt;P&gt;INCTABL-LINE = 'data: begin of dyntab occurs 10,'. APPEND INCTABL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT STRUCT.&lt;/P&gt;&lt;P&gt;  INCTABL-LINE = STRUCT-FILDNAME.&lt;/P&gt;&lt;P&gt;  LNG = STRLEN( STRUCT-FILDNAME ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF NOT STRUCT-LENGTH IS INITIAL .&lt;/P&gt;&lt;P&gt;      TYPESRTING(1) = '('.&lt;/P&gt;&lt;P&gt;      TYPESRTING+1 = STRUCT-LENGTH.&lt;/P&gt;&lt;P&gt;      TYPESRTING+5 = ')'.&lt;/P&gt;&lt;P&gt;      CONDENSE TYPESRTING NO-GAPS.&lt;/P&gt;&lt;P&gt;      INCTABL-LINE+LNG = TYPESRTING.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  INCTABL-LINE+15 = 'type '.&lt;/P&gt;&lt;P&gt;  INCTABL-LINE+21 = STRUCT-ABPTYPE.&lt;/P&gt;&lt;P&gt;  INCTABL-LINE+22 = ','.&lt;/P&gt;&lt;P&gt;  APPEND INCTABL.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;INCTABL-LINE = 'end of dyntab. '.&lt;/P&gt;&lt;P&gt;APPEND INCTABL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create the code processes the dynamic internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;INCTABL-LINE = ' '. APPEND INCTABL.&lt;/P&gt;&lt;P&gt;INCTABL-LINE = 'dyntab-field1 = ''aaaaaa''.'. APPEND INCTABL.&lt;/P&gt;&lt;P&gt;INCTABL-LINE = 'dyntab-field2 = ''19970814''.'. APPEND INCTABL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INCTABL-LINE = 'append dyntab.'. APPEND INCTABL.&lt;/P&gt;&lt;P&gt;INCTABL-LINE = ' '. APPEND INCTABL.&lt;/P&gt;&lt;P&gt;INCTABL-LINE = 'loop at dyntab.'. APPEND INCTABL.&lt;/P&gt;&lt;P&gt;INCTABL-LINE = 'write: / dyntab.'. APPEND INCTABL.&lt;/P&gt;&lt;P&gt;INCTABL-LINE = 'endloop.'. APPEND INCTABL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INSERT REPORT 'zdynpro'(001) FROM INCTABL.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;SUBMIT ZDYNPRO.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;  Naresh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2007 05:09:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-internal-table-names-dynamically/m-p/2113554#M442113</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-04T05:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Declaring internal table names dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-internal-table-names-dynamically/m-p/2113555#M442114</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;u can use the funtion module "rss_template_instantiate" for creating the program dynamically.see the doccumentation of that.&lt;/P&gt;&lt;P&gt;if u have any queries let me know.&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;bharat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2007 05:13:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-internal-table-names-dynamically/m-p/2113555#M442114</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-04T05:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: Declaring internal table names dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-internal-table-names-dynamically/m-p/2113556#M442115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;chk this code:&lt;/P&gt;&lt;P&gt;method GET_ITABLE_OF_TYPE_NAME . &lt;/P&gt;&lt;P&gt;*IMPORTING IM_ITABLE_TYPE_NAME TYPE STRING &lt;/P&gt;&lt;P&gt;*RETURNING RE_ITABLE_REF_TO_DATA type ref to data &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: &lt;/P&gt;&lt;P&gt;  alv_field_catalog TYPE lvc_t_fcat, &lt;/P&gt;&lt;P&gt;  alv_field LIKE LINE OF alv_field_catalog, &lt;/P&gt;&lt;P&gt;  curr_col_pos LIKE alv_field-col_pos, &lt;/P&gt;&lt;P&gt;  tmp_itable_type_name TYPE DD02L-TABNAME. &lt;/P&gt;&lt;P&gt;curr_col_pos = 1. &lt;/P&gt;&lt;P&gt;*the interface of function "LVC_FIELDCATALOG_MERGE" expect the name with this type &lt;/P&gt;&lt;P&gt;tmp_itable_type_name = im_itable_type_name. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*creating fieldcatalog &lt;/P&gt;&lt;P&gt;CALL FUNCTION 'LVC_FIELDCATALOG_MERGE' &lt;/P&gt;&lt;P&gt;  EXPORTING &lt;/P&gt;&lt;P&gt;    i_structure_name = tmp_itable_type_name &lt;/P&gt;&lt;P&gt;  CHANGING &lt;/P&gt;&lt;P&gt;    ct_fieldcat      = alv_field_catalog &lt;/P&gt;&lt;P&gt;  EXCEPTIONS &lt;/P&gt;&lt;P&gt;    inconsistent_interface = 1 &lt;/P&gt;&lt;P&gt;    program_error          = 2 &lt;/P&gt;&lt;P&gt;    OTHERS                 = 3. &lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0. &lt;/P&gt;&lt;P&gt;*here jour error handling &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table &lt;/P&gt;&lt;P&gt;  EXPORTING &lt;/P&gt;&lt;P&gt;    it_fieldcatalog = alv_field_catalog &lt;/P&gt;&lt;P&gt;  IMPORTING &lt;/P&gt;&lt;P&gt;    ep_table = RE_ITABLE_REF_TO_DATA. &lt;/P&gt;&lt;P&gt;*Now ist in re_itable_ref_to_data a pointer to a internal table with the *wished type &lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To call the method: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: &lt;/P&gt;&lt;P&gt;table_type_name type String, &lt;/P&gt;&lt;P&gt;ref_to_internal_table type ref to data. &lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS : &amp;lt;internal_Table&amp;gt; type standard table. &lt;/P&gt;&lt;P&gt;table_type_name = 'LIKP'. &lt;/P&gt;&lt;P&gt;CALL METHOD ZCL_MYCLASS=&amp;gt;GET_ITABLE_OF_TYPE_NAME &lt;/P&gt;&lt;P&gt;      EXPORTING &lt;/P&gt;&lt;P&gt;              im_itable_type_name   = table_type_name &lt;/P&gt;&lt;P&gt;            receiving &lt;/P&gt;&lt;P&gt;              re_itable_ref_to_data = ref_to_internal_table. &lt;/P&gt;&lt;P&gt;ASSIGN ref_to_internal_table-&amp;gt;* to &amp;lt;internal_Table&amp;gt;. &lt;/P&gt;&lt;P&gt;SELECT * FROM (table_type_name) INTO CORRESPONDING FIELDS OF TABLE &amp;lt;internal_Table&amp;gt;. &lt;/P&gt;&lt;P&gt;etc. etc. &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;keerthi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2007 05:19:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-internal-table-names-dynamically/m-p/2113556#M442115</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-04T05:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Declaring internal table names dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-internal-table-names-dynamically/m-p/2113557#M442116</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;Iam sending a my program please suggest me where in the program i can create multiple dynamic internal tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPE-POOLS: SLIS.&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF X_DD03L,&lt;/P&gt;&lt;P&gt;       TABNAME TYPE TABNAME,&lt;/P&gt;&lt;P&gt;       END OF X_DD03L.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: T_DD03L TYPE STANDARD TABLE OF X_DD03L,&lt;/P&gt;&lt;P&gt;      W_DD03L TYPE X_DD03L.&lt;/P&gt;&lt;P&gt;DATA: G_TABNAME TYPE DD03L-TABNAME,&lt;/P&gt;&lt;P&gt;      g_FIELDNAME type FIELDNAME,&lt;/P&gt;&lt;P&gt;      T_FIELDCAT TYPE lvc_t_fcat,&lt;/P&gt;&lt;P&gt;      w_fieldcat type LVC_S_FCAT,&lt;/P&gt;&lt;P&gt;      new_table TYPE REF TO data,&lt;/P&gt;&lt;P&gt;      l_wa_newline  TYPE REF TO data,&lt;/P&gt;&lt;P&gt;      p_table type char30.&lt;/P&gt;&lt;P&gt;types: begin of x_tab.&lt;/P&gt;&lt;P&gt;       include structure PA0000.&lt;/P&gt;&lt;P&gt;types: end of x_tab.&lt;/P&gt;&lt;P&gt;data: t_tab type standard table of x_tab,&lt;/P&gt;&lt;P&gt;      w_tab type x_tab,&lt;/P&gt;&lt;P&gt;      l_tabix type sy-tabix.&lt;/P&gt;&lt;P&gt;*Field-symbols:&lt;/P&gt;&lt;P&gt;    FIELD-SYMBOLS : &amp;lt;l_fs_dyn_table&amp;gt; TYPE STANDARD TABLE ,&lt;/P&gt;&lt;P&gt;                    &amp;lt;l_fs_dyn_wa&amp;gt; ,&lt;/P&gt;&lt;P&gt;                    &amp;lt;f_tab&amp;gt; type standard table,&lt;/P&gt;&lt;P&gt;                    &amp;lt;dyn_field&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS:S_TABNAM FOR G_TABNAME,&lt;/P&gt;&lt;P&gt;               s_Fnam  for g_FIELDNAME.&lt;/P&gt;&lt;P&gt;SELECT TABNAME&lt;/P&gt;&lt;P&gt;       FROM DD03L&lt;/P&gt;&lt;P&gt;       INTO TABLE T_DD03L&lt;/P&gt;&lt;P&gt;       WHERE TABNAME IN S_TABNAM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from t_dd03l.&lt;/P&gt;&lt;P&gt;LOOP AT T_DD03L INTO W_DD03L.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      i_structure_name       = W_DD03L-TABNAME&lt;/P&gt;&lt;P&gt;    CHANGING&lt;/P&gt;&lt;P&gt;      ct_fieldcat            = t_fieldcat&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      inconsistent_interface = 1&lt;/P&gt;&lt;P&gt;      program_error          = 2&lt;/P&gt;&lt;P&gt;      OTHERS                 = 3.&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;*No sy-subrc required&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create dynamic internal table and assign to FS&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        it_fieldcatalog = t_fieldcat&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        ep_table        = new_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ASSIGN new_table-&amp;gt;* TO &amp;lt;l_fs_dyn_table&amp;gt;.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create dynamic work area and assign to FS&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CREATE DATA l_wa_newline LIKE LINE OF &amp;lt;l_fs_dyn_table&amp;gt;.&lt;/P&gt;&lt;P&gt;    ASSIGN l_wa_newline-&amp;gt;* TO &amp;lt;l_fs_dyn_wa&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p_table = w_dd03l-tabname .&lt;/P&gt;&lt;P&gt;select * up to 10 rows into corresponding fields of table &amp;lt;l_fs_dyn_table&amp;gt;&lt;/P&gt;&lt;P&gt;from (p_table)&lt;/P&gt;&lt;P&gt;where pernr = '00000007'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here we are creating &amp;lt;l_fs_dyn_table&amp;gt; dynamic table but every time when new tablename comes i want to change the dynamic table name . like &amp;lt;l_fs_dyn_table1&amp;gt; , &amp;lt;l_fs_dyn_table2&amp;gt; etc....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2007 05:27:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-internal-table-names-dynamically/m-p/2113557#M442116</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-04T05:27:32Z</dc:date>
    </item>
  </channel>
</rss>

