<?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 data in dynamically generated db table thro' dynamically ITAB in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-data-in-dynamically-generated-db-table-thro-dynamically-itab/m-p/2911707#M685161</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;exactly what error do you get? I don't know your transformation but I can not see any usage of the parameter target_client except in DELETE statement. You should fill this value in all lines in your table &amp;lt;lt_data&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 23 Feb 2009 03:56:27 GMT</pubDate>
    <dc:creator>mvoros</dc:creator>
    <dc:date>2009-02-23T03:56:27Z</dc:date>
    <item>
      <title>Inserting data in dynamically generated db table thro' dynamically ITAB</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-data-in-dynamically-generated-db-table-thro-dynamically-itab/m-p/2911706#M685160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;FUNCTION Z_BC_INSERT_DATA.&lt;/P&gt;&lt;P&gt;Hi Friends,&lt;/P&gt;&lt;P&gt;I have created RFC function module for transfering data from one client to another client or from one quality to devlopment as well but now i m getting error in inserting data to target table as both taget table and internal table for holding data are generated dynamically. Can anybody faced such type of problem earliear?&lt;/P&gt;&lt;P&gt;Help me with solution as i m giving my code of function module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(TARGET_TABLE) TYPE  DD03L-TABNAME
*"     VALUE(TARGET_CLIENT) TYPE  SY-MANDT
*"     VALUE(I_TDATA) TYPE  STRING
*"  EXCEPTIONS
*"      AUTHORIZATION_ERROR
*"      INVALID_TABLE
*"      TABLE_NOT_EXIST
*"      INSERT_ERROR
*"----------------------------------------------------------------------
  DATA: DREF TYPE REF TO DATA.
  FIELD-SYMBOLS: &amp;lt;FS&amp;gt; TYPE ANY.
  CREATE DATA DREF TYPE (TARGET_TABLE).
  ASSIGN DREF-&amp;gt;* TO &amp;lt;FS&amp;gt;.
  DATA: WA_TADIR TYPE TADIR.

* internal table to hold the data
  DATA: W_TABNAME TYPE W_TABNAME,
        W_DREF TYPE REF TO DATA.

  FIELD-SYMBOLS: &amp;lt;LT_DATA&amp;gt; TYPE ANY TABLE.

  W_TABNAME = TARGET_TABLE.

  CREATE DATA W_DREF TYPE TABLE OF (W_TABNAME).

  ASSIGN W_DREF-&amp;gt;* TO &amp;lt;LT_DATA&amp;gt;.

*  verify that the table starts with a 'Z'.
  IF TARGET_TABLE(1) &amp;lt;&amp;gt; 'Z'.
    RAISE INVALID_TABLE.
  ENDIF.
*  verify that the table exists.
  SELECT SINGLE * FROM TADIR INTO WA_TADIR
         WHERE
           PGMID = 'R3TR' AND
           OBJECT = 'TABL' AND
           OBJ_NAME = TARGET_TABLE.
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    RAISE TABLE_NOT_EXIST.
  ENDIF.
* Insert the data.
  DATA: COUNT_F TYPE I.
** delete target client
  DELETE FROM (TARGET_TABLE) CLIENT SPECIFIED
         WHERE MANDT = TARGET_CLIENT.
  COMMIT WORK.

* Add imported XML data into lt_data internal table
  CALL TRANSFORMATION (`Z_XML_ID`)
       SOURCE XML I_TDATA
         RESULT L_T_DATA = &amp;lt;LT_DATA&amp;gt;.

* Insert records from internal table into target table
  insert (target_table) CLIENT SPECIFIED from TABLE &amp;lt;lt_data&amp;gt;.

  COMMIT WORK.
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    RAISE INSERT_ERROR.
  ENDIF.
ENDFUNCTION.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2007 06:53:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-data-in-dynamically-generated-db-table-thro-dynamically-itab/m-p/2911706#M685160</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-24T06:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting data in dynamically generated db table thro' dynamically ITAB</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-data-in-dynamically-generated-db-table-thro-dynamically-itab/m-p/2911707#M685161</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;exactly what error do you get? I don't know your transformation but I can not see any usage of the parameter target_client except in DELETE statement. You should fill this value in all lines in your table &amp;lt;lt_data&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Feb 2009 03:56:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-data-in-dynamically-generated-db-table-thro-dynamically-itab/m-p/2911707#M685161</guid>
      <dc:creator>mvoros</dc:creator>
      <dc:date>2009-02-23T03:56:27Z</dc:date>
    </item>
  </channel>
</rss>

