<?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>Question Re: Reuse routine for different transformation routines in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/reuse-routine-for-different-transformation-routines/qaa-p/9654162#M3449903</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent, thanks Matthew and everyone who answered. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Definitely, building a separate class and instantiating it in the transformation seems to me the most effective way. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Aug 2013 16:53:14 GMT</pubDate>
    <dc:creator>JC-Azcoitia</dc:creator>
    <dc:date>2013-08-20T16:53:14Z</dc:date>
    <item>
      <title>Reuse routine for different transformation routines</title>
      <link>https://community.sap.com/t5/technology-q-a/reuse-routine-for-different-transformation-routines/qaq-p/9654155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm adding some new fields to a cube and would like to use part of the code used by one transformation routine in another routine. So if the existing routine determines whether the employees is eligible for retire, my new routine will calculate something else based on the employee eligibility. Other than repeating the same code in this new routine, which is not very efficient should the criteria change, is there any other way to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I create a new method in LCL_TRANSFORM (for which I'd need to modify RS_ROUTINE) that would be called by different transformation routines or this is not possible because trans_routine is regenerated at some point? Before requesting a developer key to do this, I need to know if I can do that. What other options do I have?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks so much in advance!&lt;/P&gt;&lt;P&gt;Juan Carlos&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Aug 2013 17:55:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/reuse-routine-for-different-transformation-routines/qaq-p/9654155</guid>
      <dc:creator>JC-Azcoitia</dc:creator>
      <dc:date>2013-08-19T17:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Reuse routine for different transformation routines</title>
      <link>https://community.sap.com/t5/technology-q-a/reuse-routine-for-different-transformation-routines/qaa-p/9654156#M3449897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is always good to move code out of the routines into something more permanent. My routines usually have code something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #800000;"&gt;IF me-&amp;gt;r_routine IS NOT BOUND.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #800000;"&gt;&amp;nbsp; CREATE OBJECT me-&amp;gt;r_routine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #800000;"&gt;ENDIF:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #800000;"&gt;me-&amp;gt;routine-&amp;gt;do_stuff( ...&lt;EM&gt;parameters&lt;/EM&gt;...).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;r_routine&lt;/STRONG&gt; is declared above the routine, as an attribute of LCL_TRANSFORM.&lt;/P&gt;&lt;P&gt;e.g.&lt;SPAN style="font-family: 'courier new', courier;"&gt; DATA r_routine TYPE REF TO zcl_some_class.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could equally do this using static methods of classes, function modules, or forms in subroutine pools. The advantages are:&lt;/P&gt;&lt;P&gt;1. You get version management&lt;/P&gt;&lt;P&gt;2. You can change the code without needing to reactivate the object the routine is in&lt;/P&gt;&lt;P&gt;3. You can properly modularise complicated code&lt;/P&gt;&lt;P&gt;4. You can reuse code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your case, you'd instantiate the object in a start routine, and then call methods for the individual characteristics.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Aug 2013 06:03:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/reuse-routine-for-different-transformation-routines/qaa-p/9654156#M3449897</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2013-08-20T06:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: Reuse routine for different transformation routines</title>
      <link>https://community.sap.com/t5/technology-q-a/reuse-routine-for-different-transformation-routines/qaa-p/9654157#M3449898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mostly during such such kind of scenarios we go for the OOPs ABAP functionality, where you have a consolidated class containing the codes that need to be implemented in the routine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can dynamically call this class from the different transformations to avoid redundancy in coding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Prathish.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Aug 2013 06:05:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/reuse-routine-for-different-transformation-routines/qaa-p/9654157#M3449898</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-08-20T06:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: Reuse routine for different transformation routines</title>
      <link>https://community.sap.com/t5/technology-q-a/reuse-routine-for-different-transformation-routines/qaa-p/9654158#M3449899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Juan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please use class and methods which gives you option of reusing the routines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please refer document &lt;A _jive_internal="true" href="https://answers.sap.com/docs/DOC-12046"&gt;http://scn.sap.com/docs/DOC-12046&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Aug 2013 06:12:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/reuse-routine-for-different-transformation-routines/qaa-p/9654158#M3449899</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-08-20T06:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Reuse routine for different transformation routines</title>
      <link>https://community.sap.com/t5/technology-q-a/reuse-routine-for-different-transformation-routines/qaa-p/9654159#M3449900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In order to reuse codes you have to declare them in the include programs and later call them in the respective routines i.e. start , field etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also this would help in tracking the changes done later on as well if using include programs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Aug 2013 07:59:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/reuse-routine-for-different-transformation-routines/qaa-p/9654159#M3449900</guid>
      <dc:creator>KamalMehta</dc:creator>
      <dc:date>2013-08-20T07:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Reuse routine for different transformation routines</title>
      <link>https://community.sap.com/t5/technology-q-a/reuse-routine-for-different-transformation-routines/qaa-p/9654160#M3449901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I must point out that from a programming perspective, using includes for re-use is the &lt;EM&gt;least&lt;/EM&gt; desirable method. Use of includes does not provide encapsulation, and so can cause problems with scope. E.g. you have two includes included - what if both declare the same variable? It also obscures functionality. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use proper modulari&lt;SPAN style="font-size: 10pt;"&gt;sation techniques - classes, function modules or even performs - then you do not have this issue.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Aug 2013 08:28:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/reuse-routine-for-different-transformation-routines/qaa-p/9654160#M3449901</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2013-08-20T08:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Reuse routine for different transformation routines</title>
      <link>https://community.sap.com/t5/technology-q-a/reuse-routine-for-different-transformation-routines/qaa-p/9654161#M3449902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the best way of doing this is to create a function module with the code which you don't intend to repeat and then use the function module all the places wherever required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If both routines are in same transformation, then you can write the code in start routine, fill an internal table and then read that internal table in the field routine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sourav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Aug 2013 14:52:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/reuse-routine-for-different-transformation-routines/qaa-p/9654161#M3449902</guid>
      <dc:creator>snitwipro</dc:creator>
      <dc:date>2013-08-20T14:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: Reuse routine for different transformation routines</title>
      <link>https://community.sap.com/t5/technology-q-a/reuse-routine-for-different-transformation-routines/qaa-p/9654162#M3449903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent, thanks Matthew and everyone who answered. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Definitely, building a separate class and instantiating it in the transformation seems to me the most effective way. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Aug 2013 16:53:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/reuse-routine-for-different-transformation-routines/qaa-p/9654162#M3449903</guid>
      <dc:creator>JC-Azcoitia</dc:creator>
      <dc:date>2013-08-20T16:53:14Z</dc:date>
    </item>
  </channel>
</rss>

