webflow

Upload: yanirapm

Post on 08-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 webflow

    1/11

    Using Form Steps

    in SAPs WebFlow Engine

    Jocelyn Dart, 20.03.2003, Technology Cook book

  • 8/7/2019 webflow

    2/11

    Using Form Steps in SAPs WebFlow Engine

    Jocelyn Dart:Last updated: 20 February 2003 Page 2 of 11

    Table of Contents

    1 WHAT ARE FORM STEPS?.............................................................................................................................3

    2 BASIC PROCESS FOR CREATING FORM STEPS......................................................................................3

    2.1 CREATE A DICTIONARY STRUCTURE FOR THE FORM .......................................................................................4

    2.2 CREATE A WORKFLOW CONTAINER ELEMENT USING THE DICTIONARY STRUCTURE........................................4

    2.3 FILL THE WORKFLOW CONTAINER ELEMENT ...................................................................................................4

    2.4 INSERT THE FORM STEP OR START FORMS ENTRY ............................................................................................4

    2.5 GENERATE THE FORM .....................................................................................................................................4

    2.6 EXECUTING THE FORM....................................................................................................................................5

    2.6.1 Executing form steps..............................................................................................................................52.6.2 Executing start forms.............................................................................................................................7

    2.7 EXTRACTING FORM DATA ...............................................................................................................................8

    2.8 DEMONSTRATIONS OF FORMS .........................................................................................................................8

    3 OPTIONS FOR EXTENDING FORM STEPS.................................................................................................8

    3.1 CHANGING THE FORM LAYOUT .......................................................................................................................9

    3.2 ADDING CODE TO THE FORM...........................................................................................................................93.3 CREATING A NEW FORM TASK VIA REFERENCE ...............................................................................................9

    3.4 CREATING HTML VERSIONS OF THE SCREEN .................................................................................................9

    4 ADDITIONAL TECHNICAL INFORMATION............................................................................................10

    5 LIMITATIONS OF FORM STEPS.................................................................................................................10

    6 WHEN TO USE FORM STEPS.......................................................................................................................10

    7 FUTURE DIRECTIONS...................................................................................................................................11

  • 8/7/2019 webflow

    3/11

    Using Form Steps in SAPs WebFlow Engine

    Jocelyn Dart:Last updated: 20 February 2003 Page 3 of 11

    1 What are FORM steps?

    Form steps are a new insertable step type in SAPs WebFlow Engine available in all WAS (Web

    Application Server) system, represented by the form step icon . They enable the quick and easycreation of simple forms. These forms can be used:

    To start a workflow

    In a work item that displays the form

    In a work item that changes the form

    In a work item that approves the form

    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 SAPGUIfor HTML.

    In addition a form can be converted to an XML document and vice versa. The resulting XML documentcan then be transmitted to another system or received from another system over the web, e.g. using aweb activity step to send it via Wf-XML.

    Form steps can be extended to:

    Change the layout of the form

    Add default values

    Add search helps

    Add validation

    Save data e.g. to custom tables

    A significant advantage of these forms is that they include the workflow toolbox, i.e. while executing thework 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 simplifiedinboxes are used, such as the Enterprise Portals Universal Worklist Iview, where these functions may notbe easily accessible.

    Prior to the introduction of form steps, there was no standard way of producing forms that could be usedequally in SAPGUI and in web environments.

    In 3.1, for web environments only, the ability to create forms using the SAPForms for HTML techniquewas 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).

    2 Basic process for creating form steps

  • 8/7/2019 webflow

    4/11

    Using Form Steps in SAPs WebFlow Engine

    Jocelyn Dart:Last updated: 20 February 2003 Page 4 of 11

    2.1 Create a dictionary structure for the formThe dictionary structure must be a flat structure, i.e. no table types or structures within structures (otherthan append or include structures) can be used.

    All fields to be passed from the workflow to the form step and vice versa must be included in thestructure.

    2.2 Create a workflow container element using the dictionary structure

    The workflow container element cannot be multiline. If used to start a workflow the workflow containerelement should be marked as an import element.

    2.3 Fill the workflow container element

    When using start forms the user fills the form directly, and the data is then passed to the workflowcontainer element for the form.

    You can also use a form step with the Change action to enable a user to enter the form details byexecuting 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 canbe done by:

    Receiving the form in XML format, e.g. via a web activity step and using object methodDYNP_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 theworkflow container element.

    2.4 Insert the form step or start forms entryIf using a form as a step in a workflow, insert the step type form step into the relevant position in theworkflow.

    In a form step, nominate the form action: Display, Change, Approve or Approve with Query. These affectthe buttons displayed with the form.

    Display No special buttons are shown.

    Change The standard SAP Save button is active. The work item is not complete until Savehas been chosen.

    Approve The buttons Approve and Reject are shown. The work item is not complete untileither Approve or Reject has been chosen.

    Approve with query The buttons Approve, Reject and Query are shown. The work item isnot complete until either Approve, Reject or Query has been chosen.

    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.

    2.5 Generate the formForm the form step or basic data, use the Create option to start the wizard to create the form. In thewizard you confirm which workflow container element is to be used for the form. The following will thenbe generated:

  • 8/7/2019 webflow

    5/11

    Using Form Steps in SAPs WebFlow Engine

    Jocelyn Dart:Last updated: 20 February 2003 Page 5 of 11

    A function group in the customer namespace. If no function group has yet been entered in theBasic Data of the workflow (Version-Independent, Function group tab), a new function group willbe created, named after the workflow. E.g. If the workflow is WS92000001 then the functiongroup will be ZWS92000001. The created function group will be automatically entered in theBasic 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 workflowcontainer 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 screennumber.

    By default, one screen is created per form. If the form is used to start a workflow and then in other stepsto 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 functiongroup.

    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.

    2.6 Executing the form

    2.6.1 Executing form stepsExecuting the work item linked to the form step results in the following tabs being displayed:

    Form fields This contains the form screen

    Properties This shows the status of the step (e.g. In Process), the creation date/time, thepriority, the latest end and requested start deadlines. The priority can be changed

    Workflow Toolbox - The workflow toolbox is displayed in inplace with info mode. This toolboxincludes: display of work item long text and ad hoc objects list, display of workflow summary log,

    option to forward the work item, option to resubmit the work item, option to send a mail (this mailcan then be returned to the work item) , option to view/create attachments, option to view thecurrent agents of the work item.

  • 8/7/2019 webflow

    6/11

    Using Form Steps in SAPs WebFlow Engine

    Jocelyn Dart:Last updated: 20 February 2003 Page 6 of 11

  • 8/7/2019 webflow

    7/11

    Using Form Steps in SAPs WebFlow Engine

    Jocelyn Dart:Last updated: 20 February 2003 Page 7 of 11

    2.6.2 Executing start formsStart forms can be executed by:

    Using transaction SWUI to display all workflows that can be started ad-hoc Using Generic Object Services in a transaction to display all workflows that can be started ad-hoc

    for a particular object instance, e.g. in the cost centre display transaction to start a workflowbased on the current cost centre.

    Use the generated transaction code shown in the Start Forms tab in Basic Data, e.g.ZTF_WS920000010001 where WS92000001 is the workflow template and 0001 is the screennumber.

    To execute a start form the user must be a possible agent of the relevant workflow template.

    When started, the following tabs will be displayed:

    Form fields This contains the form screen

    Properties This shows the priority, latest end and requested start deadlines. New values canbe input.

    Note at start This easily creates an initial attachment for the workflow, if desired.

    Attachments This enables other attachments to be added to the workflow, e.g. PC documents.

  • 8/7/2019 webflow

    8/11

    Using Form Steps in SAPs WebFlow Engine

    Jocelyn Dart:Last updated: 20 February 2003 Page 8 of 11

    2.7 Extracting form data

    Between steps in the workflow, the workflow container element is used to pass the form data from onestep to another.

    To extract the form data for sending to an external system via XML, the object methodDYNP_FORM.TO_XML can be used. This converts the form to an XML document that can then be sentto 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 anobject 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 individualfields within the form structure.

    2.8 Demonstrations of formsTransaction SWUI_DEMO includes a demonstration workflow for forms, demoforms. This workflowdemonstrates forms used to start a workflow and to execute a work item.

    3 Options for extending form steps

  • 8/7/2019 webflow

    9/11

    Using Form Steps in SAPs WebFlow Engine

    Jocelyn Dart:Last updated: 20 February 2003 Page 9 of 11

    3.1 Changing the form layoutThe ABAP screen editor can be used to change the layout of the form. Both the graphical andalphanumerical editors can be used. The screen can be accessed by:

    Pressing the change form option on the Form step

    Pressing the change form option in the Start Forms tab in Basic Data

    By accessing the function group in transaction SE80 (Repository Browser).

    Fields can be hidden if desired.

    New screen elements can be added if desired. The input/output/hidden settings of these elements arecompletely under the control of the custom code and are not affected by the form action chosen. If theform is to be executed in SAPGUI for HTML, care should be taken to ensure all screen elements can bereproduced via SAPGUI for HTML.

    If additional fields are added to the dictionary structure after the form has been created, the form can bedeleted 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 numberedtexts of function group SWY_WI_EXECUTE. They can be changed via translation. However the same

    texts are displayed for all forms.

    3.2 Adding code to the form

    The flow logic of the form screen can be changed as desired to determine whether a field should be openfor input/output or hidden, to add default values, search helps, validation of data, saving of data, etc. Anycode added is added to the function group in the customer namespace and is considered development,not modification, for upgrade purposes.

    The following should be noted:

    The work item is not passed the form. However function moduleSWE_WI_GET_FROM_REQUESTER can be used to find the calling work item. Alternatively theworkflow item can be passed in the form structure.

    All the workflow/work item containers can be read, e.g. using SAP_WAPI_READ_CONTAINER,the workflow/work item containers cannot be updated directly. Only the workflow containerelement for the form can be passed back to the workflow.

    It is possible to save data to databases using the form. E.g. If lists needed to be entered, then thelists could be saved to another table and the key information to access the lists passed back tothe workflow container.

    Care should be taken that the standard modules IMPORT_DATA_nnnn and EXPORT_DATA_nnnn arenot removed as these contain the code to read and pass back the workflow container element for theform.

    3.3 Creating a new form task via reference

    To adjust the work item text, long text, or restrict the possible agents given with the standard form tasks,use the Control tab of the form step to create a new task with reference to the standard task.

    The new task is created in the customer namespace. Work item subject text, long text, possible agentassignment, etc. can then be changed.

    3.4 Creating HTML versions of the screenAs form steps are executed in the web environment using an EasyWeb transaction it is possible toreplace individual screens with ITS templates. However it should be remembered that if an ITS templateis created for the form screen, only the contents of the Form fields tab will be affected.

  • 8/7/2019 webflow

    10/11

    Using Form Steps in SAPs WebFlow Engine

    Jocelyn Dart:Last updated: 20 February 2003 Page 10 of 11

    4 Additional technical information

    The business object for forms is DYNP_FORM. All standard tasks for forms are based on this object.

    When executing forms, the transaction used for SAPGUI is WI_EXECUTE. From the web the EasyWebtransaction used is WI_EXECUTE_WEB. The code for these transactions is held in programRSWY_WI_EXECUTE.

    Screen 1000 of function group SWY_WI_EXECUTE is the main screen that controls the form fields,properties, and workflow toolbox tabs.

    5 Limitations of form steps

    Forms are used in conjunction with a workflow, either to start a workflow or to execute a work item. Theycannot be used on their own outside of workflow as they rely on data being imported/exported to a

    workflow.

    The work item and workflow item are not passed directly to the form. It is possible to pass the workflowitem in a prior step, when using form steps rather than start forms. When using form steps, the work itemcan be retrieved using function module SWE_WI_GET_FROM_REQUESTER. Once the work item orworkflow item is known, additional information can be retrieved from their containers e.g. usingSAP_WAPI_READ_CONTAINER.

    During the execution of a form step, it is not possible to save any data back to the workflow containerother than via the form structure. As the form step updates the workflow container element directly, boththe work item and workflow containers are effectively locked during form execution. Even if changes aremade to the workflow container, e.g. via SAP_WAPI_WRITE_CONTAINER or similar, then when theexecution completes the container is overwritten.

    To fill or extract data from the form, it is usually necessary to create a custom object method for thepurpose 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 workflowcontainer 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 whatoptions 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 onwhich the form is based is attached to both workflows.

    6 When to use form steps

    Use forms when:

    Forms are to be created inside-out

  • 8/7/2019 webflow

    11/11

    Using Form Steps in SAPs WebFlow Engine

    Jocelyn Dart:Last updated: 20 February 2003 Page 11 of 11

    ABAP skills are available for extending the form

    Forms need to work from both SAPGUI and the web equally

    Accessing the workflow toolbox is an important part of the process

    Executing via SAPGUI for HTML is acceptable

    For web execution, the SAPGUI for HTML environment is available (i.e. prior to WAS 6.30, anITS must be available)

    Forms need to be created quickly

    7 Future directionsThe form type Form is the only form type currently available. The form step will be used for other formtypes in future. These new form types have yet to be determined.