on 03-15-2013 5:41 PM
Hi SAP CRM Experts,
This is sudhakar, i am new to CRM. I got requirement like, create a toolbar delete button, when i click on delete button it must ask popup confirmation like " Are you want to delete" message in popup window with yes or no options... i know how to create toolbar delete button and how to delete the selected record without popup confirmation window. Now i want to know how to get popup confirmation window when i click on delete button, and how can delete the selected record by click on yes option in popup window, where i have to write the code? plz explain with code...
Thanks in advance
Hi
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
* TITLEBAR = ' '
* DIAGNOSE_OBJECT = ' '
text_question = 'Document No is generated'
text_button_1 = 'Yes'(001)
* ICON_BUTTON_1 = ' '
text_button_2 = 'No'(002)
* ICON_BUTTON_2 = ' '
* DEFAULT_BUTTON = '1'
display_cancel_button = ' '
* USERDEFINED_F1_HELP = ' '
* START_COLUMN = 25
* START_ROW = 6
* POPUP_TYPE =
* IV_QUICKINFO_BUTTON_1 = ' '
* IV_QUICKINFO_BUTTON_2 = ' '
IMPORTING
answer = lv_ans
* TABLES
* PARAMETER =
EXCEPTIONS
text_not_found = 1
OTHERS = 2
.
IF sy-subrc <> 0.
ELSEIF lv_ans EQ '1'.
ENDIF.
Regards,
Prakash.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prakash,
Thanks for your reply,
Let me know Where can i write the code which you send. i mean can i write the code in the Event handler of the Delete button or in any method.
Once i click on the "Yes" option on Popup Confirmation window, how it goes to delete the record. i mean how we are going provide linkage between yes option and selected field through this FM.
In Above FM,Which parameters i have to pass in order to satisfy the above two requirements.
or is there any alternate code to satisfy the above two things.
Plz reply...
Regards,
Sudhakar.
Hi Sudhakar,
In the DELETE Button
DATA: lv_title TYPE string,
lv_text TYPE string.
( confirm_popup is ref to if_bsp_wd_popup )
( windw manager is ref to if_bsp_wd_window_manager )
( create_popup_2_confirm is from if_bsp_wd_window_manager )
IF confirm_popup IS NOT BOUND.
lv_title = 'Confirmation'.
lv_text = 'Do you want to Delete this?'.
CALL METHOD comp_controller->window_manager->create_popup_2_confirm
EXPORTING
iv_title = lv_title
iv_text = lv_text
iv_btncombination = if_bsp_wd_window_manager=>co_btncomb_yesno
RECEIVING
rv_result = confirm_popup.
confirm_popup->set_on_close_event( iv_event_name = 'CONFIRM' iv_view = me ).
ENDIF.
( in the above we are making to trigger an event CONFIRM )
( in the confirm event we call the oubound plug )
data : lv_decision type string.
lv_decision = lv_popup->get_fired_outbound_plug( ).
if lv_decision = 'YES'. "this will get the action from POPUP
Now Create a event CONFIRM
In the Confirm write the DELETE code which you have already done
Regards,
Satya Prakash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prakash,
Thanks for your reply..
As you said i wrote the following code in DELETE event of DELETE Button:
DATA: lv_title TYPE string,
lv_text TYPE string.
Data: confirm_popup type ref to if_bsp_wd_popup .
IF confirm_popup IS NOT BOUND.
lv_title = 'Confirmation'.
lv_text = 'Do you want to Delete this?'.
CALL METHOD comp_controller->window_manager->create_popup_2_confirm
EXPORTING
iv_title = lv_title
iv_text = lv_text
iv_btncombination = if_bsp_wd_window_manager=>co_btncomb_yesno
RECEIVING
rv_result = confirm_popup.
confirm_popup->set_on_close_event( iv_event_name = 'CONFIRM'
iv_view = ME ).
ENDIF.
And then i created CONFIRM event, in that i wrote the following code...
data : lv_decision type string,
lv_popup type ref to if_bsp_wd_popup.
DATA : lr_entity TYPE REF TO cl_crm_bol_entity,
lr_current TYPE REF TO if_bol_bo_property_access,
lr_col TYPE REF TO if_bol_bo_col,
lr_core TYPE REF TO cl_crm_bol_core,
lv_size TYPE i.
lv_decision = lv_popup->get_fired_outbound_plug( ).
if lv_decision = 'YES'. "this will get the action from POPUP
lr_col ?= typed_context->result->collection_wrapper->get_marked( ).
lv_size = lr_col->size( ).
IF lv_size > 0.
DO lv_size TIMES.
IF sy-index = 1.
lr_current = lr_col->get_first( ).
ELSE.
lr_current = lr_col->get_next( ).
ENDIF.
lr_entity ?= lr_current.
typed_context->result->collection_wrapper->remove( lr_current ).
lr_entity->delete( ).
ENDDO.
lr_core = cl_crm_bol_core=>get_instance( ).
lr_core->modify( ).
typed_context->result->deselect_all( ).
ENDIF.
endif.
----------------------------------------------------------------------
It is not working and even i didn't getting any popup confirmation window when i click on delete button.
Please correct the code and resend to me?
Please tell the procedure?
Thank you...
Regards,
Sudhakar
Instead of defining confirm_popup as a local variable in DELETE event, try defining it as a global variable in attributes section of your 'View' implementation class (ZL_ZXX_IMPL). This way, you need not define it again as a local variable in CONFIRM event. Wherever you used lv_popup in CONFIRM event, change it with confirm_popup which is now global variable and accessible throughout your IMPL class.
Please try that and see if it works.
Regards,
Satya Prakash.
Hi
I did the same but then also popup not coming.
In my case I need to show the popup after clicking on accept button and then continue the code written in an ACCEPT event(around 1000 lines).
Please reply on my email id --> hjain5419@gmail.com.
Thanks in advance.
Harshit.
Hi Harshit,
Define the popup variable at implementation class level and not a local variable.
Try following in event handler of accept
IF gv_popup IS NOT BOUND.
gv_popup = me->comp_controller->window_manager->CREATE_POPUP_2_CONFIRM( ).
ENDIF.
IF gv_popup IS BOUND.
gv_popup->open( ).
gv_popup->set_on_close_event( ).
ENDIF.
User | Count |
---|---|
4 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.