<?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: Inserting into dbtab from dynamic internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-into-dbtab-from-dynamic-internal-table/m-p/8567004#M1659554</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sumanas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did a test with a table and ZTEST and ZTESTE2. You can try the code below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See if that's what you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I modified these variables via debug for this test.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  zteste.

PARAMETERS: p_tab1 TYPE dd03l-tabname OBLIGATORY,
            p_tab2 TYPE dd03l-tabname OBLIGATORY.

DATA: v_data_ref TYPE REF TO data.

DATA: v_inter_tab TYPE dd03l-tabname.

FIELD-SYMBOLS: &amp;lt;f_tab&amp;gt; TYPE STANDARD TABLE.

START-OF-SELECTION.

*TABLE 1
  UNASSIGN &amp;lt;f_tab&amp;gt;.
  CREATE DATA v_data_ref TYPE TABLE OF (p_tab1).
  ASSIGN v_data_ref-&amp;gt;* TO &amp;lt;f_tab&amp;gt;.
  IF &amp;lt;f_tab&amp;gt; IS ASSIGNED.

      PERFORM f_insert USING p_tab1
                             &amp;lt;f_tab&amp;gt;.
  ENDIF.

*TABLE 2
  CLEAR v_data_ref.
  UNASSIGN &amp;lt;f_tab&amp;gt;.
  CREATE DATA v_data_ref TYPE TABLE OF (p_tab2).
  ASSIGN v_data_ref-&amp;gt;* TO &amp;lt;f_tab&amp;gt;.
  IF &amp;lt;f_tab&amp;gt; IS ASSIGNED.

      PERFORM f_insert USING p_tab2
                             &amp;lt;f_tab&amp;gt;.
  ENDIF.
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  F_INSERT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;P_V_TAB  text
*      --&amp;gt;P_&amp;lt;F_TAB&amp;gt;  text
*----------------------------------------------------------------------*
FORM f_insert  USING    pv_tab TYPE dd03l-tabname
                        pt_tab TYPE STANDARD TABLE.

  INSERT (pv_tab) FROM TABLE pt_tab.
ENDFORM.                    " F_INSERT
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Bruno Xavier.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Jan 2012 23:21:32 GMT</pubDate>
    <dc:creator>brunobex</dc:creator>
    <dc:date>2012-01-24T23:21:32Z</dc:date>
    <item>
      <title>Inserting into dbtab from dynamic internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-into-dbtab-from-dynamic-internal-table/m-p/8567003#M1659553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am want to insert data into a database table from a dynamic internal table. I am using the below syntax:&lt;/P&gt;&lt;P&gt;INSERT INTO (&amp;lt;dbtab&amp;gt;) FROM TABLE itab. &lt;/P&gt;&lt;P&gt;Where this dbtab will be taken as input in selection screen of the program and the itab will be a internal table of the same type. I am able to pass database table name dynamically but not able for itab.&lt;/P&gt;&lt;P&gt;It seems SAP does not allow Field-Symbols in INSERT statement and also not a Reference Object. &lt;/P&gt;&lt;P&gt;Do you have any other solution for this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sumanas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jan 2012 20:11:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-into-dbtab-from-dynamic-internal-table/m-p/8567003#M1659553</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-24T20:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting into dbtab from dynamic internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-into-dbtab-from-dynamic-internal-table/m-p/8567004#M1659554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sumanas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did a test with a table and ZTEST and ZTESTE2. You can try the code below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See if that's what you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I modified these variables via debug for this test.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  zteste.

PARAMETERS: p_tab1 TYPE dd03l-tabname OBLIGATORY,
            p_tab2 TYPE dd03l-tabname OBLIGATORY.

DATA: v_data_ref TYPE REF TO data.

DATA: v_inter_tab TYPE dd03l-tabname.

FIELD-SYMBOLS: &amp;lt;f_tab&amp;gt; TYPE STANDARD TABLE.

START-OF-SELECTION.

*TABLE 1
  UNASSIGN &amp;lt;f_tab&amp;gt;.
  CREATE DATA v_data_ref TYPE TABLE OF (p_tab1).
  ASSIGN v_data_ref-&amp;gt;* TO &amp;lt;f_tab&amp;gt;.
  IF &amp;lt;f_tab&amp;gt; IS ASSIGNED.

      PERFORM f_insert USING p_tab1
                             &amp;lt;f_tab&amp;gt;.
  ENDIF.

*TABLE 2
  CLEAR v_data_ref.
  UNASSIGN &amp;lt;f_tab&amp;gt;.
  CREATE DATA v_data_ref TYPE TABLE OF (p_tab2).
  ASSIGN v_data_ref-&amp;gt;* TO &amp;lt;f_tab&amp;gt;.
  IF &amp;lt;f_tab&amp;gt; IS ASSIGNED.

      PERFORM f_insert USING p_tab2
                             &amp;lt;f_tab&amp;gt;.
  ENDIF.
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  F_INSERT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;P_V_TAB  text
*      --&amp;gt;P_&amp;lt;F_TAB&amp;gt;  text
*----------------------------------------------------------------------*
FORM f_insert  USING    pv_tab TYPE dd03l-tabname
                        pt_tab TYPE STANDARD TABLE.

  INSERT (pv_tab) FROM TABLE pt_tab.
ENDFORM.                    " F_INSERT
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Bruno Xavier.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jan 2012 23:21:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-into-dbtab-from-dynamic-internal-table/m-p/8567004#M1659554</guid>
      <dc:creator>brunobex</dc:creator>
      <dc:date>2012-01-24T23:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting into dbtab from dynamic internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-into-dbtab-from-dynamic-internal-table/m-p/8567005#M1659555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bruno,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good code and many thanks for this.&lt;/P&gt;&lt;P&gt;I hope Sumanas is looking to insert the values from local internal table.&lt;/P&gt;&lt;P&gt;In that case, can we create a reference to ITAB and then pass it to respective DB table??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raja.D&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2012 06:22:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-into-dbtab-from-dynamic-internal-table/m-p/8567005#M1659555</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-25T06:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting into dbtab from dynamic internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-into-dbtab-from-dynamic-internal-table/m-p/8567006#M1659556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Bruno. It was very helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2012 13:15:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-into-dbtab-from-dynamic-internal-table/m-p/8567006#M1659556</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-25T13:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting into dbtab from dynamic internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-into-dbtab-from-dynamic-internal-table/m-p/8567007#M1659557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm also trying to do an INSERT (l_nametab) FROM TABLE &amp;lt;dynamic_table&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was following the Bruno's code but I received this runtime error:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DBIF_RSQL_INTERNAL_ERROR&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Internal error when accessing a table.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;The current ABAP/4 program terminated due to&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;an internal error in the database interface.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;An internal error in the database interface occurred during access to&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;the data of table "PA0002 ".&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;The situation points to an internal error in the SAP software&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;or to an incorrect status of the respective work process.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;For further analysis the SAP system log should be examined&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;(transaction SM21).&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;For a precise analysis of the error, you should supply&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;documents with as many details as possible.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: l_nametab TYPE TABNAME VALUE 'PA0002'.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;dynamic_table&amp;gt; TYPE STANDARD TABLE.&lt;/P&gt;&lt;P&gt;DATA: dy_table2 type ref to data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA dy_table2 TYPE STANDARD TABLE OF (l_nametab).&lt;/P&gt;&lt;P&gt;ASSIGN dy_table2-&amp;gt;* TO &amp;lt;dynamic_table&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have some Ideas about this error, I'll really apreciate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Feb 2012 19:03:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-into-dbtab-from-dynamic-internal-table/m-p/8567007#M1659557</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-26T19:03:40Z</dc:date>
    </item>
  </channel>
</rss>

