<?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: Error while passing attribute from 1 class to another class in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-passing-attribute-from-1-class-to-another-class/m-p/784064#M39470</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hallo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in your example method:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method M1 .&lt;/P&gt;&lt;P&gt;DATA: A TYPE REF TO C2.&lt;/P&gt;&lt;P&gt;A1 = A-&amp;gt;A2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the creation of the instance A is missing. You have to add something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create object A.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Oliver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Jun 2004 12:23:34 GMT</pubDate>
    <dc:creator>olivergrande</dc:creator>
    <dc:date>2004-06-14T12:23:34Z</dc:date>
    <item>
      <title>Error while passing attribute from 1 class to another class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-passing-attribute-from-1-class-to-another-class/m-p/784063#M39469</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 am not much into ABAP. Appreciate if u could help me with this. I am trying to pass an attribute from one class to another class. I am getting an error when accesing a class attribute from a method of another class. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate if anyone can atleast direct me to some good documentation on ABAP OO classes and methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calling from&lt;/P&gt;&lt;P&gt;============&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Super Class -&lt;/P&gt;&lt;HR originaltext="--------" /&gt;&lt;P&gt;&amp;gt; SC1 = CL_RSR_WWW_HELP_WINDOW&lt;/P&gt;&lt;P&gt;CLASS -&lt;/P&gt;&lt;HR originaltext="--------------" /&gt;&lt;P&gt;&amp;gt; C1 (public) = Z_PRINT_HELP_SERVICE&lt;/P&gt;&lt;P&gt;METHOD----&lt;/P&gt;&lt;HR originaltext="----------" /&gt;&lt;P&gt;&amp;gt; M1 (Instance Method, Private) &lt;/P&gt;&lt;P&gt;Class Attribute------&amp;gt; A1 (Instance Attribute, Private type STRING)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Method M1 needs Attribute A1 value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calling to&lt;/P&gt;&lt;P&gt;==========&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Super Class -&lt;/P&gt;&lt;HR originaltext="--------" /&gt;&lt;P&gt;&amp;gt; SC2 = CL_RSR_WWW_MODIFY_TABLE&lt;/P&gt;&lt;P&gt;CLASS -&lt;/P&gt;&lt;HR originaltext="--------------" /&gt;&lt;P&gt;&amp;gt; C2 (public) = Z_CL_RSR_WWW_MODIFY_TABLE&lt;/P&gt;&lt;P&gt;Class Attribute------&amp;gt; A2 (Instance Attribute, Public type STRING)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A2 has a value which has to be passsed to A1 of method M1 in Class C1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is the code for method M1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method M1 .&lt;/P&gt;&lt;P&gt;DATA: A TYPE REF TO C2.&lt;/P&gt;&lt;P&gt;A1 = A-&amp;gt;A2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I'm accessing these classes from Web, I am not sure what the error is except that browser says "page can't be displayed" without the values that are passed from A2 into A1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there is no problem in the browser if i hard code the value in method 1 as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method M1 .&lt;/P&gt;&lt;P&gt;A1 = 'value'.&lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope it is clear.&lt;/P&gt;&lt;P&gt;thanks and appreciate any kinda help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Jun 2004 23:31:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-passing-attribute-from-1-class-to-another-class/m-p/784063#M39469</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2004-06-13T23:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Error while passing attribute from 1 class to another class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-passing-attribute-from-1-class-to-another-class/m-p/784064#M39470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hallo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in your example method:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method M1 .&lt;/P&gt;&lt;P&gt;DATA: A TYPE REF TO C2.&lt;/P&gt;&lt;P&gt;A1 = A-&amp;gt;A2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the creation of the instance A is missing. You have to add something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create object A.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Oliver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jun 2004 12:23:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-passing-attribute-from-1-class-to-another-class/m-p/784064#M39470</guid>
      <dc:creator>olivergrande</dc:creator>
      <dc:date>2004-06-14T12:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: Error while passing attribute from 1 class to another class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-passing-attribute-from-1-class-to-another-class/m-p/784065#M39471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;thanks so much for your help. in my earlier post, I just asked to see if passing attribute works. but, my actual requirement is this. I appreciate if you could help me with this. I tried in all possible ways but of no luck so far.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;am sure it might not be clear. but, I appreciate if you can be of any help to me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attribute A1 of class C1 needs a value that is passed from Method M2 of class C2.&lt;/P&gt;&lt;P&gt;Method M2 has 16 obligatory importing paramters and 4 changing parameters. one of the 4 "changing parameters of type STRING" is C_CELL_CONTENT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Method M2 of Class C2&lt;/P&gt;&lt;P&gt;16 Parameters typeIMPORTING&lt;/P&gt;&lt;P&gt;4 parameters type CHANGING&lt;/P&gt;&lt;P&gt;C_CELL_CONTENT type CHANGING associated type STRING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class C2 has a public instance attribute A2 of type string. &lt;/P&gt;&lt;P&gt;I am trying to store C_CELL_CONTENT into A2 in method M2 and trying to access attribute A2 from method M1 of class c1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not even sure if the path am going is right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From method M2, I need to pass C_CELL_CONTENT value to A1 if I_Y = 1. (where I_Y is 1 of 9 importing parameters of method M2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;M2 method is as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method M2 .&lt;/P&gt;&lt;P&gt;IF I_Y = 1.&lt;/P&gt;&lt;P&gt;A2 = C_CELL_CONTENT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;M1 method is as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method M1 .&lt;/P&gt;&lt;P&gt;DATA ClassA TYPE REF TO C2.&lt;/P&gt;&lt;P&gt;Create object ClassA.&lt;/P&gt;&lt;P&gt;A1 = ClassA-&amp;gt;A2.&lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By above methods, I am getting blank value into A1. If i give initial value for attribute A2, Initial value of A2 is getting passed onto A1 using the above method M1 but not getting the value of C_CELL_CONTENT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought method M2 is not being called.&lt;/P&gt;&lt;P&gt;I even called method M2 from M1 by passing blank parameters to all obligatory parameters and value 1 to I_Y as follows. As C_CELL_CONTENT is obligatory changing parameter, I had to pass some value and this value (thr' C_CELL_CONTENT_1 string in Method M1) is overwriting the value that i am looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Method M1&lt;/P&gt;&lt;P&gt;Data ClassA type ref to C2.&lt;/P&gt;&lt;P&gt;create object A.&lt;/P&gt;&lt;P&gt;CALL METHOD A-&amp;gt;CHARACTERISTIC_CELL&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;I_X = '' I_Y = '1' I_IOBJNM = ' ' I_AXIS = ' ' I_CHAVL_EXT = ' '&lt;/P&gt;&lt;P&gt;I_CHAVL = ' ' I_NODE_IOBJNM = ' ' I_TEXT = ' ' I_HRY_ACTIVE = ' '&lt;/P&gt;&lt;P&gt;I_DRILLSTATE = ' ' I_DISPLAY_LEVEL = '1' I_USE_TEXT = ' ' I_IS_SUM = ''&lt;/P&gt;&lt;P&gt;I_IS_REPETITION = ' ' I_CELLSPAN = ' ' I_CELLSPAN_ORT = ' ' &lt;/P&gt;&lt;P&gt;changing&lt;/P&gt;&lt;P&gt;C_CELL_ID = C_CELL_ID_1&lt;/P&gt;&lt;P&gt;C_CELL_CONTENT = C_CELL_CONTENT_1&lt;/P&gt;&lt;P&gt;C_CELL_STYLE = C_CELL_STYLE_1&lt;/P&gt;&lt;P&gt;C_CELL_TD_EXTEND = C_CELL_TD_EXTEND_1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A1 = ClassA-&amp;gt;A2.&lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I am not successful in calling method M2 from M1. Can we somehow call method M2 without passing any parameters from method M1?&lt;/P&gt;&lt;P&gt;I thought of doing it in reverse. calling method M1 from M2. Still, value of A2 is not passed to A1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;M2 method is as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method M2.&lt;/P&gt;&lt;P&gt;DATA ClassB type ref to C1.&lt;/P&gt;&lt;P&gt;create object ClassB.&lt;/P&gt;&lt;P&gt;A2 = C_CELL_CONTENT.&lt;/P&gt;&lt;P&gt;ClassB-&amp;gt;A1 = A2.&lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I even tried to work around this problems using events. I am not sure if we can deal with events for this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I raised an event E1 in method M2 to send C_CELL_CONTENT thr' export parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method M2 contains the following code where title is instance public event and send_title is a parameter of type STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RAISE EVENT title&lt;/P&gt;&lt;P&gt;exporting send_title = C_CELL_CONTENT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I need to handle (trigger) this event from M1 to get C_CELL_CONTENT into A1.&lt;/P&gt;&lt;P&gt;i used following code in method M1 and i get error "the statement for is not expected. A correct similar statement is FORM".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code in method M1 is as follows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for event title of C2 importing send_title.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;hari&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jun 2004 21:00:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-passing-attribute-from-1-class-to-another-class/m-p/784065#M39471</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2004-06-15T21:00:03Z</dc:date>
    </item>
  </channel>
</rss>

