Problem with deleting Web UI message
i have two fields(let say Field1 & Field2) in view BT111H_OPPT/Details, context node - BTOPPORTH, based on field1(field1 is drop down contains value A & B) i have to make field2 mandatory at run time. if field1 is 'A' then field2 should be mandatory and if 'B' then non-mandatory.
i have done that by implementing GET_p method and it is working fine. now problem is that when first i select 'A' in field1 then Field2 is mandatory and message is showing in Web UI and after that if i choose 'B' in field1 then it makes the field2 non-mandatory but the error message remains same in UI.
can anyone please suggest me how can i delete that error message in case of non-mandatory..?
i used below codes in GET_P but it is not deleting the message...even i deleted that field from DO_VALIDATE_INPUT but still showing error message in UI.
DATA: lr_core TYPE REF TO cl_crm_bol_core,
lr_mess_cont_manager TYPE REF TO cl_crm_genil_mess_cont_manager,
lr_global_message_cont TYPE REF TO cl_crm_genil_global_mess_cont.
lr_core = cl_crm_bol_core=>get_instance( ).
CHECK lr_core IS BOUND.
lr_mess_cont_manager = lr_core->get_message_cont_manager( ).
lr_global_message_cont = lr_mess_cont_manager->get_global_message_cont( ).
CALL METHOD lr_global_message_cont->IF_GENIL_MESSAGE_CONTAINER~DELETE_MESSAGES
IV_OBJECT_NAME = 'BTOPPORTH'
** IV_OBJECT_ID = sy-msgid
IV_MSG_ID = 'BSP_WD'
IV_MSG_NUMBER = '022'.
The mandatory messages are raised using a global message class in do_finish_input method of that particular view.
Redefine do_finish_input and call super then get the value of field 1 and place your logic and then delete message from returning parameter GLOBAL_MESSAGES->delete_message(..)