cancel
Showing results for 
Search instead for 
Did you mean: 

How to close window tab using popup 'OK' button in ABAP Web DynPro?

shiromani_soni1
Active Participant
0 Kudos

Hi,

I have a requirement to display a popup when user click on a custom link given in ESS. Popup ALV displays some records and user selects any of the single row after that as soon as user clicks on 'OK' button of popup, it should be closed as well as the tab of 'Interner Explorer' should also be closed.

I am able to close popup however not able to close IE tab though I have used 'EXIT' outbound plug and fire-plug method on 'OK' button event of popup.

Below is the code for popup OK button to close popup as well as IE tab:

"To close PopUp window

wd_comp_controller->go_window->close( ).

* To Close Window

DATA LO_API_V_MAIN TYPE REF TO IF_WD_VIEW_CONTROLLER.

LO_API_V_MAIN = WD_THIS->WD_GET_API( ).

DATA : LO_WINDOW TYPE REF TO IF_WD_WINDOW_CONTROLLER.

CALL METHOD LO_API_V_MAIN->GET_EMBEDDING_WINDOW_CTLR

RECEIVING

RESULT = LO_WINDOW.

DATA : IT_PARAMETERS TYPE wdr_event_parameter_list,

WA_PARAMETERS TYPE wdr_event_parameter,

LV_DATA       TYPE REF TO DATA.

FIELD-SYMBOLS : <FS_PARA> TYPE ANY.

CREATE DATA LV_DATA TYPE C.

ASSIGN LV_DATA->* TO <FS_PARA>.

<FS_PARA> = 'X'.

WA_PARAMETERS-NAME = 'CLOSE_WINDOW'.

WA_PARAMETERS-VALUE = LV_DATA.

INSERT WA_PARAMETERS INTO TABLE IT_PARAMETERS.

CLEAR WA_PARAMETERS.

CALL METHOD LO_WINDOW->IF_WD_VIEW_CONTROLLER~FIRE_PLUG

EXPORTING

PARAMETERS = IT_PARAMETERS

PLUG_NAME  = 'EXIT'.


I am not able to understand the cause as values are passing perfectly however not getting desired output.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Shiromani,

Try using the code below instead:

* To Close Window

data : LO_API_V_MAIN type ref to if_wd_view_controller,

         LO_WINDOW  type ref to if_wd_window_controller,

         IT_PARAMETERS  type wdr_event_parameter_list,

         WA_PARAMETERS       type   wdr_event_parameter,

         LV_DATA type ref to data.

         field-symbols <fs> type any.

LO_API_V_MAIN = wd_this->wd_get_api( ).

LO_WINDOW  = LO_API_V_MAIN->get_embedding_window_ctlr( ).

WA_PARAMETERS-name = 'CLOSE_WINDOW'.

create data LV_DATA type c.

assign LV_DATA->* to <fs>.

<fs> = 'X'.

WA_PARAMETERS-value = LV_DATA.

insert WA_PARAMETERS into table IT_PARAMETERS.

LO_WINDOW->if_wd_view_controller~fire_plug(

exporting plug_name = 'EXIT'

           parameters = IT_PARAMETERS ).

endmethod.

Regards,

Ashvin

shiromani_soni1
Active Participant
0 Kudos

Hi Ashvin,

Thanks for writing this code to me hoever it is same as I have mentioned in the discussion. However my requirement is, how to close parent window using child popup 'OK' button? Let me know if you can assist into this.

Regards,

Shiromani Soni

Former Member
0 Kudos

Shiromani,

Copy the code above and use it.

I am sure that now you will be able to close the IE browser.

I have used this code before and it has worked for me.

Regards,

Ashvin

Former Member
0 Kudos
ramakrishnappa
Active Contributor
0 Kudos

Hi Shiromani,

Go to the window, and make sure that the outbound plug 'EXIT'  is marked as interface and also chosen the plug type 'EXIT Plug'.

Regards,

Rama

shiromani_soni1
Active Participant
0 Kudos

I have already done this as per screenshot, still it is not working.

ramakrishnappa
Active Contributor
0 Kudos

Hi Shiromani,

You have already closed the popup window using code WD_COMP_CONTROLLER->GO_WINDOW->CLOSE( ) and now you need to close the main window ZTEST_HR right?

If so, the EXIT plug needs to be created on window ZTEST_HR and need to get this window controller and trigger the exit plug.

Hope this helps you.

Regards,

Rama

shiromani_soni1
Active Participant
0 Kudos

Hi Ramakrishnappa,

Thank you for this explanation. Is there any way to close ZTEST_HR window as soon as POPUP window closes? How can I achieve this functionality?

Regards,

Shiromani Soni

harsha_jalakam
Active Contributor
0 Kudos

Hi ,

Please check this for achieving , on how to close browser, on a particular action. You can use this same code.

Regards,

Harsha

shiromani_soni1
Active Participant
0 Kudos

Hi Harsha,

Where should I check?

Regards,

Shiromani Soni

harsha_jalakam
Active Contributor
0 Kudos

Hi,

Regards,

Harsha

ramakrishnappa
Active Contributor
0 Kudos

Hi Shiromani,

Here, you need to create EXIT plug in window ZTEST_HR and your code already getting the window controller of ZTEST_HR and it should work fine.

So, just create an EXIT plug inside ZTEST_HR window.

Regards,

Rama

shiromani_soni1
Active Participant
0 Kudos

Hi Rama,

I have created the EXIT plug in window ZTEST_HR however where would I write "OnAction" event code as this window is blank and POPUP "OK" button is embedded in another window.

Using POPUP "OK" button can I close this parent window? If yes, How? Explain in brief.

Regards,

Shiromani Soni

ramakrishnappa
Active Contributor
0 Kudos

Hi Shiromani,

Oh, here your popup is triggered from the ESS window.

So, you need to close the main window from which the popup is called.

Let us say you have a link "openDetails" in ESS view V_ESS_MAIN, from where the popup window is called.

Now, you need to create exit plug inside the ESS view's main window and OK button event should be handled inside the view V_ESS_MAIN

Hence the ESS main window gets closed, not the window of your component.

Hope this helps you.

Regards,

Rama

shiromani_soni1
Active Participant
0 Kudos

Hi Rama,

Thank you for this solution. Let me check if it works, one more thing I would like to ask to how to read value of a variable or string from Assistence class method to WD using wd_assist?

Write the syntax, would be a great help.

Regards,

Shiromani Soni

ramakrishnappa
Active Contributor
0 Kudos

Hi Shiromani,

To access any attribute / methods of an assistance class, it should be made as PUBLIC.

Let us say you have attribute GV_NAME inside class and its marked as public.

Then inside WD component, you can access using wd_assist->gv_name.

Similarly, you can have method GET_DETAILS( ) and its public method.

          wd_this->get_datails(

Regards,

Rama

shiromani_soni1
Active Participant
0 Kudos

Hi Rama,

I have created an Enhancement in WD, where in post exit method, I have written:

DATA: ld_application_id TYPE string.

          wd_assist->ld_application_id.

Where ld_application_id is coming from method link_created, but I am not able to access this variable using wd_assist giving below error:

Statement "WD_ASSIST->LD_APPLICATION_ID" is not defined.

ramakrishnappa
Active Contributor
0 Kudos

Hi,

You cannot access method parameters using wd_assist.

Sample:

          wd_assist->link_created(

                    importing

                         id_application_id = ld_application_id )

Here: id_application_id is parameter from method LINK_CREATED, check out if it is of type returning, if so

          wd_assist->link_created(

                    receiving

                         id_application_id = ld_application_id )

Hope this helps you.

Regards,

Rama