SAP CMX_MESSAGE_VARIANT_WRITE_LOG Function Module for Writing a Variant Log
CMX_MESSAGE_VARIANT_WRITE_LOG is a standard cmx message variant write log SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Writing a Variant Log 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 cmx message variant write log FM, simply by entering the name CMX_MESSAGE_VARIANT_WRITE_LOG into the relevant SAP transaction such as SE37 or SE38.
Function Group: CMX_PM_MDA
Program Name: SAPLCMX_PM_MDA
Main Program:
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function CMX_MESSAGE_VARIANT_WRITE_LOG 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 'CMX_MESSAGE_VARIANT_WRITE_LOG'"Writing a Variant Log.
EXPORTING
PLANT = "Plant of Variant
* MESSAGES = "Alternative: Message Table
* EXCEPTION = "Reference to an Exception Instance
* SAVE_LOG = 'X' "Save Log Immediately
* EXPIRATION = "Number of Days Logs Overdue
VARIANT = "Name of Variant
* MSGID = "Message Class
* MSGTY = "Message Type
* MSGNO = "Message Number
* MSGV1 = "Message Variable
* MSGV2 = "Message Variable
* MSGV3 = "Message Variable
* MSGV4 = "Message Variable
IMPORTING Parameters details for CMX_MESSAGE_VARIANT_WRITE_LOG
PLANT - Plant of Variant
Data type: WERKS_DOptional: No
Call by Reference: Yes
MESSAGES - Alternative: Message Table
Data type: CMX_PM_VAR_MSG_TABOptional: Yes
Call by Reference: Yes
EXCEPTION - Reference to an Exception Instance
Data type: CX_ROOTOptional: Yes
Call by Reference: Yes
SAVE_LOG - Save Log Immediately
Data type: FLAGDefault: 'X'
Optional: Yes
Call by Reference: Yes
EXPIRATION - Number of Days Logs Overdue
Data type: CMX_PM_EXP_DATEOptional: Yes
Call by Reference: Yes
VARIANT - Name of Variant
Data type: CMX_PM_VAR_NAMEOptional: No
Call by Reference: Yes
MSGID - Message Class
Data type: SYMSGIDOptional: Yes
Call by Reference: Yes
MSGTY - Message Type
Data type: SYMSGTYOptional: Yes
Call by Reference: Yes
MSGNO - Message Number
Data type: SYMSGNOOptional: Yes
Call by Reference: Yes
MSGV1 - Message Variable
Data type: CLIKEOptional: Yes
Call by Reference: Yes
MSGV2 - Message Variable
Data type: CLIKEOptional: Yes
Call by Reference: Yes
MSGV3 - Message Variable
Data type: CLIKEOptional: Yes
Call by Reference: Yes
MSGV4 - Message Variable
Data type: CLIKEOptional: Yes
Call by Reference: Yes
Copy and paste ABAP code example for CMX_MESSAGE_VARIANT_WRITE_LOG 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_plant | TYPE WERKS_D, " | |||
| lv_messages | TYPE CMX_PM_VAR_MSG_TAB, " | |||
| lv_exception | TYPE CX_ROOT, " | |||
| lv_save_log | TYPE FLAG, " 'X' | |||
| lv_expiration | TYPE CMX_PM_EXP_DATE, " | |||
| lv_variant | TYPE CMX_PM_VAR_NAME, " | |||
| lv_msgid | TYPE SYMSGID, " | |||
| lv_msgty | TYPE SYMSGTY, " | |||
| lv_msgno | TYPE SYMSGNO, " | |||
| lv_msgv1 | TYPE CLIKE, " | |||
| lv_msgv2 | TYPE CLIKE, " | |||
| lv_msgv3 | TYPE CLIKE, " | |||
| lv_msgv4 | TYPE CLIKE. " |
|   CALL FUNCTION 'CMX_MESSAGE_VARIANT_WRITE_LOG' "Writing a Variant Log |
| EXPORTING | ||
| PLANT | = lv_plant | |
| MESSAGES | = lv_messages | |
| EXCEPTION | = lv_exception | |
| SAVE_LOG | = lv_save_log | |
| EXPIRATION | = lv_expiration | |
| VARIANT | = lv_variant | |
| MSGID | = lv_msgid | |
| MSGTY | = lv_msgty | |
| MSGNO | = lv_msgno | |
| MSGV1 | = lv_msgv1 | |
| MSGV2 | = lv_msgv2 | |
| MSGV3 | = lv_msgv3 | |
| MSGV4 | = lv_msgv4 | |
| . " CMX_MESSAGE_VARIANT_WRITE_LOG | ||
ABAP code using 7.40 inline data declarations to call FM CMX_MESSAGE_VARIANT_WRITE_LOG
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_save_log) | = 'X'. | |||
Search for further information about these or an SAP related objects