Scroll Top

World Class Utility Makes getting a WHERE-USED on a RFC Push Button Easy – Part 2

In this installment of our IT Partners blog, I will be inviting a good friend of mine Henry Stewart to teach us about using a tool he developed to analyze and perform a WHERE-USED on a RFC in a remote SAP System. Typically, you use the delivered WHERE-USED functionality of the Repository Information System (SE84) inside an SAP instance to discover where the subject object is called or referenced.

But what if the objects calling reference is not in the system that has the RFC? You could log on to every SAP system and do a search, or we can learn from Henry and use his tool. 

Here is a brief intro to Henry…..

Henry Stewart

Henry Stewart has been consulting in the SAP technologies for 8+ years, providing his clients with expert experience in many SAP Modules including SRM, Document Builder, Records Management, FI/CO, SD, MM, PP, RE-FX,HR. Henry has extensive knowledge for implementing SRM in the public sector area customizing and developing unique solutions to meet the needs of his clients. During his free time Henry enjoys spending time with his twin boys, learning new trends in technologies, listening to Audiobooks and watching his alma-mater LSU football. Henry also severed in Louisiana Air National Guard. You can reach him at [email protected]

The ALV Usage to Display Found RFC Locations

Lets pick up in part 2 with a closer look into the ALV Grid and it’s usage from part 1. ALV Programming is an area of ABAP development that allows for presenting the ABAP report in the tabular format with integrated functions as sorting, output in different formats, etc…

There are many good sites for ALV development, on SCN, SAP Help and elsewhere:


ALV stands either for ABAP List Viewer or for SAP List Viewer, and is available in ABAP and Java. In this article we are not presenting ALV development just it’s aspects as it relates to this article. So let’s pick up after we selected the RFC locations.

The result of our SAP Where Used List selection of RFC references and identification of their location in the code is collected in the internal table gt_display:

RFC Locations


We would like to present this result to the user in the neat format with a minimum programming.  For this reaso, using ALV is a good choice:

RFC ALV Display

We also would like provide the user the capability to drill down – if they double click on the row in the ALV Grid, this  should open the specific include in the ABAP editor and point the user to the location of the call.

We use the SAP standard SALV Classes to set-up ALV table:

DATA go_salv_table            TYPE REF TO cl_salv_table.
DATA go_salv_events_table     TYPE REF TO cl_salv_events_table.
DATA go_salv_functions_list   TYPE REF TO cl_salv_functions_list.
DATA go_salv_display_settings TYPE REF TO cl_salv_display_settings.
DATA go_salv_columns_table    TYPE REF TO cl_salv_columns_table.
DATA go_salv_column           TYPE REF TO cl_salv_column.

The local class is used to detect and react to the double-click event:

DATA go_salv_event_handler    TYPE REF TO lcl_salv_event_handler.


The standard SAP class CL_SALV_TABLE is used to prepare the table of locations for display and present it to the user for interaction.

The Process starts from:

        EXPORTING list_display = abap_false           
        IMPORTING r_salv_table = go_salv_table           
        CHANGING  t_table      = gt_display ).

And ends with the call:

  go_salv_table->display( ).

All ALV set-up goes between this two calls. Example of this set-up could be the code below:

* Set Column names   
go_salv_columns_table = go_salv_table->get_columns( ).
* Get the column in the ALV  
go_salv_column = go_salv_columns_table->get_column( 'RFC_FM' ).
* Change the column header name from the default values   
go_salv_column->set_long_text( 'External FM' ).

If the user double-clicks on a row in the GRID as shown below

RFC Double-Click

He or she will be taken to the ABAP Editor of the FM B40B_PO_GETDETAIL which is contained in include LBBP_BD_DRIVER_40BU20 to the line 105:

RFC Display CALL

Display Found RFC Location in the Code on Double Click

We use the object go_salv_event_handler to intercept ALV events (e.g. double click) and react to them.

* Handle ALV Grid events.   
  CREATE OBJECT go_salv_event_handler.   
  go_salv_events_table = go_salv_table->get_event( ).
  SET HANDLER go_salv_event_handler->on_double_click FOR go_salv_events_table.

The local class lcl_salv_event_handler has method on_double_click. It is defined as:

METHODS on_double_click                    
         FOR EVENT double_click OF cl_salv_events_table
         IMPORTING row

In other words we provide a connection between the objects:

RFC Object Connections

The Implementation of the method on_double_click has actually one call to FM RS_TOOL_ACCESS. This call passes to this FM name of the include and the position within include.

   METHOD on_double_click.     
       FIELD-SYMBOLS <ls_display>  TYPE gts_display.     
       TA lv_value             TYPE trobj_name.
*   Read the row     
   READ TABLE gt_display ASSIGNING <ls_display> INDEX row.     
   IF sy-subrc EQ 0.       
      IF <ls_display>-include EQ gc_not_found OR          
         <ls_display>-include EQ gc_rfc_error OR          
         <ls_display>-include IS INITIAL.         
            MESSAGE i001(00) WITH 'Error finding location'.       
            CALL FUNCTION 'RS_TOOL_ACCESS'           
                EXPORTING operation = 'SHOW'             
                object_name         = <ls_display>-include             
                object_type         = 'PROG'             
                position            = <ls_display>-line_num           
                not_executed        = 1             
                invalid_object_type = 2             
                OTHERS              = 3.         
            IF sy-subrc NE 0.           
                MESSAGE i001(00) WITH 'Error navigating to code'.         

That’s all. The rest is done by SAP.

helpful hintsJust one more note – the row index (and also column index) is passed to the on_double_click method by the ALV framework.

During the development Henry noticed one peculiarity of how the Function Module  “RS_TOOL_ACCESS” points to a specific line in the source code. Any Enhancements placed in the code before the line specified by the parameter POSITION are ignored and the code can be positioned slightly different from the detected position of the RFC.  The Enhancements in the code after the RFC do not have such effect.

Program Design – usage of Local Classes

The program z_find_where_rfc_is_called is desaigned as an SAP Report – Executable program.

Major parts of the program were already discussed:

– Selection Screen

– Data retrieval. (RFC locations and lines in the code).

– Data presentation as ALV table.

– Location display on the double click on the row in the ALV table of found locations.

The easiest way to see the program structure is to click on the ABAP Hierarchy Button button Display object list.

ABAP Display Objects

This program uses two different types of processing blocks – Subroutines (or Forms) and Classes.

It is a mixture of the Structured and Object Oriented Programming. Not very far apart chronologically 1960s former and 1970s latter. We can surely replace subroutines by the methods of the class (local or global). The usage of the local class lcl_salv_event_handler is driven by the SAP ALV framework.

The entire code of the program is presented below.

Program Code

After all the analysis of the program we provided on previous pages probably no actual code is needed. Still to make this article most useful the complete code is below. The user just has to replace the fictional RFC system by the real in his SAP shop. Click the link below.

RFC Program Code z_find_where_rfc_is_called

ITP logo

If you enjoyed this blog, World Class Utility Makes getting a WHERE-USED on a RFC Push Button Easy – Part 2, please fill out the form below to sign up for our newsletter. We deliver SAP Technical tips & tricks, SAP news, and the current month’s BLOG right to your inbox!

Related Posts

Related Posts

Pin It on Pinterest

Share This

If you enjoyed this post, why not share it with your friends!