Skip to Content
Former Member
Feb 27, 2012 at 08:03 AM

Clearing message area in Web UI


Dear Experts,

I have kept passport field as mandatory in account creation application. I am displaying custom error message if its not entered. Assume end user id not entering passport and fills other fields and presses enter. In EH_ONSUBMITONENTER event I am throwing custom error message prompting user to enter a value. Now user enters a passport no and directly presses SAVE(Note: He does not press ENTER). Now I display a confirmation popup to user. Issue is that the error message Enter passport no is still displayed in the background.

Ideally I am trying to clear the error message in EH_ONSAVE but its not working out. I used below code,

lr_msg ?= me->view_manager->get_message_service( ).
        CHECK lr_msg IS BOUND.

        DATA: lr_core TYPE REF TO cl_crm_bol_core,
              global_message_cont TYPE REF TO cl_crm_genil_global_mess_cont,
              lt_messages TYPE crmt_genil_message_tab,
              ls_message TYPE crmt_genil_message.

        lr_core = cl_crm_bol_core=>get_instance( ).
        lr_msg->collect_messages( iv_message_type = if_genil_message_container=>mt_error iv_delete_read_messages = abap_false ).

        CALL METHOD lr_core->get_global_message_cont
            rv_result = global_message_cont.

        CALL METHOD global_message_cont->if_genil_message_container~get_messages
            iv_message_type = 'E'
            et_messages     = lt_messages.
        LOOP AT lt_messages INTO ls_message.
          CALL METHOD global_message_cont->if_genil_message_container~delete_messages
              iv_msg_id     = ls_message-id
              iv_msg_number = ls_message-number.

In above code in table global_message_cont->if_genil_message_container~get_messages is not returning the error message into table lt_messages. Kindly share your inputs for the same. I searched forum for threads but could not find a relevant one except [Clear error message|[]



Edited by: bharath padmanabhan on Feb 27, 2012 1:33 PM

Edited by: bharath padmanabhan on Feb 27, 2012 1:35 PM