Skip to Content
Author's profile photo Vijai Reghunath

Easy Way to Find Signature of all Function Modules Used in a Project.

Signature is the Exporting/Importing parameters of the function module. See below, for the function module REUSE_ALV_GRID_DISPLAY have many exporting, importing and table parameters.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
*   I_CALLBACK_PROGRAM                = ' '
*   I_CALLBACK_PF_STATUS_SET          = ' '
*   I_CALLBACK_USER_COMMAND           = ' '
*   I_CALLBACK_TOP_OF_PAGE            = ' '
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
*   I_STRUCTURE_NAME                  =
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      =
*   I_GRID_SETTINGS                   =
*   IS_LAYOUT                         =
*   IT_FIELDCAT                       =
*   IT_EXCLUDING                      =
*   IT_SPECIAL_GROUPS                 =
*   IT_SORT                           =
*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        =
*   IT_EVENTS                         =
*   IT_EVENT_EXIT                     =
*   IS_PRINT                          =
*   IS_REPREP_ID                      =
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   =
*   IT_HYPERLINK                      =
*   IT_ADD_FIELDCAT                   =
*   IT_EXCEPT_QINFO                   =
*   IR_SALV_FULLSCREEN_ADAPTER        =
IMPORTING
   E_EXIT_CAUSED_BY_CALLER           =
*   ES_EXIT_CAUSED_BY_USER            =
TABLES
    t_outtab                          =
* EXCEPTIONS
*   PROGRAM_ERROR                     = 1
*   OTHERS                            = 2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

When we start working for a project, we usually create a new function group. All FMs will be included in this function group (There may be cases like multiple function group created for same project or same function group for multiple projects ). When we create a function group, there will be a program automatically generated with prefix SAPL.

Eg: If the function group name is Z_TEST, then the program name will be SAPLZ_TEST.

We can open this program in the ABAP editor. There will be one include after TOP include with name LZ_TESTUXX. This include will have all the function modules used in the function group. There will be separate includes for each function modules. Name of these includes will be like LZ_TESTU01, LZ_TESTU02 etc..

 

Table TFDIR helps us to find all the FMs in the function group, we need to pass the above program name as input to PNAME field. We just need to pass all these FMs into table FUPARAREF to get the signature details of  all FMs.

Below code can be used to fetch the details.

TOP

 TYPES: BEGIN OF fm_sign,
       funcname TYPE tfdir-funcname,
       parameter TYPE fupararef-parameter,
       paramtype TYPE fupararef-paramtype,
       structure TYPE fupararef-structure,
       optional  TYPE fupararef-optional,
       END OF fm_sign.

CONSTANTS: c_prefix TYPE c LENGTH 4 VALUE 'SAPL'.

DATA:  lt_signature TYPE STANDARD TABLE OF fm_sign,
       fng_name TYPE char40,
       msg TYPE REF TO cx_salv_msg,
       alv TYPE REF TO cl_salv_table,
       layout_settings TYPE REF TO cl_salv_layout,
       layout_key      TYPE salv_s_layout_key,
       columns TYPE REF TO cl_salv_columns_table,
       functions TYPE REF TO cl_salv_functions_list.
INCLUDE zfmsignature_top.

START-OF-SELECTION.
PARAMETERS FnGrp TYPE char30.
END-OF-SELECTION.
CONCATENATE c_prefix FnGrp INTO fng_name.

SELECT tfdir~funcname fupararef~parameter fupararef~paramtype fupararef~structure fupararef~optional
       INTO CORRESPONDING FIELDS OF TABLE lt_signature
       FROM fupararef AS fupararef INNER JOIN tfdir AS tfdir ON fupararef~funcname EQ tfdir~funcname
       WHERE tfdir~pname EQ fng_name AND tfdir~funcname NOT LIKE 'TABLE%'.
  TRY.
      cl_salv_table=>factory(
        IMPORTING
          r_salv_table = alv
        CHANGING
          t_table      = lt_signature ).
  layout_settings = alv->get_layout( ).
  layout_key-report = sy-repid.
  layout_settings->set_key( layout_key ).
  layout_settings->set_save_restriction( if_salv_c_layout=>restrict_none ).
  columns = alv->get_columns( ).
  columns->set_optimize( ).
  functions = alv->get_functions( ).
  functions->set_all( ).
    CATCH cx_salv_msg INTO msg.
 ENDTRY.
    alv->display( ).

If we created custom tables and generated table maintenance generator, then there will be two additional FMs in the function group with below names.

  1. TABLEFRAME_functiongroupname.
  2. TABLEPROC_functiongroupname.

We should remove these two FMs in the output, to achieve that in where clause filtering is used for funcname.

 

Selection Screen looks like Below.

 

Output

 

Here parameter I – Input, E – Exporting , T- Table and optional parameter’s are marked with ‘X’.

 

Assigned Tags

      8 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo VINAY REDDY
      VINAY REDDY

      Hi Vijai,

      Very useful , while developing exists..

      thanks for sharing and you valuable effort..

       

      Regards,

      vinay reddy..

       

      Author's profile photo Richard Harper
      Richard Harper

      Whats wrong with using function module 'FUNCTION_STUB_GENERATE'

      Rich

      Author's profile photo VINAY REDDY
      VINAY REDDY

      Here you can see all function module parameters corresponding to an entire function group.

      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      Why would you need that?

      Author's profile photo Matthew Billingham
      Matthew Billingham

      I don’t see the point. What’s the use case? If you’re programming, you can see the parameters, even with documentation in some cases, by looking at the function module or group. If it’s after programming, why should you care what the signature of the function modules is?

      In over 20 years of working with SAP, I've never had a need for a program like this.

      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      Same here. I'm also very much confused what would be the purpose of this. Granted, I only have 12 years but not a single "if only I had this" moment either. Maybe I'm missing something...

      Author's profile photo Douglas Santos
      Douglas Santos

      Me too.

      Author's profile photo Former Member
      Former Member

      Hi Vijai,

      Can you please let me know in what way this program will be helpful for the business/client.