Sei sulla pagina 1di 38

SAP SCRIPTS

Kaavian Systems

What is SAPscript ?
SAPsc ript is the integrated text management system of R/3.
It is similar to word proc essing syst ems.
SAPsc ript simplifies the proc ess of designing forms.
It supplies the layout and cont ent for your business forms.
Used To print, distribute, or display the business forms

Kaavian Systems

Components
Editor
Form Layouts and Styles
Composer
Print Program (Driver)
Database

Kaavian Systems

Process
The Print Program and Composer
Print program
report jh_form_01.

Application

DB

data

Layout set
ABAP/4
program

program
tables: scustom.
select * from scustom...
......
call function OPEN_FORM
......
call function START_FORM
......
call function WRITE_FORM'
......

to
J. Smith
7 Second Ave.
47110 XYZ City

Composer

Place, Date
Invoice No.4
123-45-556-678

Art.No.
00345
00379
02378
00458
Total

Price
200.150.50.300.700.R

XYZ B ank
Acct. No.: 0815 4711
Bank N o.: 000000000

SAP AG

Kaavian Systems

FORM Management Tools


FORM Painter (SE71)
A graphical tool to manage form design and layout

PC Editor (SO10) Standard Text


A text based tool to manage business contents

Kaavian Systems

FORM Components:
Header
Paragraph format
Character format
Page layout
Documentation

Kaavian Systems

Header :
Consists of Administrative Data and Basic
Settings.

Administrative Data :
Displays the name of the form, its description,
form class and the status.

Kaavian Systems

Header
Basic Settings :
Default settings for the entire document is
given here. It consists of page size, Orientation,
font, print attributes (Lines per inch, and
Characters per inch) default font to be used etc.

Kaavian Systems

Paragraph Format
Used to define several paragraph formats to
be used with Texts in Forms. Some of the
Attributes are Margins, Alignment, Font Name &
Size, Tab settings and Outline definitions.
At least 1 format to be specified and it has
to be defined as default paragraph in Basic
settings.

Kaavian Systems

Paragraph Format :

Kaavian Systems

Character Format:
To define formats to words and characters such as Bold, Italic, Underlined,
Barcode format, Font Name and Size etc.

Page Layout:

Page size is defined in the Basic Settings of Header.


Within the Page, we can place any number of Windows in any size.
Using Graphical Editor, placing and sizing windows on form is

simplified with mouse clicks and drag & drop.


We can define several pages with minimum of one page.
Different pages can have different layouts.

Kaavian Systems

Windows:

There are 3 Types of Windows


1. Main Window.
It controls the page break.
It contains the body text that may cover several pages.
It allows to fix text elements at the upper and lower margins of the allocated page
window (for example, for column headings).

2. Variable Window.
Window with variable contents. The text can vary on each page in which
positioned. Variable windows are formatted for each page.

3. Constant Window.
Window with constant contents that is formatted only once

Kaavian Systems

the window is

Window Types :

Company Name & Details

LOGO

Recipient
Address

Information

MAIN
WINDOW

FOOTER WINDOW

Constant Windows

HEADER WINDOW

Variable Windows

Variable
Main Windows
Windows

Variable Windows

MAIN
WINDOW

FOOTER WINDOW

Documentation:

Store Technical Details relating to the Script.

Detailed Help regarding the Variables used (text elements, program symbols
etc), Logical Flow, Description about Various Windows etc to be provided.

If copy of standard forms are modified, make sure that the changes are
properly documented.

Kaavian Systems

Working With Windows:

Manipulation of the layout of a form can be subdivided into the following


operations:

Creating a new window


Renaming a window
Changing the position of a window
Changing the size of a window
Removing a window
Aligning a window
Kaavian Systems

PC Editor :

PC Editor can be invoked using Transaction SO10.


When working with Form Painter Layout, Select the
Window to Edit, right click and Select Edit Text.
The Graphical Editor displayed can be changed to
Line Editor using the menu path GOTO Change
Editor.
Displays the Text Editor for the Window.
You can Enter the Text Elements, Symbols etc.

Kaavian Systems

Text Elements:

Text elements are defined for each window.


They are accessed using their name by a print program,

formatted, and output in the respective window.


The /E in the tag column is used to identify the text as a

text element
Text is assigned to window(s) as text elements.

Types :
Named Text Element
Un-named Text Element
Kaavian Systems

Symbols:

These are Placeholders which represents data, replaced with their


output values.
1. System symbol
SAP Script supplies values for the system symbols
2. Program symbol
Data is supplied by the program.
3. Standard symbol
values are defined in the TTDTG table.
4.Text symbol
values From control commands in text editor
Kaavian Systems

CONDITIONS FOR USING SYMBOLS

Symbols must be enclosed within & character.


Line break should not occur between the symbols.
Additional formatting options can be used within ()

immediately after the symbols.


The code letters should be in CAPITAL letters

System Symbols
Sap script supplies values for System symbols.
Fixed name for system symbols.

Examples
&DATE&
&ULINE&
&TIME&

Program Symbols
SAP Scripts cannot directly retrieve data from DB tables calls another

program to do this.
Values fed to SAP Scripts using data areas.
Program symbol value limited to 255 chars
Kaavian Systems

Standard Symbols
Standard symbols are defined in the TTDTG table.
This table contains both the name of each symbol and its value.
The value, which is language-dependent, can contain up to 60 chars.
This table is delivered complete with standard entries supplied by SAP.
It may be extended with customer-specific symbols

Text Symbols
All symbols which do not correspond to one of the three types of symbol

described above are text symbols. You define the value of a text symbol
yourself in the text module.
There are two ways of doing this :
Use the menu entries in the text editor
Use the control command DEFINE
Kaavian Systems

How to Define Commands ?


Following tags are used in Editor to designate the commands

Tag
/E
/:

=
(
/
/=
/(
*
/*

Meaning
-

Element Name
Command Line
Continuous Text (Left Blank)
Extended Line
Raw Line
Line Feed
Line feed with Extended Line
Life feed with Raw Line
Default Paragraph
Comment Line
along with other paragraph formats defined.

SAPscript Commands :
SAPscript
commands

Description

SAPscript
Commands

Address,
Endaddress

Formatting of address

Perform,
Endperform

Call ABAP subroutines

Bottom, Endbottom

Define footer text in window

Print-control

Box, Position, Size

Boxes, Lines and Shading

Insert print control


character

Case, Endcase

Case distinction

Protect,
Endprotect

Protect from page break

Define

Value assignment to text


symbols

Reset

Initialize outline
paragraph

Hex, Endhex

Hexadecimal values

Set country

Country-specific
formatting

If, Endif

Conditional text output

Set date mask

Formatting of date fields

Include

Include other texts

Set sign

Position + / - sign

New-page

Explicit form feed

Set time mask

Formatting of time fields

New-window

New window main

Style

Change style

Summing

Summing variables

Top

Set header text in main


window

Kaavian Systems

Description

SAPscript Command: Address ENDAddress.


The command formats an address according to the postal standards of
the destination country defined in the parameter COUNTRY. The
reference fields are described in the structure ADRS. Both constants
and symbols can be assigned to the parameters.
/: ADDRESS [DELIVERY][PARAGRAPH P][PRIORITY PR][LINES L ]
/: TITLE <title>
/: NAME name1 [,name3[,name3]]
/: STREET street
/: POSTBOX PO Box [CODE zipcode]
/: POSTCODE zipcode
/: CITY town1[,town2]
/: REGION region
/: COUNTRY country
/: FROMCOUNTRY from country
/:ENDADDRESS
Kaavian Systems

SAP script Command:


BOXES, LINES, SHADING: BOX, POSITION, SIZE
The BOX, POSITION and SIZE commands for drawing boxes, lines and
shadowing can be used for specifying that within a layout set particular
windows or passages of text within a window are to be output in a frame or
with shadowing.
Syntax
1. /: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]
2. /: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]
3. /: SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE]

Kaavian Systems

SAP script Command:


SET DATE

/: Set date mask= date mask

SET TIME

/: Set Time mask = HH:MM

HEADER TEXT :

/:TOP
..
/:ENDTOP

FOOTER TEXT :

/:BOTTOM
..
/:ENDBOTTOM

PROTECT

/: PROTECT
.
/: ENDPROTECT

Kaavian Systems

SAP script Formatting :


Changing the value of a counter

Increasing or decreasing the value of a counter

Country dependent formatting

Specifying formats for country dependent values

Date mask

Formatting date fields

Exponent for floating point


numbers

Specifying an exponent for floating point values

Fill characters

Replacing leading spaces with fill characters

Ignoring conversion rules

Ignoring conversion rules from Dictionary

Leading sign to the left

Leading sign of numeric values is on the left

Leading sign to the right

Leading sign of numeric values is on the right

Number of decimals

Specifying the number of decimal places

Offset

Specifying an offset of n characters

Omitting leading zeros

Omitting the leading zeros

Omitting the leading sign

Omitting the leading sign of numeric values

Omitting the separator for


Thousands

Omitting the separator for thousands in numeric values

Kaavian Systems

SAPscript Formatting:
&SYMBOL&

Symbol value is output

&SYMBOL+4&

Offset (Value returned from Offset)

&SYMBOL(5)&

Width of the value

&SYMBOL(I)&

Suppress Initial Value

&SYMBOL(Z)&

Suppress Leading Zeros

&SYMBOL(C)&

Condense the variable

&SYMBOL(R)&

Right Aligned Output

&SYMBOL(*)&

Dictionary Length

&SYMBOL(9.2)& -

Decimal Format

&text1 SYMBOL text2& - Outputs Value preceded by text1


and succeeded by text2.
Kaavian Systems

PRINT PROGRAM :
The Structure of a Print Program
Retrieves data

Opens layout set


printing

Closes layout set


printing

program rstxexp1.
tables: scustom, sbook, ...
select * from ...
...
call function 'OPEN_FORM'
exporting form = ...
...
call function 'START_FORM' ...
...
call function 'WRITE_FORM'
exporting element = ...
window = ...
...
call function 'END_FORM' ...
...
call function 'START_FORM' ...
...
call function 'END_FORM' ...
...
call function 'CLOSE_FORM' ...

SAP AG

Kaavian Systems

Changes to
another layout set
Prints output on the
layout set

Form Functions
Open_form

- Opens form printing.

Close_form

Closes form printing.

Write_form

- Prints text elements in layout set window.

Write_form_lines

Prints text lines from table into specified


form window.

Start_form

- To combine several different forms into one


print output

End_form

- Ends the currently open form and Executes


the required termination processing
Kaavian Systems

Beginning and End of Layout Set Prin

CALL FUNCTION OPEN_FORM


EXPORTING
FORM
=
LANGUAGE
=
DEVICE
=
OPTIONS
=
DIALOG
=
IMPORTING
LANGUAGE
=
EXCEPTIONS ...
=

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

...
...

CALL FUNCTION CLOSE_FORM


IMPORTING
RESULT
= ...
EXCEPTIONS ...
= ...

tputting More than One Layout Se


ng a Single Spool Request
CALL FUNCTION START_FORM
EXPORTING
FORM
= .
LANGUAGE
= .
STARTPAGE
= .
IMPORTING
LANGUAGE
= .
EXCEPTIONS ...
= .

..
..
..
..
..

CALL FUNCTION END_FORM


IMPORTING
RESULT
= ...
EXCEPTIONS ...
= ...
Kaavian Systems

CALL FUNCTION 'WRITE_FORM'


EXPORTING
ELEMENT =
WINDOW =
FUNCTION =
TYPE =
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT =
FUNCTION =
TYPE =
UNOPENED =
UNSTARTED =
WINDOW =
Kaavian Systems

Adding Graphics to Layout:


Convert the available graphic to either BMP format or TIFF format.
Invoke Transaction SE78.
Select Category and Enter a name of the graphic image to be stored in
Document Server.
Click on Import Icon.
Enter existing image file name with path at File name field.
Enter Description of the image.
Press Enter Key.
The image is saved in Document Server from where we can directly
place it on the layout.
Kaavian Systems

Source of SAPscript Forms:


SAP provides you with two different sources for
SAPscript forms:
Standard SAPscript forms: Standard SAPscript
forms are delivered with the SAP standard client
(usually referred to as client 000).
Preconfigured SAPscript forms:
Developed for the U.S. and Canadian markets, the
preconfigured SAPscript forms are delivered with
the Preconfigured Client (PCC).
Kaavian Systems

Some of the Standard SAPscript Forms:


Form Description

Standard Form Name

Sales Order Confirmation

RVORDER01

Packing List

RVDELNOTE

Invoice

RVINVOICE01

Purchase Order

MEDRUCK

Prenumbered Check

F110_PRENUM_CHCK

Some of the Preconfigured SAPscript forms (for US & CANADA)


Form Description

Preconfigured Form Name

Sales Order Confirmation

YPCC_ORDCONF_STD

Packing List

YPCC_PACKLIST

Purchase Order

YPCC_CHECK_NUM

Invoice

YPCC_INVOICE_STD

Remittance Advice

YPCC_REMITT_STD

Account Statement / Open Item List

YPCC_STATEMT_STD

Balance Carried Forward Statement /Open Item List

YPCC_STMBCF_STD

Unnumbered Check

YPCC_CHECK_UNN

Prenumbered Check

Kaavian Systems

YPCC_CHECK_NUM

Discussion

Potrebbero piacerti anche