Hi All
I want to remove an error from the UI Screen , Please find the attached screenshot and the code which i have embedded in CPG_MAIN component in the Do_Prepare_Output .
The Scenario is that I need to have the same coupon number as Campaign ID , when i add the same coupon number as the campaign ID in the standard coupon field the error is displayed . If i rename the coupon Code it blows away .
I need the same coupon code to fetch the discount that i have imparted for that particular Campaign ID , but I dint find any relationship between coupon number and Discount so i used that campaign ID as the coupon number .
The message container is empty and the message is shown in the buffer , But even after resetting , the message is displayed . Please find the below code i have written for removing/resetting the error message .
CODE :
DATA: lr_core TYPEREFTO cl_crm_bol_core,
lr_msg TYPEREFTO cl_crm_genil_mess_cont_manager.
**Create a instance of BOL
lr_core = cl_crm_bol_core=>get_instance( ).
*
**Create a instance of message container
lr_msg = lr_core->get_message_cont_manager( ).
**Reset the container to delete the messages
*lr_global_message->DELETE_MESSAGES
lr_msg->reset( ).
DATA: lo_core TYPEREFTO cl_crm_bol_core,
* lr_msg TYPE REF TO cl_crm_genil_mess_cont_manager,
lo_global_msg_cont TYPEREFTO CL_CRM_GENIL_GLOBAL_MESS_CONT,
lo_mess_core TYPEREFTO CL_CRM_GENIL_MESS_CONT_MANAGER,
p_mstyp TYPE SYMSGTY,
lt_messages TYPE CRMT_GENIL_MESSAGE_TAB,
lt_messagetab TYPE CRMT_GENIL_MESS_CONT_TAB,
lo_message_container type CRMT_GENIL_MESS_CONT_REF,
lt_msg_tab type CRMT_GENIL_MESSAGE_TAB ,
ls_message type CRMT_GENIL_MESSAGE.
lo_core = cl_crm_bol_core=>get_instance( ).
* lo_core->start_up( iv_appl_name = 'BT' ).
lo_global_msg_cont = lo_core->get_global_message_cont( ).
try.
lo_mess_core = lo_core->get_message_cont_manager( ).
catch cx_bol_exception.
endtry.
* if lo_mess_core is bound and lo_global_msg_cont is not bound.
lo_global_msg_cont = lr_msg->get_global_message_cont( ).
* endif.
if lo_global_msg_cont isnotbound.
message'No global message container exists!'type'S'.
exit.
endif.
lo_global_msg_cont->if_genil_message_container~get_messages(
exporting
iv_message_type = p_mstyp
importing
et_messages = lt_messages ).
if lr_msg isbound.
lr_msg->get_all_message_containers( importing et_result = lt_messagetab ).
loopat lt_messagetab into lo_message_container.
refresh lt_msg_tab.
callmethod lo_message_container->get_messages
exporting
iv_message_type = p_mstyp
importing
et_messages = lt_msg_tab.
appendlinesof lt_msg_tab to lt_messages.
endloop.
deleteadjacentduplicatesfrom lt_messages comparingtypeidnumbermessage.
endif.
if lt_messages isinitial.
message'No messages found!'type'S'.
endif.
loopat lt_messages into ls_message.
lo_global_msg_cont->if_genil_message_container~delete_messages(
exporting
iv_msg_id = ls_message-id
iv_msg_number = ls_message-number ).
endloop.
lr_msg->delete_message_cont( EXPORTING IV_OBJECT_NAME = 'Campaign'
).
*
*lr_msg->delete_message_cont( EXPORTING iv_msg_id = 'CRM_MKTPL_COUP'
*iv_msg_number = '011' ).
endmethod.
Any suggestions / answers would really be helpful .
Thanks in advance .
Vikrant Tuli .