cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

Hi

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.
EXIT.
ENDIF.

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 ).
ELSE.
* CSN 4970 - 2007
* Save business partner-accounts and related objects (contacts, conditions,..)
cl_crm_uiu_bp_tools
=>save( ).
ENDIF.
ENDIF.


* 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
EXPORTING
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 ).
ENDIF.

ENDIF.


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

ENDMETHOD.

Accepted Solutions (0)

Answers (1)

Answers (1)

nicolas_busson
Active Contributor
0 Kudos

Hello,

For your information the following thread is giving very good hints on how to prevent saving documents with errors:

http://scn.sap.com/message/10092785

And if you need to know how to create a popup, many threads are available on SCN as well. Example:

http://wiki.sdn.sap.com/wiki/display/CRM/Calling+Custom+component+as+popup+from+a+standard+component...

Regards,

Nicolas.

Former Member
0 Kudos

Thanks  A LOT For your reply  nicolas

we already implement badi for partner funtions in order_save badi

but now my requirement is to stop the transaction if it contains any errors ,the transaction wont be save,for this how to write the code part in order_Save badi

please let me know i am new to sap crm webui

please help me out from this?

its very needfull to me

Former Member
0 Kudos

Hi Anithosh,

Please raise exception in order save badi in its method to not save record. SAP already given exception paramter in ORDER_SAVE method badi.

Thanks,

Jigar Parikh

Former Member
0 Kudos

Hi thanks for your reply

i am try to implement order_save badi,in that badi

i am writeing the code part in check_before_save.

but can u let me know how to write the code part there?

i am new to crm

please send me code part for my requirement its very helpfull to me

i need to check mandatory fields

in general data mandatory filed:- CRM ACCOUNT ID

CLASSIFICATION TAB MANDATORY FIELD:-  origen

parties involved assignment block manadatory fileds:- Responsible org unit

                                                                      resposible employee

PRODUCTS ASSIGNMENT BLOCK MANDATORY FILEDS:- product id

                                                            amount

organicational data assignement block manadatory fileds:- sales org unit

                                                                                sales organization

                                                                                sales office

                                                                                sales group

can u please send me code part for this checking?