Skip to Content
Former Member
Dec 04, 2012 at 11:20 AM

how to show popup window on eh_onsave()event handler when lead contains errors?



i am requesting you crm expects please help me in this requirement

i am createing a lead from business role zmarkingpro,

i filled some fields in that lead creation and i try to save my lead transaction even its shows error messages on the screen,

now my requirement is i wont save my lead transaction when in webui if any error messages appear

if i try to save even in webui contains error messages i want to show a popup window with message and that lead transaction wont be saved in the database.

how can do this requirement?

can anyone please let me know the code and step by step process

this is code for eh_onsave() method

METHOD eh_onsave.

DATA: lr_tx TYPE REF TOcl_crm_bol_custom_tx_ctxt,
lr_access TYPE REF TOif_crm_uiu_bt_channel_aspects,
lr_root_entity TYPE REF TOcl_crm_bol_entity,
lv_dedup_popup_enabled TYPE abap_bool,
lv_found_prime_merged_lead TYPE crmt_boolean.

DATA: lr_msg_srv TYPE REF TOcl_bsp_wd_message_service,
lr_controller TYPE REF TOcl_bsp_wd_appl_controller.

* cancel save because of mandatory fiels
lr_controller ?= comp_controller->m_parent.
lr_msg_srv ?= me->view_manager->get_message_service( ).
IF cl_crm_uiu_bt_tools=>mandatory_flds_no_save_allowed(ir_controller = lr_controller
ir_msg_srv = lr_msg_srv ) = abap_true.

lr_tx = cl_crm_uiu_bp_tools=>get_custom_tx_ctxt( ).
IF lr_tx->if_bol_transaction_context~check_save_needed( ) =abap_true.
IF cl_crm_uiu_bt_partner_popup=>get_quick_create_status( ) = abap_true.
*Save business partner-accounts and related objects (contacts, conditions,..)
cl_crm_uiu_bp_tools=>save( ).
cl_crm_uiu_bt_partner_popup=>set_quick_create_status(EXPORTING iv_quick_create = abap_false ).
* CSN 4970 - 2007
* Save business partner-accounts and related objects (contacts, conditions,..)
cl_crm_uiu_bp_tools=>save( ).

* save the LEAD
* Skip the mandatory fields check in the super class,
* because it was already executed above.
gv_skip_mand_fields_check = abap_true.
CALL METHOD super->eh_onsave
htmlb_event = htmlb_event
htmlb_event_ex = htmlb_event_ex.

* Logic for the deduplication in IC-> aligment IC with UIU
lr_root_entity ?= me->typed_context->btorder->collection_wrapper->get_current( ).
lr_access = cl_crm_uiu_bt_channel_asp_fac=>get_instance( ).

lv_dedup_popup_enabled = lr_access->if_crm_uiu_channel_aspects~is_data_loss_enabled( ).
* This is in IC role
IF lv_dedup_popup_enabled = abap_false.
lv_found_prime_merged_lead = load_prime_lead( ).
IF lv_found_prime_merged_lead = abap_true.
lr_access->after_lead_merged( ir_lead_entity =lr_root_entity ).


** CALL METHOD cl_crm_uiu_bt_tools=>save
** ir_node = me->typed_context->btadminh.
** me->typed_context->btadminh->collection_wrapper->publish_current( ).
** reset views to display-only
** me->view_group_context->reset( ).


lead contains any error then the trasaction wont be save.