Phil,
I believe what you are describing is the expected behavior when working with well-designed ABAP OO code:
- Performing a where-used on a method implementation should really not return a results list unless the method is used within the implementing class.
- Performing a where-used on the interface's method definition should return all results.
The reason I say this is the expected behavior for well-designed code is that there should be no direct references to method implementations outside of the implementing classes themselves or else one of the primary purposes of using an interface is violated. Here's an example of what I mean:
Say you have an interface for documents called IF_DOC:
* Basic interface for a document
INTERFACE if_doc.
METHODS:
get_output
RETURNING VALUE(r_result)TYPE nast.
ENDINTERFACE.
You then have two separate implementations to that document interface, one for sales orders and one for deliveries:
* Sales Order Class to implement the document interface
CLASS cl_sales_order DEFINITION.
INTERFACES if_doc.
ENDCLASS.
CLASS cl_sales_order IMPLEMENTATION.
METHOD if_doc~get_output.
* Some code here to get sales order outputs
ENDMETHOD.
ENDCLASS.
* Delivery Class to implement the document interface
CLASS cl_delivery DEFINITION.
INTERFACES if_doc.
ENDCLASS.
CLASS cl_delivery IMPLEMENTATION.
METHOD if_doc~get_output.
* Some code here to get delivery outputs
ENDMETHOD.
ENDCLASS.
At this point, if you carried out a where-used on the interface method, you should see two hits: one for the sales order implementation and one for the delivery implementation. The implementations have not actually been used yet though so you'd expect the list to return no results.
Finally, a third class is created to work with the document interface called CL_DOC_PROCESSOR:
* Additional class used to process documents
CLASS cl_doc_processor DEFINITION.
* Static method accepts a reference to doc interface
CLASS-METHODS:
issue_output
IMPORTING im_document TYPEREFTO if_doc.
ENDCLASS.
CLASS cl_doc_processor IMPLEMENTATION.
METHOD issue_output.
* Calling method only ever references interface, never concrete classes.
DATA(ls_output) = im_document->get_output().
print_output( ls_output ).
ENDMETHOD.
ENDCLASS.
At this point, carrying out a where-used on the interface method would now yield three hits: the two mentioned above and a third for the usage of the method in the document processor. Notice however that there are still no direct references to the implementations so carrying out a where-used on them would still yield no results. Also note: if results were returned for carrying out a where-used on those method implementations, they would be misleading as there is no guarantee that those implementations are actually being used.
One last example I'd like to add is a case in which you should get results for carrying out a where-used on a method implementation. Say that document processor class had another method called ISSUE_DELIVERY_OUTPUT:
METHOD issue_delivery_output.
DATA(lo_delivery) = NEW cl_delivery.
DATA(ls_output) = lo_delivery->if_doc~get_output().
print_output( ls_output ).
ENDMETHOD.
In this case, there is a direct reference to the implementing class so if you carried out a where-used against it you would find a match. Ideally these types of direct references to implementing classes should be avoided when using interfaces as the calling program should not need to worry about specific implementations.
Sorry for being a bit long winded, hopefully that's what you are looking for.
Thanks,
Brian
Message was edited by: Brian McDonnell