<?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: Dynamic Internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597882#M1275829</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;use following sample code..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;used from [url] saptechnical&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

REPORT  ZPP_FS_CHINTAN_2.

****************** HARDCODED "OLD STYLE" LOCAL TYPE
******************** THIS IS A NORMAL HARDCODED LOCAL TYPE

TYPES : BEGIN OF TYP_HARDCODED,
L_COUNT TYPE I,
LT_SFLIGHT TYPE SFLIGHT.
TYPES : END OF TYP_HARDCODED.
* CREATE A TABLE BASED ON HARDCODED TYPE
DATA : LT_HARDCODED TYPE TABLE OF TYP_HARDCODED.
****************** DYNAMIC "NEW WAVE" LOCAL TYPE *******************
TYPES: TYP_COUNT TYPE I.

FIELD-SYMBOLS : &amp;lt;LT_DYNAMIC&amp;gt; TYPE ANY TABLE.
DATA: DREF TYPE REF TO DATA,
ITAB_TYPE TYPE REF TO CL_ABAP_TABLEDESCR,
STRUCT_TYPE TYPE REF TO CL_ABAP_STRUCTDESCR,
ELEM_TYPE TYPE REF TO CL_ABAP_ELEMDESCR,
COMP_TAB TYPE CL_ABAP_STRUCTDESCR=&amp;gt;COMPONENT_TABLE,
COMP_FLD TYPE CL_ABAP_STRUCTDESCR=&amp;gt;COMPONENT.

* WE READ INFORMATION ABOUT EACH FIELDS OF SFLIGHT (SEE ABAP FAQ #2)
STRUCT_TYPE ?= CL_ABAP_TYPEDESCR=&amp;gt;DESCRIBE_BY_NAME( 'MARA' ).
* WE ALSO NEED THE INFORMATION ABOUT THE TYPE "TYP_COUNT", NOTE THAT
* WE SHOULD USE CLASS CL_ABAP_ELEMDESCR INSTEAD OF CL_ABAP_TYPEDESCR
ELEM_TYPE ?= CL_ABAP_ELEMDESCR=&amp;gt;DESCRIBE_BY_NAME( 'TYP_COUNT' ).

* WE READ ALL FLEIDS OF SFLIGHT AND CREATE A COMPONENT TABLE
COMP_TAB = STRUCT_TYPE-&amp;gt;GET_COMPONENTS( ).

* WE ADD MANUALLY THE COUNTER

COMP_FLD-NAME = 'L_COUNT'.
COMP_FLD-TYPE = ELEM_TYPE.
INSERT COMP_FLD INTO COMP_TAB INDEX 1.

* WE CREATE THE STRUCTURE
STRUCT_TYPE = CL_ABAP_STRUCTDESCR=&amp;gt;CREATE( COMP_TAB ).
* ... AND THE INTERNAL TABLE

ITAB_TYPE = CL_ABAP_TABLEDESCR=&amp;gt;CREATE( STRUCT_TYPE ).
* THE NEW THING HERE IS THE "TYPE HANDLE" WHICH CREATE A POINTER TO A
* HANDLE

CREATE DATA DREF TYPE HANDLE ITAB_TYPE.

* WE FINALLY ASSIGN A FIELD SYMBOL TO THE POINTER BECAUSE WE CANNOT
* DIRECTLY ACCESS A POINTER.

ASSIGN DREF-&amp;gt;* TO &amp;lt;LT_DYNAMIC&amp;gt;.

* AT THE END OF THIS SMALL PROGRAM, INTERNAL TABLE LT_HARDCODED AND
* LT_DYNAMIC ARE THE SAME

BREAK-POINT.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here 'L_COUNT' field is dynamically added in ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so loop for your table E, F , G and H....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at i_dyn into w_dyn&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    COMP_FLD-NAME = w_dyn-name.&lt;/P&gt;&lt;P&gt;    COMP_FLD-TYPE = ELEM_TYPE.&lt;/P&gt;&lt;P&gt;    INSERT COMP_FLD INTO COMP_TAB INDEX sy-index.&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;Edited by: Chintan_SAP on May 14, 2009 9:30 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Chintan_SAP on May 14, 2009 9:31 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Chintan_SAP on May 14, 2009 9:32 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 May 2009 04:00:39 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-05-14T04:00:39Z</dc:date>
    <item>
      <title>Dynamic Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597880#M1275827</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;1 . I have a field in my selection screen .Based on the user input the  internal table columns should   &lt;/P&gt;&lt;P&gt;     be  created.&lt;/P&gt;&lt;P&gt;2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i have 4  valuse given by user in the selection the program should crete 4 coulms .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;&lt;P&gt;C&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Based on these 4 fields the data will be extracted from the  Data base table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A --- E&lt;/P&gt;&lt;P&gt;B---- F&lt;/P&gt;&lt;P&gt;C----G&lt;/P&gt;&lt;P&gt;D---H&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the output will be displayed in a file like this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E     F   G   H -&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt; each value one column in the excel sheet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know &amp;lt;&amp;lt; Removed &amp;gt;&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on May 14, 2009 11:01 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 03:51:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597880#M1275827</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-14T03:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597881#M1275828</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;Please Test the following Sample Code hope will help you to solve out your problem,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TABLES: dd02l.

PARAMETERS: tabname TYPE tabname OBLIGATORY.

DATA: itab_ref TYPE REF TO data.

CREATE DATA itab_ref TYPE STANDARD TABLE OF (tabname).
FIELD-SYMBOLS: &amp;lt;itab&amp;gt; TYPE STANDARD TABLE.
ASSIGN itab_ref-&amp;gt;* TO &amp;lt;itab&amp;gt;.

SELECT * FROM (tabname) UP TO 10 ROWS
  INTO CORRESPONDING FIELDS OF TABLE &amp;lt;itab&amp;gt;.

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    filename              = 'C:\TEXT.XLS' " EXCEL File will save on you Local Drive C with name test.xls
    write_field_separator = 'X'
  TABLES
    data_tab              = &amp;lt;itab&amp;gt;.
IF sy-subrc NE 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

AT SELECTION-SCREEN.
  SELECT SINGLE * FROM dd02l
    WHERE tabname = tabname.
  IF sy-subrc NE 0.
    MESSAGE: 'Please Enter Correct Table Name' TYPE 'E'.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Reply if any Issue,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Faisal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Faisal Altaf on May 14, 2009 9:20 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 03:58:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597881#M1275828</guid>
      <dc:creator>faisalatsap</dc:creator>
      <dc:date>2009-05-14T03:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597882#M1275829</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;use following sample code..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;used from [url] saptechnical&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

REPORT  ZPP_FS_CHINTAN_2.

****************** HARDCODED "OLD STYLE" LOCAL TYPE
******************** THIS IS A NORMAL HARDCODED LOCAL TYPE

TYPES : BEGIN OF TYP_HARDCODED,
L_COUNT TYPE I,
LT_SFLIGHT TYPE SFLIGHT.
TYPES : END OF TYP_HARDCODED.
* CREATE A TABLE BASED ON HARDCODED TYPE
DATA : LT_HARDCODED TYPE TABLE OF TYP_HARDCODED.
****************** DYNAMIC "NEW WAVE" LOCAL TYPE *******************
TYPES: TYP_COUNT TYPE I.

FIELD-SYMBOLS : &amp;lt;LT_DYNAMIC&amp;gt; TYPE ANY TABLE.
DATA: DREF TYPE REF TO DATA,
ITAB_TYPE TYPE REF TO CL_ABAP_TABLEDESCR,
STRUCT_TYPE TYPE REF TO CL_ABAP_STRUCTDESCR,
ELEM_TYPE TYPE REF TO CL_ABAP_ELEMDESCR,
COMP_TAB TYPE CL_ABAP_STRUCTDESCR=&amp;gt;COMPONENT_TABLE,
COMP_FLD TYPE CL_ABAP_STRUCTDESCR=&amp;gt;COMPONENT.

* WE READ INFORMATION ABOUT EACH FIELDS OF SFLIGHT (SEE ABAP FAQ #2)
STRUCT_TYPE ?= CL_ABAP_TYPEDESCR=&amp;gt;DESCRIBE_BY_NAME( 'MARA' ).
* WE ALSO NEED THE INFORMATION ABOUT THE TYPE "TYP_COUNT", NOTE THAT
* WE SHOULD USE CLASS CL_ABAP_ELEMDESCR INSTEAD OF CL_ABAP_TYPEDESCR
ELEM_TYPE ?= CL_ABAP_ELEMDESCR=&amp;gt;DESCRIBE_BY_NAME( 'TYP_COUNT' ).

* WE READ ALL FLEIDS OF SFLIGHT AND CREATE A COMPONENT TABLE
COMP_TAB = STRUCT_TYPE-&amp;gt;GET_COMPONENTS( ).

* WE ADD MANUALLY THE COUNTER

COMP_FLD-NAME = 'L_COUNT'.
COMP_FLD-TYPE = ELEM_TYPE.
INSERT COMP_FLD INTO COMP_TAB INDEX 1.

* WE CREATE THE STRUCTURE
STRUCT_TYPE = CL_ABAP_STRUCTDESCR=&amp;gt;CREATE( COMP_TAB ).
* ... AND THE INTERNAL TABLE

ITAB_TYPE = CL_ABAP_TABLEDESCR=&amp;gt;CREATE( STRUCT_TYPE ).
* THE NEW THING HERE IS THE "TYPE HANDLE" WHICH CREATE A POINTER TO A
* HANDLE

CREATE DATA DREF TYPE HANDLE ITAB_TYPE.

* WE FINALLY ASSIGN A FIELD SYMBOL TO THE POINTER BECAUSE WE CANNOT
* DIRECTLY ACCESS A POINTER.

ASSIGN DREF-&amp;gt;* TO &amp;lt;LT_DYNAMIC&amp;gt;.

* AT THE END OF THIS SMALL PROGRAM, INTERNAL TABLE LT_HARDCODED AND
* LT_DYNAMIC ARE THE SAME

BREAK-POINT.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here 'L_COUNT' field is dynamically added in ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so loop for your table E, F , G and H....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at i_dyn into w_dyn&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    COMP_FLD-NAME = w_dyn-name.&lt;/P&gt;&lt;P&gt;    COMP_FLD-TYPE = ELEM_TYPE.&lt;/P&gt;&lt;P&gt;    INSERT COMP_FLD INTO COMP_TAB INDEX sy-index.&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;Edited by: Chintan_SAP on May 14, 2009 9:30 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Chintan_SAP on May 14, 2009 9:31 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Chintan_SAP on May 14, 2009 9:32 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 04:00:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597882#M1275829</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-14T04:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597883#M1275830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&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 = IT_LVC_CAT&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;&lt;/P&gt;&lt;P&gt;ASSIGN NEW_TABLE-&amp;gt;* TO &amp;lt;L_TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;CREATE DATA NEW_LINE LIKE LINE OF &amp;lt;L_TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;ASSIGN NEW_LINE-&amp;gt;* TO &amp;lt;L_LINE&amp;gt;. -&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;&amp;gt; i need to move this to work area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i do that ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 05:39:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597883#M1275830</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-14T05:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597884#M1275831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The main crux in creating a dynamic internal table using the method CL_ALV_TABLE_CREATE=&amp;gt;CREATE_DYNAMIC_TABLE is the fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fieldcatalog contains the details about the columns which you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you specify 4 fields in the field-catalog along with their technical attributes then the method will create a dynamic internal table based on the fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps you in understanding the concept.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ankur Parab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 05:57:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597884#M1275831</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-14T05:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597885#M1275832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But i just want to get the Header in a work area .  How can i do that ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 06:12:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597885#M1275832</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-14T06:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597886#M1275833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have an internal table and a work area, so just do a loop at your internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT &amp;lt;L_TABLE&amp;gt; INTO &amp;lt;L_LINE&amp;gt;. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 06:17:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597886#M1275833</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2009-05-14T06:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597887#M1275834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tashvi,&lt;/P&gt;&lt;P&gt;The code can be explained as follows:-&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 = IT_LVC_CAT&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_TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;CREATE DATA NEW_LINE LIKE LINE OF &amp;lt;L_TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;ASSIGN NEW_LINE-&amp;gt;* TO &amp;lt;L_LINE&amp;gt;. -&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;&amp;gt; i need to move this to work area&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The method will create an internal table 'NEW_TABLE' depending upon the fieldcatalog IT_LVC_FCAT.&lt;/P&gt;&lt;P&gt;Note that NEW_TABLE is not an internal table but it is a data type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The statement ASSIGN NEW_TABLE-&amp;gt;* TO &amp;lt;L_TABLE&amp;gt; will basically assign the structure of NEW_TABLE to field symbol &amp;lt;L_TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;So &amp;lt;L_TABLE&amp;gt; will become a table of structure NEW_TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The statement CREATE DATA NEW_LINE LIKE LINE OF &amp;lt;L_TABLE&amp;gt; will create a plain stucture type which will have just the structure of NEW_TABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The statement ASSIGN NEW_LINE-&amp;gt;* TO &amp;lt;L_LINE&amp;gt; will actually make teh field symbol &amp;lt;L_LINE&amp;gt; as a stucture or work area having a structure of NEW_TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So now you can loop &amp;lt;L_TABLE&amp;gt; into  &amp;lt;L_LINE&amp;gt; safely.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that you will always have to check that both the fieldsymbols &amp;lt;L_TABLE&amp;gt; and &amp;lt;L_LINE&amp;gt; have been assigned before you do the loop statement else it might result in a dump.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this makes you understand the concept.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ankur Parab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 06:32:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597887#M1275834</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-14T06:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597888#M1275835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let me explain you in detail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In selection screen user may give Fieldname,rollname,domname,etc....&lt;/P&gt;&lt;P&gt;Purely depends on user selection...Each field equal to one column in the dynamic intrnal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'DDIF_FIELDINFO_GET'&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      tabname              = TABLENM -&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt;.&amp;gt; if i give MARA here .It will get list of MARA fields with &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     field            = FIELDNM                    fieldnames,data elements etc.... but this FM will get 44&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      LANGU                = SY-LANGU         fields data which are table properties.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        Lfield           = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        ALL_TYPES            = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        X030L_WA             = WATAB&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        DDOBJTYPE            =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        DFIES_WA             =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        LINES_DESCR          =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      DFIES_TAB            = INTTAB&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        FIXED_VALUES         =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      NOT_FOUND            = 1&lt;/P&gt;&lt;P&gt;      INTERNAL_ERROR       = 2&lt;/P&gt;&lt;P&gt;      OTHERS               = 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    WRITE:/ 'Table Name Not Found'.&lt;/P&gt;&lt;P&gt;    Exit.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select * from dd03l into table t_dd03l  where fieldname in fieldnm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from dd03t into table t_dd03t where fieldname in  fieldnm and&lt;/P&gt;&lt;P&gt;DDLANGUAGE = 'EN'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sort t_dd03t by fieldname.&lt;/P&gt;&lt;P&gt;Delete adjacent duplicates from t_dd03t comparing fieldname.&lt;/P&gt;&lt;P&gt;sort t_dd03l by fieldname.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from t_dd03l comparing fieldname .&lt;/P&gt;&lt;P&gt;describe table t_dd03t lines n.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at t_dd03t.&lt;/P&gt;&lt;P&gt;if not t_dd03t-fieldname = 'SHLPORIGIN'.&lt;/P&gt;&lt;P&gt;is_lvc_cat-fieldname   = t_dd03t-fieldname.&lt;/P&gt;&lt;P&gt;is_lvc_cat-seltext = t_dd03t-ddtext.&lt;/P&gt;&lt;P&gt;Read table t_dd03l with key fieldname = t_dd03t-fieldname.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;IS_LVC_CAT-intlen = t_dd03l-leng.&lt;/P&gt;&lt;P&gt;append IS_LVC_CAT to IT_LVC_CAT.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;is_lvc_cat-fieldname   = t_dd03t-fieldname.&lt;/P&gt;&lt;P&gt;IS_LVC_CAT-seltext = t_dd03t-ddtext.&lt;/P&gt;&lt;P&gt;IS_LVC_CAT-intlen = '60'.&lt;/P&gt;&lt;P&gt;append IS_LVC_CAT to IT_LVC_CAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&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 = IT_LVC_CAT&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_TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;CREATE DATA NEW_LINE LIKE LINE OF &amp;lt;L_TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;ASSIGN NEW_LINE-&amp;gt;* TO &amp;lt;L_LINE&amp;gt;.    .......&amp;gt;    Using this code i will be creating dynamic internal &lt;/P&gt;&lt;P&gt;                                                                        table with user selection&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once this is done i need to get list of fields info from the INNTAB .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have only one row in the dynamic internal table .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i know which column equal to which row in INNTAB.Please let me know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 08:12:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597888#M1275835</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-14T08:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597889#M1275836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If i understand you correctly, you seem to have a problem in knowing the columns of the dynamic internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please note that the columns will be in a serialised way as u specifyin the fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose my fieldcatalog has 3 entries&lt;/P&gt;&lt;P&gt;A&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;&lt;P&gt;C&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then the dynamic internal table will be as follows:-&lt;/P&gt;&lt;P&gt;A   B   C&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to access a particular column of the work area &amp;lt;L_LINE&amp;gt;&lt;/P&gt;&lt;P&gt;then you can access it as follows:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols : &amp;lt;F_FIELD&amp;gt; type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assign component 'A' of &amp;lt;L_LINE&amp;gt; to &amp;lt;F_FIELD&amp;gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Assign component 1 of &amp;lt;L_LINE&amp;gt; to &amp;lt;F_FIELD&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ankur Parab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 09:03:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597889#M1275836</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-14T09:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597890#M1275837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ASSIGN COMPONENT p_cnt of structure &amp;lt;l_line&amp;gt; TO &amp;lt;l_field&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have this statement correctly . When i check in Debug  &amp;lt;l_field&amp;gt; is empty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know &amp;lt;&amp;lt; Removed &amp;gt;&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on May 14, 2009 11:01 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 14:36:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597890#M1275837</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-14T14:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597891#M1275838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's possible, if the field you are currently assigning is empty as well. And that seems to be the case. Or you have already reached the last field of the structure, in which case to return code will not equal zero (is not initial).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 14:50:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597891#M1275838</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2009-05-14T14:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597892#M1275839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Please check my WIKI and you will understand.&lt;/P&gt;&lt;P&gt;&lt;A href="https://wiki.sdn.sap.com/wiki/x/UYA_Bg" target="test_blank"&gt;https://wiki.sdn.sap.com/wiki/x/UYA_Bg&lt;/A&gt;  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does your internal table contain any data??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ankur Parab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 15:02:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597892#M1275839</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-14T15:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597893#M1275840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tashvi - please do not use ASAP. Everyone's problem is important.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 15:03:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table/m-p/5597893#M1275840</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-14T15:03:09Z</dc:date>
    </item>
  </channel>
</rss>

