<?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: declaring data type dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-data-type-dynamically/m-p/3875290#M931485</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try making the work area Dynamic; Take this eg:- &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA : 
it_tab TYPE TABLE OF pa0002,
wa_tab LIKE LINE OF it_tab,
record TYPE REF TO data.

FIELD-SYMBOLS: &amp;lt;fs&amp;gt; TYPE ANY.

GET REFERENCE OF wa_tab INTO record.
ASSIGN record-&amp;gt;* TO &amp;lt;fs&amp;gt;.
SELECT SINGLE * FROM pa0002
              INTO &amp;lt;fs&amp;gt;
              WHERE pernr = '1'. "some criteria for selection
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I guess in your case, the problem is with &lt;EM&gt;work&lt;/EM&gt; and not with &lt;EM&gt;object_type-viewname&lt;/EM&gt; .&lt;/P&gt;&lt;P&gt;So, all you need to do is make it dynamic based on the above eg:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Remi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 May 2008 12:22:07 GMT</pubDate>
    <dc:creator>RemiKaimal</dc:creator>
    <dc:date>2008-05-15T12:22:07Z</dc:date>
    <item>
      <title>declaring data type dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-data-type-dynamically/m-p/3875289#M931484</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;i am upgrading version 4.7 to 6.0.&lt;/P&gt;&lt;P&gt;In one of the program i came across following statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Select * from (object_type-viewname) into work.*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;object_type-viewname&lt;/STRONG&gt;  has some table name as value which changes with each loop pass.&lt;/P&gt;&lt;P&gt;Earlier in version 4.7 version the structure of &lt;STRONG&gt;work&lt;/STRONG&gt; was flat,&lt;/P&gt;&lt;P&gt;but if i use the same in 6.0 it gives dump saying types not compatible.&lt;/P&gt;&lt;P&gt;So the only solution I was able to understand is every time *data type of work should be equal to contents of &lt;STRONG&gt;object_type-viewname.&lt;/STRONG&gt;* But how do i achieve that &lt;/P&gt;&lt;P&gt;PLzzz help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2008 05:44:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-data-type-dynamically/m-p/3875289#M931484</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-14T05:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: declaring data type dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-data-type-dynamically/m-p/3875290#M931485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try making the work area Dynamic; Take this eg:- &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA : 
it_tab TYPE TABLE OF pa0002,
wa_tab LIKE LINE OF it_tab,
record TYPE REF TO data.

FIELD-SYMBOLS: &amp;lt;fs&amp;gt; TYPE ANY.

GET REFERENCE OF wa_tab INTO record.
ASSIGN record-&amp;gt;* TO &amp;lt;fs&amp;gt;.
SELECT SINGLE * FROM pa0002
              INTO &amp;lt;fs&amp;gt;
              WHERE pernr = '1'. "some criteria for selection
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I guess in your case, the problem is with &lt;EM&gt;work&lt;/EM&gt; and not with &lt;EM&gt;object_type-viewname&lt;/EM&gt; .&lt;/P&gt;&lt;P&gt;So, all you need to do is make it dynamic based on the above eg:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Remi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2008 12:22:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-data-type-dynamically/m-p/3875290#M931485</guid>
      <dc:creator>RemiKaimal</dc:creator>
      <dc:date>2008-05-15T12:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: declaring data type dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-data-type-dynamically/m-p/3875291#M931486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shubhi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ZUPGRADE_BDC_ABAP1.


* Set of table names
DATA: IT_TABNAME TYPE TABLE OF DD03L-TABNAME,
      WA_TABNAME LIKE LINE OF IT_TABNAME.

* Field Symbols for the dynamic data creation
DATA LR_DATA TYPE REF TO DATA.

FIELD-SYMBOLS &amp;lt;FS&amp;gt; TYPE ANY TABLE.

CLEAR WA_TABNAME.

MOVE 'SPFLI' TO WA_TABNAME.
APPEND WA_TABNAME TO IT_TABNAME.

MOVE 'MARA' TO WA_TABNAME.
APPEND WA_TABNAME TO IT_TABNAME.


LOOP AT IT_TABNAME INTO WA_TABNAME.

*Dynamically creating the internal table
  IF &amp;lt;FS&amp;gt; IS ASSIGNED.
    UNASSIGN &amp;lt;FS&amp;gt;.
  ENDIF.

  CLEAR LR_DATA.

  CREATE DATA LR_DATA TYPE TABLE OF (WA_TABNAME).

  ASSIGN LR_DATA-&amp;gt;* TO &amp;lt;FS&amp;gt;.

  SELECT * FROM (WA_TABNAME) INTO TABLE &amp;lt;FS&amp;gt; UP TO 10 ROWS.

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2008 12:49:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/declaring-data-type-dynamically/m-p/3875291#M931486</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-15T12:49:51Z</dc:date>
    </item>
  </channel>
</rss>

