Вы находитесь на странице: 1из 65

*SCRIPTS*

BY ----Arjun

List of topics to be discussed

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 2

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 3

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 8.IF...ENDIF.. 9.CASE...ENDCASE
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 4

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.

Configuration of custom script in NACE.


DEBUGGING SAP SCRIPT

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 5

What is SAP Script?

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 6

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 7

Why scripts are client dependent?

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 8

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(& data) are client dependent (SAP RULE).


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 9

Components of SAP Scripts

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 10

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 11

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 12

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 13

Components of SAP Scripts :

Pages:
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.


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 14

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 window Graphical window.

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 15

Components of SAP Scripts :

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
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 16

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 17

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 18

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 19

Function Modules in SAP Scripts

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 20

Function Modules in SAP Scripts :


The various function modules available in SAP Scripts are: 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.
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 21

Driver Program

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 22

Driver Program::

Driver Program(Print Prg):


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 23

CREATING DRIVER PROGRAM

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 24

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 25

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 26

LOGO/GRAPHICS IN SCRIPTS

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 27

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.
Claudia Binder / Jens Stumpe 28

SAP AG 2001, Smart Forms - the Form Printing Solution,

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 29

ADRESS IN SAP SCRIPTS

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 30

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 31

Example on displaying ADDRESS Create a window by name ADDRESS 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 32

STANDARD TEXT

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 33

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 34

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 35

Symbols in SAP Script

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 36

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 37

CONTROL COMMANDS

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 38

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 39

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 40

Bottom . Endbottom :
It is used to display constant footer in main window across all pages .

syntax :

/: Bottom
* here footer information / : Endbottom

Protect . Endprotect :
syntax : /: protect

It is used to display the entire information without any pagebreak .

* here our data is placed


/ : Endprotect
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 41

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 42

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 43

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 44

Configuaration of Driver Prg & SAP-SCRIPT

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 45

Configuaration of Driver Prg & SAP-SCRIPT


Basically configuaration is done by functional consultants Once the ABAP consultant develops the SCRIPT and Driver prg, 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. STEPS FOR CONIGURATION

Go to NACE tcode
Select the Appliction EX--- EF for purchase order

V1 for sales
V2 for Billing
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 46

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 Medium Program Form routine Form MEDRUCK MEDRUCK

Print output SAPFM06P Entry_neu Fax SAPFM06P Entry_neu

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 47

MODIFYING STANDARD SCRIPT

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 48

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 Client : 000. Target Form : ZMEDRUCK. Select trace only. Click on Execute.

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 49

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 50

Example on modifying standard SCRIPT

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 51

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 52

Configuring custom script in NACE Transaction

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 53

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 54

Testing the configured script

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 55

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 56

Modifying Std.scripts without changing driver program

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 57

Modifying Std.scripts without changing driver program


We need to use external subroutines concept to write the code with out changing the 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. Endform.

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 58

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 59

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 60

Debugging SAP Scripts

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 61

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 62

CONVERTING SCRIPTS TO SMARTFORMS

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 63

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 64

Review

--

Please Ask Questions!

SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 65