cancel
Showing results for 
Search instead for 
Did you mean: 

Message problem

Former Member
0 Kudos

Hi,

I am having an input field and a 'SAVE' button. When i click save, if the input field is blank i will use the wizard and generate a message saying that 'The field is blank'. This am able to achieve.

Now the message is displayed at the top. If i fill the input field and press enter, this message should disappear. How should i do this?

Accepted Solutions (1)

Accepted Solutions (1)

raja_narayanan2
Active Participant
0 Kudos

Hi.

Clear the Message area....using the method "CLEAR_MESSAGES".

this method also u can get it from code wizard itself.

Regards

Raja

Former Member
0 Kudos

Thanks a lot,

Actually i have around ten input fields. So should i write these clear messages inside the event 'onEnter' of each of these input fields. Or is there any other short way to do this?

uday_gubbala2
Active Contributor
0 Kudos

Hi Mohammed,

Actually I dont understand as to why the messages still remain on your screen even when you have entered something in the input field. Just to be completely sure I created a test component and tried it out myself. The messages are thrown when there is no input but when I make an input and then press on the button the MessageArea is no longer visible. Where have you put in the coding for triggering the mandatory checks? Did you put it in the WDDOAFTERACTION itself?

Regards,

Uday

Former Member
0 Kudos

When i click the 'SAVE' button the DB table should be updated. So am checking the mandatory fields in the SAVE button itself

uday_gubbala2
Active Contributor
0 Kudos

Hi Mohammed,

If you want to clear the messages from your MessageArea then you can do it within WDDOAFTERACTION itself. As how I was saying earlier you put here your coding to check for any unfilled fields. If there aren't any such fields then you can use the reference of your message manager to call the method CLEAR_MESSAGES.

Regards,

Uday

DATA: lt_msg TYPE cl_wd_dynamic_tool=>t_check_result_message_tab,
        lo_view_controller TYPE REF TO if_wd_view_controller.
  DATA lo_message_manager    TYPE REF TO if_wd_message_manager.

*  lo_current_controller ?= wd_this->wd_get_api( ).
  lo_view_controller ?= wd_this->wd_get_api( ).

  lo_message_manager = lo_view_controller->get_message_manager( ).

  lo_view_controller = wd_this->wd_get_api( ).

  cl_wd_dynamic_tool=>check_mandatory_attr_on_view(
    EXPORTING
      view_controller = lo_view_controller
      display_messages = abap_true
    IMPORTING
      messages = lt_msg ).

uday_gubbala2
Active Contributor
0 Kudos

Hi Mohammed,

You can follow the same approach even with your SAVE button. Just place all the coding which I had mentioned in there. But I dont understand as to why the messages still do remain in your MessageArea. The entire MessageArea should by itself become invisible as soon as you fill your fields and press on the SAVE button. Your functionality seems to have gone wrong somewhere and the system is considering them to be still unfilled.

Regards,

Uday

You can use the below approach to clear the messages. Use the message manager reference that you have obtained while trying to throw messages:

lo_message_manager->clear_messages( ).

Edited by: Uday Gubbala on Jul 22, 2009 12:25 PM

Answers (1)

Answers (1)

raja_narayanan2
Active Participant
0 Kudos

Hi Mohammed,

You no need to write the clear message in all the fileds.

just check if you have not filled any mandatory fields in the save button.

if you have not filled... raise the error message...

once you have filled it and again clicking the save button... you will check for the same.. if all the fields are filled... clear the message area.. and do the DB update.

if DB successful raise a DB Success message...

i think this will helpful for u

regards

Raja