*SCRIPTS*
BY ----Arjun
List of topics to be discussed
What is SAP Script?
Why they are client dependant?
Components of Script
Text Elements
Window types
FM's
Driver prg and Passing Data
5 Examples on displaying text,
variables from driver prog, logo, Address, StandardText
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 2
SYMBOLS IN SAP SCRIPTS
CONTROL COMMANDS
1.define
2.address
3.top..endtop
4.bottom...endbottom
5.protect...endprotect
6.standard text/pageno
7.NEW-PAGE
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 3
8.IF...ENDIF..
9.CASE...ENDCASE
10.PERFORM(EXT SUBROUTINE)
Real time Ex on PO
Configuration of SCRIPT&driver prog.
Modifying std Sap Script
Modifying std Sap Script w/o modifying driver prog using External
Subroutines.
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 4
Configuration of custom script in NACE.
DEBUGGING SAP SCRIPT
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 5
Overview
SAP SCRIPT
It is an SAP tool. which is used to generate printable
business documents like invoice , sale order, delivery
note,Employee forms etc.,
The advanced version of script is smart form .
SAP scripts are client dependent i.e. If a script is developed in
client 100, it is not visible in another client 120 or 130.
Smart forms are client independent
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 6
Why scripts are client dependent?
Why scripts are client dependent???
When ever an SAP script is generated it is internally stored as
texts .
All texts are client dependent .
Because texts are client dependent .
SAP scripts are also client dependent .
SE71 is the Transaction code for Scripts .
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 7
Components of SAP Scripts :
Components of SAP Scripts :
1.Header
.Administrative data
.Basic settings
2. pages
3.Windows
4.Pagewindows
5.Paragraphformat
6.Charecterformat
7.Layout
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 8
Components of SAP Scripts :
HEADER
It contains the header information of the SAP Script .
Administrative data
It contains the data related to package name , clientno,username and
languages
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 9
Components of SAP Scripts :
Basic settings
It contains the data related to settings like
Page format, orientation, first page, default paragraph
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 10
Components of SAP Scripts :
SAP script is a group of pages.
Each page contains a layout.
The layout is used to design the page.
Page is a group of windows.
We can create 99 Pages only.
Pages:
For every page, we need to specify next page
If next page is not specified then it will consider the same page as
next page.
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 11
Components of SAP Scripts :
Windows:
A window contains some information to display on script.
The entire page information is divided in the form of windows.
There are four types of windows:
Main
window
Variable
window
Constant
Graphical
window
window.
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 12
Components of SAP Scripts :
Main window:
A Window which automatically expands depends 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 purticular text element, so that only that specific
info related to text element is displayed
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 13
Components of SAP Scripts :
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.
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 14
Components of SAP Scripts :
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).
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 15
Components of SAP Scripts :
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
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 16
Function Modules in SAP Scripts :
The various function modules available in SAP Scripts are:
OPEN_FORM
WRITE_FORM
It is used to call another SAP Script into current SAP Script(Nested
Scripts).
END_FORM
It is used to close the form which is opened by open form
START_FORM
It is used to write Some information on the SAP Script form using
Text Element.
CLOSE_FORM
This is used to open a form for execution by loading it into memory
It is used to end the form which started by START_FORM.
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 17
Driver Program::
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&
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 18
CREATING DRIVER PROGRAM
Creating program in SE38 by name zScript_DP
CALL FUNCTION OPEN_FORM
EXPORTING
FORMNAME = ZSCRIPT
LANGUAGE = SY-LANGU.
CALL FUNCTION WRITE_FORM
EXPORTING
ELEMENT
= MAIN
WINDOW
= MAIN.
CALL FUNCTION CLOSE_FORM.
SAVE ,ACTIVATE AND TEST IT.
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 19
EXAMPLES
Example on sample script to display TITLE and some info on MAIN
window
Example on sample script to display variable from driver prog.
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 20
LOGO/GRAPHICS IN SCRIPTS
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 21
DISPLAYING GRAPHICS OR IMAGES
We have two options to display images on SAP Script
One is using SE78 Tcode
Another is using RSTXLDMC Program.
Using SE78
Goto SE78
Expand Form Graphics
Stored on Document Server
Graphics
Bitmap Images
Double click on Bit map Images
Click on Import Button
Select the File name
Give the name as GE.
Give Description .
Select color bitmap radio button
Press Enter.
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 22
Uploading Into Scripts
Open the Script created.
Click on windows
Create window by name logo.
Click on Pages windows and adjust the position.
Double Click on Logo Window.
Click on Insert
Graphics
Select the Tab Stored on Document Server.
Give the image name as GE.
press enter.
Save Activate and Execute Driver program.
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 23
ADRESS IN SAP SCRIPTS
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 24
Address EndAddress :
It is the command used to print the Address of customer or
vendor
Each customer or vendor or employee will have a address no
which holds the address of customer or vendor or employee .
The address nos are stored in master tables by fieldname
ADRNR
The complete address will be available in ADRC table
syntax :
/: Address
/: Addressnumber &Addressno&
/ : Endaddres
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 25
Example on displaying ADDRESS
Create a window by name ADRESS
Double click on it and write the below code
/: Address
/: Addressnumber 122
/ : Endaddres
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 26
STANDARD TEXT
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 27
STANDARD TEXT IN SCRIPTS :
It is a text which is reusable by multiple scripts or Smartforms is
called standard texts .
SO10 is the transaction code for standard texts .
Steps:
Goto SO10.
Give a TextName : ZARJUNClick on Create
Write the text
Save itClick on Back
Click on Print Preview Icon
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 28
Once stanadard text is created,follow the below steps
Goto Main windowDouble click
Click on INSERT->TEXT->STANDARD
A popup is raised
GIve the text name as ZARJUNPress enter
The below code will be generated
/:Include ZARJUN object TEXT id ST
Save,activate,Test
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 29
Symbols in SAP Script
Symbols are place holders for storing a value and printing them
In SAP SCRIPT.
There are mainly 3 types of symbols in SAP Script .
Programsymbols : Driver program symbols
System symbols : symbols defined by system
Standard symbols : symbols which are declared at a standard place
i.e. table(TTDTG) so that they can be reusable by multiple scripts
are called standard symbols
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 30
CONTROL COMMANDS
The commands which are used to format or change the output
Of SAP SCRIPT are called control commands
DEFINE
/: DEFINE &LV_NAME& = RELIANCE.
* &LV_NAME&
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 31
CONTROL COMMANDS
Address EndAddress :
It is used to print the Address of customer or vendor
syntax :
/: Address
/: Addressnumber &Addressno&
/ : Endaddres
Top Endtop :
It is used to display the constant page heading in the main window across all the
pages .
syntax :
/: Top
* here pageheading
/ : Endtop
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 32
Bottom . Endbottom :
It is used to display constant footer in main window across all
pages .
syntax :
/: Bottom
* here footer information
/ : Endbottom
Protect . Endprotect :
It is used to display the entire
information without any pagebreak .
syntax :
/: protect
* here our data is placed
/ : Endprotect
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 33
CONTROL COMMANDS
New-page :
it is used to start a new page to display some information .
* this is some data ON PAGE1
/: new-page
* this is some data ON PAGE2
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 34
IF.ENDIF
It is a conditional statement which is same as ABAP .
/: DEFINE &LV_NAME& = RELIANCE.
/ : IF &LV_NAME& = RELIANCE.
* RELIANCE GLOBAL SERVICES
/: endif
similarly we use
IFELSEENDIF.
IFELSEIF.ELSEIF.ELSEIF..ELSE.ENDIF
CASE..ENDCASE
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 35
STANDARD TEXT IN SCRIPTS
STANDARD TEXT IN SCRIPTS :
It is a text which is reusable by multiple scripts or Smartforms is
called standard texts .
SO10 is the transaction code for standard texts .
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 36
Purchase Order
A Real Time Scenario
on Purchase Order
SAP Script Form
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 37
Configuaration of Driver Prg & SAP-SCRIPT
Basically configuaration is done by functional consultants
Once the ABAP consultant develops the SCRIPT and Driver prg,
STEPS FOR CONIGURATION
Go to NACE tcode
Select the Appliction
It should be configured in NACE Tcode, so that the End Users can
directly take the print from the transaction itself w/o executing the
driver prg.
EX--- EF for purchase order
V1 for sales
V2 for Billing
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 38
Configuaration of Driver Prg & SAP-SCRIPT
Click on output types
Select the output type as NEU
Double click on processing routines
The below processing routines are displayed
SAPFM06P stands for standard driver prg for purchase order
MEDRUCK stands or standard SAP SCRIPT for purchase order
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 39
MODIFYING STANDARD SCRIPT
If we want to modify the standard script we need to copy standard
script into custom script.
Copying Standard Script
Goto SE71.
Click on Utilities.
Copy from Client.
Give the details as below.
Form
Name : MEDRUCK.
Source
Target
Form : ZMEDRUCK.
Select
trace only.
Click
Client : 000.
on Execute.
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 40
MODIFYING STANDARD SCRIPT
Converting Original Language of a Script
Whenever
we copy the Standard SAP Script(MEDRUCK) into
Customised script(ZMEDRUCK) we cannot do the Changes
directly.
If we want to do the Changes we need to change the original
language to our own language(EN).
Steps:
Goto SE71
Give Form name as ZMEDRUCK
Give the language as DE
Click on Change
Click on Utilites
Convert Original language
Give the Original Language as EN.
Press Enter.
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 41
EX on modifying standard SCRIPT
STEP1:Copy the standard script MERDUCK to ZMEDRUCK.
STEP2: Convert the original language from DE TO EN
STEP3: Now insert our company logo into ZMEDRUCK as below
Click on windows
Create a window by name LOGO
Copy the LOGO window onto PAGE1
Give height&width
Click on graphical form painter and adjust the length&position
Double click on LOGO window & insert the image by clicking on
INSERT--GRAPHICS
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 42
Configuring custom script in NACE Transaction
GO TO NACE TCODE
Select EF
Click on output types
Select NEU
Double click on processing routines
Change FORMNAME from MEDRUCK to ZMEDRUCK
Save
Save
Test it
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 43
Testing
Goto ME22N
Give purchase order no : 4500012164
Enter
Click on print preview
Our ZMEDRUCK will be dispalyed.
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 44
Modifying Std.scripts without changing driver
program
Syntax : perform <formname> in program <prgname>
using <v1>
Changing <v2>
Endperform.
Syntax for form definition :
Form <formname> tables intab structure ITCSY
Outtab structure ITCSY.
We need to use external subroutines concept to write the code with
out changing the driver program.
Endform.
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 45
Modifying Std.scripts without changing driver
program
Where,
ITCSY is a structure for storing name and value of exported variable
from perform statement.
In the subroutine implementation, we write the custom logic i.e all
our select statements
Business requirement :
Modify the standard script MEDRUCK to print PO document type in
the layout .
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 46
Go to se71.
Give the form name as zmedruckClick on Change.
Create a window by name document type
Double click on it and write the below code.
/: perform GET_BSART in program ZGET_BSART.
/: using &EKKO-EBELN&
/: changing &V_BSART&
Doc. Type : &V_BSART&.
Create a program by name ZGET_BSART in se38 of type
subroutine pool and Write the below code
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 47
Debugging SAP Scripts
Goto SE71
Give script name
Click on Utilities
Activate debugger
Now execute the driver program it will automatically start the
SAP script editor .
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 48
CONVERTING SCRIPTS TO SMARTFORMS
Go to Smartforms Tcode
Click on UTILITIESMIGRATIONIMPORT SAPSCRIPT FORM
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 49
Review
--
Please Ask Questions!
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 50