<?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 SAP Function Module to Object Method in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-function-module-to-object-method/m-p/6974980#M1491820</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Howdy folks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a requirement to convert a custom Function Module into an ABAP Object Method.  The requirement for this is that the required output is to be in table form, the structure of which will be determined dynamically using RTTC funtionality.  Passing the dynamic table back to an output parameter is a lot easier to manage with an Object Method than with a Function Module (or so it seems!).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The downside is that many of the perform routines which are defined in Include programs attached to the Function group now need to be built/copied as new methods within my custom object class because the Include programs are not recognised within the methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many key defintions, particularly variables, internal tables and Type-Pool declarations that are used in a variety of subroutines accross the different include programs are stored in a xxxTOP include.  Is there any way of defining type-pools and associated declarations at a global level in the Object Class via SE24, or copying them in en-masse, or do they have to be defined individually? And how do you declare an internal table or type pool in SE24 - via the Attributes tab, Types Tab, or via some other place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any assistance would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stephen Keam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Jun 2010 06:44:39 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-06-24T06:44:39Z</dc:date>
    <item>
      <title>SAP Function Module to Object Method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-function-module-to-object-method/m-p/6974980#M1491820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Howdy folks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a requirement to convert a custom Function Module into an ABAP Object Method.  The requirement for this is that the required output is to be in table form, the structure of which will be determined dynamically using RTTC funtionality.  Passing the dynamic table back to an output parameter is a lot easier to manage with an Object Method than with a Function Module (or so it seems!).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The downside is that many of the perform routines which are defined in Include programs attached to the Function group now need to be built/copied as new methods within my custom object class because the Include programs are not recognised within the methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many key defintions, particularly variables, internal tables and Type-Pool declarations that are used in a variety of subroutines accross the different include programs are stored in a xxxTOP include.  Is there any way of defining type-pools and associated declarations at a global level in the Object Class via SE24, or copying them in en-masse, or do they have to be defined individually? And how do you declare an internal table or type pool in SE24 - via the Attributes tab, Types Tab, or via some other place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any assistance would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stephen Keam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jun 2010 06:44:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-function-module-to-object-method/m-p/6974980#M1491820</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-24T06:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Function Module to Object Method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-function-module-to-object-method/m-p/6974981#M1491821</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;First of all I am afraid that there is no tool to get all the type/type-pools declarations from a program/function group into a class definition (at least to my knowledge, I would like to see me corrected). So you have to do that manually, which should be in principle easy if you edit the public, protected and private sections directly - not via the types/attributes tabs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But to me your task sounds more like a re-engineering task, so, I would rather do an object oriented redesign than just copy the old code. Maybe you will create more than one class to cover the requirements formerly met by a number of form routines in that function group. Unfortunately budget restrictions might force you to follow a 'copy' strategy, but in the long run thinking a bit bigger might pay off.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Gerd Rother&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jun 2010 08:35:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-function-module-to-object-method/m-p/6974981#M1491821</guid>
      <dc:creator>gerd_rother</dc:creator>
      <dc:date>2010-06-24T08:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Function Module to Object Method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-function-module-to-object-method/m-p/6974982#M1491822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The requirement for this is that the required output is to be in table form, the structure of which will be determined dynamically using RTTC funtionality. Passing the dynamic table back to an output parameter is a lot easier to manage with an Object Method than with a Function Module (or so it seems!).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am curious why you think so. In both cases you can use parameter typed &lt;STRONG&gt;ANY TABLE&lt;/STRONG&gt; which you can use to pass generic (or dynamic) tables. Maybe you mean using &lt;EM&gt;functional method&lt;/EM&gt; but here this is just a matter of different calling structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also in none of the above you can statically determine line type of dynamic table, so you have to type is generically anyway. So the way you handle your dynamic table stays the same both for function and method. You have to address its components dynamically. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for the passing one more thing to be noticed. You can pass the reference to a table (type this parameter with &lt;STRONG&gt;type ref to data&lt;/STRONG&gt; ), dereference it inside FM/method and work internally with the table behind this reference. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I don't think there is a need for re-engineering all you procedural code to OO, unless the reason is more serious. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jun 2010 09:10:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-function-module-to-object-method/m-p/6974982#M1491822</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-06-24T09:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Function Module to Object Method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-function-module-to-object-method/m-p/6974983#M1491823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Marcin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your reply.  The reason behind my assertion that Objects are better suited to Dynamic passback than Function Modules was largely based around the fact that, when I defined the table parameter as 'any table', the Function module would not compile on activation with this definition. The closest I could come was to define the output tables as a table of type string, but then I lost the table structure and it became a string record again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My issue is largely around how to declare variable and structure data objects globally for all methods in the class given that I cannot use the 'TOP' include functionality as I can for a function module/function group.&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;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jun 2010 23:46:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-function-module-to-object-method/m-p/6974983#M1491823</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-24T23:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Function Module to Object Method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-function-module-to-object-method/m-p/6974984#M1491824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're welcome. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when I defined the table parameter as 'any table', the Function module would not compile on activation with this definition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This is true when you use &lt;STRONG&gt;TABLES&lt;/STRONG&gt; parameter tab. The system then does not allow to type the parameter fully generically. You can use anyhow STANDARD TABLE type. &lt;/P&gt;&lt;P&gt;But for ANY TABLE you can use one of other parameter type, namely EXPORTING/CHANGING, so this issue will no longer be a valid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My issue is largely around how to declare variable and structure data objects globally for all methods in the class given that I cannot use the 'TOP' include functionality as I can for a function module/function group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;For all the classes which have to use same data (as global data) you can use INTERFACE for this. You define all data objects there and include this INTEFACE in all the classes you need. This way you don't violate the encapsulation still being able to have kind of "global data" not specific to any of the classes, while all of them can work with these data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jun 2010 07:17:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-function-module-to-object-method/m-p/6974984#M1491824</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-06-25T07:17:17Z</dc:date>
    </item>
  </channel>
</rss>

