Program-Driven Generation of Form
Templates
SAP provides an API (application programming interface) that you can use to generate a form template. This API generates an XFA (XML Forms Architecture) document that can be displayed in Adobe LiveCycle Designer. This enables you to implement the program-driven generation of form templates, without using Adobe Designer.
The API is based on Adobe XFA Version 2.2. It offers only a selection of the XML tags and attributes from the XFA specification. Adobe Designer itself offers a much wider range of functions. For this reason, we recommend that you restrict program-driven generation to simple form templates only.
To fully understand how to use the API, you must read this description together with the XFA specification. To access the Adobe XFA specification, go to the following Internet address: http://partners.adobe.com/public/developer/xml/index_arch.html.
This specification contains explanations of all elements and attributes, as well as suggestions for the hierarchical structure of the elements.
You can use all interfaces from the package SAXFT.
Each interface corresponds to precisely one tag in the XFA specification.
You generate the root node by using CREATE_OBJECT to instantiate an object from the class CL_SXFT_TEMPLATE. For this object, you can call the method GET_FACTORY( ) to create a factory object. You can generate all subsequent XFA elements by using a “create” method of the factory method to instantiate the corresponding object. You create the structure of the XFA document as follows:
● You use “set” methods to set simple attributes and to send the attribute value to the VALUE parameter in quotation marks.
● You use “set” methods to set attributes that are themselves elements, and to send an object to the VALUE parameter that represents the attribute (and the new element).

An exception to this are attributes that are themselves elements but only have a few of their own attributes; these attributes do not need to be generated. The values can be set directly by using the corresponding “set” method (such as <margin> and <color>).
● You use the method IF_SXFT_NODE~APPEND_CHILD( NEW_CHILD ) to set child elements. The interface IF_SXFT_NODE is included in all interfaces that represent XFA elements.
Grouping interfaces are used for attributes that are used very frequently
● The interface IF_SXFT_ALIGNMENT groups the “set” methods for the attributes VALIGN and HALIGN. This interface is included in all interfaces that represent elements with these attributes.
● The interface IF_SXFT_MEASUREMENT groups the “set” methods for the attributes X, Y, W, H, and Layout. This interface is included in all interfaces that represent elements with these attributes.
For an example implementation, see the program RSXFT_XFT_API_DEMOII.
This program generates a template that includes the following: header and footer, a static text, a selection list, option fields, a text input field, and a pushbutton. Since no context is generated, no data binding is created.
