<?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 how to use variable value as variable name in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-variable-value-as-variable-name/m-p/8022215#M1608902</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;I would like to know if is it possible to do something like follow: say I have a variable A with a value:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA A TYPE string VALUE 'VAR_X'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I need is to make a test on another variable of the program that is &lt;STRONG&gt;VAR_X&lt;/STRONG&gt;. So the question is, how can I 'understand' value of &lt;STRONG&gt;A&lt;/STRONG&gt; and use it as a variable name?&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;P&gt;Gabriele&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Aug 2011 12:33:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-08-01T12:33:13Z</dc:date>
    <item>
      <title>how to use variable value as variable name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-variable-value-as-variable-name/m-p/8022215#M1608902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;I would like to know if is it possible to do something like follow: say I have a variable A with a value:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA A TYPE string VALUE 'VAR_X'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I need is to make a test on another variable of the program that is &lt;STRONG&gt;VAR_X&lt;/STRONG&gt;. So the question is, how can I 'understand' value of &lt;STRONG&gt;A&lt;/STRONG&gt; and use it as a variable name?&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;P&gt;Gabriele&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Aug 2011 12:33:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-variable-value-as-variable-name/m-p/8022215#M1608902</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-01T12:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to use variable value as variable name</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-variable-value-as-variable-name/m-p/8022216#M1608903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know the functinality of field-symbols to make something similar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: l_string TYPE string.

  FIELD-SYMBOLS: &amp;lt;any&amp;gt; TYPE ANY.

  l_string = 'fieldname'.
  CONCATENATE 'strucname-' l_string INTO l_string.
  ASSIGN (l_string) TO &amp;lt;any&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;any&amp;gt; contains now the value of strucname-fieldname. Maybe this is useful for you.&lt;/P&gt;&lt;P&gt;I do not know if this is just possible for structure or if it also works with simple variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT: It works:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: l_string TYPE string.
 
data: l_field type string value 'AAA'.
 FIELD-SYMBOLS: &amp;lt;any&amp;gt; type any.
 
l_string = 'l_field'.
ASSIGN (l_string) TO &amp;lt;any&amp;gt;.

write: &amp;lt;any&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output is 'AAA'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Maximilian Tews on Aug 1, 2011 3:25 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Aug 2011 13:23:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-variable-value-as-variable-name/m-p/8022216#M1608903</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-01T13:23:39Z</dc:date>
    </item>
  </channel>
</rss>

