SAP ST04_DB4_GET_STATISTICS Function Module for AS/400: Get Database statistics for ST04 Main Screen









ST04_DB4_GET_STATISTICS is a standard st04 db4 get statistics SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for AS/400: Get Database statistics for ST04 Main Screen 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 st04 db4 get statistics FM, simply by entering the name ST04_DB4_GET_STATISTICS into the relevant SAP transaction such as SE37 or SE38.

Function Group: STU4_TCC
Program Name: SAPLSTU4_TCC
Main Program: SAPLSTU4_TCC
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:



Function ST04_DB4_GET_STATISTICS 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 'ST04_DB4_GET_STATISTICS'"AS/400: Get Database statistics for ST04 Main Screen
EXPORTING
* RESETFLAG = ' ' "Character field currently not used
* DBHOST = "R/3 System, Name of Application Server
* SCHEMANAME = "DB6: Schema Name
* SYSTEM_ID = "Name of SAP R/3 System

IMPORTING
DATE = "Date of analysis
TIME = "Time of analysis
DB_STATS = "DB statistic: User calls and performance data
WAIT_STATS_DATE = "date of wait statistic analysis
WAIT_STATS_TIME = "time of wait statistic analysis
SUM_WAITS = "Sum of waits (db + non-db + int.machine)
SUM_WAIT_TIMES = "Sum of wait times (db + non-db + int.machine)
WAIT_STATS_SUMMARY = "Summary of wait statistic of all instances
WAIT_STAT_SUBRC = "Error code of DB4_GET_WAIT_STATISTIC

TABLES
* DBMON_HEADER_INFO = "DBMonitor info (oldest data, dump, merge)

EXCEPTIONS
WAIT_STATS_ERROR = 1 NO_DB_STATS_FOUND = 2 NO_DB_STATS_AND_WAIT_STATS_ERR = 3
.



IMPORTING Parameters details for ST04_DB4_GET_STATISTICS

RESETFLAG - Character field currently not used

Data type: DB4QQPAR-QRESET
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

DBHOST - R/3 System, Name of Application Server

Data type: DB6NAVSYST-DBHOST
Optional: Yes
Call by Reference: No ( called with pass by value option)

SCHEMANAME - DB6: Schema Name

Data type: DB6NAVSYST-SCHEMANAME
Optional: Yes
Call by Reference: No ( called with pass by value option)

SYSTEM_ID - Name of SAP R/3 System

Data type: DB6NAVSYST-SYSID
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for ST04_DB4_GET_STATISTICS

DATE - Date of analysis

Data type: SY-DATUM
Optional: No
Call by Reference: No ( called with pass by value option)

TIME - Time of analysis

Data type: SY-UZEIT
Optional: No
Call by Reference: No ( called with pass by value option)

DB_STATS - DB statistic: User calls and performance data

Data type: SQHIST_DB4
Optional: No
Call by Reference: No ( called with pass by value option)

WAIT_STATS_DATE - date of wait statistic analysis

Data type: SY-DATUM
Optional: No
Call by Reference: No ( called with pass by value option)

WAIT_STATS_TIME - time of wait statistic analysis

Data type: SY-UZEIT
Optional: No
Call by Reference: No ( called with pass by value option)

SUM_WAITS - Sum of waits (db + non-db + int.machine)

Data type: DB4WTSTS_S-WDB
Optional: No
Call by Reference: No ( called with pass by value option)

SUM_WAIT_TIMES - Sum of wait times (db + non-db + int.machine)

Data type: DB4WTSTS_S-WDBT
Optional: No
Call by Reference: No ( called with pass by value option)

WAIT_STATS_SUMMARY - Summary of wait statistic of all instances

Data type: DB4WTSTS_S
Optional: No
Call by Reference: No ( called with pass by value option)

WAIT_STAT_SUBRC - Error code of DB4_GET_WAIT_STATISTIC

Data type: SY-SUBRC
Optional: No
Call by Reference: No ( called with pass by value option)

TABLES Parameters details for ST04_DB4_GET_STATISTICS

DBMON_HEADER_INFO - DBMonitor info (oldest data, dump, merge)

Data type: DB4DBMON
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXCEPTIONS details

WAIT_STATS_ERROR - Error in DB4_GET_WAIT_STATISTIC

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

NO_DB_STATS_FOUND - No data found in the performance tables

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

NO_DB_STATS_AND_WAIT_STATS_ERR - No perf. data found & DB4_GET_WAIT_STATISTIC-err

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for ST04_DB4_GET_STATISTICS 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_date  TYPE SY-DATUM, "   
lv_resetflag  TYPE DB4QQPAR-QRESET, "   SPACE
lv_wait_stats_error  TYPE DB4QQPAR, "   
lt_dbmon_header_info  TYPE STANDARD TABLE OF DB4DBMON, "   
lv_time  TYPE SY-UZEIT, "   
lv_dbhost  TYPE DB6NAVSYST-DBHOST, "   
lv_no_db_stats_found  TYPE DB6NAVSYST, "   
lv_db_stats  TYPE SQHIST_DB4, "   
lv_schemaname  TYPE DB6NAVSYST-SCHEMANAME, "   
lv_no_db_stats_and_wait_stats_err  TYPE DB6NAVSYST, "   
lv_system_id  TYPE DB6NAVSYST-SYSID, "   
lv_wait_stats_date  TYPE SY-DATUM, "   
lv_wait_stats_time  TYPE SY-UZEIT, "   
lv_sum_waits  TYPE DB4WTSTS_S-WDB, "   
lv_sum_wait_times  TYPE DB4WTSTS_S-WDBT, "   
lv_wait_stats_summary  TYPE DB4WTSTS_S, "   
lv_wait_stat_subrc  TYPE SY-SUBRC. "   

  CALL FUNCTION 'ST04_DB4_GET_STATISTICS'  "AS/400: Get Database statistics for ST04 Main Screen
    EXPORTING
         RESETFLAG = lv_resetflag
         DBHOST = lv_dbhost
         SCHEMANAME = lv_schemaname
         SYSTEM_ID = lv_system_id
    IMPORTING
         DATE = lv_date
         TIME = lv_time
         DB_STATS = lv_db_stats
         WAIT_STATS_DATE = lv_wait_stats_date
         WAIT_STATS_TIME = lv_wait_stats_time
         SUM_WAITS = lv_sum_waits
         SUM_WAIT_TIMES = lv_sum_wait_times
         WAIT_STATS_SUMMARY = lv_wait_stats_summary
         WAIT_STAT_SUBRC = lv_wait_stat_subrc
    TABLES
         DBMON_HEADER_INFO = lt_dbmon_header_info
    EXCEPTIONS
        WAIT_STATS_ERROR = 1
        NO_DB_STATS_FOUND = 2
        NO_DB_STATS_AND_WAIT_STATS_ERR = 3
. " ST04_DB4_GET_STATISTICS




ABAP code using 7.40 inline data declarations to call FM ST04_DB4_GET_STATISTICS

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.

"SELECT single DATUM FROM SY INTO @DATA(ld_date).
 
"SELECT single QRESET FROM DB4QQPAR INTO @DATA(ld_resetflag).
DATA(ld_resetflag) = ' '.
 
 
 
"SELECT single UZEIT FROM SY INTO @DATA(ld_time).
 
"SELECT single DBHOST FROM DB6NAVSYST INTO @DATA(ld_dbhost).
 
 
 
"SELECT single SCHEMANAME FROM DB6NAVSYST INTO @DATA(ld_schemaname).
 
 
"SELECT single SYSID FROM DB6NAVSYST INTO @DATA(ld_system_id).
 
"SELECT single DATUM FROM SY INTO @DATA(ld_wait_stats_date).
 
"SELECT single UZEIT FROM SY INTO @DATA(ld_wait_stats_time).
 
"SELECT single WDB FROM DB4WTSTS_S INTO @DATA(ld_sum_waits).
 
"SELECT single WDBT FROM DB4WTSTS_S INTO @DATA(ld_sum_wait_times).
 
 
"SELECT single SUBRC FROM SY INTO @DATA(ld_wait_stat_subrc).
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!