cancel
Showing results for 
Search instead for 
Did you mean: 

Messages.

Former Member
0 Kudos

Hi,

If I've a inputfield, and I want that when the user put a wrong data, I could put a error message, for example <i>"The inputfield data is wrong, be patient and put the data good</i>", in message area.

How can I do it?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Guillermo,

In your method, get the instance of the message manager as follows:

data: lr_view_controller type ref to if_wd_view_controller,

msg type ref to if_wd_message manager.

lr_view_controller = wd_this->wd_get_api( ).

msg = lr_view_controller->get_message_manager( ).

Now if you have message classes with your messages already defined, use the method

msg->report_t100_message(

msgid = <message class>

msgno = <message no>

msgty = <type - 'E'/'S'>

).

Check out the methods in the interface if_wd_message_manager for various types of messages that can be reported.

By default, the messages will appear on the top of the page. Instead, if you want them next to your input field, define a message area in your view and it will appear there.

Regards,

Nithya

Former Member
0 Kudos

Hi Guillermo,

you could also use the method report_error_message

if you do not want to use message classes and just transfer a string which contains the message.

Cheers,

Sascha

mohammed_anzys
Contributor
0 Kudos

Hi

You could also put a wrning message as well..

Tahnks

Anzy

mohammed_anzys
Contributor
0 Kudos

Hi,

You could use the following the code to show the message, if you are using a message class , you could get those messages also.

Data:lv_mesg type string,

lo_current_controller type ref to if_wd_controller,

lo_message_manager type ref to if_wd_message_manager.

lo_current_controller ?= wd_this->wd_get_api( ).

lo_message_manager = lo_current_controller->get_message_manager( ).

message i076(/MYMESSAGECLASS) into lv_mesg.

lo_message_manager->REPORT_SUCCESS( message_text = lv_mesg ).

Thanks

Anzy

Former Member
0 Kudos

Hi,

Thanks, I've put a error messages.

Thank you.

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

you should build up an t100 message eg:

wd_this->m_messages->report_t100_message(exporting

msgid = id

msgno = no

msgty = msgty

p1 = parameter1

p2 = parameter2

...

).

or you can bind it to your field/context attribute

wd_this->m_messages->report_attribute_error_message(

message_text = text

element = context element where your inputfield value is on

attribute_name = name of the attribute in inputfield

).

m_messages is an attribute for the view type ref to if_wd_message_manager

which is an instance of message manager instantiated in the wddoinit.

grtz,

Koen