Sei sulla pagina 1di 49

AB1008 SAPscripts - v1.

India SAP CoE, Slide 1

SAPscripts
1 2

Introduction Syntax Description


3

Demonstration
Exercises HelpMe

5
India SAP CoE, Slide 2

SAPscripts
1 2

Introduction Syntax Description


3

Demonstration
Exercises HelpMe

5
India SAP CoE, Slide 3

Purpose

SAPscript is a template that simplifies the process of designing business forms. You need SAPscript forms to print, distribute or display business forms.

India SAP CoE, Slide 4

Use

Forms are defined and formatted using layout sets. SAP documents are printed using forms. SAPscript is a tool that SAP provides for creating layout sets.

India SAP CoE, Slide 5

How SAPscript Works


SAP Document Document Layout set Read Data (Template) Form

Print

(Output)

Sales order Billing document Purchase order etc

Define

SAPscript

Order confirmation Invoice Purchase order etc

SAP documents are printed using forms. Forms are defined and formatted using layout sets. SAPscript is a tool that SAP provides for creating layout sets.

India SAP CoE, Slide 6

Components of SAPscript
Output determination configuration

SAP Document Document

Output Program

Layout set

Form

Printer / Font Configuration


Output program:
Layout set: Printer / Font configuration:

Extracts data from SAP data dictionary


Formats the extracted data Configures impact / laser printer, bar code, logo

Output determination configuration: Configures triggering event, timing/destination

India SAP CoE, Slide 7

SAPscripts
1 2

PrepareMe Syntax description


3

Demonstration
Exercises HelpMe

5
India SAP CoE, Slide 8

Print Program
Overview
Print Program Overview: Get the required data from the database. Call function modules : OPEN_FORM (to initialize the print output of the form), WRITE_FORM (to output the general text and data in the main window) CLOSE_FORM (ends the printing of the form)

Note: For each printout of a form, you must use the pair of function modules OPEN_FORM and CLOSE_FORM. You can also use a print program to print several forms, which you can either maintain in separate spool requests or combine into one. In the latter case, you must use the function modules START_FORM and END_FORM.

India SAP CoE, Slide 9

Structure of Programs Stand alone Transaction Triggered Communication in between program and layout set is done via execution of function calls and communication structures. Execution sequence of function calls A layout set must be opened before being able to output data. Data can be transfer as often as required. At end layout set has to be closed.

India SAP CoE, Slide 10

Syntax Description
General Function calls: CALL FUNCTION OPEN_FORM . CALL FUNCTION WRITE_FORM . CALL FUNCTION CLOSE_FORM . CALL FUNCTION CONTROL_FORM . CALL FUNCTION READ_TEXT .

India SAP CoE, Slide 11

Syntax Description
CALL FUNCTION OPEN_FORM = ..

EXPORTING
IMPORTING EXCEPTIONS

FORM LANGUAGE DEVICE = .. OPTIONS DIALOG = .. APPLICATION


LANGUAGE ..

= .. = ..
= .. = .. = ..

India SAP CoE, Slide 12

Syntax Description
CALL FUNCTION WRITE_FORM

EXPORTING
ELEMENT TYPE FUNCTION WINDOW .. = .. = .. = .. = ..

EXCEPTIONS

India SAP CoE, Slide 13

SAPscripts
1 2

PrepareMe Syntax Description


3

Demonstration
Exercises HelpMe

5
India SAP CoE, Slide 14

Demonstration
SAPscript Development
Component Output program Layout set Resource ABAP resource ABAP resource

Output determination Functional resource configuration Printer configuration Basis / ABAP (Impact, Thermal, Laser) Font configuraiton Basis / ABAP Testing End-user / Functional / ABAP resrouce

India SAP CoE, Slide 15

SAPscript Transaction Codes


SE71 : Form Painter SE72: Style Maintenance SE78: Graphics Managements S010: Create Standard Text Module

India SAP CoE, Slide 16

Layout Set
Some Facts

Client specific (client-dependent) Language specific While creating SAP Script it is necessary to specify a language. Note: If the layout set is not available in the client in which the document is being printed, then the SAPscript checks for the style or layout set in client 000. Recommendation: Keep only one copy of the layout set in one client.

India SAP CoE, Slide 17

Layout Set Elements


Give Transaction SE71 in command field

Header
Pages Windows Page windows Paragraphs formats Character formats

Documentation

India SAP CoE, Slide 18

Layout Set Elements Components


Header: Pages: Windows: Page windows: Paragraphs formats: Character formats: Documentation:

General info and default settings Name of the pages with page flow info Description of areas on the pages Position and size of the windows on the pages Font and tab info Font info within a paragraph Gives the documentation of the form

India SAP CoE, Slide 19

Layout Set Elements


Header-Administrative Data

This tab gives all the administrative information like Form Name, Description, Package, Date of creation and change and language attributes.

India SAP CoE, Slide 20

Layout Set Elements


Header- Basic Settings
This tab gives the Basic Settings like Page format, Default paragraph, Font size and family, lines per inch and characters per inch (never change Lines per inch & Characters/inch)

India SAP CoE, Slide 21

Layout Set Elements


Page Windows
List of all the windows on the page with coordinates. The coordinates are given by the upper left-hand corner and the width and length. Note: A window which should appear on a page must first be defined under Windows and then be added to the page windows.

India SAP CoE, Slide 22

Layout Set Elements


Windows
Type of windows: Main - Special VAR - Variable CONST - Constant Shows list of all windows defined for the layout set. A window can contain hardcoded texts and the variables to be printed in the window.

India SAP CoE, Slide 23

Layout Set Elements


Windows - Text element
Tag column: The tag column contains format keys which define the output formatting of the text or initiate control commands. Text line column: Contains the actual content of the window. Special characters * Default paragraph /: Command line /* Comment line /E Text element

India SAP CoE, Slide 24

Layout Set Elements


Pages
Shows the no of pages and page flow information.
The next page of the current page is defined here.

India SAP CoE, Slide 25

Layout Set Elements


Paragraph Formats
Contains all information needed to format a paragraph of text. Following are the attributes

Standard Font Tabs Outline

India SAP CoE, Slide 26

Layout Set Elements


Paragraph Format-Standard Attributes
Standard attributes
The values for margin, alignment and line spacing for the corresponding paragraph is defined here.

India SAP CoE, Slide 27

Layout Set Elements


Paragraph Format-Tabs
Tabs
Specifies the value for each tab with alignment corresponding to the paragraph.

India SAP CoE, Slide 28

Layout Set Elements


Paragraph Format-Font
Font
Font attributes like font family, size, bold, Italic etc. is defined here. If no font is specified, default font from the layout set header will be used.

India SAP CoE, Slide 29

Layout Set Elements


Character Format - Standard Attributes
A default character style is specified at the paragraph level. Can be used within paragraph to override the default settings for a few words within the paragraph.

India SAP CoE, Slide 30

Layout Set Elements


Character Format - Font Attributes
Font attributes like font family, size etc for a particular character format can be defined here.

India SAP CoE, Slide 31

Layout Set
Test Print
Menu: Utilities > Printing test Shows the layout design of the layout set. Test printing does not trigger the output program to interface with the layout set. It simply shows the maximum length of each of the fields being printed.

India SAP CoE, Slide 32

Layout Set
Activating Layout Set
Menu: Form > Activate Must activate the layout set any time a change has been made

India SAP CoE, Slide 33

Layout Set
Commands
In SAPscript, any text can be included at a certain position in the document. The text is defined as standard text using transaction SO10. This text is displayed in the document using INCLUDE command as follows.
Syntax : INCLUDE name OBJECT object ID identifier PARAGRAPH paragraph LANGUAGE language. Example : INCLUDE &VBDPL-TDNAME& OBJECT VBBP ID 0001 PARAGRAPH IT INCLUDE SD_TEXT OBJECT TEXT ID SDVD PARAGRAPH HT

India SAP CoE, Slide 34

Translation
Forms and styles are language - specific. That is, the definitions and texts in a form or style are defined for a particular language. The language in which a form or style is created is its "original language."

Forms and styles can be translated using the standard SAP translation tools ( Transaction SE63 ).
Goto transaction SE63, select the menu path: Translation ABAP Objects Other Long Texts .

India SAP CoE, Slide 35

Select SAP Smart Forms option from the list. Give the name of text module and select the source and target languages for the translation and edit.

India SAP CoE, Slide 36

Retrieved Data passing to Program


FORM .. ENDFORM is used when retrieved data needs to sent back to print program.

In SAPscript:
PERFORM < routine_name> in <report_name> USING &var1& CHANGING &var2&. ENDPERFORM.

India SAP CoE, Slide 37

Retrieved Data passing to Program


In Report:
FORM < routine_name> in_tab type ITCSY out_tab type ITCSY READ TABLE in_tab WITH KEY NAME = var1. {Data Selection based on above value. It returns ret_value.} READ TABLE out_tab WITH KEY name = var2. out_tab-value = ret_value. MODIFY out_tab. ENDFORM.

India SAP CoE, Slide 38

Logo Printing
To print a Logo, follow the steps below :
Built a Logo. This file can be a bit map or windows meta file. Convert the Logo to a TIFF ( extension TIF ) file. Use program RSTXLDMC to convert the TIF file to a standard text. Print this standard text via SAPscript INCLUDE command.
e.g. /: INCLUDE ZHEX-IBMLOGO-PCL OBJECT TEXT ID ST

India SAP CoE, Slide 39

Barcode Printing
To print barcode , follow the steps below :
Select / Create a barcode in SAP using transaction SE73. Create a character format and include the barcode with it. The data need to printed as barcode should be attributed via the character format. e.g. / <BC>&VBAK-WERKS&</>

India SAP CoE, Slide 40

Execution methods
Direct call
A script is called in a custom report program which is executed through a transaction code assigned to it.

Dynamic call
The configuration need to be done for this. The basic configuration required to do for script is creating output type and attaching the script to the output type. - NACE is the transaction to set the output type. - In this transaction first the application is selected ( e.g.V1 Sales, V2 Shipping etc) - Then output type is selected. Sometimes output type is created newly. - Whenever new output type is created , 3 parameters are required. They are :
Script Name Driver Program Name ENTRY routine name.

India SAP CoE, Slide 41

SAPscripts
1 2

Introduction Syntax Description


3

Demonstration
Exercises HelpMe

5
India SAP CoE, Slide 42

Exercises
Let us design one SAPscript for Billing Document.. The layout specifications and data retrieval logic has been explained in these word documents.

Layout Specification

Data Retrieval Logic

India SAP CoE, Slide 43

SAPscripts
1 2

Introduction Syntax Description


3

Demonstration
Exercises HelpMe

5
India SAP CoE, Slide 44

HelpMe

Additional Info
Some Standard SAPscript Forms

Form Description Sales order confirmation Picking List INVOICE PURCHASE ORDER PRENUMBERED CHECK

Standard Form Name RVORDER01 RVDELNOTE RVINVOICE01 MEDRUCK F110_PRENUM_CHCK

India SAP CoE, Slide 45

SAPscripts - Important Programs

RSTXPDFT4 : to convert your SAPscripts spools into a PDF format. RSTXSCRP : Import/Export SAPscript form from PC file RSTXLDMC : To convert TIF file to Standard text

India SAP CoE, Slide 46

Layout Set
Symbol
SYSTEM symbols are supplied by SAPscripts. They can be used in all texts. Following are list of frequently used system symbols.
&DATE& &DAY& &MONTH& &YEAR& &TIME& &HOURS& &MINUTES& &SECONDS& &PAGE& &NEXTPAGE& &SPACE& &ULINE& &VLINE& &NAME_OF_MONTH& = Current date = Day = Month = Year = Time of day = Hours = Minutes = Seconds = Page = Page number of next page = Blanks = Underline = Vertical line = Name of month

India SAP CoE, Slide 47

Layout Set
Symbol
FORMATTING of the symbol can be done in following different ways:
&SYMBOL+ 4& &SYMBOL(5)& &SYMBOL(I)& &SYMBOL(Z)& &SYMBOL(C)& &SYMBOL(R)& &SYMBOL(S)& &SYMBOL(5,2)& &SYMBOL(E3)& &text1SYMBOLtext2& = Off set = Length = If the symbol is initial, output nothing = Suppress leading zeros = Compress blanks = Right-justified output = Suppress +/- sign = Decimal place formatting = Exponential notation = Concatenation of symbol and text

Examples :
&VBDPR-MATNR+2(4)& &VBDKL-BRGEW(I13)& &Currency : VBDKA-WAERK& &Case # &PREFIX&VBDPR-BSTNK+2(8)00&

India SAP CoE, Slide 48

SAPscripts Boxes/Lines/Shading
Drawing a box
/: BOX XPOS '11.21' MM YPOS '5.31' MM HEIGHT '10' MM WIDTH '20' MM INTENSITY 10 FRAME 0 TW OR /: POSITION XORIGIN '11.21' YORIGIN '5.31' MM /: SIZE HEIGHT '2' MM WIDTH '76' MM /: BOX FRAME 10 TW INTENSITY 10

To set the current position relatively to the start of the Window.


/: POSITION WINDOW /: POSITION XORIGIN '+5' MM YORIGIN '+10' MM

The position is now 5 MM from the left and 10 MM from the top of the window.

India SAP CoE, Slide 49

Potrebbero piacerti anche