Wednesday, July 30, 2008

Inserting (Interactive) Forms Web Dynpro ABAP Integrating Forms

Use

As there is very little difference between the print scenario and the interactive scenario for inserting a form in a Web Dynpro application, the procedure for both scenarios is provided together below.

Forms with static content, such as PDF-based print forms, can be used to display or print data in Web Dynpro applications.

In the case of interactive forms, you can reuse user entries stored in the Web Dynpro context for your own Web Dynpro application.

In scenarios where the templateSource/dataSource are filled, the form can only be created if an ADS is available. On the other hand, the pdfSource property is ignored in this case. For the properties enabled and readOnly, note the following:

If enabled is set, the form is displayed via the ACF.
If readOnly is set too, no entries or changes can be made in the form.

If enabled is not set, the form is displayed without the ACF, and the readOnly setting is ignored.

Procedure

1. In the Web Dynpro explorer, create a view for your component or select a view to which to add the form.

2. In the view context, create the node with attributes that will be bound to the form later.

3. In the view, drag the InteractiveForm UI element from the integration category to the Layout Designer.

4. For the templateSource property, enter the name of the selected form.

You can select an existing form (via F4, for example) or enter a name to create a new form. Based on the interface of the selected form, a context node with attributes is automatically created for the InteractiveForm UI element. The dataSource property of the UI element is automatically bound to this context node.

If you are creating a new form, double-click the name.

...

a. The dialog box that now appears informs you that you have to specify an interface before you can create the new template. At this point, you can either use an existing interface or create a new one adapted to suit your Web Dynpro view. To create a new interface, enter a name and choose Context. Since the creation process is connected to the view you are processing, the context of this view is provided for the selection of a suitable node.

b. Choose the context node created in step 2 and close the dialog box.

c. In the next two dialog boxes, save a new interface and a form that uses this interface, each as a separate transport object. Do not save the view until the third dialog box appears.

d. You now go to Form Builder, where you can design the new form. To begin with here, you can have the basic framework of your form generated by choosing Generate Data View Using Fields.
When designing the form layout, note the translation link for forms.

Based on your selected Web Dynpro context, an XML schema is created for the new interface, which is available to the new form for data selection.

e. Save and activate your form in Form Builder (objects of type SFPF and SFP1).

5. Once you have finished designing the form, switch to the editing screen for the Web Dynpro view.

If you select the InteractiveForm UI element in the view layout, you will see that view context node has been automatically connected with the form or relevant interface.

6. Specify whether the form is a PDF-based print form or an interactive form.

If it is a non-interactive form usage, that is. the form is a PDF-based print form, make sure that the enabled property is not selected in the property table. This is the default setting.

If it is an interactive form usage, activate the enabled property in the property table. Note the various points that need to be observed during interactive usages.

7. After filling the created context structure – for example using a suitable supply function – and inserting it into the window navigation, you can activate and test an application.

Subsequent Changes to the Web Dynpro Context

To offer new elements in the data view for the form, you first need to enhance the relevant Web Dynpro context accordingly. You do this, as usual, in the context editor of the Web Dynpro Explorer. Triggering forwards navigation on the InteractiveForm UI Element takes you back to Form Builder. The XML schema is automatically adjusted, together with the data view in Form Builder.

If you used an existing templateSource for the form integration and its interface is not based on an XML schema, you cannot add any further data fields subsequently.

Note that other forms may have used or be using your interface. Check carefully before changing an interface.

Result

In the form displayed in the Web Dynpro application, you can perform the usual Adobe functions by choosing the relevant buttons, such as Print or Save a Copy.

Example

You can find a simple example component for the interactive scenario in the system in the SWDP_TEST package, under WDR_TEST_IA_FORMS.

No comments:

Archive