Trace files are extensively utilized in Sage X3 software, particularly during lengthy processes like Automatic Invoice Validation or Automatic Work Order Release. When a trace file is displayed, error lines appear in red text, allowing you to navigate through the errors.
To customize a trace file, follow the below steps:
Step 1: We need to open the trace file using the ‘OUVRE_TRACE’ function, as shown in the code below.
Step 2: After opening the log file, we can insert any messages as per our requirements.
Note: To customize a trace file, it’s essential to understand the color codes associated with different messages:
0: Used to display messages in black color.
1: Used to indicate error messages in red color.
-1: Used to present messages in green color.
-2: Used to showcase messages in blue color.
Step 3: Insert a message line using the ‘ECR_TRACE’ function. This function takes two parameters: the first parameter contains the message, and the second contains the color code, as shown in the code below.
Step 4: After inserting messages, we need to close this trace file using the ‘FERME_TRACE’ function.
Step 5: Now we can display our trace log file using the ‘LEC_TRACE’ function.
Step 6: If you want to delete this trace file, you can use the ‘SUPP_TRACE’ function.
After executing this script, you can view the log file as depicted in the screenshot below.
Note: If you added an error message using the code ‘1’ in the ‘ECR_TRACE’ function, you will receive a popup indicating the number of errors before the log file.
By following the above steps, we can customize the trace log file for errors and success messages.