SAP MESSAGES_COUNT Function Module for Determine number of collected messages in a line interval









MESSAGES_COUNT is a standard messages count SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Determine number of collected messages in a line interval 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 messages count FM, simply by entering the name MESSAGES_COUNT into the relevant SAP transaction such as SE37 or SE38.

Function Group: SMSG
Program Name: SAPLSMSG
Main Program: SAPLSMSG
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function MESSAGES_COUNT 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 'MESSAGES_COUNT'"Determine number of collected messages in a line interval
EXPORTING
* ONLY_FOR_ACTUAL_LINE = "
* LINE_FROM = ' ' "Only count messages with a longer
* LINE_TO = ' ' "Only count messages with a shorter
* SEVERITY_FROM = 0 "only messages from the degree of severity
* SEVERITY_TO = 16 "only messages up to the degree of severity

IMPORTING
COUNT = "Number of collected messages in th
MAX_SEVERITY = "Maximum degree of severity of the errors occured
E_CHECK_ON_COMMIT = "
E_HANDLER_ACTIVE = "

EXCEPTIONS
INCONSISTENT_RANGE = 1 INCONSISTENT_RANGE_SEVERITY = 2
.



IMPORTING Parameters details for MESSAGES_COUNT

ONLY_FOR_ACTUAL_LINE -

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

LINE_FROM - Only count messages with a longer

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

LINE_TO - Only count messages with a shorter

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

SEVERITY_FROM - only messages from the degree of severity

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

SEVERITY_TO - only messages up to the degree of severity

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

EXPORTING Parameters details for MESSAGES_COUNT

COUNT - Number of collected messages in th

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

MAX_SEVERITY - Maximum degree of severity of the errors occured

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

E_CHECK_ON_COMMIT -

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

E_HANDLER_ACTIVE -

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

EXCEPTIONS details

INCONSISTENT_RANGE - LINE_TO is shorter than LINE_FROM

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

INCONSISTENT_RANGE_SEVERITY - SEVERITY_TO smaller than SEVERITY_FROM

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

Copy and paste ABAP code example for MESSAGES_COUNT 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_count  TYPE SY-TABIX, "   
lv_inconsistent_range  TYPE SY, "   
lv_only_for_actual_line  TYPE SY-BATCH, "   
lv_line_from  TYPE SY, "   SPACE
lv_max_severity  TYPE SY-SUBRC, "   
lv_inconsistent_range_severity  TYPE SY, "   
lv_line_to  TYPE SY, "   SPACE
lv_e_check_on_commit  TYPE SY-BATCH, "   
lv_severity_from  TYPE SY-SUBRC, "   0
lv_e_handler_active  TYPE BOOLE_D, "   
lv_severity_to  TYPE SY-SUBRC. "   16

  CALL FUNCTION 'MESSAGES_COUNT'  "Determine number of collected messages in a line interval
    EXPORTING
         ONLY_FOR_ACTUAL_LINE = lv_only_for_actual_line
         LINE_FROM = lv_line_from
         LINE_TO = lv_line_to
         SEVERITY_FROM = lv_severity_from
         SEVERITY_TO = lv_severity_to
    IMPORTING
         COUNT = lv_count
         MAX_SEVERITY = lv_max_severity
         E_CHECK_ON_COMMIT = lv_e_check_on_commit
         E_HANDLER_ACTIVE = lv_e_handler_active
    EXCEPTIONS
        INCONSISTENT_RANGE = 1
        INCONSISTENT_RANGE_SEVERITY = 2
. " MESSAGES_COUNT




ABAP code using 7.40 inline data declarations to call FM MESSAGES_COUNT

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 TABIX FROM SY INTO @DATA(ld_count).
 
 
"SELECT single BATCH FROM SY INTO @DATA(ld_only_for_actual_line).
 
DATA(ld_line_from) = ' '.
 
"SELECT single SUBRC FROM SY INTO @DATA(ld_max_severity).
 
 
DATA(ld_line_to) = ' '.
 
"SELECT single BATCH FROM SY INTO @DATA(ld_e_check_on_commit).
 
"SELECT single SUBRC FROM SY INTO @DATA(ld_severity_from).
 
 
"SELECT single SUBRC FROM SY INTO @DATA(ld_severity_to).
DATA(ld_severity_to) = 16.
 


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!