cancel
Showing results for 
Search instead for 
Did you mean: 

Overwrite Standard Validation message to Custom message

Former Member
0 Kudos

Hello Gurus,

I searched and have gone through lot of resources but did not find solution and came up with this question.

I have a scenario where I can not make action(Save) as validation independent. So, I tried using IF_WD_MESSAGE_MANAGER methods in WDDOBEFOREACTION as below.

1) Used HAS_VALIDATION_ERRORS If true got all the messages using method GET_MESSAGES.

2) Loop through messages of perticular attribute and deleted message based on MSG_ID using REMOVE_MESSAGE.

3) And tried to set custom error message using REPORT_ATTRIBUTE_ERROR_MESSAGE.

But to my suprise IF_WD_MESSAGE_MANAGER->GET_MESSAGES is not returning any messages even though there exists a validation erro, though HAS_VALIDATION_ERRORS returning TRUE.

Cant we make use of GET_MESSAGES in WDDOBEFOREACTION or anything wrong in my logic.

Any inputs would be appreciated!

Thanks a ton in advance!

Regards,

Pavan.

Edited by: Pavankumar Adiraju on Aug 1, 2011 6:42 AM

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member450736
Active Participant
0 Kudos

Hi Pavan,

if i am not wrong, you want to hide standard validation messages specific to data types and then put your own custom messages instead. for this

you have to use if_wd_validation interface and its methods to suppress those validation errors and then use report_attribute_message to put your custom messages (or) at first hand avoid those data type errors by using character or string data type

Hope this helps.

Former Member
0 Kudos

Thanks for the response!!

@ Srinivas: Sorry, I missed one more step wherein I use message object(MSG_OBJECT) of messages returned by GET_MESSAGES to get the specific message using GET_TEXT.

So, to rephrase I will only overwrite specific error message with my custom message.

@ Kranthi : Before posting the question I found the forum suggestion you mentioned but did not find a way to get reference to it.

Please tell me if you know how to get reference of IF_WD_VALIDATION in WDDOBEFOREVALIDATION to use it.

Regards,

Pavan.

former_member199125
Active Contributor
0 Kudos

Pavan,

Then did you place the get_Text method in correct place? because i think, once the validation of one field is over, it goes to next , at that time I hope new msg will overwrite the previous one.

Regards

Srinivas

Former Member
0 Kudos

Hello Srinivas,

I could take care of the placing of GET_TEXT, but the actual problem to which I am seeking solution is GET_MESSAGES is not returning any messages even though validation errors exist on screen.

Please provide me inputs in this direction.

Thanks in Advance!!

Pavan.

former_member450736
Active Participant
0 Kudos

Hi pavan,

you can get the reference for if_wd_validation using below code

data:lo_msg_mgr type ref to if_wd_message_manager,

lo_val type ref to if_wd_validation.

lo_val ?= lo_msg_mgr.

i hope you will have message manager reference variable anyways.

former_member199125
Active Contributor
0 Kudos

hi pavan,

let me rephrase your requirement,

You want to avoid all standard error messages and conveying the same with single custom message ?

Regards

Srinivas