Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8720

Re: Reuse routine for different transformation routines

$
0
0

It is always good to move code out of the routines into something more permanent. My routines usually have code something like this:

 

IF me->r_routine IS NOT BOUND.

  CREATE OBJECT me->r_routine.

ENDIF:

 

me->routine->do_stuff( ...parameters...).

 

r_routine is declared above the routine, as an attribute of LCL_TRANSFORM.

e.g. DATA r_routine TYPE REF TO zcl_some_class.

 

You could equally do this using static methods of classes, function modules, or forms in subroutine pools. The advantages are:

1. You get version management

2. You can change the code without needing to reactivate the object the routine is in

3. You can properly modularise complicated code

4. You can reuse code


Viewing all articles
Browse latest Browse all 8720

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>