Creating custom messages in Payroll log using operation XMES
Often times our SAP end users requests to see messages in the payroll log during payroll processing. These messages can be informational or warning in nature, intended to pro-actively alert the end user about missing master data or other HR related information processed during the payroll run.
In SAP, this can be achieved by using the operation XMES. This operation overhauls the obsolete operation MESSG. Without any enhancement to operation XMES, this can only be used to display a single message. This limits our ability to display custom messages requests from end users. To resolve this, we can implement the customer user exit or country exit that SAP has delivered per note 504704.
Note: With the release of SAP note 1952925, a new parameter ‘P’ is delivered to display the message in a dialog box.
SAP has delivered the routine PCBURZXX0 with both customer and country exit to display the messages according to our requirement. In this article, I will show you how to implement this message for US customer exit using PCBURZUS0.
To this end, you will need to create a message class and use it to store the messages to be displayed in the payroll log.
Fig.1: Create message class in SE91 transaction code
You will be using the message number 001 (Fig.1) in the custom PCR (Fig.2)to display the customer specific messages.
Fig.2 Customer PCR that sets the logic to display the custom messages along with personnel number
You can refer the code I provided below as a guide to implement the customer message class in the user exit PCBURZUS0.
*& Include ZHRPY_ZZXMES
*& Author: Sumy Nair
FORM OPXMES_CUST USING P_PARAM TYPE CHAR3
CHANGING P_LOG_MSG TYPE HRPLOG_MSG
P_NO_DISPLAY TYPE RP_XFELD.
STATICS: S_PERNR LIKE PERNR-PERNR.
DATA: DUMMY(1) TYPE C.
CONSTANTS: C_MSGID TYPE HRPLOG_MSG-MSGID VALUE ‘ZHRPY’.
P_LOG_MSG-MSGID = C_MSGID.
P_LOG_MSG-MSGNO = P_PARAM.
P_LOG_MSG-MSGV1 = PERNR-PERNR.
Process the payroll using the payroll driver and the message will appear on the payroll log.