SAP SWA_MESSAGE_STORE Function Module for
SWA_MESSAGE_STORE is a standard swa message store SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, 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 swa message store FM, simply by entering the name SWA_MESSAGE_STORE into the relevant SAP transaction such as SE37 or SE38.
Function Group: SWA0
Program Name: SAPLSWA0
Main Program: SAPLSWA0
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function SWA_MESSAGE_STORE 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 'SWA_MESSAGE_STORE'".
EXPORTING
ARBGB = "Message ID
* EXCEPTION_IF_NOT_ACTIVE = 'X' "X = exception not_active is raised
MSGTY = "Type of message (I, S, W, E, A)
* MSGV1 = ' ' "1st variable parameter of message
* MSGV2 = ' ' "2nd variable parameter of message
* MSGV3 = ' ' "3rd variable parameter of message
* MSGV4 = ' ' "4th variable parameter of message
TXTNR = "Number of message
* ZEILE = '000' "Reference line, if available
IMPORTING
ACT_SEVERITY = "Degree of severity of current message
MAX_SEVERITY = "Maximum severity degree which occurred
EXCEPTIONS
MESSAGE_TYPE_NOT_VALID = 1 NOT_ACTIVE = 2
IMPORTING Parameters details for SWA_MESSAGE_STORE
ARBGB - Message ID
Data type: SWAMESG-ARBGBOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTION_IF_NOT_ACTIVE - X = exception not_active is raised
Data type:Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
MSGTY - Type of message (I, S, W, E, A)
Data type: SWAMESG-MSGTYOptional: No
Call by Reference: No ( called with pass by value option)
MSGV1 - 1st variable parameter of message
Data type: SWAMESG-MSGV1Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
MSGV2 - 2nd variable parameter of message
Data type: SWAMESG-MSGV2Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
MSGV3 - 3rd variable parameter of message
Data type: SWAMESG-MSGV3Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
MSGV4 - 4th variable parameter of message
Data type: SWAMESG-MSGV4Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TXTNR - Number of message
Data type: SWAMESG-TXTNROptional: No
Call by Reference: No ( called with pass by value option)
ZEILE - Reference line, if available
Data type: SWAMESG-ZEILEDefault: '000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for SWA_MESSAGE_STORE
ACT_SEVERITY - Degree of severity of current message
Data type: SY-SUBRCOptional: No
Call by Reference: No ( called with pass by value option)
MAX_SEVERITY - Maximum severity degree which occurred
Data type: SY-SUBRCOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
MESSAGE_TYPE_NOT_VALID - Type of message not I, S, W, E or A
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NOT_ACTIVE - Collection of messages is not active
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for SWA_MESSAGE_STORE 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_arbgb | TYPE SWAMESG-ARBGB, " | |||
| lv_act_severity | TYPE SY-SUBRC, " | |||
| lv_message_type_not_valid | TYPE SY, " | |||
| lv_not_active | TYPE SY, " | |||
| lv_max_severity | TYPE SY-SUBRC, " | |||
| lv_exception_if_not_active | TYPE SY, " 'X' | |||
| lv_msgty | TYPE SWAMESG-MSGTY, " | |||
| lv_msgv1 | TYPE SWAMESG-MSGV1, " SPACE | |||
| lv_msgv2 | TYPE SWAMESG-MSGV2, " SPACE | |||
| lv_msgv3 | TYPE SWAMESG-MSGV3, " SPACE | |||
| lv_msgv4 | TYPE SWAMESG-MSGV4, " SPACE | |||
| lv_txtnr | TYPE SWAMESG-TXTNR, " | |||
| lv_zeile | TYPE SWAMESG-ZEILE. " '000' |
|   CALL FUNCTION 'SWA_MESSAGE_STORE' " |
| EXPORTING | ||
| ARBGB | = lv_arbgb | |
| EXCEPTION_IF_NOT_ACTIVE | = lv_exception_if_not_active | |
| MSGTY | = lv_msgty | |
| MSGV1 | = lv_msgv1 | |
| MSGV2 | = lv_msgv2 | |
| MSGV3 | = lv_msgv3 | |
| MSGV4 | = lv_msgv4 | |
| TXTNR | = lv_txtnr | |
| ZEILE | = lv_zeile | |
| IMPORTING | ||
| ACT_SEVERITY | = lv_act_severity | |
| MAX_SEVERITY | = lv_max_severity | |
| EXCEPTIONS | ||
| MESSAGE_TYPE_NOT_VALID = 1 | ||
| NOT_ACTIVE = 2 | ||
| . " SWA_MESSAGE_STORE | ||
ABAP code using 7.40 inline data declarations to call FM SWA_MESSAGE_STORE
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 ARBGB FROM SWAMESG INTO @DATA(ld_arbgb). | ||||
| "SELECT single SUBRC FROM SY INTO @DATA(ld_act_severity). | ||||
| "SELECT single SUBRC FROM SY INTO @DATA(ld_max_severity). | ||||
| DATA(ld_exception_if_not_active) | = 'X'. | |||
| "SELECT single MSGTY FROM SWAMESG INTO @DATA(ld_msgty). | ||||
| "SELECT single MSGV1 FROM SWAMESG INTO @DATA(ld_msgv1). | ||||
| DATA(ld_msgv1) | = ' '. | |||
| "SELECT single MSGV2 FROM SWAMESG INTO @DATA(ld_msgv2). | ||||
| DATA(ld_msgv2) | = ' '. | |||
| "SELECT single MSGV3 FROM SWAMESG INTO @DATA(ld_msgv3). | ||||
| DATA(ld_msgv3) | = ' '. | |||
| "SELECT single MSGV4 FROM SWAMESG INTO @DATA(ld_msgv4). | ||||
| DATA(ld_msgv4) | = ' '. | |||
| "SELECT single TXTNR FROM SWAMESG INTO @DATA(ld_txtnr). | ||||
| "SELECT single ZEILE FROM SWAMESG INTO @DATA(ld_zeile). | ||||
| DATA(ld_zeile) | = '000'. | |||
Search for further information about these or an SAP related objects