SAP SQLM_API_GET_TOP_RECS_SNAPSHOT Function Module for SQL Monitor API: Get Top Records of Snapshot
SQLM_API_GET_TOP_RECS_SNAPSHOT is a standard sqlm api get top recs snapshot SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for SQL Monitor API: Get Top Records of Snapshot processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for sqlm api get top recs snapshot FM, simply by entering the name SQLM_API_GET_TOP_RECS_SNAPSHOT into the relevant SAP transaction such as SE37 or SE38.
Function Group: SQLM_API
Program Name: SAPLSQLM_API
Main Program: SAPLSQLM_API
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function SQLM_API_GET_TOP_RECS_SNAPSHOT pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'SQLM_API_GET_TOP_RECS_SNAPSHOT'"SQL Monitor API: Get Top Records of Snapshot.
EXPORTING
I_SNAPSHOT_ID = "
* I_FILTER_REQUESTNAME_RANGE = "
* I_FILTER_REQUESTTYPE_RANGE = "
* I_FILTER_TABLENAME_RANGE = "
* I_FILTER_RUNLEVEL_RANGE = "
* I_FILTER_STMTKIND_RANGE = "
* I_FILTER_EXCLUDE_TECH_RECORDS = ' ' "
* I_FILTER_INCLUDE_RANGE = "
* I_COMPUTE_STATISTICS = 'X' "
* I_TOPREC_SPEC_MAXIMUM = C_TOP_REC_DEFAULT_MAX "
* I_TOPREC_SPEC_ORDER = C_TOP_REC_ORDER_EXC "
* I_TOPREC_SPEC_AGGREGATION_KIND = C_TOP_REC_AGGR_NONE "
* I_TOPREC_SPEC_IGNORE_TECH_RECS = 'X' "
* I_FILTER_PACKAGE_RANGE = "
* I_FILTER_OBJNAME_RANGE = "
* I_FILTER_OBJTYPE_RANGE = "
IMPORTING
E_TOP_RECORDS = "
EXCEPTIONS
SQLM_API_FAILURE = 1
IMPORTING Parameters details for SQLM_API_GET_TOP_RECS_SNAPSHOT
I_SNAPSHOT_ID -
Data type: SQLM_API_SNAPSHOT_IDOptional: No
Call by Reference: No ( called with pass by value option)
I_FILTER_REQUESTNAME_RANGE -
Data type: SQLM_API_REQNAME_RANGEOptional: Yes
Call by Reference: No ( called with pass by value option)
I_FILTER_REQUESTTYPE_RANGE -
Data type: SQLM_API_REQTYPE_RANGEOptional: Yes
Call by Reference: No ( called with pass by value option)
I_FILTER_TABLENAME_RANGE -
Data type: SQLM_API_TABLENAME_RANGEOptional: Yes
Call by Reference: No ( called with pass by value option)
I_FILTER_RUNLEVEL_RANGE -
Data type: SQLM_API_RUNLEVEL_RANGEOptional: Yes
Call by Reference: No ( called with pass by value option)
I_FILTER_STMTKIND_RANGE -
Data type: SQLM_API_STMTKIND_RANGEOptional: Yes
Call by Reference: No ( called with pass by value option)
I_FILTER_EXCLUDE_TECH_RECORDS -
Data type: XFLAGDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_FILTER_INCLUDE_RANGE -
Data type: SQLM_API_INCLUDE_RANGEOptional: Yes
Call by Reference: No ( called with pass by value option)
I_COMPUTE_STATISTICS -
Data type: XFLAGDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_TOPREC_SPEC_MAXIMUM -
Data type: INT4Default: C_TOP_REC_DEFAULT_MAX
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_TOPREC_SPEC_ORDER -
Data type: SQLM_API_ORDERDefault: C_TOP_REC_ORDER_EXC
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_TOPREC_SPEC_AGGREGATION_KIND -
Data type: SQLM_API_AGGREGATION_KINDDefault: C_TOP_REC_AGGR_NONE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_TOPREC_SPEC_IGNORE_TECH_RECS -
Data type: XFLAGDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_FILTER_PACKAGE_RANGE -
Data type: SQLM_API_PACKAGE_RANGEOptional: Yes
Call by Reference: No ( called with pass by value option)
I_FILTER_OBJNAME_RANGE -
Data type: SQLM_API_OBJNAME_RANGEOptional: Yes
Call by Reference: No ( called with pass by value option)
I_FILTER_OBJTYPE_RANGE -
Data type: SQLM_API_OBJTYPE_RANGEOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for SQLM_API_GET_TOP_RECS_SNAPSHOT
E_TOP_RECORDS -
Data type: SQLM_API_RECORDSOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
SQLM_API_FAILURE -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for SQLM_API_GET_TOP_RECS_SNAPSHOT Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_e_top_records | TYPE SQLM_API_RECORDS, " | |||
| lv_i_snapshot_id | TYPE SQLM_API_SNAPSHOT_ID, " | |||
| lv_sqlm_api_failure | TYPE SQLM_API_SNAPSHOT_ID, " | |||
| lv_i_filter_requestname_range | TYPE SQLM_API_REQNAME_RANGE, " | |||
| lv_i_filter_requesttype_range | TYPE SQLM_API_REQTYPE_RANGE, " | |||
| lv_i_filter_tablename_range | TYPE SQLM_API_TABLENAME_RANGE, " | |||
| lv_i_filter_runlevel_range | TYPE SQLM_API_RUNLEVEL_RANGE, " | |||
| lv_i_filter_stmtkind_range | TYPE SQLM_API_STMTKIND_RANGE, " | |||
| lv_i_filter_exclude_tech_records | TYPE XFLAG, " SPACE | |||
| lv_i_filter_include_range | TYPE SQLM_API_INCLUDE_RANGE, " | |||
| lv_i_compute_statistics | TYPE XFLAG, " 'X' | |||
| lv_i_toprec_spec_maximum | TYPE INT4, " C_TOP_REC_DEFAULT_MAX | |||
| lv_i_toprec_spec_order | TYPE SQLM_API_ORDER, " C_TOP_REC_ORDER_EXC | |||
| lv_i_toprec_spec_aggregation_kind | TYPE SQLM_API_AGGREGATION_KIND, " C_TOP_REC_AGGR_NONE | |||
| lv_i_toprec_spec_ignore_tech_recs | TYPE XFLAG, " 'X' | |||
| lv_i_filter_package_range | TYPE SQLM_API_PACKAGE_RANGE, " | |||
| lv_i_filter_objname_range | TYPE SQLM_API_OBJNAME_RANGE, " | |||
| lv_i_filter_objtype_range | TYPE SQLM_API_OBJTYPE_RANGE. " |
|   CALL FUNCTION 'SQLM_API_GET_TOP_RECS_SNAPSHOT' "SQL Monitor API: Get Top Records of Snapshot |
| EXPORTING | ||
| I_SNAPSHOT_ID | = lv_i_snapshot_id | |
| I_FILTER_REQUESTNAME_RANGE | = lv_i_filter_requestname_range | |
| I_FILTER_REQUESTTYPE_RANGE | = lv_i_filter_requesttype_range | |
| I_FILTER_TABLENAME_RANGE | = lv_i_filter_tablename_range | |
| I_FILTER_RUNLEVEL_RANGE | = lv_i_filter_runlevel_range | |
| I_FILTER_STMTKIND_RANGE | = lv_i_filter_stmtkind_range | |
| I_FILTER_EXCLUDE_TECH_RECORDS | = lv_i_filter_exclude_tech_records | |
| I_FILTER_INCLUDE_RANGE | = lv_i_filter_include_range | |
| I_COMPUTE_STATISTICS | = lv_i_compute_statistics | |
| I_TOPREC_SPEC_MAXIMUM | = lv_i_toprec_spec_maximum | |
| I_TOPREC_SPEC_ORDER | = lv_i_toprec_spec_order | |
| I_TOPREC_SPEC_AGGREGATION_KIND | = lv_i_toprec_spec_aggregation_kind | |
| I_TOPREC_SPEC_IGNORE_TECH_RECS | = lv_i_toprec_spec_ignore_tech_recs | |
| I_FILTER_PACKAGE_RANGE | = lv_i_filter_package_range | |
| I_FILTER_OBJNAME_RANGE | = lv_i_filter_objname_range | |
| I_FILTER_OBJTYPE_RANGE | = lv_i_filter_objtype_range | |
| IMPORTING | ||
| E_TOP_RECORDS | = lv_e_top_records | |
| EXCEPTIONS | ||
| SQLM_API_FAILURE = 1 | ||
| . " SQLM_API_GET_TOP_RECS_SNAPSHOT | ||
ABAP code using 7.40 inline data declarations to call FM SQLM_API_GET_TOP_RECS_SNAPSHOT
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| DATA(ld_i_filter_exclude_tech_records) | = ' '. | |||
| DATA(ld_i_compute_statistics) | = 'X'. | |||
| DATA(ld_i_toprec_spec_maximum) | = C_TOP_REC_DEFAULT_MAX. | |||
| DATA(ld_i_toprec_spec_order) | = C_TOP_REC_ORDER_EXC. | |||
| DATA(ld_i_toprec_spec_aggregation_kind) | = C_TOP_REC_AGGR_NONE. | |||
| DATA(ld_i_toprec_spec_ignore_tech_recs) | = 'X'. | |||
Search for further information about these or an SAP related objects