X Debugging Exercises
X Debugging Exercises
1 Development Objectives
2 Result
Optional part I:
You will learn how you to change code
on the fly in a debugging session
3 Prerequisites
You have launched the SAP NetWeaver Developer Studio.
You have selected the Web Dynpro perspective.
The structure of your project WebDynpro_Quiz is currently displayed in
the Web Dynpro Explorer. Please take a moment to deploy and run this
application so that you are familiar with the application logic
4 Debugging, Step-by-Step
Save the new project data by choosing Save All Metadata from the toolbar.
4-2-2 Define a Dictionary structure type.
Choose Finish.
Save the new project data by choosing Save All Metadata from the toolbar.
4-2-3 Create the view context for view Exc06_TableView with structure
binding.
Choose Next.
Select structure
com.sap.training.wd.exc06.
Person
Choose Next.
Select the structure elements firstname,
lastname, date_begin, and date_end.
Choose Finish.
Save the new project data by choosing Save All Metadata from the toolbar.
Choose Edit.
Choose Finish.
Open the View Designer for
Exc06_TableView and choose
the table UI element again.
Save the new project data by choosing Save All Metadata from the toolbar.
4-2-5 Add the values of the input fields of Exc06_StartView to the table of
Exc06_TableView.
wdThis.wdGetContext().nodePerson().addElement(person);
//@@end
}
This method is called, after the user has made some changes to the input fields in
the StartView and pressed the Next button.
The Web Dynpro automatically stores the values of the input fields to the
component context. Before the TableView is shown, the onPlugFromStartView
is called. Here you’ll get the values from the component context, create a new
person element, set the attributes of the person element with the context data,
and create a new person node in the view context. Because the view context is
bound to the table as data source, the data is then shown in the table.
Save the new project data by choosing Save All Metadata from the toolbar.
Select
Web Dynpro Component Exc05_Component
Interface View Exc05_WindowInterfaceView
Startup Plug Default
and choose Finish.
Successful result:
To deploy and run the application, choose Deploy new Archive and Run
.
Successful result:
6-1-1-1 Define the component context value node Person for the component
controller.
Choose Next.
Select structure
com.sap.training.wd.exc06.
Person
Choose Next.
Select the structure person.
Choose Finish.
Successful result:
Save the new project data by choosing Save All Metadata from the toolbar.
6-1-1-2 Define view context value node Person for view Exc06_TableView.
This has already been done in exercise 4-2-3.
Choose Next.
In the next screen select all attributes from
the structure Person.
Choose Finish.
Successful result:
Save the new project data by choosing Save All Metadata from the toolbar.
Choose Exc06_TableDetailView
Choose Finish
Define navigation links
from to
Outbound plug Inbound plug
toDetailView fromTableView
toTableView fromDetailView
In Exc06_TableView
Save the new project data by choosing Save All Metadata from the toolbar.
Successful result:
Choose Finish.
Save the new project data by choosing Save All Metadata from the toolbar.
Name: DeleteEntry
Text Delete entry
Event Handler: Default
Fire Plug: <none>
Choose Finish.
Save the new project data by choosing Save All Metadata from the toolbar.
6-2-3 Implement the event handler for deleting a person entry..
Choose the Implementaion tab of Exc06_TableView
Insert the following code in method onActionDeletePerson(…)
(For your convenience: You can cut and paste the code from the
implementation of Sol06_TableView)
//@@begin onActionDeleteEntry(ServerEvent)
int n = wdContext.nodePerson().size();
int leadSelected = wdContext.nodePerson().getLeadSelection();
//@@end
}
Save the new project data by choosing Save All Metadata from the toolbar.
text: <>
At runtime this will be
replaced by the text Delete
entry that you have defined
when you created the
DeleteEntry action.
onAction DeleteEntry
Save the new project data by choosing Save All Metadata from the toolbar.
Save the new project data by choosing Save All Metadata from the toolbar.
Save the new project data by choosing Save All Metadata from the toolbar.
. . .
return ++days;
//@@end
}
Save the new project data by choosing Save All Metadata from the toolbar.
Choose Finish
Save the new project data by choosing Save All Metadata from the toolbar.
6-3-4 Update table Person on Exc06_TableView. Add the additional attributes
DATE_BEGIN, DATE_END, and DURATION from structure Person.
In the Web Dynpro Explorer, expand the nodes
WD01_Basics/Web Dynpro/Web Dynpro Components/Views..
Choose Exc06_TableView, open the context menu and choose Edit.
Choose Finish.
Save the new project data by choosing Save All Metadata from the toolbar.
Successful result: