<?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: How to loop at dynamic table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-at-dynamic-table/m-p/2733824#M634895</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;Thanks for your quick reply but I still have a doubt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I pass name to &amp;lt;l_table&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example as shown below how do I make &amp;lt;l_table&amp;gt; as itab while running.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT &amp;lt;l_table&amp;gt; ASSIGNING &amp;lt;l_line&amp;gt;.   &lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;LOOP AT itab ASSIGNING &amp;lt;l_line&amp;gt;.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Sep 2007 08:17:06 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-03T08:17:06Z</dc:date>
    <item>
      <title>How to loop at dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-at-dynamic-table/m-p/2733821#M634892</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;I want to loop at internal table whose name can be dynamic (i can pass as variable).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at &amp;lt;dyn_table&amp;gt;.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I pass different values to &amp;lt;dyn_table&amp;gt;?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 07:51:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-at-dynamic-table/m-p/2733821#M634892</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T07:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to loop at dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-at-dynamic-table/m-p/2733822#M634893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Apps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   This is example to loop dynamic table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS : &amp;lt;GT_1&amp;gt;     TYPE TABLE ,&lt;/P&gt;&lt;P&gt;                &amp;lt;GS_1&amp;gt;     TYPE ANY ,&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;               &amp;lt;FS&amp;gt;       TYPE ANY .&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;                &amp;lt;F_1&amp;gt;      TYPE ANY .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF GT_FLD OCCURS 0,&lt;/P&gt;&lt;P&gt;        FIELDNAME TYPE FIELDNAME,&lt;/P&gt;&lt;P&gt;      END OF GT_FLD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF GT_1 OCCURS 0,&lt;/P&gt;&lt;P&gt;       KUNNR LIKE BSID-KUNNR,&lt;/P&gt;&lt;P&gt;       DMBTR LIKE BSID-DMBTR,&lt;/P&gt;&lt;P&gt;END OF GT_1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:  GD_REF1     TYPE REF TO DATA,&lt;/P&gt;&lt;P&gt;       GT_ALV_CAT  TYPE TABLE OF LVC_S_FCAT WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt; REFRESH: GT_FLD.&lt;/P&gt;&lt;P&gt; REFRESH GT_ALV_CAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  MOVE 'GJAHR'         TO GT_FLD.  APPEND GT_FLD.&lt;/P&gt;&lt;P&gt;  MOVE 'BSID'          TO GT_ALV_CAT-REF_TABLE.&lt;/P&gt;&lt;P&gt;  MOVE 'GJAHR'         TO GT_ALV_CAT-REF_FIELD.&lt;/P&gt;&lt;P&gt;  MOVE 'GJAHR'         TO GT_ALV_CAT-FIELDNAME.&lt;/P&gt;&lt;P&gt;  APPEND GT_ALV_CAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  MOVE 'KUNNR'         TO GT_FLD.  APPEND GT_FLD.&lt;/P&gt;&lt;P&gt;  MOVE 'BSID'          TO GT_ALV_CAT-REF_TABLE.&lt;/P&gt;&lt;P&gt;  MOVE 'KUNNR'         TO GT_ALV_CAT-REF_FIELD.&lt;/P&gt;&lt;P&gt;  MOVE 'KUNNR'         TO GT_ALV_CAT-FIELDNAME.&lt;/P&gt;&lt;P&gt;  APPEND GT_ALV_CAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  MOVE 'DMBTR'         TO GT_FLD.  APPEND GT_FLD.&lt;/P&gt;&lt;P&gt;  MOVE 'BSID'          TO GT_ALV_CAT-REF_TABLE.&lt;/P&gt;&lt;P&gt;  MOVE 'DMBTR'         TO GT_ALV_CAT-REF_FIELD.&lt;/P&gt;&lt;P&gt;  MOVE 'DMBTR'         TO GT_ALV_CAT-FIELDNAME.&lt;/P&gt;&lt;P&gt;  APPEND GT_ALV_CAT.&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;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;make dynamic table to use alv method&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 IT_FIELDCATALOG = GT_ALV_CAT[]&lt;/P&gt;&lt;P&gt;     IMPORTING EP_TABLE = GD_REF1.&lt;/P&gt;&lt;P&gt;  ASSIGN GD_REF1-&amp;gt;* TO &amp;lt;GT_1&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT (GT_FLD) INTO TABLE &amp;lt;GT_1&amp;gt;&lt;/P&gt;&lt;P&gt;                    FROM BSID&lt;/P&gt;&lt;P&gt;                    WHERE GJAHR = 2007 AND&lt;/P&gt;&lt;P&gt;                          BUKRS = 'C5A0'.&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;assign data to field&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  LOOP AT &amp;lt;GT_1&amp;gt; ASSIGNING &amp;lt;GS_1&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CLEAR GT_1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ASSIGN COMPONENT 'KUNNR' OF STRUCTURE &amp;lt;GS_1&amp;gt; TO &amp;lt;F_1&amp;gt;.&lt;/P&gt;&lt;P&gt;    MOVE &amp;lt;F_1&amp;gt;        TO GT_1-KUNNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ASSIGN COMPONENT 'DMBTR' OF STRUCTURE &amp;lt;GS_1&amp;gt; TO &amp;lt;F_1&amp;gt;.&lt;/P&gt;&lt;P&gt;    MOVE &amp;lt;F_1&amp;gt;        TO GT_1-DMBTR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    APPEND GT_1.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&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;Regards&lt;/P&gt;&lt;P&gt;Wiboon&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Wiboon Chaiyabutsakul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 07:54:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-at-dynamic-table/m-p/2733822#M634893</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T07:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to loop at dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-at-dynamic-table/m-p/2733823#M634894</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;&lt;/P&gt;&lt;P&gt;You can use field symbols for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the following example,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the program is to handle dynamic internal table you can use this for your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPE-POOLS: slis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: it_fcat TYPE slis_t_fieldcat_alv,&lt;/P&gt;&lt;P&gt;      is_fcat LIKE LINE OF it_fcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: it_fieldcat TYPE lvc_t_fcat,&lt;/P&gt;&lt;P&gt;      is_fieldcat LIKE LINE OF it_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: new_table TYPE REF TO data,&lt;/P&gt;&lt;P&gt;      new_line TYPE REF TO data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;l_table&amp;gt; TYPE ANY TABLE,&lt;/P&gt;&lt;P&gt;               &amp;lt;l_line&amp;gt; TYPE ANY,&lt;/P&gt;&lt;P&gt;               &amp;lt;l_field&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Build fieldcat&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;i_structure_name = 'SYST'&lt;/P&gt;&lt;P&gt;CHANGING&lt;/P&gt;&lt;P&gt;ct_fieldcat = it_fcat[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_fcat INTO is_fcat WHERE NOT reptext_ddic IS initial.&lt;/P&gt;&lt;P&gt;MOVE-CORRESPONDING is_fcat TO is_fieldcat.&lt;/P&gt;&lt;P&gt;is_fieldcat-fieldname = is_fcat-fieldname.&lt;/P&gt;&lt;P&gt;is_fieldcat-ref_field = is_fcat-fieldname.&lt;/P&gt;&lt;P&gt;is_fieldcat-ref_table = is_fcat-ref_tabname.&lt;/P&gt;&lt;P&gt;APPEND is_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create a new Table&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 = it_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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create a new Line with the same structure of the table.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&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;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Test it...&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DO 30 TIMES.&lt;/P&gt;&lt;P&gt;ASSIGN COMPONENT 'SUBRC' OF STRUCTURE &amp;lt;l_line&amp;gt; TO &amp;lt;l_field&amp;gt;.&lt;/P&gt;&lt;P&gt;&amp;lt;l_field&amp;gt; = sy-index.&lt;/P&gt;&lt;P&gt;INSERT &amp;lt;l_line&amp;gt; INTO TABLE &amp;lt;l_table&amp;gt;.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT &amp;lt;l_table&amp;gt; ASSIGNING &amp;lt;l_line&amp;gt;.&lt;/P&gt;&lt;P&gt;ASSIGN COMPONENT 'SUBRC' OF STRUCTURE &amp;lt;l_line&amp;gt; TO &amp;lt;l_field&amp;gt;.&lt;/P&gt;&lt;P&gt;WRITE &amp;lt;l_field&amp;gt;.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward if helpful.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 07:56:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-at-dynamic-table/m-p/2733823#M634894</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T07:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to loop at dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-at-dynamic-table/m-p/2733824#M634895</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;Thanks for your quick reply but I still have a doubt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I pass name to &amp;lt;l_table&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example as shown below how do I make &amp;lt;l_table&amp;gt; as itab while running.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT &amp;lt;l_table&amp;gt; ASSIGNING &amp;lt;l_line&amp;gt;.   &lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;LOOP AT itab ASSIGNING &amp;lt;l_line&amp;gt;.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 08:17:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-at-dynamic-table/m-p/2733824#M634895</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T08:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to loop at dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-at-dynamic-table/m-p/2733825#M634896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Apps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     1.you need to declare  field for dynabic table into GT_FLD(from my example I woud like field GJAHR of table BSID , I will declare like this &lt;/P&gt;&lt;P&gt;REFRESH: GT_FLD.&lt;/P&gt;&lt;P&gt;REFRESH GT_ALV_CAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MOVE 'GJAHR' TO GT_FLD. APPEND GT_FLD.&lt;/P&gt;&lt;P&gt;MOVE 'BSID' TO GT_ALV_CAT-REF_TABLE.&lt;/P&gt;&lt;P&gt;MOVE 'GJAHR' TO GT_ALV_CAT-REF_FIELD.&lt;/P&gt;&lt;P&gt;MOVE 'GJAHR' TO GT_ALV_CAT-FIELDNAME.&lt;/P&gt;&lt;P&gt;APPEND GT_ALV_CAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. use this below function to create dynamic table  .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;make dynamic table to use alv method&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 IT_FIELDCATALOG = GT_ALV_CAT[]&lt;/P&gt;&lt;P&gt;IMPORTING EP_TABLE = GD_REF1.&lt;/P&gt;&lt;P&gt;ASSIGN GD_REF1-&amp;gt;* TO &amp;lt;GT_1&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. you cannot name the dynamic table . if you want to use the dynamic table ,you will use the field symbol(&amp;lt;GT_1&amp;gt;) .&lt;/P&gt;&lt;P&gt;4.if you want to change a table , you will redo the above process again.&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;Wiboon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 08:26:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-at-dynamic-table/m-p/2733825#M634896</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T08:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to loop at dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-at-dynamic-table/m-p/2733826#M634897</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 code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT zpwtest .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;Tables&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;DATA: lt_data TYPE REF TO data.&lt;/P&gt;&lt;P&gt;DATA: lt_fieldcatalog TYPE lvc_t_fcat.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;Structure&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;DATA: ls_fieldcatalog TYPE lvc_s_fcat.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;Data References&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;DATA: new_line TYPE REF TO data.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;Field Symbols&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;fs_data&amp;gt; TYPE REF TO data,&lt;/P&gt;&lt;P&gt;               &amp;lt;fs_1&amp;gt; TYPE ANY TABLE,&lt;/P&gt;&lt;P&gt;               &amp;lt;fs_2&amp;gt;,&lt;/P&gt;&lt;P&gt;               &amp;lt;fs_3&amp;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;ls_fieldcatalog-fieldname = 'MANDT'.&lt;/P&gt;&lt;P&gt;APPEND ls_fieldcatalog TO lt_fieldcatalog.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ls_fieldcatalog-fieldname = 'CARRID'. "Fieldname&lt;/P&gt;&lt;P&gt;ls_fieldcatalog-inttype = 'C'. "Internal Type C-&amp;gt; Character&lt;/P&gt;&lt;P&gt;APPEND ls_fieldcatalog TO lt_fieldcatalog.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ls_fieldcatalog-fieldname = 'CONNID'.&lt;/P&gt;&lt;P&gt;ls_fieldcatalog-inttype = 'N'.&lt;/P&gt;&lt;P&gt;APPEND ls_fieldcatalog TO lt_fieldcatalog.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ls_fieldcatalog-fieldname = 'FLDATE'.&lt;/P&gt;&lt;P&gt;ls_fieldcatalog-inttype = 'D'.&lt;/P&gt;&lt;P&gt;APPEND ls_fieldcatalog TO lt_fieldcatalog.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ls_fieldcatalog-fieldname = 'PRICE'.&lt;/P&gt;&lt;P&gt;ls_fieldcatalog-inttype = 'P'.&lt;/P&gt;&lt;P&gt;APPEND ls_fieldcatalog TO lt_fieldcatalog.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ls_fieldcatalog-fieldname = 'CURRENCY'.&lt;/P&gt;&lt;P&gt;ls_fieldcatalog-inttype = 'C'.&lt;/P&gt;&lt;P&gt;APPEND ls_fieldcatalog TO lt_fieldcatalog.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ASSIGN lt_data TO &amp;lt;fs_data&amp;gt;.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;CALL METHOD cl_alv_table_create=create_dynamic_table&lt;/P&gt;&lt;P&gt;     EXPORTING&lt;/P&gt;&lt;P&gt;       it_fieldcatalog = lt_fieldcatalog&lt;/P&gt;&lt;P&gt;     IMPORTING&lt;/P&gt;&lt;P&gt;       ep_table = fs_data&lt;/P&gt;&lt;P&gt;     EXCEPTIONS&lt;/P&gt;&lt;P&gt;       generate_subpool_dir_full = 1&lt;/P&gt;&lt;P&gt;       OTHERS = 2&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;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;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;So &amp;lt;FS_1&amp;gt; now points to our dynamic internal table.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ASSIGN &amp;lt;fs_data&amp;gt;-&amp;gt;* TO &amp;lt;fs_1&amp;gt;.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;Next step is to create a work area for our dynamic internal table.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;CREATE DATA new_line LIKE LINE OF &amp;lt;fs_1&amp;gt;.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;A field-symbol to access that work area&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;ASSIGN new_line-&amp;gt;*  TO &amp;lt;fs_2&amp;gt;.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;And to put the data in the internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;SELECT mandt carrid connid fldate price currency&lt;/P&gt;&lt;P&gt;  FROM sflight&lt;/P&gt;&lt;P&gt;  INTO CORRESPONDING FIELDS OF TABLE &amp;lt;fs_1&amp;gt;.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;Access contents of internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;LOOP AT &amp;lt;fs_1&amp;gt; ASSIGNING &amp;lt;fs_2&amp;gt;.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  ASSIGN COMPONENT 1 OF STRUCTURE &amp;lt;fs_2&amp;gt; TO &amp;lt;fs_3&amp;gt;.&lt;/P&gt;&lt;P&gt;  WRITE: / &amp;lt;fs_3&amp;gt;.&lt;/P&gt;&lt;P&gt;ENDLOOP.&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, 03 Sep 2007 08:26:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-loop-at-dynamic-table/m-p/2733826#M634897</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T08:26:43Z</dc:date>
    </item>
  </channel>
</rss>

