<?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 assignment - runtime error. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-assignment-runtime-error/m-p/12612547#M2011925</link>
    <description>&lt;P&gt;You can try this way:&lt;/P&gt;&lt;P&gt;DATA: dref    TYPE REF TO data,&lt;/P&gt;&lt;P&gt;           tabname TYPE tabname.&lt;/P&gt;&lt;P&gt; FIELD-SYMBOLS: &amp;lt;row&amp;gt;       TYPE any,&lt;/P&gt;&lt;P&gt;                               &amp;lt;component&amp;gt; TYPE any.&lt;/P&gt;&lt;P&gt;PARAMETERS: P_TABNAME(10) DEFAULT 'SPFLI'.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;tabname = p_tabname.&lt;/P&gt;&lt;P&gt; * dynamically create appropriate Data Structure&lt;/P&gt;&lt;P&gt;     CREATE DATA dref TYPE (tabname).&lt;/P&gt;&lt;P&gt;     ASSIGN dref-&amp;gt;* TO &amp;lt;row&amp;gt;.&lt;/P&gt;&lt;P&gt; * fetch the data&lt;/P&gt;&lt;P&gt;     SELECT *&lt;/P&gt;&lt;P&gt;     FROM (tabname) UP TO 2 ROWS&lt;/P&gt;&lt;P&gt;     INTO &amp;lt;row&amp;gt;.&lt;/P&gt;&lt;P&gt; * display the result&lt;/P&gt;&lt;P&gt;       NEW-LINE.&lt;/P&gt;&lt;P&gt;       DO.&lt;/P&gt;&lt;P&gt;         ASSIGN COMPONENT sy-index OF STRUCTURE &amp;lt;row&amp;gt; TO &amp;lt;component&amp;gt;.&lt;/P&gt;&lt;P&gt;         IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;           EXIT. " no more components&lt;/P&gt;&lt;P&gt;         ENDIF.&lt;/P&gt;&lt;P&gt;         WRITE: &amp;lt;component&amp;gt;.&lt;/P&gt;&lt;P&gt;       ENDDO.&lt;/P&gt;&lt;P&gt;     ENDSELECT.&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jun 2022 12:46:35 GMT</pubDate>
    <dc:creator>Rajasekhar_Dina</dc:creator>
    <dc:date>2022-06-14T12:46:35Z</dc:date>
    <item>
      <title>dynamic assignment - runtime error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-assignment-runtime-error/m-p/12612544#M2011922</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;The following is a snippet of programming albeit from a very old SAP tutorial. This gives runtime error. Is dynamic assignment of table name not allowed ? Is this obsolete now. Just curious. Thanks&lt;/P&gt;
  &lt;P&gt;TABLES: SPFLI, SFLIGHT.&lt;/P&gt;
  &lt;P&gt;DATA: BEGIN OF WA,&lt;/P&gt;
  &lt;P&gt; LINE(100),&lt;/P&gt;
  &lt;P&gt; END OF WA.&lt;/P&gt;
  &lt;P&gt;PARAMETERS: TABNAME(10) DEFAULT 'SPFLI'.&lt;/P&gt;
  &lt;P&gt;SELECT * FROM (TABNAME) INTO WA.&lt;/P&gt;
  &lt;P&gt; WRITE: / WA-LINE.&lt;/P&gt;
  &lt;P&gt;ENDSELECT.&lt;/P&gt;
  &lt;P&gt;IF SY-SUBRC NE 0.&lt;/P&gt;
  &lt;P&gt; WRITE: / TEXT-001.&lt;/P&gt;
  &lt;P&gt;ENDIF.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 21:39:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-assignment-runtime-error/m-p/12612544#M2011922</guid>
      <dc:creator>jyothsna1234</dc:creator>
      <dc:date>2022-06-05T21:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic assignment - runtime error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-assignment-runtime-error/m-p/12612545#M2011923</link>
      <description>&lt;P&gt;SELECT ... FROM (tabname) is not obsolete as you can find in the ABAP documentation.&lt;/P&gt;&lt;P&gt;Maybe the code was working in Non-Unicode SAP systems, but anyway the code in this tutorial (?) should have WA correspond to the structure of the table. You can find lots of working examples in the forum and in the ABAP documentation.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 07:48:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-assignment-runtime-error/m-p/12612545#M2011923</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2022-06-06T07:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic assignment - runtime error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-assignment-runtime-error/m-p/12612546#M2011924</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;You can refer the  demo program &lt;STRONG&gt;DEMO_SELECT_INTO_NEW_VARIANTS&lt;/STRONG&gt; which demonstrates how the &lt;STRONG&gt;NEW&lt;/STRONG&gt; addition is used in different variants of the &lt;STRONG&gt;INTO&lt;/STRONG&gt; clause.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 12:39:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-assignment-runtime-error/m-p/12612546#M2011924</guid>
      <dc:creator>Rajasekhar_Dina</dc:creator>
      <dc:date>2022-06-14T12:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic assignment - runtime error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-assignment-runtime-error/m-p/12612547#M2011925</link>
      <description>&lt;P&gt;You can try this way:&lt;/P&gt;&lt;P&gt;DATA: dref    TYPE REF TO data,&lt;/P&gt;&lt;P&gt;           tabname TYPE tabname.&lt;/P&gt;&lt;P&gt; FIELD-SYMBOLS: &amp;lt;row&amp;gt;       TYPE any,&lt;/P&gt;&lt;P&gt;                               &amp;lt;component&amp;gt; TYPE any.&lt;/P&gt;&lt;P&gt;PARAMETERS: P_TABNAME(10) DEFAULT 'SPFLI'.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;tabname = p_tabname.&lt;/P&gt;&lt;P&gt; * dynamically create appropriate Data Structure&lt;/P&gt;&lt;P&gt;     CREATE DATA dref TYPE (tabname).&lt;/P&gt;&lt;P&gt;     ASSIGN dref-&amp;gt;* TO &amp;lt;row&amp;gt;.&lt;/P&gt;&lt;P&gt; * fetch the data&lt;/P&gt;&lt;P&gt;     SELECT *&lt;/P&gt;&lt;P&gt;     FROM (tabname) UP TO 2 ROWS&lt;/P&gt;&lt;P&gt;     INTO &amp;lt;row&amp;gt;.&lt;/P&gt;&lt;P&gt; * display the result&lt;/P&gt;&lt;P&gt;       NEW-LINE.&lt;/P&gt;&lt;P&gt;       DO.&lt;/P&gt;&lt;P&gt;         ASSIGN COMPONENT sy-index OF STRUCTURE &amp;lt;row&amp;gt; TO &amp;lt;component&amp;gt;.&lt;/P&gt;&lt;P&gt;         IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;           EXIT. " no more components&lt;/P&gt;&lt;P&gt;         ENDIF.&lt;/P&gt;&lt;P&gt;         WRITE: &amp;lt;component&amp;gt;.&lt;/P&gt;&lt;P&gt;       ENDDO.&lt;/P&gt;&lt;P&gt;     ENDSELECT.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 12:46:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-assignment-runtime-error/m-p/12612547#M2011925</guid>
      <dc:creator>Rajasekhar_Dina</dc:creator>
      <dc:date>2022-06-14T12:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic assignment - runtime error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-assignment-runtime-error/m-p/12612548#M2011926</link>
      <description>Check online or F1 help&lt;UL&gt;&lt;LI&gt;A classic defined work area must meet some &lt;A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenabap_sql_wa.htm"&gt;prerequisites&lt;/A&gt;.&lt;/LI&gt;&lt;LI&gt;In non obsolete version, you can dynamically define the target work area/internal table, check either &lt;A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abapselect_into_target.htm#!ABAP_ALTERNATIVE_2@2@"&gt;@DATA(dobj)&lt;/A&gt;  or &lt;A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abapselect_into_target.htm#!ABAP_ALTERNATIVE_4@4@"&gt;NEW @DATA(dref)&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Tue, 14 Jun 2022 13:32:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-assignment-runtime-error/m-p/12612548#M2011926</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2022-06-14T13:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic assignment - runtime error.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-assignment-runtime-error/m-p/12612549#M2011927</link>
      <description>&lt;P&gt;What would be most helpful is if you would give some details on what the error message is.&lt;/P&gt;&lt;P&gt;Or is it a secret?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 14:23:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-assignment-runtime-error/m-p/12612549#M2011927</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2022-06-14T14:23:15Z</dc:date>
    </item>
  </channel>
</rss>

