In SAP world there is usually more than one way to do something. This is true in functional processes where several transactions can perform the same action. It is also true in the development area where one can find in the SAP database several functions that perform the same (or almost the same) action.
When "shopping" for a function I usually check the number of times the function is used in the standard code. Since this information is available in a table it is easy to build a list the top used functions (in the picture a word map of the top used APO functions without the /SAPAPO/ prefix for easier readability).
Bellow is a minimal report to query the functions and get the usage counter. I think such report is quite useful for day to day work. Consider the following sample case where I want to find a function to display a pop-up message. Using this report I do a query by *POPUP*.
It will display __ entries sorted by the number of times that function is used. As there are many possible functions it is nice to know the ones that are more often used, since those are more likely to work better.
The report code:
report z_top_used_functions.
tables cross.
data:
gt_objs type table of ztopusedfunctions.
selection-screen begin of block 0 with frame title text-002.
select-options:
s_name for cross-name.
selection-screen end of block 0.
selection-screen begin of block 1 with frame title text-001.
parameters:
p_type like cross-type default 'F',
p_max type tbmaxsel default 200.
selection-screen end of block 1.
start-of-selection.
clear gt_objs.
refresh gt_objs.
select name count(*) as counter
from cross
up to p_max rows
into table gt_objs
where type = p_type
and name in s_name
group by name
order by counter descending.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_structure_name = 'ZTOPUSEDFUNCTIONS'
tables
t_outtab = gt_objs.
The ztopusedfunctions structure is defined as follows.
Happy coding.
Labels: abap, sap