Upload
anil-chandrasekharan-nair
View
679
Download
5
Embed Size (px)
Citation preview
Day 4
SAP Scripts I
Agenda
• About Forms• Header• Page Layout
– Windows– Pages– Page Windows
• Paragraph Format• Character Format• Documentation
Different Forms
Form 2
Form 1
Form 3
Dear
Invoice
Document
Processing Sequence
Invoice
Document
Print program
Application transaction
Form
Composer
SAP DBSAP DB
Invoice
SAP Script SE71
A form of the graphical
Form Painter consists of
Header data
Page layout
Paragraph format
Character format
Documentation
Header Data: Organization:
HeaderdataHeaderdata
Administrative data
Language attributes
Basic settings
Default values fortextformatting
Administration
Set up page
information
Header Data: Basic Settings
Basic SettingsBasic Settings
PageformatFirst pageOrientation
Portrait formatLandscape format
Lines/inchCharacters/inch
Set uppage
Tab stopFont familyFont sizeDefault paragraphBoldItalicUnderlined
SpacingThicknessIntensity
Default values for text formatting
Spool
FormFormdefinitiondefinition
Fontmaintenance
Editing Forms: The Form Painter
alphanumeric
Header data
Windows
Pages
Pagewindows
Paragraphformats
Character formats
Form Painter graphical
Layout
Header data
Paragraphformats
Character formats
Structuring Pages Using Windows
Windows
Pages
Form Components - Windows
• They represent areas that are positioned on pages – as page windows – and in which at a later time text is printed. You must define at least one window for each form
• Types of windows
– Main Window
– Variable Window
– Const Window© SAP AG 1999
SenderDate
Adressee
Footer
Window withbody text
Windows
Window type: MAIN
Window type: VAR
Window type: VAR
Window Types
Page Windows
• Window names are linked to page names. The position and size of the window on the assigned page should be specified– Left margin
– Upper margin
– Window width
– Window height
Pagewindow
TopTopedgeedgeLeft edgeLeft edge
WidthWidth
HeightHeight
PagePage
Windows and Page Windows
SenderDate
Adressee
Footer
Window withbody text
Windows Form: Page windows
Page 1
Page 2
and
Pages
• Define at least one page for every form
• Designate a "first" page in the form header
• Inform the system which page is to be used after reaching the end of the first page
Pages - Attributes
ModeINC Increases the counter by 1HOLD Counter remains unchangedSTART Sets the counter to 1
NUMBERING TYPES ARABICArabicnumeralsCHAR Fixed characterLETTERLettersROMAN Romannumerals
Papertray choice
S Simplex modeD Duplex modeT Tumble mode
S Simplex modeD Duplex modeT Tumble mode
Character formats
• Allows to format entire blocks of text within a paragraph
• Character attribute groups can be: – Font
– Standard
Font attributes - attributes such as
font family, size, bold, italic etc.
Standard attributes– Marker– Bar code– Protected– Hidden– Superscript/subscript
Paragraph formats
• In SAPScript, paragraphs are formatted using formats and their corresponding attributes
• Helps simplifying the text processing
Attributes– Standard
– Font
– Tabs
– Outline
Paragraph formats
• Standard attributes– Description– Left or right margin– Indent first line– Space before and space after– Alignment– Line spacing– No blank lines– Page protection– Next paragraph same page
Paragraph
Left marginRight marginIndent 1st lineSpace beforeSpace after
AlignmentLine spacing
Noblank linesPage protectionNext paragraph same page
Description
WindowWindow
IndentationIndentation
Space afterSpace after
Space beforeSpace before
Left marginLeft margin Right marginRight margin
HD Header 1
1.00 CM LEFT1.50 CM 1.00 LN2.00 CM1.50 CM
Alignment:BLOCK justifiedCENTER centeredLEFT aligned left RIGHT aligned right
Alignment:BLOCK justifiedCENTER centeredLEFT aligned left RIGHT aligned right
Units of measurement:LN LinesCM CentimetersMM MillimetersIN InchesPT PointsTW Twips
Units of measurement:LN LinesCM CentimetersMM MillimetersIN InchesPT PointsTW Twips
Standardattributes
Paragraph formats
• Font attributes - attributes such as font family, size, bold, italic etc.
• Tabs - tab position (different units of measure)
• Outline - Outline, outline level, Number margin, left/right delimiter, Number chaining, character string, Numbering type.
Paragraph Formats: Metric Sizes
Dear Mr.. Smythe,
reservation. We are pleased to
confirm the following bookings
Thank you for your
WindowWindow
IndentIndent
Space afterSpace after
Space beforeSpace before
Left marginLeft margin Right marginRight margin
Paragraph Formats: MetricSizes
Graphical Form Painter: Page Layout
OptionsDesign / Text
WindowWindowDescription
Left marginUpper marginWindow widthWindow height
Main window
Default paragraph1,60 CM1,60 CM9,00 CM6,00 CM
ADDRESSAddress
Page
FIRST Address page
Graphic
Form ...
MAIN*
WINDOW1*
WINDOW2*
Design windowAdministrative window
Form Elements: Documentation
List ofall pages PAGE_1PAGE_2. . .
List ofallwindows WINDOW_1MAIN. . .
Listofall text elements MAIN -ITEM_HEADERMAIN -ITEM_LINE. . .
EditorEditor
Enter long texts
Day 4
SAP Scripts II
Agenda
• Text Elements• Control Commands• Symbols – System, Program, Standard, Text• Function Modules
Text Elements
• Text elements are defined for each window. On the Form: choose Edit → Text elements.
• In the layout of a text element, we can use the paragraph and character formats defined in the form.
Example/E ITEM_LINEIL &VBDPA-POSNR&,,&VBDPA-MATNR/ &'Customerarticlenumber 'VBDPA-IDNKD'
SAP Script - Control commands
• IF CommandSyntax/: IF condition:ELSEIF condition:/:ELSE:/:ENDIF
IF + the condition must not extend more than a line
SAP Script - Control commands
• CASE commandSyntax/: CASE symbol
/: WHEN value1
:
/: WHEN value 2
:
/: WHEN value n
:
/: WHEN OTHERS.
:
/:ENDCASE
SAP Script - Control commands
• PERFORM CommandTo Call an ABAP subroutine (form) from any program
Syntax/: PERFORM <form> IN PROGRAM <prog>
/: USING &VAR1&
…
/: CHANGING &VAR2&
…
/: ENDPERFORM
SAP Script - Control commands
• ADDRESS CommandFormatting Addresses/: ADDRESS [DELIVERY] [TYPE t] [PARAGRAPH a]
[PRIORITY p] [LINES l] /: TITLE title…./: STREET street name HOUSE house number….
/: ENDADDRESS
SAP Script - Control commands
• INCLUDE Command
To include the contents of another text into the current textSyntax
/: INCLUDE name [OBJECT o] [ID i] [LANGUAGE l] [PARAGRAPH p] [NEW-PARAGRAPH np]
Example/: INCLUDE MYTEXT LANGUAGE 'E' PARAGRAPH 'A1'
SAP Script - Symbols
• Text in the SAP system contains a reference to some other stored object
• We can create flexible text modules by using the placeholders at all points where the text needs to be variable. These placeholders are symbols
• Data is added to the text normally at the point at which output is formatted
SAP Script - Symbols - Types
• System symbols
• Standard symbols
• Program symbols
• Text symbols
System Symbols
DATE DateDAY DayNAME_OF_DAY Name of dayMONTH MonthNAME_OF_MONTH Name of monthYEAR YearTIME TimeHOURS HoursMINUTES MinutesSECONDS SecondsPAGE Page numberNEXTPAGE Number of next pageDEVICE Output deviceSPACE Blank spaceULINE UnderlineVLINE Vertical line
Standard Symbols
Table TTDTG
Symbols are user-defined
Symbols are language-dependent
Name: max. 22 characters
Value: max. 60 characters
Text Symbols
Value is defined in the text module
DEFINE &symbol& = ’ value ’
Name: max. 32 characters
Value: max. 60 characters
Program SymbolsKNA1
TABLES KNA1.DATA: COUNTRY LIKE ...* Data selection
...* Start of form printing
...
Jane Smith81 Third Ave.Capital City, CA 80801USA
ABAP
Form
&KNA1 - NAME1&&KNA1 - STRAS&&KNA1 - PSTLZ&&KNA1 - ORT01&&COUNTRY&
NAME1 Jane Smith
PSTLZ 80801ORT01 Capital City, CA
STRAS 81 Third Ave
Program Symbol and Symbol Definition
Text Edit Goto Format Insert System Help
Program symbols Symbol definition
Print programs for formPrint report Short description
RIPRAT01 .....
Program symbols
Symbol definition
SPFLISFLIGHTCRTX.....
.....
REPORT riprat01.TABLES: spfli, sflight, ...DATA: sums LIKE ...
Text Edit Goto Format Include System Help
Programm symbolsSymbol definition
DDIC fields Global data
Print programfor form
..... .....
Print programm Description
RIPRAT01 .....
Defining Text Symbols
/ : DEFINE&SYMBOL& = 'String1 String2 String3'
. . .
Form: RVINVOICE01
Window: FOOTER
Time, Date Format
/: SET TIME MASK = ’.........’
/: SET DATE MASK = ’........’
/: SET COUNTRY ’........’
SET TIME MASK = ’HH : MM’ SET DATE MASK = ’DD.MMMM YYYY’
Example :
SET COUNTRY ’US’
/:/:/:
Frames, Lines and Shading
Window1
[/ : POSITION WINDOW] [/ : SIZE WIDTH 2 CM HEIGHT +40 TW]/ : BOX FRAME 10 TW
Window2
/ : BOX INTENSITY 10
Window3
/ : BOX HEIGHT 0 CM FRAME 20 TW/ : BOX WIDTH 0 CM FRAME 20 TW
FormWindow1
Window2
Window3
Calling ABAP Subroutines
/: PERFORM <form> IN PROGRAM <prog>/: USING &invar1&/: USING &invar2&
………./: CHANGING &outvar1&
……../: ENDPERFORM
FormIN_TAB structure ITCSY
NAME VALUEinvar1 . . .invar2 . . .
REPORT <prog>.FORM <form> TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
. . .
ENDFORM.ABAPreport
ABAPDictionary
Function Modules in SAP Script
Form functions• OPEN_FORM Opens the form output• WRITE_FORM Calls a form element • CLOSE_FORM Ends the form output• START_FORM Starts a new form
Database• READ_TEXT Reads a text module and passes
it to the specified work areas
Print Program and Composer
ComposerComposerXYZ Bank
Acct. No.: 0815 4711Bank No.: 000000000
J. Smith7 Second Ave.47110 XYZ City
Place, DateInvoice No.4 123-45-556-678
Art.No. Price 00345 200.-00379 150.-02378 50.-00458 300.-Total 700.-
Print programreport jh_form_01.
tables: scustom.select * from scustom...
......call function 'OPEN_FORM'
......call function 'START_FORM'
......call function 'WRITE_FORM'
......
ABAPprogramApplication
data
Form
DB
Structure of Print Program
programrstxexp1.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' ...
Retrieves data
Opens formprinting
Closes formprinting
Prints output on form
Changes to another form
Main Windows
TOP
BODY
BOTTOM
MAIN
Outputting Text Elements in the Main Window
/E ITEM_HEADERArt.No.,,Price
/E ITEM_LINE&vbdpa-matnr&,,&vbdpa-netpr&
CALL FUNCTION 'WRITE_FORM'EXPORTING
ELEMENT = . . .EXCEPTIONS ... = . . .
Art.No. Price 00345 200.-
MAIN
Art.No. Price 00345 200.-00379 150.-
MAIN
WRITE_FORMelement = 'ITEM_LINE'window= 'MAIN'
Creating and Deleting Headings
Output headingtocurrent page
call function'START_FORM' ......call function'WRITE_FORM'
exporting element = 'ITEM_HEADER'type = 'BODY'window = 'MAIN'
call function'WRITE_FORM'exporting element = 'ITEM_HEADER'
function= 'SET'type = 'TOP'window = 'MAIN'
...call function'WRITE_FORM'
exporting element = 'ITEM_HEADER'function= 'DELETE'type = 'TOP'window = 'MAIN'
...call function'END_FORM' ...
Write headinginTOParea
Delete heading fromTOParea
for next page
Adding Text Elements to Non-main Windows
CALL FUNCTION 'WRITE_FORM'EXPORTING
ELEMENT = . . .FUNCTION = 'APPEND'WINDOW = 'INFO'
EXCEPTIONS ... = . . .
INFO
Art.No. Price 00345 200.-00379 150.-02378 50.-00458 300.-Total 700.-
INFOTEXT1
Art.No. Price 00345 200.-00379 150.-02378 50.-00458 300.-Total 700.-
INFO
INFOTEXT1INFOTEXT2
WRITE_FORMelement = 'INFOTEXT2'function= 'APPEND'window = 'INFO'
Style : A Formatting Aid
You have assigned a style to this text.
This is an outline:
=> First level=> Second level
=> Third level
----------MYSTYLE---------System-------------Lines 1 - 1/ 1 -----------
You have assigned a STYLE to this text.This is an outline:First levelSecond levelThird level
B
CU
G1
G2
G3
. . . . + . . . . 1 . . . . + . . . . 2 . . . . + . . . . 3 . . . . + . . . . 4 . . . . + . . . . 5 . . . . + . . . . 6 . . . . +
G3 Outline level 3
G2 Outline level 2
G1 Outline level 1
CU Italic, underlined
B Bold
AS Standard paragraphOutline level 3G3
F.... Description
Format column(1) 6 En...
F4
Thank You