Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CLASS where-used Function Module or Method?

Former Member
0 Likes
642

I found function module RS_TYPE_IN_PROGRAMS that outputs a where-list for classes, but it only lists the programs as indicated by the name.

The following code would list all the classes too, but it will require additional processing to convert the INCLUDE fields to actual object names:

SELECT INCLUDE INTO LT_INCLUDES

WHERE "OTYPE" = 'TY'

AND "NAME" = 'ZCL_GENERIC_READ'

Does anyone know of a function module or method that returns a list of proper class names for a where-used on CLASS?

Thank you and best regards,

Adrian

1 REPLY 1
Read only

Former Member
0 Likes
402

I can't seem to find any code that already does this, so I came up with the following

...

  • check first 30 chars == clsname. remove filler '=' chars

ld_clsname = p_obj_name(30).

replace all occurrences of '=' in ld_clsname with ''.

  • now read gt_seoclass to see if it is a class

read table gt_seoclass into ls_seoclass

with key clsname = ld_clsname.

if sy-subrc eq 0.

move ld_clsname to p_obj_name_n.

move 'CLAS' to p_obj_type.

exit.

endif.

...

call method cl_oo_classname_service=>get_all_method_includes

exporting

clsname = clsname

receiving

result = lt_result

exceptions

class_not_existing = 1

others = 2.

if sy-subrc eq 0.

read table lt_result into ls_result

with key incname = ls_include-include.

endif.

*

...