<?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 class/variable from ABAP Callstack in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-class-variable-from-abap-callstack/m-p/543403#M20304</link>
    <description>&lt;P&gt;From SYSTEM_CALLSTACK, you get the program name (even for class) &lt;/P&gt;
  &lt;P&gt;But for class it's often easier to get a reference to the instance in another level of the stack and then access public attributes of this instance.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Oct 2017 05:53:02 GMT</pubDate>
    <dc:creator>RaymondGiuseppi</dc:creator>
    <dc:date>2017-10-16T05:53:02Z</dc:date>
    <item>
      <title>Get class/variable from ABAP Callstack</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-class-variable-from-abap-callstack/m-p/543401#M20302</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;anybody know answer for below question?&lt;/P&gt;
  &lt;P&gt;&lt;A href="https://archive.sap.com/discussions/thread/1365791" target="test_blank"&gt;https://archive.sap.com/discussions/thread/1365791&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Oct 2017 01:08:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-class-variable-from-abap-callstack/m-p/543401#M20302</guid>
      <dc:creator>former_member477051</dc:creator>
      <dc:date>2017-10-14T01:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: Get class/variable from ABAP Callstack</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-class-variable-from-abap-callstack/m-p/543402#M20303</link>
      <description>&lt;P&gt;You might be looking for the function module &lt;A href="https://archive.sap.com/discussions/thread/813014"&gt;SYSTEM_CALLSTACK&lt;/A&gt;.&lt;/P&gt;
  &lt;P&gt;JNN&lt;/P&gt;</description>
      <pubDate>Sun, 15 Oct 2017 09:11:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-class-variable-from-abap-callstack/m-p/543402#M20303</guid>
      <dc:creator>nomssi</dc:creator>
      <dc:date>2017-10-15T09:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Get class/variable from ABAP Callstack</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-class-variable-from-abap-callstack/m-p/543403#M20304</link>
      <description>&lt;P&gt;From SYSTEM_CALLSTACK, you get the program name (even for class) &lt;/P&gt;
  &lt;P&gt;But for class it's often easier to get a reference to the instance in another level of the stack and then access public attributes of this instance.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 05:53:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-class-variable-from-abap-callstack/m-p/543403#M20304</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2017-10-16T05:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: Get class/variable from ABAP Callstack</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-class-variable-from-abap-callstack/m-p/543404#M20305</link>
      <description>&lt;P&gt;If it's a &lt;STRONG&gt;local variable&lt;/STRONG&gt;, then you should add some custom code to the standard program or class, if possible, via the enhancement framework.&lt;/P&gt;
  &lt;P&gt;Here is the shortest example if the program is a class pool.&lt;/P&gt;
  &lt;P&gt;1. declare a public data reference :&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;CLASS-DATA ref_to_localvariable TYPE REF TO &amp;lt;the type of localvariable&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Note that you may also need to make public the type of localvariable :&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;TYPES zztype_localvariable TYPE &amp;lt;type of localvariable&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;2. add an implicit enhancement at the beginning of the method:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;ASSIGN ('localvariable') TO &amp;lt;fs_to_localvariable&amp;gt;.
IF sy-subrc = 0.
  GET REFERENCE OF &amp;lt;fs_to_localvariable&amp;gt; INTO ref_to_localvariable.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;3. Access the local variable from outside:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;FIELD-SYMBOLS &amp;lt;fs_ref_to_localvariable&amp;gt; TYPE classpool=&amp;gt;ref_to_localvariable.
FIELD-SYMBOLS &amp;lt;fs_localvariable&amp;gt; TYPE classpool=&amp;gt;zztype_localvariable.
ASSIGN ('(classpool===CP)ref_to_localvariable') TO &amp;lt;fs_ref_to_localvariable&amp;gt;.
IF sy-subrc = 0 AND &amp;lt;fs_ref_to_localvariable&amp;gt; IS BOUND.
  ASSIGN &amp;lt;fs_ref_to_localvariable&amp;gt;-&amp;gt;* TO &amp;lt;fs_localvariable&amp;gt;.
  " now work with the local variable by using &amp;lt;fs_localvariable&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Oct 2017 07:48:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-class-variable-from-abap-callstack/m-p/543404#M20305</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2017-10-16T07:48:12Z</dc:date>
    </item>
  </channel>
</rss>

