A wizard let users to perform tasks that otherwise be more complicated and take longer.
Wizard offers:
Simplification when the steps for completing a task are very complex.
Support when expertise is required.
Mental relief when the user has to pay attention to large number of associated factors.
A wizard accomplishes these goals by:
Dividing the task to into just a few logical steps.
Offering the user sensible defaults values for selection.
Making decision for the user so they can only perform the task in the order of the specified steps.
Activating the wizard
The wizard framework is activated by executing the MODAL global function.
MODAL('core.lib.wizard.htm',{src:'com.sap.mypackage:myWizardPage.xml',...});
The parameters for the wizard page are:
Param name |Type |Description
src | String |(required) Url for wizard definition file.
width |Integer | The width of the wizard window.
height | Integer |The height of the wizard window.
title | String |The title of the wizard window.
Implementation Issues
You can access the wizard methods and properties by the $WIZ prefix.
In order to implement a wizard you should follow this steps:
Define the wizard pages and the navigation between them, see the next section for the xml definition of a wizard xml.
For each wizard page implement an appropriate smartform editor in xml format(see @lib:smartform for How To define an editor in xml format).
When opening the wizard (via MODAL global functions ) add to the MODAL the src param pointing to the wizard page.
The finish page is the default next page of all the pages that don’t have any NEXTPAGE tag
attached to them, The finish page collects all the data from the pages the user has navigated in.
This action is done automatically if you follow the next steps:
In the smartform xml file, you add a child element called ‘showInSummary’ with the value ~true to any editor element.
If the id of the editor element is also a property of the data object of the page.
Data binding
Every page has it’s own data object, you can define that data object
in a declarative way via the xml(for details please see the structure of
wizard xml file). This data object is attached automatically to the data
property of the smartform, this enables for data binding of the smartform
to operate correctly on page data object. Please note , that for the data
binding to operate the id of the editor element should be identical for
the property name of the data.
For example:
For the following editor definition:
.
.
.
.
.
.
.
.
There should be a corresponding page definition:
true
.
.
.
Error handling
Error handling could be done by the following steps:
Gather one or more errors by executing the ~$WIZ.addError('error description') method.
Exit from the current trail by executing the ~$WIZ.abort() method.
Wizard page definition (XML format)
? #Define the callback for the wizard
? #Define a callback function that will be called
at the start up of the wizard
? #Define a callback function that will be called
at the ending of the wizard
? #Define a callback function that will be called
when the user press the cancel button
#Define the wizard page
#Title of the page
#A url for smartform editor in xml format,
see @lib:smartform.
? #Description for the page.
#Define the page data structure.
#Child tag name represent the data item name ,
and the value of the child represent the
# default value of the date item
? #Define callback functions for the page.
?
?
?
?
*
#Declare the next pages for the current
page, default attribute is optional
and if absent then the first next page
is the default page.