SlideShare a Scribd company logo
1 of 63
Download to read offline
ABAP Training
SAP Script
ABAP Training SAP Scripts 2
What Is SAP Script ?
 SAP script is the SAP system's own text-processing system.
 SAP script is integrated text management system of the SAP R/3 system.
 The transaction code is SE71.
ABAP Training SAP Scripts 3
Why SAP Script ?
 It is used to print preformatted text in preformatted forms.
 Unlike reports , the text can be aligned, different fonts can be
used.Company logo can be printed.
ABAP Training SAP Scripts 4
How to Go About Creating Forms ?
 A layout set is defined as a page design for a document.
 A layout set specifies the page design by defining one or more windows
and arranging them on a page.
 Layout set on its own does not contain any data.
ABAP Training SAP Scripts 5
Creating Forms Contnd……
 The selection of data for the document is done through the print
program.
 The print program selects the data from database table and feeds it to
the layout set.
 When the print program is executed the document is printed.
ABAP Training SAP Scripts 6
Components of Layout Set
A layout set consists of following components
 Header
 Pages
 Windows
 Page windows
 Paragraph formats
 Character formats
ABAP Training SAP Scripts 7
Header
Header – this part of the layout set consists of both administrative data
and basic (default) settings for the various other components of the
layout set like first page, default paragraph for layout set etc.,
Header data : used for information and control purposes.
- Start page
- Default paragraph
- Tab stop
- Language, original language
- Page format
- Orientation
- Lines per inch (LPI)
- Characters per inch (CPI)
- Font attributes
ABAP Training SAP Scripts 8
Pages
Pages :
Must define at least one page for every form and you must designate a
First page in the form header.
Page attributes :
- Next page
- Page counter mode
- Resource name ( paper tray to be used for printer)
- Paper mode (simplex , Tumblex)
Page windows :
Window names are linked to page names and specify the window
Position on the page.
Text elements :
The print program accesses text elements by name, formats them and
Prints them in the respective window.
ABAP Training SAP Scripts 9
Windows
Windows – at least one logical window must be defined for every page.
(Otherwise it is not possible to format the texts) window definition
involves a list of window names and corresponding window types. A
MAIN window is displayed automatically.
They represent areas that are positioned on pages as page windows and
in which at a later time text is printed.
Window types :
- Main
- Var
- Const
ABAP Training SAP Scripts 10
Page Windows
Page windows - A page window is defined by allocating a logical window to
a logical page and specifying the position and size of the window.
ABAP Training SAP Scripts 11
Paragraph Formats
Paragraph formats – A paragraph contains all the information needed to
format a paragraph of text and font. Tabs are important for
paragraphs. Specifying the list of tabs is the way to create columns for
outputting line items of a document.
Paragraph formats and attributes :
- Standard
- Font
- Tabs
- Outline
ABAP Training SAP Scripts 12
Character Formats
Character formats – this is used to override paragraph settings for specific
words in a paragraph.
Character formats and attributes :
- Standard
- Font
ABAP Training SAP Scripts 13
Creating a Layout Set
 To create a layout set go to tools -> SAP script -> form.
 The transaction code is SE71.
ABAP Training SAP Scripts 14
Steps to Create Layout Set
1. Go to SE71. This takes you to the form .Enter name for the layout /
form in the text box given.The screen as shown below.
ABAP Training SAP Scripts 15
Form Painter (SE71)
ABAP Training SAP Scripts 16
Steps to Create Layout Set Contd….
2. After entering the name for the layout set choose the “create”
button.This takes you to the next screen where in you need to enter the
description for the layout set.
ABAP Training SAP Scripts 17
Header Details of Form
ABAP Training SAP Scripts 18
Steps to Create Layout Set Contd….
3. Next step is to create pages for the layout or form.Go to pages button
on the application toolbar.Enter name for the page in the standard
attributes and description for the page.For the next page in the standard
attribute specify the name.
ABAP Training SAP Scripts 19
Page Details - Form
ABAP Training SAP Scripts 20
Steps to Create Layout Set Contd….
4. The above screen takes to the pages screen of the form.After pages,
you have to create windows needed for the page.Go to windows button
on the toolbar.MAIN window is created given by the system itself.The
window can be of type VAR or CONST except for MAIN.
ABAP Training SAP Scripts 21
5. Next step is to create Windows on
the Page .
Window Details - Form
ABAP Training SAP Scripts 22
Steps to Create Layout Set Contd….
6. To create windows go to edit -> create element of menu bar.Using this
option you can create as many windows as needed for the page.By
default the window created will have window type as VAR.For windows
to be constant, you can name them as CONST.
ABAP Training SAP Scripts 23
Steps to Create Layout Set Contd….
7. Next step after creating windows is to “create page windows”.Click
“page windows” on the application toolbar. Choose the windows needed
for that page using edit -> create element. Enter the margins for the
page windows created in the standard attributes.
ABAP Training SAP Scripts 24
Details of Page Windows
ABAP Training SAP Scripts 25
Paragraph Formats
8. Go to paragraph formats in the application toolbar.
9. Name the paragraph format and enter the description .Specify the font
family and size .If needed ,specify the tab positions. Tabs are columns
created for outputting line items of a document.
ABAP Training SAP Scripts 26
Paragraph Formats - Form
ABAP Training SAP Scripts 27
Character Formats
10. Next step is to create “character formats”.This is used to override the
paragraph settings for specific words.
ABAP Training SAP Scripts 28
Character Format
ABAP Training SAP Scripts 29
Steps to Create Layout Set Contd….
11. Go to text elements (F9) in the application toolbar of the selected page
window.
12. The text elements are assigned to the active window. You can create
several text elements in a window.
ABAP Training SAP Scripts 30
Steps to Create Layout Set Contd….
13. The text elements are called from print program,through function
modules and outputted in the respective window.
ABAP Training SAP Scripts 31
MAIN Window – Text Element
ABAP Training SAP Scripts 32
Steps to Create Layout Set Contd….
14. Next step is to save the layout.Go to form -> save. While saving the
form ,it asks for the default paragraph and page in header details of
basic settings.You need to specify the default paragraph and page in this
page.
ABAP Training SAP Scripts 33
Header Details
ABAP Training SAP Scripts 34
Steps to Create Layout Set Contd….
16. The form gets saved after entering the above details. Save the form
and activate the layout set.After activating the form,a driver program or
print program has to written or modified according to the requirement in
SE38.
ABAP Training SAP Scripts 35
SAP Script – Control Commands
New page : forcing a page break in a
text.
Syntax :
/: NEW-PAGE [page_name]
Ex :
/: NEW-PAGE S1 -> contents of S1 are printed in a new page.
ABAP Training SAP Scripts 36
Date Command
Set date mask : formatting date fields.
Syntax :
/: SET DATE MASK = ‘date_mask’.
Ex : /: SET DATE MASK = ‘DD/MM/YY’.
&Date& = 01/01/01
ABAP Training SAP Scripts 37
Include Command
3. INCLUDE : to include contents of another text into current text.
Syntax :
/: INCLUDE name [OBJECT o] [ID i] [LANGUAGE l]
[PARAGRAPH p] [NEW-PARAGRAPH np]
Ex :
/: Include MYTEXT language 'e' paragraph 'a1'
ABAP Training SAP Scripts 38
Address – EndAddress
ADDRESS – ENDADDRESS : to format the address.
Syntax :
/: ADDRESS [DELIVERY] [TYPE t] [PARAGRAPH a] [PRIORITY p] [LINES l]
/: TITLE title
/: NAME name1[,name2[,name3[,name4]]]
ABAP Training SAP Scripts 39
Address – EndAddress Contnd…..
/: PERSON name of natural person [TITLE form of address]
/: DEPARTMENT department
/: STREET street name
/: LOCATION additional location information
/: POBOX po box [CODE post code / zip code] [CITY city]
ABAP Training SAP Scripts 40
Address – EndAddress Contnd…..
/: POSTCODE post code / zip_code
/: CITY city1[,city2]
/: REGION county / state
/: COUNTRY recipient country [LANGUAGE language code]
/: FROMCOUNTRY sender country
/: ADDRESSNUMBER address number
/: ENDADDRESS
ABAP Training SAP Scripts 41
Perform Command
5. PERFORM : it is used to call an ABAP/4 subroutine from any SE38
program.
Syntax :
/: PERFORM <form_name> IN PROGRAM <prog>
/: Using &invar1&…..
/: Changing &outvar1&…..
/: ENDPERFORM
ABAP Training SAP Scripts 42
SE38 Program for Perform Stmt
Form <form_name>
Tables itab like itcsy,
otab like itcsy.
- - - - - - - - - - Coding
Endform
ABAP Training SAP Scripts 43
IF Command
6. /: IF condition
:
/: ENDIF
 = EQ equal to
 < LT less than
 > GT greater than
 <= LE less than or equal to
 >= GE greater than or equal to
 <> NE not equal to
ABAP Training SAP Scripts 44
Case Command
Syntax : CASE command
/: CASE symbol
/: WHEN value1
:
/: WHEN valuen
:
/: When others.
:
/: ENDCASE
ABAP Training SAP Scripts 45
Protect – End Protect
Protect – EndProtect command is used to print complete text on same page.
Syntax : / : PROTECT
- - - -
- - - -
/ : ENDPROTECT
ABAP Training SAP Scripts 46
Driver Program
 The execution of script is done through driver program
 The driver program can be either a stand alone program or it can be
called from any transaction.
ABAP Training SAP Scripts 47
Driver Program Cont. ….
 In the 2nd case for execution of script go to the reqd. Transaction and
reqd. Document no. For which the print out or fax to be taken and enter
the output type, transmission medium and the partner to whom we have
to send.
 For a standard configuration we can see the form name, program name
and output type in the table TNAPR.
ABAP Training SAP Scripts 48
Driver Program Cont ….
 Other details like mode of print, I.E. Print immediately or scheduling of
jobs also can be entered in the transaction itself.
 If the mode of print is set as print immediately, then the script is
executed as soon as the user saves the transaction.
 In later case one has to run the program RSNAST00 to get the output.
ABAP Training SAP Scripts 49
Driver Program Cont ….
 All the details entered in the transaction will be stored in the table
NAST.
 So without an entry in the NAST table execution of script is not possible
through RSNAST00.
 For standalone driver programs entry in NAST is not required and the
form name and driver program name may not appear in the TNAPR
table.
ABAP Training SAP Scripts 50
Function Modules
 The driver program must contain either all or some of the function
modules listed below.
 Open_form (mandatory)
 Start_form (optional)
 Write_form (mandatory)
 End_form (optional)
 Close_form (mandatory)
ABAP Training SAP Scripts 51
….Cont
 If start_form is present then end_form also should be there.
 One more function module which is useful is control_form. This is also
optional.
ABAP Training SAP Scripts 52
Translation of Layout Set
 To create layout set in different languages use transaction SE63.
 The complete path from SE63 is translation  long texts  SAP scripts
 forms (SE76).
 Enter the form name, source language and target language.
ABAP Training SAP Scripts 53
Printing Company Logo
Steps required to print a company logo :
1. Go to SE38 .Type RSTXLDMC in the text box provided .
ABAP Training SAP Scripts 54
Printing Company Logo Contd…..
ABAP Training SAP Scripts 55
Printing Company Logo Contd…..
2. Execute the program by pressing F8.
3. Enter the file name of the TIFF file,resolution ,text name and text title
ABAP Training SAP Scripts 56
Uploading Pictures
4. The TIFF file will be uploaded and gets stored as a text element in SO10.
ABAP Training SAP Scripts 57
Different Commands in SAP Script
BOX :- command for drawing a box or a horizontal or vertical line.
/: Box [XPOS] [YPOS] [width] [height] [frame] [intensity]
POSITION :- command for specifying the width and the height of
the box
/: Position [XORIGIN] [YORIGIN] [window] [page]
SIZE :- sets the values of the WIDTH and HEIGHT parameters
used in
The BOX command
/: Size [width] [height] [window] [page]
Syntax of control commands :-
Use the paragraph format /:
Does not occupy more than a single line
ABAP Training SAP Scripts 58
Different Commands in SAP Script Contd….
Explicit page break :- NEW-PAGE
/: New-page [page_name]
Preventing page breaks :- PROTECT
/: Protect
:
:
/: ENDPROTECT
Assigning value to a text symbol :- DEFINE
/: DEFINE &symbol_name& = ‘value’
Conditional text :-
/: IF condition
:
/: Else
:
ABAP Training SAP Scripts 59
Different Commands in SAP Script Contd….
Formatting :-
/: SET DATE MASK = ‘date_mask’
eg. /: Set date mask ‘mm/DD/YY’
&Date& -> 06/06/02
/: SET TIME MASK = ‘time_mask’
eg. /: Set time mask ‘HH:mm’
&Time& -> 11:52
/: Set sign left
/: Set sign right
ABAP Training SAP Scripts 60
Different Commands in SAP Script Contd….
Setting header text in main window :-
/: Top
:
:
/: ENDTOP
Setting footer text in main window :-
/: Bottom
:
:
/: ENDBOTTOM
General SAPSCRIPT fields :
&SAPSCRIPT-SUBRC&
&SAPSCRIPT-FORMPAGES&
&Page&
&Date&
&ULINE&
ABAP Training SAP Scripts 61
Different Commands in SAP Script Contd….
Formatting options :
Offset
&Symbol& -> 123456789
&Symbol+3& -> 456789
Output length
&Symbol( length )&
Omitting the leading sign
&Symbol(s)&
Leading sign to left
&Symbol(<)&
Omitting leading zeros
&Symbol(z)&
Space compression
&Symbol(c) &
ABAP Training SAP Scripts 62
Different Commands in SAP Script Contd….
Number of decimal places
&Symbol(.N)&
Omitting the separator for ‘thousands ‘
&Symbol(t)&
Suppressing output of initial values
&Symbol(i)&
Function modules in print program
 Open_form
 Close_form
 Start_form
 End_form
 Write_form
 Control_form
ABAP Training SAP Scripts 63
Utilities and Programs
 RSTXCRP :- program is used to upload and download a form
across
different system using the local file system as an
interface.
 Utilities copy from client is used to copy the layout in the same
System across different clients.
 Form >> copy from to copy in the other language
 Utilities >> change page format
 Table TNAPR – what program is attached to which layout.

More Related Content

What's hot

Call transaction method
Call transaction methodCall transaction method
Call transaction methodKranthi Kumar
 
User exit training
User exit trainingUser exit training
User exit trainingJen Ringel
 
Ab1011 module pool programming
Ab1011   module pool programmingAb1011   module pool programming
Ab1011 module pool programmingSatheesh Kanna
 
SAP Modularization techniques
SAP Modularization techniquesSAP Modularization techniques
SAP Modularization techniquesJugul Crasta
 
Object oriented approach to ALV Lists in ABAP
Object oriented approach to ALV Lists in ABAPObject oriented approach to ALV Lists in ABAP
Object oriented approach to ALV Lists in ABAPNoman Mohamed Hanif
 
Introducing enhancement framework.doc
Introducing enhancement framework.docIntroducing enhancement framework.doc
Introducing enhancement framework.docKranthi Kumar
 
Chapter 01 user exits
Chapter 01 user exitsChapter 01 user exits
Chapter 01 user exitsKranthi Kumar
 
1000 solved questions
1000 solved questions1000 solved questions
1000 solved questionsKranthi Kumar
 
Chapter 02 sap script forms
Chapter 02 sap script formsChapter 02 sap script forms
Chapter 02 sap script formsKranthi Kumar
 
Enhancement framework the new way to enhance your abap systems
Enhancement framework   the new way to enhance your abap systemsEnhancement framework   the new way to enhance your abap systems
Enhancement framework the new way to enhance your abap systemsKranthi Kumar
 
Internal tables
Internal tables Internal tables
Internal tables Jibu Jose
 
Sap abap interview questions
Sap abap interview questionsSap abap interview questions
Sap abap interview questionskssr99
 

What's hot (20)

07 sap scripts
07 sap scripts07 sap scripts
07 sap scripts
 
Sap scripts
Sap scriptsSap scripts
Sap scripts
 
Sapscript
SapscriptSapscript
Sapscript
 
Call transaction method
Call transaction methodCall transaction method
Call transaction method
 
User exit training
User exit trainingUser exit training
User exit training
 
Reports
ReportsReports
Reports
 
Ab1011 module pool programming
Ab1011   module pool programmingAb1011   module pool programming
Ab1011 module pool programming
 
SAP Modularization techniques
SAP Modularization techniquesSAP Modularization techniques
SAP Modularization techniques
 
Sap abap
Sap abapSap abap
Sap abap
 
Object oriented approach to ALV Lists in ABAP
Object oriented approach to ALV Lists in ABAPObject oriented approach to ALV Lists in ABAP
Object oriented approach to ALV Lists in ABAP
 
Introducing enhancement framework.doc
Introducing enhancement framework.docIntroducing enhancement framework.doc
Introducing enhancement framework.doc
 
Chapter 01 user exits
Chapter 01 user exitsChapter 01 user exits
Chapter 01 user exits
 
Abap reports
Abap reportsAbap reports
Abap reports
 
1000 solved questions
1000 solved questions1000 solved questions
1000 solved questions
 
Sap abap material
Sap abap materialSap abap material
Sap abap material
 
Chapter 02 sap script forms
Chapter 02 sap script formsChapter 02 sap script forms
Chapter 02 sap script forms
 
Enhancement framework the new way to enhance your abap systems
Enhancement framework   the new way to enhance your abap systemsEnhancement framework   the new way to enhance your abap systems
Enhancement framework the new way to enhance your abap systems
 
Internal tables
Internal tables Internal tables
Internal tables
 
Index in SAP ABAP
Index in SAP ABAPIndex in SAP ABAP
Index in SAP ABAP
 
Sap abap interview questions
Sap abap interview questionsSap abap interview questions
Sap abap interview questions
 

Similar to Sap scripts

Sap sapscripts tips and tricks
Sap sapscripts tips and tricksSap sapscripts tips and tricks
Sap sapscripts tips and tricksKranthi Kumar
 
How to find user exits
How to find user exitsHow to find user exits
How to find user exitsMohammed Shoeb
 
Abap sample code
Abap sample codeAbap sample code
Abap sample coderoymat2
 
Abap sample programs 24 slides
Abap sample programs 24 slidesAbap sample programs 24 slides
Abap sample programs 24 slidesRoy Mathew
 
Chapter 04 sap script - output program
Chapter 04 sap script - output programChapter 04 sap script - output program
Chapter 04 sap script - output programKranthi Kumar
 
sap abap training in chennai
sap abap training in chennaisap abap training in chennai
sap abap training in chennaisanjai rsamy
 
Sap abap training Overview
Sap abap training OverviewSap abap training Overview
Sap abap training Overviewraviadm100
 
Programming Interface & SAP BDC
Programming Interface & SAP BDCProgramming Interface & SAP BDC
Programming Interface & SAP BDCSyam Sasi
 
Smartforms interview questions with answers
Smartforms interview questions with answersSmartforms interview questions with answers
Smartforms interview questions with answersUttam Agrawal
 
How to develop_smart_forms_01
How to develop_smart_forms_01How to develop_smart_forms_01
How to develop_smart_forms_01Rafael Rocha
 
Abap fundamentals-training-course-document
Abap fundamentals-training-course-documentAbap fundamentals-training-course-document
Abap fundamentals-training-course-documentjohnbryan26
 
Sap step-by-step-navigation-guide-for-beginners
Sap step-by-step-navigation-guide-for-beginnersSap step-by-step-navigation-guide-for-beginners
Sap step-by-step-navigation-guide-for-beginnersHossam Abdo
 
90 Tips & Tricks Every SAP Super User Should Know - Submitted.pdf
90 Tips & Tricks Every SAP Super User Should Know - Submitted.pdf90 Tips & Tricks Every SAP Super User Should Know - Submitted.pdf
90 Tips & Tricks Every SAP Super User Should Know - Submitted.pdfRahulSinha756887
 
Beginner’s guide to_sap_abap
Beginner’s guide to_sap_abapBeginner’s guide to_sap_abap
Beginner’s guide to_sap_abapAngel Inga
 

Similar to Sap scripts (20)

Sap sapscripts tips and tricks
Sap sapscripts tips and tricksSap sapscripts tips and tricks
Sap sapscripts tips and tricks
 
Spool Admin
Spool AdminSpool Admin
Spool Admin
 
Abap training material
Abap training material Abap training material
Abap training material
 
How to find user exits
How to find user exitsHow to find user exits
How to find user exits
 
Abap sample code
Abap sample codeAbap sample code
Abap sample code
 
Abap sample programs 24 slides
Abap sample programs 24 slidesAbap sample programs 24 slides
Abap sample programs 24 slides
 
Abap sample
Abap sampleAbap sample
Abap sample
 
Abap start
Abap startAbap start
Abap start
 
Chapter 04 sap script - output program
Chapter 04 sap script - output programChapter 04 sap script - output program
Chapter 04 sap script - output program
 
Sap abap
Sap abapSap abap
Sap abap
 
sap abap training in chennai
sap abap training in chennaisap abap training in chennai
sap abap training in chennai
 
Sap abap training Overview
Sap abap training OverviewSap abap training Overview
Sap abap training Overview
 
Abap sample
Abap sampleAbap sample
Abap sample
 
Programming Interface & SAP BDC
Programming Interface & SAP BDCProgramming Interface & SAP BDC
Programming Interface & SAP BDC
 
Smartforms interview questions with answers
Smartforms interview questions with answersSmartforms interview questions with answers
Smartforms interview questions with answers
 
How to develop_smart_forms_01
How to develop_smart_forms_01How to develop_smart_forms_01
How to develop_smart_forms_01
 
Abap fundamentals-training-course-document
Abap fundamentals-training-course-documentAbap fundamentals-training-course-document
Abap fundamentals-training-course-document
 
Sap step-by-step-navigation-guide-for-beginners
Sap step-by-step-navigation-guide-for-beginnersSap step-by-step-navigation-guide-for-beginners
Sap step-by-step-navigation-guide-for-beginners
 
90 Tips & Tricks Every SAP Super User Should Know - Submitted.pdf
90 Tips & Tricks Every SAP Super User Should Know - Submitted.pdf90 Tips & Tricks Every SAP Super User Should Know - Submitted.pdf
90 Tips & Tricks Every SAP Super User Should Know - Submitted.pdf
 
Beginner’s guide to_sap_abap
Beginner’s guide to_sap_abapBeginner’s guide to_sap_abap
Beginner’s guide to_sap_abap
 

More from Kranthi Kumar

Creating simple comp
Creating simple compCreating simple comp
Creating simple compKranthi Kumar
 
Controllers and context programming
Controllers and context programmingControllers and context programming
Controllers and context programmingKranthi Kumar
 
Binding,context mapping,navigation exercise
Binding,context mapping,navigation exerciseBinding,context mapping,navigation exercise
Binding,context mapping,navigation exerciseKranthi Kumar
 
Web(abap introduction)
Web(abap introduction)Web(abap introduction)
Web(abap introduction)Kranthi Kumar
 
Chapter 07 debugging sap scripts
Chapter 07 debugging sap scriptsChapter 07 debugging sap scripts
Chapter 07 debugging sap scriptsKranthi Kumar
 
Chapter 06 printing sap script forms
Chapter 06 printing sap script formsChapter 06 printing sap script forms
Chapter 06 printing sap script formsKranthi Kumar
 
Chapter 05 sap script - configuration
Chapter 05 sap script - configurationChapter 05 sap script - configuration
Chapter 05 sap script - configurationKranthi Kumar
 
BATCH DATA COMMUNICATION
BATCH DATA COMMUNICATIONBATCH DATA COMMUNICATION
BATCH DATA COMMUNICATIONKranthi Kumar
 
Using folder options for page protection
Using folder options for page protectionUsing folder options for page protection
Using folder options for page protectionKranthi Kumar
 

More from Kranthi Kumar (20)

Exercise in alv
Exercise in alvExercise in alv
Exercise in alv
 
Dynamic binding
Dynamic bindingDynamic binding
Dynamic binding
 
Data binding
Data bindingData binding
Data binding
 
Creating simple comp
Creating simple compCreating simple comp
Creating simple comp
 
Creating messages
Creating messagesCreating messages
Creating messages
 
Creating a comp
Creating a compCreating a comp
Creating a comp
 
Controllers and context programming
Controllers and context programmingControllers and context programming
Controllers and context programming
 
Context at design
Context at designContext at design
Context at design
 
Binding,context mapping,navigation exercise
Binding,context mapping,navigation exerciseBinding,context mapping,navigation exercise
Binding,context mapping,navigation exercise
 
Alv for web
Alv for webAlv for web
Alv for web
 
Web(abap introduction)
Web(abap introduction)Web(abap introduction)
Web(abap introduction)
 
Abap faq
Abap faqAbap faq
Abap faq
 
Crm technical
Crm technicalCrm technical
Crm technical
 
control techniques
control techniquescontrol techniques
control techniques
 
Chapter 07 debugging sap scripts
Chapter 07 debugging sap scriptsChapter 07 debugging sap scripts
Chapter 07 debugging sap scripts
 
Chapter 06 printing sap script forms
Chapter 06 printing sap script formsChapter 06 printing sap script forms
Chapter 06 printing sap script forms
 
Chapter 05 sap script - configuration
Chapter 05 sap script - configurationChapter 05 sap script - configuration
Chapter 05 sap script - configuration
 
Batch input session
Batch input sessionBatch input session
Batch input session
 
BATCH DATA COMMUNICATION
BATCH DATA COMMUNICATIONBATCH DATA COMMUNICATION
BATCH DATA COMMUNICATION
 
Using folder options for page protection
Using folder options for page protectionUsing folder options for page protection
Using folder options for page protection
 

Sap scripts

  • 2. ABAP Training SAP Scripts 2 What Is SAP Script ?  SAP script is the SAP system's own text-processing system.  SAP script is integrated text management system of the SAP R/3 system.  The transaction code is SE71.
  • 3. ABAP Training SAP Scripts 3 Why SAP Script ?  It is used to print preformatted text in preformatted forms.  Unlike reports , the text can be aligned, different fonts can be used.Company logo can be printed.
  • 4. ABAP Training SAP Scripts 4 How to Go About Creating Forms ?  A layout set is defined as a page design for a document.  A layout set specifies the page design by defining one or more windows and arranging them on a page.  Layout set on its own does not contain any data.
  • 5. ABAP Training SAP Scripts 5 Creating Forms Contnd……  The selection of data for the document is done through the print program.  The print program selects the data from database table and feeds it to the layout set.  When the print program is executed the document is printed.
  • 6. ABAP Training SAP Scripts 6 Components of Layout Set A layout set consists of following components  Header  Pages  Windows  Page windows  Paragraph formats  Character formats
  • 7. ABAP Training SAP Scripts 7 Header Header – this part of the layout set consists of both administrative data and basic (default) settings for the various other components of the layout set like first page, default paragraph for layout set etc., Header data : used for information and control purposes. - Start page - Default paragraph - Tab stop - Language, original language - Page format - Orientation - Lines per inch (LPI) - Characters per inch (CPI) - Font attributes
  • 8. ABAP Training SAP Scripts 8 Pages Pages : Must define at least one page for every form and you must designate a First page in the form header. Page attributes : - Next page - Page counter mode - Resource name ( paper tray to be used for printer) - Paper mode (simplex , Tumblex) Page windows : Window names are linked to page names and specify the window Position on the page. Text elements : The print program accesses text elements by name, formats them and Prints them in the respective window.
  • 9. ABAP Training SAP Scripts 9 Windows Windows – at least one logical window must be defined for every page. (Otherwise it is not possible to format the texts) window definition involves a list of window names and corresponding window types. A MAIN window is displayed automatically. They represent areas that are positioned on pages as page windows and in which at a later time text is printed. Window types : - Main - Var - Const
  • 10. ABAP Training SAP Scripts 10 Page Windows Page windows - A page window is defined by allocating a logical window to a logical page and specifying the position and size of the window.
  • 11. ABAP Training SAP Scripts 11 Paragraph Formats Paragraph formats – A paragraph contains all the information needed to format a paragraph of text and font. Tabs are important for paragraphs. Specifying the list of tabs is the way to create columns for outputting line items of a document. Paragraph formats and attributes : - Standard - Font - Tabs - Outline
  • 12. ABAP Training SAP Scripts 12 Character Formats Character formats – this is used to override paragraph settings for specific words in a paragraph. Character formats and attributes : - Standard - Font
  • 13. ABAP Training SAP Scripts 13 Creating a Layout Set  To create a layout set go to tools -> SAP script -> form.  The transaction code is SE71.
  • 14. ABAP Training SAP Scripts 14 Steps to Create Layout Set 1. Go to SE71. This takes you to the form .Enter name for the layout / form in the text box given.The screen as shown below.
  • 15. ABAP Training SAP Scripts 15 Form Painter (SE71)
  • 16. ABAP Training SAP Scripts 16 Steps to Create Layout Set Contd…. 2. After entering the name for the layout set choose the “create” button.This takes you to the next screen where in you need to enter the description for the layout set.
  • 17. ABAP Training SAP Scripts 17 Header Details of Form
  • 18. ABAP Training SAP Scripts 18 Steps to Create Layout Set Contd…. 3. Next step is to create pages for the layout or form.Go to pages button on the application toolbar.Enter name for the page in the standard attributes and description for the page.For the next page in the standard attribute specify the name.
  • 19. ABAP Training SAP Scripts 19 Page Details - Form
  • 20. ABAP Training SAP Scripts 20 Steps to Create Layout Set Contd…. 4. The above screen takes to the pages screen of the form.After pages, you have to create windows needed for the page.Go to windows button on the toolbar.MAIN window is created given by the system itself.The window can be of type VAR or CONST except for MAIN.
  • 21. ABAP Training SAP Scripts 21 5. Next step is to create Windows on the Page . Window Details - Form
  • 22. ABAP Training SAP Scripts 22 Steps to Create Layout Set Contd…. 6. To create windows go to edit -> create element of menu bar.Using this option you can create as many windows as needed for the page.By default the window created will have window type as VAR.For windows to be constant, you can name them as CONST.
  • 23. ABAP Training SAP Scripts 23 Steps to Create Layout Set Contd…. 7. Next step after creating windows is to “create page windows”.Click “page windows” on the application toolbar. Choose the windows needed for that page using edit -> create element. Enter the margins for the page windows created in the standard attributes.
  • 24. ABAP Training SAP Scripts 24 Details of Page Windows
  • 25. ABAP Training SAP Scripts 25 Paragraph Formats 8. Go to paragraph formats in the application toolbar. 9. Name the paragraph format and enter the description .Specify the font family and size .If needed ,specify the tab positions. Tabs are columns created for outputting line items of a document.
  • 26. ABAP Training SAP Scripts 26 Paragraph Formats - Form
  • 27. ABAP Training SAP Scripts 27 Character Formats 10. Next step is to create “character formats”.This is used to override the paragraph settings for specific words.
  • 28. ABAP Training SAP Scripts 28 Character Format
  • 29. ABAP Training SAP Scripts 29 Steps to Create Layout Set Contd…. 11. Go to text elements (F9) in the application toolbar of the selected page window. 12. The text elements are assigned to the active window. You can create several text elements in a window.
  • 30. ABAP Training SAP Scripts 30 Steps to Create Layout Set Contd…. 13. The text elements are called from print program,through function modules and outputted in the respective window.
  • 31. ABAP Training SAP Scripts 31 MAIN Window – Text Element
  • 32. ABAP Training SAP Scripts 32 Steps to Create Layout Set Contd…. 14. Next step is to save the layout.Go to form -> save. While saving the form ,it asks for the default paragraph and page in header details of basic settings.You need to specify the default paragraph and page in this page.
  • 33. ABAP Training SAP Scripts 33 Header Details
  • 34. ABAP Training SAP Scripts 34 Steps to Create Layout Set Contd…. 16. The form gets saved after entering the above details. Save the form and activate the layout set.After activating the form,a driver program or print program has to written or modified according to the requirement in SE38.
  • 35. ABAP Training SAP Scripts 35 SAP Script – Control Commands New page : forcing a page break in a text. Syntax : /: NEW-PAGE [page_name] Ex : /: NEW-PAGE S1 -> contents of S1 are printed in a new page.
  • 36. ABAP Training SAP Scripts 36 Date Command Set date mask : formatting date fields. Syntax : /: SET DATE MASK = ‘date_mask’. Ex : /: SET DATE MASK = ‘DD/MM/YY’. &Date& = 01/01/01
  • 37. ABAP Training SAP Scripts 37 Include Command 3. INCLUDE : to include contents of another text into current text. Syntax : /: INCLUDE name [OBJECT o] [ID i] [LANGUAGE l] [PARAGRAPH p] [NEW-PARAGRAPH np] Ex : /: Include MYTEXT language 'e' paragraph 'a1'
  • 38. ABAP Training SAP Scripts 38 Address – EndAddress ADDRESS – ENDADDRESS : to format the address. Syntax : /: ADDRESS [DELIVERY] [TYPE t] [PARAGRAPH a] [PRIORITY p] [LINES l] /: TITLE title /: NAME name1[,name2[,name3[,name4]]]
  • 39. ABAP Training SAP Scripts 39 Address – EndAddress Contnd….. /: PERSON name of natural person [TITLE form of address] /: DEPARTMENT department /: STREET street name /: LOCATION additional location information /: POBOX po box [CODE post code / zip code] [CITY city]
  • 40. ABAP Training SAP Scripts 40 Address – EndAddress Contnd….. /: POSTCODE post code / zip_code /: CITY city1[,city2] /: REGION county / state /: COUNTRY recipient country [LANGUAGE language code] /: FROMCOUNTRY sender country /: ADDRESSNUMBER address number /: ENDADDRESS
  • 41. ABAP Training SAP Scripts 41 Perform Command 5. PERFORM : it is used to call an ABAP/4 subroutine from any SE38 program. Syntax : /: PERFORM <form_name> IN PROGRAM <prog> /: Using &invar1&….. /: Changing &outvar1&….. /: ENDPERFORM
  • 42. ABAP Training SAP Scripts 42 SE38 Program for Perform Stmt Form <form_name> Tables itab like itcsy, otab like itcsy. - - - - - - - - - - Coding Endform
  • 43. ABAP Training SAP Scripts 43 IF Command 6. /: IF condition : /: ENDIF  = EQ equal to  < LT less than  > GT greater than  <= LE less than or equal to  >= GE greater than or equal to  <> NE not equal to
  • 44. ABAP Training SAP Scripts 44 Case Command Syntax : CASE command /: CASE symbol /: WHEN value1 : /: WHEN valuen : /: When others. : /: ENDCASE
  • 45. ABAP Training SAP Scripts 45 Protect – End Protect Protect – EndProtect command is used to print complete text on same page. Syntax : / : PROTECT - - - - - - - - / : ENDPROTECT
  • 46. ABAP Training SAP Scripts 46 Driver Program  The execution of script is done through driver program  The driver program can be either a stand alone program or it can be called from any transaction.
  • 47. ABAP Training SAP Scripts 47 Driver Program Cont. ….  In the 2nd case for execution of script go to the reqd. Transaction and reqd. Document no. For which the print out or fax to be taken and enter the output type, transmission medium and the partner to whom we have to send.  For a standard configuration we can see the form name, program name and output type in the table TNAPR.
  • 48. ABAP Training SAP Scripts 48 Driver Program Cont ….  Other details like mode of print, I.E. Print immediately or scheduling of jobs also can be entered in the transaction itself.  If the mode of print is set as print immediately, then the script is executed as soon as the user saves the transaction.  In later case one has to run the program RSNAST00 to get the output.
  • 49. ABAP Training SAP Scripts 49 Driver Program Cont ….  All the details entered in the transaction will be stored in the table NAST.  So without an entry in the NAST table execution of script is not possible through RSNAST00.  For standalone driver programs entry in NAST is not required and the form name and driver program name may not appear in the TNAPR table.
  • 50. ABAP Training SAP Scripts 50 Function Modules  The driver program must contain either all or some of the function modules listed below.  Open_form (mandatory)  Start_form (optional)  Write_form (mandatory)  End_form (optional)  Close_form (mandatory)
  • 51. ABAP Training SAP Scripts 51 ….Cont  If start_form is present then end_form also should be there.  One more function module which is useful is control_form. This is also optional.
  • 52. ABAP Training SAP Scripts 52 Translation of Layout Set  To create layout set in different languages use transaction SE63.  The complete path from SE63 is translation  long texts  SAP scripts  forms (SE76).  Enter the form name, source language and target language.
  • 53. ABAP Training SAP Scripts 53 Printing Company Logo Steps required to print a company logo : 1. Go to SE38 .Type RSTXLDMC in the text box provided .
  • 54. ABAP Training SAP Scripts 54 Printing Company Logo Contd…..
  • 55. ABAP Training SAP Scripts 55 Printing Company Logo Contd….. 2. Execute the program by pressing F8. 3. Enter the file name of the TIFF file,resolution ,text name and text title
  • 56. ABAP Training SAP Scripts 56 Uploading Pictures 4. The TIFF file will be uploaded and gets stored as a text element in SO10.
  • 57. ABAP Training SAP Scripts 57 Different Commands in SAP Script BOX :- command for drawing a box or a horizontal or vertical line. /: Box [XPOS] [YPOS] [width] [height] [frame] [intensity] POSITION :- command for specifying the width and the height of the box /: Position [XORIGIN] [YORIGIN] [window] [page] SIZE :- sets the values of the WIDTH and HEIGHT parameters used in The BOX command /: Size [width] [height] [window] [page] Syntax of control commands :- Use the paragraph format /: Does not occupy more than a single line
  • 58. ABAP Training SAP Scripts 58 Different Commands in SAP Script Contd…. Explicit page break :- NEW-PAGE /: New-page [page_name] Preventing page breaks :- PROTECT /: Protect : : /: ENDPROTECT Assigning value to a text symbol :- DEFINE /: DEFINE &symbol_name& = ‘value’ Conditional text :- /: IF condition : /: Else :
  • 59. ABAP Training SAP Scripts 59 Different Commands in SAP Script Contd…. Formatting :- /: SET DATE MASK = ‘date_mask’ eg. /: Set date mask ‘mm/DD/YY’ &Date& -> 06/06/02 /: SET TIME MASK = ‘time_mask’ eg. /: Set time mask ‘HH:mm’ &Time& -> 11:52 /: Set sign left /: Set sign right
  • 60. ABAP Training SAP Scripts 60 Different Commands in SAP Script Contd…. Setting header text in main window :- /: Top : : /: ENDTOP Setting footer text in main window :- /: Bottom : : /: ENDBOTTOM General SAPSCRIPT fields : &SAPSCRIPT-SUBRC& &SAPSCRIPT-FORMPAGES& &Page& &Date& &ULINE&
  • 61. ABAP Training SAP Scripts 61 Different Commands in SAP Script Contd…. Formatting options : Offset &Symbol& -> 123456789 &Symbol+3& -> 456789 Output length &Symbol( length )& Omitting the leading sign &Symbol(s)& Leading sign to left &Symbol(<)& Omitting leading zeros &Symbol(z)& Space compression &Symbol(c) &
  • 62. ABAP Training SAP Scripts 62 Different Commands in SAP Script Contd…. Number of decimal places &Symbol(.N)& Omitting the separator for ‘thousands ‘ &Symbol(t)& Suppressing output of initial values &Symbol(i)& Function modules in print program  Open_form  Close_form  Start_form  End_form  Write_form  Control_form
  • 63. ABAP Training SAP Scripts 63 Utilities and Programs  RSTXCRP :- program is used to upload and download a form across different system using the local file system as an interface.  Utilities copy from client is used to copy the layout in the same System across different clients.  Form >> copy from to copy in the other language  Utilities >> change page format  Table TNAPR – what program is attached to which layout.