cancel
Showing results for 
Search instead for 
Did you mean: 

WD ABAP: call dialog window from component controller method

Former Member
0 Kudos

Hi all,

I need to call a dialog box from a method in the component controller. It would be helpful if u could post the code too.

Thanks,

Sravanthi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Maksim,

No, it is not the same view from which i call the comp controller. Sorry, I guess I was not clear with my question. This is how it is:

I'm calling a method in the component controller from a method in view, say 'BOOKVIEW' which is in 'MAINWINDOW'.

wd_comp_controller->add_to_cart( ).

In the ADD_TO_CART method of the component controller, i need to open a dialog window. The dialog window's name is 'OPTIONWD' and there's a view embedded in it called 'OPTIONVIEW'. and i need to write the code to open this popup window in the 'ADD_TO_CART' method.

Thanks for all your help.

-Sravanthi

former_member182372
Active Contributor
0 Kudos

Sorry, Spravanthis, seems like I don`t have an idea how to solve "An Instance of the View OPTIONWD Already Exists in the Component" issue. May be <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9e242bf5-0901-0010-c99c-83c180163c73">this tutorial</a> can be useful for you.

Or in your system you will find the detailed example component WDR_TEST_POPUPS_RT_00. It is located in package SWDP_TEST.

Best regards, Maksmim Rashchynski.

thomas_szcs
Active Contributor
0 Kudos

Hi Sravanthi,

The exception is raised whenever a view becomes visible twice. It seems that view OPTIONVIEW was about to be displayed twice. This is not possible.

Btw.: Please use the button enumerations that are offered for popup windows. I saw that your call does not specify them.

Best regards,

Thomas

Answers (4)

Answers (4)

Former Member
0 Kudos

Maksim,

Thanks for all your help.

Former Member
0 Kudos

I have a method in a view of the main window that calls a method in the component controller. the code goes like this:

wd_comp_controller->add_to_cart( ).

In the method add_to_cart of the component controller, i need to call a popup window. I created a window and embedded a view in that window. and i wrote the code that i previously sent to call this dialog box.

former_member182372
Active Contributor
0 Kudos

So, OPTIONWD window contains view which should be in popup? Is it not the same view from where you call component controller?

Former Member
0 Kudos

Hi Maksim,

this is the code i wrote:

DATA: api_component TYPE REF TO if_wd_component,

window_manager TYPE REF TO if_wd_window_manager.

api_component = wd_this->wd_get_api( ).

window_manager = api_component->get_window_manager( ).

wd_this->window = window_manager->create_window(

window_name = 'OPTIONWD'

close_button = abap_false ).

wd_this->window->open( ).

When i test it, this is the error i get.

"An Instance of the View OPTIONWD Already Exists in the Component"

how do i correct it?

Thanks,

Sravanthi

former_member182372
Active Contributor
0 Kudos

Hi Sravanthi,

Hm, what WD component strucutre you have? What is window-views hierarchy? From which controller are you calling menyioned code?

Best regards, Maksim Rashchynski.

former_member182372
Active Contributor
0 Kudos

Hi Sravanthi,

data:
    l_componentcontroller_api type ref to if_wd_component.
    l_componentcontroller_api = wd_this->wd_get_api( ).

And afterwards use

IF_WD_COMPONENT->GET_WINDOW_MANAGER->CREATE_WINDOW

Best regards, Maksim Rashchynski.