<?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: creating objects at runtime in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-objects-at-runtime/m-p/3686801#M887809</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data: gr_table type ref to data.&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;itab&amp;gt; type any table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters: p_tab type tabname default 'SFLIGHT'&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;create data gr_table type standard table of (p_tab).&lt;/P&gt;&lt;P&gt;assign gr_table-&amp;gt;* to &amp;lt;itab&amp;gt;.&lt;/P&gt;&lt;P&gt;select * from (p_tab) into table &amp;lt;itab&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Via create data you have created a internal table reference to the data structure 'SFLIGHT' (in this case).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Apr 2008 08:17:19 GMT</pubDate>
    <dc:creator>Sm1tje</dc:creator>
    <dc:date>2008-04-18T08:17:19Z</dc:date>
    <item>
      <title>creating objects at runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-objects-at-runtime/m-p/3686800#M887808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can anyone give me idea on using CREATE DATA&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Apr 2008 08:12:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-objects-at-runtime/m-p/3686800#M887808</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-18T08:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: creating objects at runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-objects-at-runtime/m-p/3686801#M887809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data: gr_table type ref to data.&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;itab&amp;gt; type any table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters: p_tab type tabname default 'SFLIGHT'&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;create data gr_table type standard table of (p_tab).&lt;/P&gt;&lt;P&gt;assign gr_table-&amp;gt;* to &amp;lt;itab&amp;gt;.&lt;/P&gt;&lt;P&gt;select * from (p_tab) into table &amp;lt;itab&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Via create data you have created a internal table reference to the data structure 'SFLIGHT' (in this case).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Apr 2008 08:17:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-objects-at-runtime/m-p/3686801#M887809</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2008-04-18T08:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: creating objects at runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-objects-at-runtime/m-p/3686802#M887810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi sandya&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All of the data objects that you define in the declaration part of a program using statements such as DATA are created statically, and already exist when you start the program. To create a data object dynamically during a program, you need a data reference variable and the following statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA dref {TYPE type}|{LIKE dobj}.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement creates a data object in the internal session of the current ABAP program. After the statement, the data reference in the data reference variable dref points to the object. The data object that you create does not have its own name. You can only address it using a data reference variable. To access the contents of the data object, you must dereference the data reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You must specify the data type of the object using the TYPEor LIKE addition. In contrast to the use of the TYPEaddition in other ABAP statements, you can use the CREATE DATA addition to dynamically specify the data type as the contents of a field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA dref TYPE (name).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward Me Points&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By&lt;/P&gt;&lt;P&gt;Pari&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Apr 2008 08:21:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-objects-at-runtime/m-p/3686802#M887810</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-18T08:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: creating objects at runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-objects-at-runtime/m-p/3686803#M887811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sandhya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA allows you to create fields in a pre-defined or user-defined data type. The statement has the following variants: &lt;/P&gt;&lt;P&gt;CREATE DATA dref TYPE typ. CREATE DATA dref TYPE (typname). CREATE DATA dref LIKE feld. CREATE DATA dref TYPE LINE OF itab. CREATE DATA dref LIKE LINE OF itab. &lt;/P&gt;&lt;P&gt;In the following example, a specific field is read from database table X031L. Note that neither the field name nor the table name is known until runtime: * Read a field from the table X031L &lt;/P&gt;&lt;P&gt;PARAMETERS: TAB_NAME LIKE SY-TNAME, "Table name TAB_COMP LIKE X031L-FIELDNAME, "Field name NUMBER TYPE I DEFAULT 10. "Number of lines &lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;WA&amp;gt; TYPE ANY, &amp;lt;COMP&amp;gt; TYPE ANY. &lt;/P&gt;&lt;P&gt;DATA: WA_REF TYPE REF TO DATA. &lt;/P&gt;&lt;P&gt;CREATE DATA WA_REF TYPE (TAB_NAME). "Suitable work area ASSIGN WA_REF-&amp;gt;* TO &amp;lt;WA&amp;gt;. &lt;/P&gt;&lt;P&gt;SELECT * FROM (TAB_NAME) INTO &amp;lt;WA&amp;gt; UP TO NUMBER ROWS. &lt;/P&gt;&lt;P&gt;ASSIGN COMPONENT TAB_COMP OF STRUCTURE &amp;lt;WA&amp;gt; TO &amp;lt;COMP&amp;gt;. &lt;/P&gt;&lt;P&gt;WRITE: / TAB_COMP, &amp;lt;COMP&amp;gt;. ENDSELECT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; __Another variant of CREATE DATA allows you to create table objects at runtime. The line type and table key can be entered statically or dynamically. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA dref (TYPE [STANDARD|SORTED|HASHED] TABLE &lt;/P&gt;&lt;P&gt;OF (LineType | (Name) |REF TO DATA | REF TO Obj)) &lt;/P&gt;&lt;P&gt;| (LIKE [STANDARD|SORTED|HASHED] TABLE OF LineObj ) &lt;/P&gt;&lt;P&gt;[ WITH (UNIQUE|NON-UNIQUE) ( KEY (k1 ... kn | (keytab) | TABLE_LINE ) &lt;/P&gt;&lt;P&gt;| DEFAULT KEY ) ] &lt;/P&gt;&lt;P&gt;[ INITIAL SIZE m ] &lt;/P&gt;&lt;P&gt;The following constraints apply to this variant: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. m is a variable or a constant without a sign, whose content at runtime must be of the type NUMLIKE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. keytab is a table of the type CHARLIKE, which must not be empty, and whose components must not contain any offset, length, or overlapping key entries. You can use the TABLE_LINE addition, if the table contains only one line. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. The system returns a syntax error if either the type, or line declaration and the key declaration are static. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. If you do not define a key, the system uses the DEFAULT-KEY. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; __You can also use the basic generic types, C, N, X, and P with the CREATE DATA statement. You can specify the length and number of decimal places (for type P) using additions. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA dref TYPE (t | (typeName)) &lt;/P&gt;&lt;P&gt;[ LENGTH len ] &lt;/P&gt;&lt;P&gt;[ DECIMALS dec ]. &lt;/P&gt;&lt;P&gt;You can only use the LENGTH addition for types C, N, X, and P and you must always include it after the TYPE keyword. A catchable runtime error occurs if you do not comply with syntax conventions when entering LENGTH or DECIMALS values. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if useful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Apr 2008 08:30:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-objects-at-runtime/m-p/3686803#M887811</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-18T08:30:16Z</dc:date>
    </item>
  </channel>
</rss>

