SAP CMS_API_GENERAL_STORE_MESSAGE Function Module for Store Messages in the current UI Message Handler
CMS_API_GENERAL_STORE_MESSAGE is a standard cms api general store message SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Store Messages in the current UI Message Handler 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 cms api general store message FM, simply by entering the name CMS_API_GENERAL_STORE_MESSAGE into the relevant SAP transaction such as SE37 or SE38.
Function Group: CMS_API_GENERAL
Program Name: SAPLCMS_API_GENERAL
Main Program: SAPLCMS_API_GENERAL
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function CMS_API_GENERAL_STORE_MESSAGE 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 'CMS_API_GENERAL_STORE_MESSAGE'"Store Messages in the current UI Message Handler.
EXPORTING
I_ID = "Message Class
* I_MH2_STEPL = "Screens, current table line index
* I_MH2_FLAG_COLL_END = "
* I_MH2_REPEAT_SHOW = '1' "
* I_MH2_SICHT = "View
* I_MH2_LOOP_KEY = "
* I_MH2_TBFLD_STRG = "
I_TYPE = "Message Category
I_NUMBER = "Message Number
* I_MSGV1 = "1st Variable for Message
* I_MSGV2 = "2nd Variable for Message
* I_MSGV3 = "3rd Variable for Message
* I_MSGV4 = "4th Variable for Message
* I_MH1_EXCEPTION_IF_NOT_ACTIVE = 'X' "(See Long Text)
* I_MH1_ZEILE = "Line number
IMPORTING
E_RC = "Return Code
E_MH1_ACT_SEVERITY = "
E_MH1_MAX_SEVERITY = "
EXCEPTIONS
INVALID_MESSAGE_TYPE = 1
IMPORTING Parameters details for CMS_API_GENERAL_STORE_MESSAGE
I_ID - Message Class
Data type: MESG-ARBGBOptional: No
Call by Reference: No ( called with pass by value option)
I_MH2_STEPL - Screens, current table line index
Data type: SY-STEPLOptional: Yes
Call by Reference: No ( called with pass by value option)
I_MH2_FLAG_COLL_END -
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
I_MH2_REPEAT_SHOW -
Data type:Default: '1'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_MH2_SICHT - View
Data type: TBZ3E-SICHTOptional: Yes
Call by Reference: No ( called with pass by value option)
I_MH2_LOOP_KEY -
Data type: COptional: Yes
Call by Reference: No ( called with pass by value option)
I_MH2_TBFLD_STRG -
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
I_TYPE - Message Category
Data type: MESG-MSGTYOptional: No
Call by Reference: No ( called with pass by value option)
I_NUMBER - Message Number
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
I_MSGV1 - 1st Variable for Message
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
I_MSGV2 - 2nd Variable for Message
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
I_MSGV3 - 3rd Variable for Message
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
I_MSGV4 - 4th Variable for Message
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
I_MH1_EXCEPTION_IF_NOT_ACTIVE - (See Long Text)
Data type:Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_MH1_ZEILE - Line number
Data type: MESG-ZEILEOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for CMS_API_GENERAL_STORE_MESSAGE
E_RC - Return Code
Data type: SY-SUBRCOptional: No
Call by Reference: No ( called with pass by value option)
E_MH1_ACT_SEVERITY -
Data type: SY-SUBRCOptional: No
Call by Reference: No ( called with pass by value option)
E_MH1_MAX_SEVERITY -
Data type: SY-SUBRCOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
INVALID_MESSAGE_TYPE -
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for CMS_API_GENERAL_STORE_MESSAGE 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_rc | TYPE SY-SUBRC, " | |||
| lv_i_id | TYPE MESG-ARBGB, " | |||
| lv_invalid_message_type | TYPE MESG, " | |||
| lv_i_mh2_stepl | TYPE SY-STEPL, " | |||
| lv_i_mh2_flag_coll_end | TYPE SY, " | |||
| lv_i_mh2_repeat_show | TYPE SY, " '1' | |||
| lv_i_mh2_sicht | TYPE TBZ3E-SICHT, " | |||
| lv_i_mh2_loop_key | TYPE C, " | |||
| lv_i_mh2_tbfld_strg | TYPE C, " | |||
| lv_i_type | TYPE MESG-MSGTY, " | |||
| lv_e_mh1_act_severity | TYPE SY-SUBRC, " | |||
| lv_i_number | TYPE SY, " | |||
| lv_e_mh1_max_severity | TYPE SY-SUBRC, " | |||
| lv_i_msgv1 | TYPE SY, " | |||
| lv_i_msgv2 | TYPE SY, " | |||
| lv_i_msgv3 | TYPE SY, " | |||
| lv_i_msgv4 | TYPE SY, " | |||
| lv_i_mh1_exception_if_not_active | TYPE SY, " 'X' | |||
| lv_i_mh1_zeile | TYPE MESG-ZEILE. " |
|   CALL FUNCTION 'CMS_API_GENERAL_STORE_MESSAGE' "Store Messages in the current UI Message Handler |
| EXPORTING | ||
| I_ID | = lv_i_id | |
| I_MH2_STEPL | = lv_i_mh2_stepl | |
| I_MH2_FLAG_COLL_END | = lv_i_mh2_flag_coll_end | |
| I_MH2_REPEAT_SHOW | = lv_i_mh2_repeat_show | |
| I_MH2_SICHT | = lv_i_mh2_sicht | |
| I_MH2_LOOP_KEY | = lv_i_mh2_loop_key | |
| I_MH2_TBFLD_STRG | = lv_i_mh2_tbfld_strg | |
| I_TYPE | = lv_i_type | |
| I_NUMBER | = lv_i_number | |
| I_MSGV1 | = lv_i_msgv1 | |
| I_MSGV2 | = lv_i_msgv2 | |
| I_MSGV3 | = lv_i_msgv3 | |
| I_MSGV4 | = lv_i_msgv4 | |
| I_MH1_EXCEPTION_IF_NOT_ACTIVE | = lv_i_mh1_exception_if_not_active | |
| I_MH1_ZEILE | = lv_i_mh1_zeile | |
| IMPORTING | ||
| E_RC | = lv_e_rc | |
| E_MH1_ACT_SEVERITY | = lv_e_mh1_act_severity | |
| E_MH1_MAX_SEVERITY | = lv_e_mh1_max_severity | |
| EXCEPTIONS | ||
| INVALID_MESSAGE_TYPE = 1 | ||
| . " CMS_API_GENERAL_STORE_MESSAGE | ||
ABAP code using 7.40 inline data declarations to call FM CMS_API_GENERAL_STORE_MESSAGE
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 SUBRC FROM SY INTO @DATA(ld_e_rc). | ||||
| "SELECT single ARBGB FROM MESG INTO @DATA(ld_i_id). | ||||
| "SELECT single STEPL FROM SY INTO @DATA(ld_i_mh2_stepl). | ||||
| DATA(ld_i_mh2_repeat_show) | = '1'. | |||
| "SELECT single SICHT FROM TBZ3E INTO @DATA(ld_i_mh2_sicht). | ||||
| "SELECT single MSGTY FROM MESG INTO @DATA(ld_i_type). | ||||
| "SELECT single SUBRC FROM SY INTO @DATA(ld_e_mh1_act_severity). | ||||
| "SELECT single SUBRC FROM SY INTO @DATA(ld_e_mh1_max_severity). | ||||
| DATA(ld_i_mh1_exception_if_not_active) | = 'X'. | |||
| "SELECT single ZEILE FROM MESG INTO @DATA(ld_i_mh1_zeile). | ||||
Search for further information about these or an SAP related objects