Class Editor – Refactoring Assistant – II

By | September 21, 2011 | ABAP Objects, OO Editor tools | 3,925 | 0

Continuing exploring the Refactoring assistant, we’ll see how we can use the class association in the refactoring assistant.

Find all the posts of Mastering the Class Editor:

Moving components from Class to Associated Class
Refactoring assistant also helps up when we don’t have the class hierarchy but the class association. Association is a reference of an object to another object. Association can be achieved by declaring an attribute using TYPE REF TO object. We’ll use calss ZCL_MAIN as the main class which we have used to declare everything. We should have designed different classes each for Data selection as ZCL_DATA and output as ZCL_ALV to better use Design Pattern MVC.

  1. Create association classes ZCL_DATA and ZCL_ALV

  2. Declare attributes with refrence to ZCL_DATA and ZCL_ALV in the main class ZCL_MAIN. Save and Activate
  3. Open the Class ZCL_MAIN Go to Utilities > Refactoring Assitant. Expand the tree.

  4. Drag and drop the method get_Data from ZCL_MAIN to ZCL_DATA.

Associated classes will look like this after refactoring:

Like It? Share!!

Don't miss an Update

Get notified of the new post, right into your inbox

Naimesh Patel{273 articles}

I'm SAP ABAP Consultant for more than a decade. I like to experiment with ABAP especially OO. I have been SDN Top Contributor.
Follow :

Explore all of his 273 articles.

Load comments

Comments on this Post are now closed. If you have something important to share, you can always contact me.

You seem to be new here. Subscribe to stay connected.