Defining the Method for Calling the
Query
In the tutorial application, you have to define a method that calls the query. In this method, you have to obtain the ID of the selected customer and provide this value to the composite class. You then have to call the query class.
...
1. In the Laptop UI explorer, expand the servapp development component.
2. Expand the nodes Web Dynpro → Components → CustomerComp.
3. Double-click Component Controller.
4. Choose the Methods tab.
5. Choose New.
6. In the New Method wizard, create a method with the name fireQuery.
7. In the Methods tab, click fireQuery with the secondary mouse button and choose Navigate to → Implementation.
8. Enter the following code:
fireQuery method
public void fireQuery() { //@@begin fireQuery() int Sel = wdContext.nodeCUSTOMERS_CUSTOMERHEADER().getLeadSelection(); if (Sel > -1) { Qid = wdContext.nodeCUSTOMERS_CUSTOMERHEADER(). getCUSTOMERS_CUSTOMERHEADERElementAt(Sel).getCUSTOMERID(); SQ.getQueryInput().setCUSTOMERID(Qid); } try { SQ.execute(); } catch (CMIException e) { e.printStackTrace(); } wdContext.nodeQueryResult().invalidate(); //@@end } |