Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

right alignment

Former Member
0 Kudos

Hi Friends,

I want to align a field to right alignment in sap scripts.

Thanx in advance,



Developer Advocate
Developer Advocate
0 Kudos

You can set the alignment in a couple ways, if you are using tabs, you can set the alignment in the tab, You can also set the alignment using the paragraph format.


Rich Heilman

Former Member
0 Kudos

Hi look at this....

hope this helps u......

Symbol values other than numeric values are normally formatted to be left-justified. Right-justified formatting can be specified with the R option. This option has to be used in conjunction with an output length specification.




If symbol has the value 1234.

&symbol& 1234

&symbol(8R)& 1234


Former Member
0 Kudos



Parent Topic: SAPScript

HOWTO:Sap script

Edit this entry - Discuss - Rename - Watch - History

Major contributors: gopang, cmurphy262 | All Contributors

Go behind the scenes to discuss ways to use and improve wiki. Visit the hub.

White Papers

SAP Solution Manager - The Next Step to Complete the Performance Management Solution

Intelligent Document Delivery: The Ins and Outs of Business Process ROI With SAP ERP

Eliminating Mailroom Inefficiencies through Mail Automation with SAP Systems

Community Content

Fear and Guilt Cultures (Blogs)

RE: SAP Script - Converting Comma to Decimal Place (Groups)

Table of contents

1. Introduction

2. Steps

3. Examples

4. Conclusion

IntroductionEdit section

StepsEdit section

ExamplesEdit section


ConclusionEdit section


1 CONCEPTOS 5 1.1 MODIFYING SAP FORMS 5 1.2 FORMS: CONCEPTS 5 1.3 CLIENT AND LANGUAGE VERSIONING: CONCEPTS 6 2 COMPONENTES 7 2.1 HEADER DATA 7 2.2 PARAGRAPH FORMATS AND ATTRIBUTES 9 2.2.1 Standard Paragraph Attributes 9 2.2.2 Font Attributes for Paragraphs 10 2.2.3 Tabs in Paragraph Formats 11 2.2.4 Paragraph and Heading Numbering 11 2.3 CHARACTER FORMATS AND ATTRIBUTES 12 2.3.1 Standard Attributes for Character Formats 13 2.3.2 Font Attributes for Character Formats 13 2.4 WINDOWS 14 2.4.1 Default Paragraph 15 2.5 PAGES 15 2.5.1 Defining Follow-On Pages in Duplex Print Modes 16 2.5.2 Testing Tray Selection and Print Mode Selection 17 2.6 PAGE WINDOWS 17 2.7 TEXT ELEMENTS 18 2.7.1 Default Text Element 19 2.8 MAIN WINDOW 19 3 TÉCNICAS 20 3.1 DISPLAYING VERSIONS OF FORMS 20 3.2 INCLUDING GRAPHICS 20 3.2.1 Using Boxes, Lines, and Shading 20 3.2.2 Supported Printers 21 3.2.3 Boxes, Lines, Shading: BOX, POSITION, SIZE 21 3.2.4 Pre-Setting BOX Position Arguments 23 3.2.5 Using the Commands in Texts and Forms 24 3.2.6 Tips and Guidelines 24 4 DESIGN TOOLS 26 4.1 FORM COMPONENTS 26 4.2 PROCESSING IN OVERVIEW 27 4.2.1 Defining Header Data 27 4.2.2 Defining Paragraph Formats 28 4.2.3 Defining Character Formats 29 4.2.4 Defining Pages 29 4.2.5 Defining Windows 30 4.2.6 Using Text Elements in Page Windows 30 4.2.7 Defining Page Windows 31 4.2.8 Using Text Elements in Page Windows 32 4.2.9 Defining Main Windows in Page Windows 32 4.3 TEST-PRINTING A FORM 33 5 RELEASING FORMS 34 6 SAPSCRIPT CONTROL COMMANDS 35 6.1 SYNTAX OF CONTROL COMMANDS 35 6.2 EXPLICIT PAGE BREAK: NEW-PAGE 35 6.3 PREVENTING PAGE BREAKS: PROTECT 36 6.4 NEXT MAIN WINDOW: NEW-WINDOW 36 6.5 ASSIGNING A VALUE TO A TEXT SYMBOL: DEFINE 37 6.6 FORMATTING DATE FIELDS: SET DATE MASK 37 6.7 FORMATTING TIME FIELDS: SET TIME MASK 38 6.8 COUNTRY-DEPENDENT FORMATTING: SET COUNTRY 38 6.9 POSITION OF THE LEADING SIGN: SET SIGN 39 6.10 INITIALIZING NUMBERED PARAGRAPHS: RESET 39 6.11 INCLUDING OTHER TEXTS: INCLUDE 40 6.12 CHANGING THE STYLE: STYLE 41 6.13 FORMATTING ADDRESSES: ADDRESS 41 6.13.1 Parameters 42 6.14 SETTING A FOOTER TEXT IN THE MAIN WINDOW: BOTTOM 45 6.15 CALLING ABAP SUBROUTINES: PERFORM 47 6.16 INSERTING PRINT CONTROLS: PRINT-CONTROL 48 6.17 BOXES, LINES, SHADING: BOX, POSITION, SIZE 48 6.17.1 BOX Command 49 6.17.2 POSITION Command 50 6.17.3 SIZE Command 50 6.18 HEXADECIMAL DATA: HEX, ENDHEX 51 6.19 SUMMING A PROGRAM SYMBOL: SUMMING 51 6.19.1 Summing and Carrying Forward is Incorrect 52 7 SAPSCRIPT SYMBOLS 54 7.1 SYNTAX OF SYMBOLS 54 7.2 SYSTEM SYMBOLS 55 7.2.1 Current Date 55 7.2.2 Current Day Number 55 7.2.3 Current Month Number 55 7.2.4 Current Year Number 55 7.2.5 Current Day Name (Long Form) 55 7.2.6 Current Month Name (Long Form) 55 7.2.7 Current Time 56 7.2.8 Hours Component of Current Time 56 7.2.9 Minutes Component of Current Time 56 7.2.10 Seconds Component of Current Time 56 7.2.11 Current Page Number 56 7.2.12 Page Number of the Next Page 56 7.2.13 Selected Device Type 56 7.2.14 Spaces 56 7.2.15 Underline 57 7.2.16 Vertical Line 57 7.3 PROGRAM SYMBOLS 57 7.3.1 SYST: System Fields in the ABAP Programming Environment 58 7.3.2 USR03: User Address Data 58 7.3.3 SAPSCRIPT: General SAPscript Fields 59 7.4 STANDARD SYMBOLS 59 7.5 TEXT SYMBOLS 60 7.6 FORMATTING OPTIONS 60 7.6.1 Offset 60 7.6.2 Output Length 61 7.6.3 Omitting the Leading Sign 61 7.6.4 Leading Sign to the Left 61 7.6.5 Leading Sign to the Right 62 7.6.6 Omitting Leading Zeros 62 7.6.7 Space Compression 62 7.6.8 Number of Decimal Places 62 7.6.9 Omitting the Separator for ‘Thousands’ 63 7.6.10 Specifying an Exponent for Floating Point Numbers 63 7.6.11 Right-Justified Output 63 7.6.12 Fill Characters 63 7.6.13 Suppressing Output of Initial Values 64 7.6.14 Ignoring Conversion Routines 64 7.6.15 Changing the Value of a Counter 64 7.6.16 Preceding and Subsequent Texts (Pre-Text / Post-Text) 64 7.7 COUNTRY-DEPENDENT FORMATTING 65 7.7.1 Date Mask 65 7.7.2 Time Mask 66 7.8 FORMATTING CONVENTIONS 66 7.8.1 Primary Formatting of System Symbols 66 7.8.2 Primary Formatting of Standard Symbols 67 7.8.3 Primary Formatting of Program Symbols 67 7.8.4 Primary Formatting of Text Symbols 68 7.8.5 End Formatting 68

1 Concepts 1.1 Modifying SAP Forms If you want to modify SAP forms, set up your development environment as follows: 1. Make sure that no SAP-standard forms are stored as client-specific copies in your development client. Such forms should be held only in client 000, the SAP development and installation client. If you access an SAP-standard form from another client, then the central copy in client 000 is used. If you need to remove SAP-standard objects from your development client, see Notes 10388 and 3355 in the SAP Online Service System (OSS). These notes explain the procedure for saving modified forms and then deleting all forms. 2. To modify SAP standard forms, – Copy the forms you need from client 000 to your development client. – Rename the forms using a name from the customer name reserve (names starting with Y or Z). – Copy the forms to one of your own Y or Z development classes. Renaming the SAP standard object makes it possible to manage and transport your changes with the SAP workbench organizer. The organizer is not activated for SAP-standard objects that are modified in clients other than 000. 3. To put your modifications into effect, you must also modify the ABAP print program used to print documents that use this form. You should rename such print programs and store them in your own Y or Z development classes. You can use the SAP Customizing System to replace the SAP print program with your modified print program in the affected applications

1.2 Forms: Concepts Forms are used to control the page layout and also the text formatting in your documents. Before formatting a document for output to the screen or to a printer, you must assign a form to it. If you do not specify a form for a document, then the SYSTEM form is assigned to the document by default. Application-specific forms are used in SAP applications to specify the page layout for such special documents as invoice or checks. These forms specify the structure of the information on the page(s) of such a document. They define, for example, the address header, item lines, the footer, and so on. There are two ways to format texts with forms: • In the standard SAPscript text processing (Tools  Word processing  Standard text), you can select a form for a document. You can then type text into the main window of the form and output the document in the format defined in the form. For example, you can select a form for a letter. You can then type the body text of the letter in the main window. When you print the letter, the default text elements in the other windows of the form (heading, footer, and so on) are printed with the body text. • A document can be generated by a print program in one of the SAP applications. The print program uses a form to generate the document. Most correspondence and document generation in the SAP System are handled by way of print programs. A print program selects the text elements that are to be printed in the windows of a form. It may also collect information from the user or ask the user to input text directly, as in some correspondence functions. The print program may also provide data for variables defined in the form. Finally, the print program uses the form to format the document for display or printing.

1.3 Client and Language Versioning: Concepts Forms and styles are client-specific. That is, a form or style other than the SAP standard in client 000 is available only in the client in which it was created. Forms and styles are also language-specific. That is, the definitions and texts in a form or style are defined for a particular language. Forms and styles can be translated using the standard SAP translation tools. Client 000 Defaulting: SAPscript accords forms and styles in client 000 a special status. If a form or style that is used in a document is not available in the client in which the document is being printed, then SAPscript checks for the form or style in client 000. If it is found there, then the client 000 version is used to print the document. SAP standard forms and styles are always held in client 000. You can take advantage of the client 000 defaulting as well by storing your Yxxx and Zxxx forms and styles there. That way, if a local version of a form or style is not present in a client, the client 000 version is used instead. Language rules: SAPscript uses the following rules to manage versions of forms and styles in different languages: • The language in which a form or style is created is its "original language." You can translate a form or style into other languages using SAP’s translation tools. • If a form or style is needed only in its original language and need not be translated, then you can indicate this in the language attributes in the header data. The form or style then does not appear in work lists in the translation tools. • In versions other than the original language version, changes to a form or style are limited only to translation of texts. No changes to definitions and attributes are permitted.

2 Componentes 2.1 Header Data

You can find header data in both form and style maintenance. In style maintenance, it is used primarily to present important information – information designed to make it easier for the end user to select a style. The header data in form maintenance, on the other hand, is used for information and control purposes. For this reason, the header data of a form will be described in more detail.

Below, the header data is described as it appears in the alphanumeric Form Painter. Like the header data of a style, the header data of a form comprises two parts: the data set by the system and the data you are expected to enter. The latter is dealt with separately. • Device-independent entries. • Description A short explanatory description of the form (also applies to the style), designed to make selection easier for the end user. • Form class You can assign a form to a class to help you organize and search for forms. The default set of classes is the set of program classes in your system. • Start page Tells the print program which page format in a form to use first for printing. • Default paragraph Paragraph set to * in standard text maintenance. • Tab stop A grid set at specified intervals in all windows defined in the form. However, you should note that the tab stops are only valid in paragraphs where you have not defined your own tabs. • Language, Original language, Translation applic Use these fields to record the master language and language of the current version of a form. Marking Translation applic makes the form accessible for translation from the SAP System’s translation tools (transaction SE63). • Device-dependent entries. You can only enter values here that are supported in the R/3 printer definition. If you make other entries, this leads to errors in the check routine. • Page format Determined from the spool administration table with transaction SPAD. Make sure there is a printer assignment – there must be an additional spool format for the printer with the same page format. • Orientation Depends on the page format selected. This can also be determined from the spool administration table. Please note that the formats landscape and portrait are not supported by all printers. • Lines per inch (LPI) Basis for converting the unit of measurement LN in style and form maintenance. The value 6.00 is set by the system, as this value is supported by all printers. • Characters per inch (CPI) Basis for converting the unit of measurement CH in style and form maintenance. The value 10.00 is set by the system, as this value is supported by all printers. • Font attributes With these fields, you can set the default font for a form. The default font applies if other objects do not specify a font. SAPscript suggests a default font, which you can change.

2.2 Paragraph Formats and Attributes

In SAPscript, paragraphs are formatted using formats and their corresponding attributes. Text processing is simplified by the use of different paragraph attribute groups: • Standard • Font • Tabs • Outline There are naming conventions for paragraph tags: • The paragraph tag can have one or two characters. • The first character in the paragraph tag must be a letter, the second a letter, number, or blank; special characters are not valid. • The paragraph format must be identified in the Description field.

2.2.1 Standard Paragraph Attributes

In the Standard attribute group, you find the general attributes that can be defined in paragraph formats: • Description Precise explanation of your paragraph tag, so that the user can immediately identify it. • Left or right margin Amount of space between the paragraph and the left or right border of the form window. • Indent first line Indent of the first line of a paragraph. If the value is positive, it is indented to the right, if it is negative, it is indented to the left. If you specify a negative value, then you must place the minus sign after the number: 1- . • Space before and space after Space before and space after control the amount of space between paragraphs. The actual space between paragraphs results from the space after the preceding paragraph and the space before the following paragraph. • Alignment Alignment of a paragraph. Left-aligned LEFT Right-aligned RIGHT Centered CENTER Justified BLOCK • Line spacing Spacing between the lines. The default value is 1 line; the LPI value (lines per inch) in the header data is used to calculate the line spacing. • No blank lines Suppression of blank lines. You can control whether the blank lines of a paragraph should be suppressed in the printout or not: No entry blank lines not suppressed X blank lines suppressed • Page protection Cohesion of a paragraph. It is possible to determine whether or not a paragraph can be divided by a page break. No entry no page protection (default) X all lines of the paragraph are on one page • Next paragraph same page Cohesion of two adjacent paragraphs. Here you can define whether the subsequent paragraph should begin on the same page (that is, at least the first line of the subsequent paragraph must be on the same page). No entry subsequent paragraph is output on the same page or the next page, depending on the amount of space (default) X subsequent paragraph begins on the same page