Professional Documents
Culture Documents
6. Character Format.
7. Layout.
Header
It contains header information of SAP Script i:e administrative data and basic settings of SAP
script.
Administrative Data: It contains administrative data like package, client, user and language.
Basic Settings: It contains settings like page format, first page, default paragraph etc.
Pages
SAP Script is a group of pages, each page contains layout.
The layout is used to design page.
Page is a group of windows.
In SAP Scripts we can create 99 pages only.
Windows
A window is a container which contains some information to display, the entire page is designed
using windows.
There are four types of windows.
Main window:
A Window which automatically expands depending upon the data is called main window.
Each page contains only one main Window.
As there are 99 pages only in scripts, we can have maximum 99 main windows only The main
Window data is divided into blocks called as text elements.
Text Element:
It is used to display the specific block of information.
Text elements are represented by /E
The entire main Window data is divided into blocks called as text elements.
Now,Display a particular text element, so that only that specific info related to text element is
displayed.
Constant Window:
A Window which is constant for all the pages is called constant Window.
Variable Window:
A Window which does not expand i.e., width and height is fixed .
Graphical Window:
A window which is used to display graphics or images.
Page windows:
The windows assigned to particular page are called page windows.
Paragraph format :
It is used to specify a particular format (font size/family/Bold/italic/underlined) for all the
characters in a paragraph .
We can also specify TABS.
Tabs : Tabs are used to specify a position in sap script so that the text will be displayed at that
particular position.
Tabs are represented by ,, (2 commas).
Character format :
A format which is used by a group of characters inside a paragraph is called a character format .
Layout:
It is a place where we design the page with windows.
OPEN_FORM
This is used to open a form for execution by loading it into memory.
WRITE_FORM
It is used to write Some information on the SAP Script form using Text Element.
CLOSE_FORM
It is used to close the form which is opened by open form.
START_FORM
It is used to call another SAP Script into current SAP Script(Nested Scripts).
END_FORM
It is used to end the form which started by START_FORM.
Driver Program
A program which contains business logic statements i.e., all select statements ,loops,appends
etc, is called Driver prg.
In simple words, a program which is used to drive or print the script.
All the variables ,work areas ,internal tables which are declared in the driver program will be
automatically transferred to SAP Scripts.
If we want to display the variables or workarea values we need to follow below syntax.
Syntax : &variable&
&workarea-fname&
EXPORTING
FORM = 'ZV_PO'
LANGUAGE = SY-LANGU.
*PRINT EACH ITEM IN MAIN WINDOW
LOOP AT IT_EKPO INTO WA_EKPO .
*CALCLUATE GRAND TOTAL
V_TOT = V_TOT + WA_EKPO-NETWR .
WA_EKPO-MATNR = 'APACHE-160' .
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'BODY'
WINDOW = 'MAIN'.
*PRIINT THETOTAL AFETR ANIN WINDOW BODY PAGE
AT LAST .
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TOTAL'
WINDOW = 'MAIN'.
ENDAT.
ENDLOOP .
CALL FUNCTION 'CLOSE_FORM'.
Step15 : EXECUTE THE driver program
EXECUTE THE driver program->Give PO number as 4151508223
and execute->Below is the output .
Step16 : Create a Second Page Layout
Now Create a second Page PAGE2 and copy the Main Window, Page No Window, Footer
Window.
Click on PAGES->EDIT->CRATE ELEMENT->give page as page2 and meaning as page2>>Give Next Page as Page2
Double click on Page1->give next page as Page2.
AT LAST .
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TOTAL'
WINDOW = 'MAIN'.
ENDAT.
ENDLOOP .
CALL FUNCTION 'END_FORM' .
*The start form is used to call another SAP SCRIPT form for printing TERMS&CONDITIONS.
*This form can be reusable by al forms as it is only for printing TREMS&CONDITIONS
CALL FUNCTION 'START_FORM'
EXPORTING
* ARCHIVE_INDEX = ARCHIVE_INDEX
FORM = 'ZV_PO_TERMS'
LANGUAGE = SY-LANGU
.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TERMS'
WINDOW = 'MAIN'.
CALL FUNCTION 'END_FORM' .
CALL FUNCTION 'CLOSE_FORM'
.