cancel
Showing results for 
Search instead for 
Did you mean: 

BSP handler close button (X) in window

former_member227595
Active Participant
0 Kudos

Hi gurus,

Does anybody knows if is there a way to handler or execute a code when I press the close button (X) in a popup BSP window.

I have a popup which is created in a BSP extension.

My popup is created

The thing is I put a external break in the event EH_ONPOPUP , but is not been raised.

Any help is useful.

Thanks in advance.

Regards

Accepted Solutions (1)

Accepted Solutions (1)

former_member227595
Active Participant
0 Kudos

I mean, my requirement is avoid the user could close the popup. Do you know if is this possible ?

Thanks in advance.

Regards

dharmakasi
Active Contributor
0 Kudos

Hi Diego,

Little confusion with the above statement, Here i am summerising your requirement.

You have added a button when user clicks on it, system will raise a popup you want to add code on close event of the popup, is my understanding correct with your requirement?

Create close event in the same view where you have added button to open popup, if you have already created event then check in do_handle_event of the same view and check whether popup close event is triggering.

Best Regards,

Dharmakasi.

deepika_chandrasekar
Active Contributor
0 Kudos

Hi,

Create the POPUP event in the first view (from which view popup is raised same view you need to created popup close event ).

means from view1 you are calling view2 as popup you need to create event in view1 for close event.

If you want close the popup using button from popup then you need to create outbound plug in window of the popup view and call that outbound plug in the event of the button.

  DATA:lr_window TYPE REF TO ZL_class."class of window

  lr_window ?= me->view_manager->get_window_controller( ).

  lr_window->call_outbound_plug( iv_outbound_plug = 'CANCEL' ).

Create cancel outbound plug in window

call statndard cancel method

METHOD op_cancel.

  fire_outbound_plug( 'CANCEL' ).

ENDMETHOD.

Regards,

Deepika.

former_member227595
Active Participant
0 Kudos

Hi Dharmakasi.

Your understanding is correct.I have created the close event in the view. But I do not know how to caugth it when I close my window :S

Thanks

Diego

dharmakasi
Active Contributor
0 Kudos

Hi Diego,

Even if you click the X icon system will trigger the assigned close event.

Are you providing any buttons in popup? If there are buttons you can differentiate the button clikc on the X icon click by using the simple outbound plug name from the window.

Other option if you are receiving any collection from the popup then you add a check for the collection bound, In case of button click system will get collection and if it is X icon click system will not have any collection.

Best Regards,
Dharmakasi.

deepika_chandrasekar
Active Contributor
0 Kudos

Hi,

When you close it the event you gave in set_on_close_event will get called. check that event

Regards,

Deepika.

mrkarthi
Participant
0 Kudos

Hi,

You shall use the below sample code.

CALL METHOD comp_controller->window_manager->create_popup_2_confirm

  EXPORTING

    iv_title           = <Popup Title>

    iv_text           = <Popup Text>

    iv_btncombination = if_bsp_wd_window_manager=>co_btncomb_yesno " Yes or No button combination in Popup.

  RECEIVING

    rv_result         = gr_confirm_popup.


gr_confirm_popup->set_on_close_event( iv_event_name = 'CONFIRM_POPUP_CLOSED'

                                                                  iv_view = me ).

gr_confirm_popup->open( ).


Create an event handler for the event "CONFIRM_POPUP_CLOSED".


METHOD eh_onconfirm_popup_closed.


IF gr_confirm_popup IS BOUND.

     lv_flag = gr_confirm_popup->get_fired_outbound_plug( ).

     IF lv_flag = 'Y'.

       " Yes

     ELSE lv_flag = 'N'.

       " No

     ELSE.

       " X Button pressed

     ENDIF.

   ENDIF.


ENDIF.


IF lv_flag = 'Y' or 'N' or ' '.

  " Implement your logic

ENDIF.


ENDMETHOD.


Regards,

Karthi M R.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Diego,

Please insert peace of code below of yours.

dec_popup->set_on_close_event( iv_event_name = 'text_close' iv_view = me ).


Thanks and Regards,

Santosh.

dharmakasi
Active Contributor
0 Kudos

Hi,

Check the name used to create the event, its casesitive. Name you mentioned in on_close_event and the event you created both should have same name with case sensitive.

Best Regards,

Dharmakasi.

deepika_chandrasekar
Active Contributor
0 Kudos

Hi,

Put a break point in DO_HANDLE_EVENT and check which event is called when you close the popup.

POPUP event should be created in the view from where you are calling the popup not in the popup view.

Regards,

Deepika.

former_member227595
Active Participant
0 Kudos

Hi, Deepika,

I've put break either in the method DO_HANDLER_EVENT at the windows as at the view but it is only been reached in the window.

I have understood, that I could handler the event only in the view. Details in the image below.

Any help is useful.

Thanks