<?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: Get type of variable dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-type-of-variable-dynamically/m-p/1659070#M292282</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if it really is a simple case of creating variables like others then you can do this:&lt;/P&gt;&lt;P&gt;DATA my_dref TYPE REF TO data.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS &amp;lt;struc&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;CREATE DATA my_dref type zmystruct.&lt;/P&gt;&lt;P&gt;ASSIGN my_dref-&amp;gt;* TO &amp;lt;struct&amp;gt;.&lt;/P&gt;&lt;P&gt;*Field symbol &amp;lt;struct&amp;gt; is now an instance of zmystruct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;CREATE DATA my_dref like my_var.&lt;/P&gt;&lt;P&gt;ASSIGN my_dref-&amp;gt;* TO &amp;lt;struct&amp;gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Nov 2006 23:49:32 GMT</pubDate>
    <dc:creator>former_member186741</dc:creator>
    <dc:date>2006-11-22T23:49:32Z</dc:date>
    <item>
      <title>Get type of variable dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-type-of-variable-dynamically/m-p/1659065#M292277</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;i want to get the type of a variable. For example, the following code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: my_var type zmystruct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ABAP, i want to get type 'zmystruct' and after to create dynamically a new variable of this type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Nov 2006 18:09:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-type-of-variable-dynamically/m-p/1659065#M292277</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-22T18:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: Get type of variable dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-type-of-variable-dynamically/m-p/1659066#M292278</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;PRE&gt;&lt;CODE&gt;
**** Get type object from a data object


DATA:   DATATYPE TYPE REF TO CL_ABAP_DATADESCR,
        FIELD(5) TYPE C.

DATATYPE ?= CL_ABAP_TYPEDESCR=&amp;gt;DESCRIBE_BY_DATA( FIELD ).

* For stucture

DATA: LINETYPE  TYPE REF TO CL_ABAP_STRUCTDESCR,
      MYSTRUC TYPE SPFLI.

* Get Structure of Some Database Table for example

LINETYPE ?=   CL_ABAP_TYPEDESCR=&amp;gt;DESCRIBE_BY_DATA( MYSTRUC ).

Write: DATATYPE-&amp;gt;TYPE_KIND,
       LINETYPE-&amp;gt;TYPE_KIND,
       LINETYPE-&amp;gt;ABSOLUTE_NAME.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Raja T&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Raja T&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Nov 2006 18:18:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-type-of-variable-dynamically/m-p/1659066#M292278</guid>
      <dc:creator>raja_thangamani</dc:creator>
      <dc:date>2006-11-22T18:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Get type of variable dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-type-of-variable-dynamically/m-p/1659067#M292279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;see also keyword DESCRIBE FIELD&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Nov 2006 18:22:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-type-of-variable-dynamically/m-p/1659067#M292279</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-22T18:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: Get type of variable dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-type-of-variable-dynamically/m-p/1659068#M292280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;You use the following syntax to define reference types:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;TYPES dtype {TYPE REF TO type}|{LIKE REF TO dobj}.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The syntax for a direct declaration of a reference variable is as follows:&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&lt;/P&gt;&lt;P&gt;DATA ref {TYPE REF TO type}|{LIKE REF TO dobj}.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The addition REF TO defines a data type dtype for a reference variable and declares the reference variable ref. The specification after REF TO specifies the static type of the reference variable. The static type constricts the object set to which a reference variable can point. The dynamic type of a reference variable is the data type and the class of the object respectively, to which it currently points. The static type is always more universal or equal to the dynamic type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the TYPE addition to define data types for data and object reference variables. The LIKE addition exclusively defines data types for data reference variables. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The syntax and meaning of the additions TYPE and LIKE are completely equal for both statements with the exception that TYPES creates an independent reference type, whereas DATA creates a bound reference type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Nov 2006 18:23:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-type-of-variable-dynamically/m-p/1659068#M292280</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-22T18:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: Get type of variable dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-type-of-variable-dynamically/m-p/1659069#M292281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There's a very good tutorial on creating dynamic objects here.  It will take a few minutes to get through it, but it is worth the read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae" target="test_blank"&gt;https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Nov 2006 18:46:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-type-of-variable-dynamically/m-p/1659069#M292281</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-22T18:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: Get type of variable dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-type-of-variable-dynamically/m-p/1659070#M292282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if it really is a simple case of creating variables like others then you can do this:&lt;/P&gt;&lt;P&gt;DATA my_dref TYPE REF TO data.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS &amp;lt;struc&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;CREATE DATA my_dref type zmystruct.&lt;/P&gt;&lt;P&gt;ASSIGN my_dref-&amp;gt;* TO &amp;lt;struct&amp;gt;.&lt;/P&gt;&lt;P&gt;*Field symbol &amp;lt;struct&amp;gt; is now an instance of zmystruct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;CREATE DATA my_dref like my_var.&lt;/P&gt;&lt;P&gt;ASSIGN my_dref-&amp;gt;* TO &amp;lt;struct&amp;gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Nov 2006 23:49:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-type-of-variable-dynamically/m-p/1659070#M292282</guid>
      <dc:creator>former_member186741</dc:creator>
      <dc:date>2006-11-22T23:49:32Z</dc:date>
    </item>
  </channel>
</rss>

