Beruflich Dokumente
Kultur Dokumente
Table of Contents
Jocelyn Dart:
Last updated: 20 February 2003 Page 2 of 11
Using Form Steps in SAP’s WebFlow Engine
The form can be used multiple times in the same workflow, e.g. the same form used to start the workflow,
then used in an approval step.
Forms are designed to work the same way whether executed via SAPGUI or from the web via SAPGUI
for HTML.
In addition a form can be converted to an XML document and vice versa. The resulting XML document
can then be transmitted to another system or received from another system over the web, e.g. using a
web activity step to send it via Wf-XML.
A significant advantage of these forms is that they include the workflow toolbox, i.e. while executing the
work item an agent can be given access to work item instructions, attachment view/creation, workflow
summary log view, etc. without having to return to the inbox. This is particularly helpful if simplified
inboxes are used, such as the Enterprise Portal’s Universal Worklist Iview, where these functions may not
be easily accessible.
Prior to the introduction of form steps, there was no standard way of producing forms that could be used
equally in SAPGUI and in web environments.
In 3.1, for web environments only, the ability to create forms using the SAPForms for HTML technique
was introduced. This technique was awkward to extended, and is essentially replaced by form steps.
Form steps are an inside-out way of producing forms where significant ABAP skills are available.
If only web forms are desired, outside-in forms can be created in web languages (such as Java and .Net)
using the WAPIs (Workflow Application Programming Interfaces) and the relevant connectors to SAP
(such as JCo and .Net Connector).
Jocelyn Dart:
Last updated: 20 February 2003 Page 3 of 11
Using Form Steps in SAP’s WebFlow Engine
All fields to be passed from the workflow to the form step and vice versa must be included in the
structure.
You can also use a form step with the “Change” action to enable a user to enter the form details by
executing a work item, which then fills the workflow container element for the form.
If the workflow container element for the form is to be filled in background prior to display, then this can
be done by:
• Receiving the form in XML format, e.g. via a “web activity” step and using object method
DYNP_FORM.FROM_XML to convert it to the workflow container element for the form.
• Creating a method to fill the form from other data, e.g. FillFormFromCostCenter
• Using a container operation and virtual attribute with the same structure as the form to fill the
workflow container element.
In a form step, nominate the form action: Display, Change, Approve or Approve with Query. These affect
the buttons displayed with the form.
If using a form to start a workflow, then the workflow container element on which the form is based must
be entered in the “Basic Data” of the workflow, “Version-Independent” section, “Start Forms” tab.
More than one form can be created for starting the same workflow.
Jocelyn Dart:
Last updated: 20 February 2003 Page 4 of 11
Using Form Steps in SAP’s WebFlow Engine
• A function group in the customer namespace. If no function group has yet been entered in the
“Basic Data” of the workflow (Version-Independent, Function group tab), a new function group will
be created, named after the workflow. E.g. If the workflow is WS92000001 then the function
group will be ZWS92000001. The created function group will be automatically entered in the
“Basic Data” of the workflow.
• In the function group a screen is created. The first screen created is 0001.
• The function group and screen also contain the code to import the form data from the workflow
container element, and export the form data back to the workflow container element.
• If the form is used as a start form then a transaction will be generated as well, e.g.
ZTF_WS920000010001 where WS92000001 is the workflow template id and 0001 is the screen
number.
By default, one screen is created per form. If the form is used to start a workflow and then in other steps
to approve, display or change the form then the same screen will be used for all scenarios.
A number of forms can be used in the same workflow, each form will have its own screen in the function
group.
Alternative screens for the same workflow container element can be created, i.e. by using the wizard to
create a form with a different form name but referencing the same workflow container element.
Jocelyn Dart:
Last updated: 20 February 2003 Page 5 of 11
Using Form Steps in SAP’s WebFlow Engine
Jocelyn Dart:
Last updated: 20 February 2003 Page 6 of 11
Using Form Steps in SAP’s WebFlow Engine
To execute a start form the user must be a possible agent of the relevant workflow template.
Jocelyn Dart:
Last updated: 20 February 2003 Page 7 of 11
Using Form Steps in SAP’s WebFlow Engine
To extract the form data for sending to an external system via XML, the object method
DYNP_FORM.TO_XML can be used. This converts the form to an XML document that can then be sent
to an external system, e.g. using a “web activity” step.
To extract the form data, e.g. to update a database, use an appropriate object method. E.g. Create an
object method such as UpdateFromForm passing the workflow container element as an input parameter.
Note that container operations and condition editors in workflow cannot be used to access individual
fields within the form structure.
Jocelyn Dart:
Last updated: 20 February 2003 Page 8 of 11
Using Form Steps in SAP’s WebFlow Engine
New screen elements can be added if desired. The input/output/hidden settings of these elements are
completely under the control of the custom code and are not affected by the form action chosen. If the
form is to be executed in SAPGUI for HTML, care should be taken to ensure all screen elements can be
reproduced via SAPGUI for HTML.
If additional fields are added to the dictionary structure after the form has been created, the form can be
deleted and regenerated, or the fields can be manually added to the screen.
The texts for the tab names “Form fields”, “Properties” and “Workflow Toolbox” are held as numbered
texts of function group SWY_WI_EXECUTE. They can be changed via translation. However the same
texts are displayed for all forms.
Care should be taken that the standard modules IMPORT_DATA_nnnn and EXPORT_DATA_nnnn are
not removed as these contain the code to read and pass back the workflow container element for the
form.
The new task is created in the customer namespace. Work item subject text, long text, possible agent
assignment, etc. can then be changed.
Jocelyn Dart:
Last updated: 20 February 2003 Page 9 of 11
Using Form Steps in SAP’s WebFlow Engine
When executing forms, the transaction used for SAPGUI is WI_EXECUTE. From the web the EasyWeb
transaction used is WI_EXECUTE_WEB. The code for these transactions is held in program
RSWY_WI_EXECUTE.
Screen 1000 of function group SWY_WI_EXECUTE is the main screen that controls the form fields,
properties, and workflow toolbox tabs.
The work item and workflow item are not passed directly to the form. It is possible to pass the workflow
item in a prior step, when using form steps rather than start forms. When using form steps, the work item
can be retrieved using function module SWE_WI_GET_FROM_REQUESTER. Once the work item or
workflow item is known, additional information can be retrieved from their containers e.g. using
SAP_WAPI_READ_CONTAINER.
During the execution of a form step, it is not possible to save any data back to the workflow container
other than via the form structure. As the form step updates the workflow container element directly, both
the work item and workflow containers are effectively locked during form execution. Even if changes are
made to the workflow container, e.g. via SAP_WAPI_WRITE_CONTAINER or similar, then when the
execution completes the container is overwritten.
To fill or extract data from the form, it is usually necessary to create a custom object method for the
purpose as container operations and condition editors cannot be used to access fields within structures.
There are only limited options for converting the form screen to an HTML page.
Only one workflow container element can be nominated per form. Only structure-based workflow
container elements can be used to create a form.
The workflow toolbox is built as part of the form execution. There is no provided way to influence what
options appear in the toolbox shown during form execution.
There are no provided options for adding additional or alternative buttons to the main execution screen for
each form action. However additional buttons can be added to the form screen itself.
A form is specific to a workflow and cannot be shared by multiple workflows, even if the function group on
which the form is based is attached to both workflows.
Jocelyn Dart:
Last updated: 20 February 2003 Page 10 of 11
Using Form Steps in SAP’s WebFlow Engine
7 Future directions
The form type “Form” is the only form type currently available. The form step will be used for other form
types in future. These new form types have yet to be determined.
Jocelyn Dart:
Last updated: 20 February 2003 Page 11 of 11