ABAP Forms - Sapscript

Sapscripts were the first form types in SAP. In the new releases of SAP, other form types are available which are more friendly; but they are still quite common because many  forms were developed before these new versions, so ABAP Consultants must be familiar with them.

To create a new form you need a Print Program and the form itself. The print program obtains all the necessary data to create the form by accesses to the DB or other sources of information, and then calls the corresponding form.

Print Program

The Print Program is a regular ABAP program, that after it has gathered all the necessary data, calls the desired form. It defines which form to use, the number of copies, the output device and other parameters.

In this type of form, the whole logic of the process of printing the form is in the print program. The print program does all the processing and the form only shows data.


Sapscript Form

Sapscript Forms are created and maintained with transaction SE71. Here the developer defines the interface of the form with the print program and the forms layout. Once the form has finished processing all the information from the print program, it delivers a spool order that is sent to the selected output device.

Sapscript Forms are divided in:

  • Header: General information. The most important is the form name, tha language, page format, first page of the form, etc.

  • Paragraph Formats: used to define the forms appearance. You can set the linespace, margins, alignment, indentation, etc. A paragraph is named with two letters, and the default paragraph is set in the header.

  • Character Formats: the developer can define different character formats with different fonts, sizes and attributes. Like paragraphs, a two character name defines the character format and the default one is set in the header of the form.

  • Windows: these are the different areas inside the form. Inside them you may add text, images, tables... There are 3 types of windows:

    • Main: this type is mandatory, so at least one must be defined. It is used to show the general information of the document; for example, the items in a billing document.

    • VAR: a window whose content may change depending on the value of variables.

    • CONST: a windows that has always the same content

  • Pages: they are the pages of the form, and contain the different windows of the layout. There can be many pages, and the first page is defined in the header.

  • Pages Window: here you indicate which windows are available for each page.

  • Text Element: they are defined for each window. The print program calls them by name, and prints their content in the indicated window.