Você está na página 1de 19

Interface in the Form Builder

To include data in our form This can include the following data:
Data selected from the database tables of your application. You use the form interface to specify this data. Data provided by the SAP system or by the PDF-based print forms solution, such as dates. Data that you have calculated or implemented in a form yourself, such as totals for tables.

For all three of these data types, the data is not specified or inserted in the form until runtime.

Interface in the Form Builder


Insert fields as placeholders in the form to specify the appearance and location of the data in the form. These fields are replaced by the current data at runtime via Interface.
The form interface is a part of the Interface form object and is defined in the Form Builder. The form interface of a form is structured in the same way as the interface of a function module in the system. But form interfaces do not support Changing parameters.

Interface in the Form Builder


Form Interface can be the following
ABAP Dictionary-Based Interface XML Schema-Based Interface Smart Forms-Compatible Interface

ABAP Dictionary - Based Interface


We have the following options for including data in PDF-based print forms In the form interface, we specify the data that is exchanged with the application program (such as tables). Under Global Definitions, we define your own fields. The System Fields contain data with a predefined meaning (such as the date). We cannot enter system fields directly. When we call the context in the Form Builder, the system shows the available system fields automatically in the interface. You can then drag and drop the required fields to the context. Under Code Initialization, you can create program code to modify global definition data before the form is processed. You can use form routines that are defined in the ABAP Editor. We can assign currency and quantity fields reference.

Creating a Form Object


Two ways of calling the Form Builder for the interface From the ABAP Workbench (Transaction SE80) Choose Form Objects Interfaces and select an interface. From Transaction SFP

Creating Interface

Creating Interface

Creating Interface
When we double-click Export, we can see the standard parameter /1BCDWB/FORMOUTPUT of the generated function We cannot change this parameter. We use this parameter in out application program, to make the generated form available as a PDF for further processing.

-- screenshot on next slide --

Creating Interface

Exceptions

Global definitions - interface of form builder


We have an option of defining own fields to be used anywhere in the form. We can initialize global data before start to process the form, for example, to convert selected application data.

Global Data
We define any data needed by the form, but which has not been provided by the form interface (for example, to display totals).

Types
We create data types as free ABAP code, if the ABAP Dictionary does not provide a type.

Field Symbols
We can use field symbols as pointers when you extract data from internal tables.

Types

Global data

Declaration of Global Variable of Global Type

Initialization in the interface of form builder


SAP customers can use this function to execute ABAP program code before a form is processed. We can initialize the global data, for example, to convert selected application data. We can also select additional data without having to make changes in the application program. We use the ABAP Editor to write the program code (Code Initialization) that is executed before the form is processed. We can include subroutines (Form Routines) when we do this.

Initialization

Specifying a Currency or Quantity Reference


In the ABAP Dictionary, we can assign a currency or quantity field to a table field. In the output of these fields, the system can then insert the relevant currency or unit:
If the value field is in the same table as the corresponding currency or quantity field, the system recognizes the reference automatically, and formats the value field according to the currency or unit in the assigned field. If the value field is in a different table from the currency or quantity field, the system cannot recognize this reference automatically. In the second case, we must indicate this reference to the system in the form, to ensure that the value field is formatted correctly.

Specifying a Currency or Quantity Reference


If we want to assign a currency or quantity field in one table (for example, CURTAB) to a value field in another table (for example, VALTAB). ... Create the reference to the currency field by entering the following values:
Field Name: VALTAB-VALUE, if this is the value field of VALTAB that you want to display. Reference Field: CURTAB-CURRENCY, which is the currency field of CURTAB. Under Data Type, specify whether the data type is a currency or quantity.

Specifying a Currency or Quantity Reference

Possibilities of Errors
At runtime, the application program must provide all the mandatory parameters that are declared in the Interface. If a parameter has been defined in the form, but is not defined when the application program is called, then the output of the form ends with the program crashing (hex dump).

It is also possible that the application program provides parameters that the form does not need.
We do not need to mention these parameters in the form; they can also be specified in a different order from the code of the application program. This has the advantage that an application program can work with several different forms.

Você também pode gostar