Hello all,
As the title suggests, i'm trying to develop a program that gets a package name as an input and does a where-used search for every object in that package. Afterwards i want it to display the objects that are not used anywhere. Here is my approach:
Unfortunately this always results in an empty table as output, is my logic incorrect? METHOD get_unused_objects.
DATA: found_check TYPE STANDARD TABLE OF rsfindlst, itab TYPE TABLE OF string. SELECT * FROM tadir INTO TABLE @DATA(package_tab) WHERE devclass = @i_packagename. "To get the objects from the exact package i need LOOP AT package_tab ASSIGNING FIELD-SYMBOL(<fs>). "To convert it to strings, otherwise it doesn't " work with the FM APPEND <fs>-obj_name TO itab. ENDLOOP. LOOP AT package_tab ASSIGNING FIELD-SYMBOL(<object>). CALL FUNCTION 'RS_EU_CROSSREF' EXPORTING i_find_obj_cls = 'CLAS' no_dialog = 'X' TABLES o_founds = found_check i_findstrings = itab EXCEPTIONS batch = 1 batchjob_error = 2 illegal_object = 3 not_executed = 4 not_found = 5 no_cross_for_this_object = 6 object_not_exist = 7 wrong_type = 8 OTHERS = 9. CASE sy-subrc. WHEN 1. cl_demo_output=>display( 'Some exception' ). WHEN 2. "Another exception and so on. ENDCASE. IF found_check IS INITIAL. "If the FM finds no usage for the object APPEND <object> TO unused_objects_tab. "Append it to a table i'll return later ELSE. CLEAR found_check. "If the FM finds usage, clear the check and continue. CONTINUE. ENDIF. ENDLOOP. r_objects_tab = unused_objects_tab. ENDMETHOD.