cancel
Showing results for 
Search instead for 
Did you mean: 

Generic Search

Former Member
0 Kudos

Hi all

I have implementated a search method that open ups a new window.

IWDWindowInfo windowinfo =

wdComponentAPI.getComponentInfo().findInWindows("Search");

IWDWindow window =

wdComponentAPI.getWindowManager().createModalWindow(windowinfo);

window.setWindowPosition(150, 100);

window.show();

wdContext.currentPopUpElement().setWindowInstance(window);

Now i want to make it generic so that same window opens up on every search but the data in it varies depending on the parameter passed.

In the above code no parameter is specified that should go into the new window (As per my requirement). Is there any way to pass the parameter into the new window so that the data in that popup window can be changed depending on that parameter.

Guys please response.

This is really urgent.

Thanxs in Advance

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Thanks Roy,

I have followed this approach..its wrking.

Former Member
0 Kudos

Thanks Roy,

I have followed this approach..its wrking.

former_member751941
Active Contributor
0 Kudos

Hi Gurmat,

Follow the steps.

Step1: Create a WD Component.

Step2: Under Component Controller create a Value Node “EmployeeInfo” with attribute “EmployeeName” and “Position” and a context attribute “WindowInstance” of type “com.sap.tc.webdynpro.services.session.api.IWDWindow”

Step3: Create 2 Views

i>EmployeeView

Layout like

-


Employee Name : EmployeeInfo.EmployeeName(InputField)

Employee Position : EmployeeInfo.Position(InputField)

DisplayResultButton

ii>DisplayView

Layout like

-


Employee Name : EmployeeInfo.EmployeeName(TextView)

Employee Position : EmployeeInfo.Position(TextView)

CloseWindowButton

Step3: Create 2 Windows

1>EmployeeWindow

2>DisplayWindow.

Under “EmployeeWindow” add the “EmployeeView”

and “DisplayWindow” add the “DisplayView”

Step3: Go to the Diagram View. Do the mapping between “EmployeeView” and “Component Controller” and between “DisplayView” and “Component Controller”

Step4: Associate action “DisplayResult” with the “DisplayResultButton” and use this code inside the Implementation of “EmployeeView”

public void wdDoInit()

{

//@@begin wdDoInit()

wdContext.nodeEmployeeInfo().addElement(wdContext.createEmployeeInfoElement());

//@@end

}

public void onActionDisplayResult(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionDisplayResult(ServerEvent)

IPrivateEmploeeView.IEmployeeInfoElement emp = wdContext.createEmployeeInfoElement();

emp.setEmployeeName(wdContext.currentEmployeeInfoElement().getEmployeeName());

emp.setPosition(wdContext.currentEmployeeInfoElement().getPosition());

wdContext.nodeEmployeeInfo().addElement(emp);

IWDWindowInfo windowInfo =(IWDWindowInfo) wdComponentAPI.getComponentInfo().findInWindows(

"DisplayWindow");

// create the Window

IWDWindow window = wdComponentAPI.getWindowManager().createWindow(windowInfo, true);

window.setWindowPosition(WDWindowPos.CENTER);

window.setTitle("WindowTitle");

window.setWindowSize(100,100);

// Save WindowInstance in Context

wdContext.currentContextElement().setWindowInstance(window);

// and show the window

window.show();

//wdThis.wdFirePlugInDisplay();

//@@end

}

Step5: Associate action “CloseWindow” with the “CloseWindowButton

” and use this code inside implementation of “DisplayView”

public void onActionCloseWindow(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionCloseWindow(ServerEvent)

IWDWindow window = wdContext.currentContextElement().getWindowInstance();

window.destroyInstance();

//@@end

}

Regards,

Mithu

Former Member
0 Kudos

Hi,

Do you need any more help on this?

If yes, let us know what.

If no, please award points and close the thread.

Rgds,

Roy

Former Member
0 Kudos

Hi,

The Window is tied up to a component.

You can create a context element at the component and map it to both the view which called this window and the view that this window presents.

Than, before you call this window set the parameter value in view which calls this window and pick it up in the 2nd view in it's Init() method.

Hope it helps,

Roy