Sei sulla pagina 1di 6

SAP Scripts : MS Word Options

Sap Script is pre defined template for the reports to be redirected to other devices[
printers / fax machine etc ].

976.chm ( SAP Script HELP ).

SE71: is the tcode used to create SAP Scripts.


PARAGRAPH SETTING
1)FONT SETTINGS
2)ALIGNMENTS
3)TAB SETTINGS
CHARACTER SETTING
PAGE SETTINGS

by default SAP Script has a bug, as data from sap script text editor is displayed in ABAP
output device for twice, due to file buffering problem.

TO AVOID THIS PROBLEM SAP INTRODUCED A CONCEPT CALLED AS


"ELEMENT" CAN BE DEFINED IN SAP SCRIPT EDITOR, SHOULD BE INVOKED
FROM SE38 PROGRAMS.

TO INVOKE THE SAP SCRIPTS DEFINED IN SE71 USE FOLLOWING FUNCTION


MODULES.

1. OPEN_FORM : IS A FUNCTION MODULES INVOKES THE FORM TO BE


EXECUTED IN THE INVOKED PROGRAM.

2. WRITE_FORM : IS THE FUNCTION MODULE USED TO INVOKE THE


WINDOW DEFINED IN SAP SCRIPT.

3. CLOSE_FORM : IS THE FUNCTION MODULE USED TO CLOSE BUFFER


ALLOCATED USING "OPEN_FORM" FROM THE INVOKED PROGRAM.

NAVIGATIONS TO CREATE SAP SCRIPTS.

1) SE71 -> NAME THE SAPSCRIPTS ( Z/Y ) -> CREATE -> ENTER SHORT TEXT
IN ADMINISTRATIVE DATA -> CLICK ON PARAGRAPH SETTINGS TO CREATE
A PARA GRAPH -> NAME PARAGRAPH -> ENTER SHORT TEXT -> SAVE SAP
SCRIPT -> COME BACK TO HEADER DATA BASIC SETTING -> ENTER
DEFAULT PARAGRAPH CREATED -> CLICK ON LAYOUT FROM APPLICATION
TOOLBAR -> OPENS LAYOUT EDITOR -> RIGHT CLICK ON MAIN WINDOW ->
CHOOSE EDIT TEXT -> OPENS PC EDITOR WINDOW , CHANGE THIS EDITOR
TO LINE EDITOR USING MENU "GOTO" -> CHANGE EDITOR -> IN THE FIRST
LINE DEFINE ELEMENT IN COMMAND LINE ENTER "/E" -> NAME THE
ELEMENT IN LINE EDITOR, AFTER ELEMENT DEFINITION ENTER ACTUAL
TEXT TO BE DISPLAYED ON REPORTS -> COME BACK -> SAVE -> ACTIVATE.

INVOKE THE SAP SCRIPT USING FOLLOWING CODE.


CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = 'ZFRM1_930'
LANGUAGE = SY-LANGU.

CALL FUNCTION 'WRITE_FORM'


EXPORTING
ELEMENT = 'ABC'
WINDOW = 'MAIN'.

CALL FUNCTION 'CLOSE_FORM'.

4TH MARCH
Send the data of internal table to the SAP script by displaying the company address
and logo and customer transactional details.

1 . Declere an internal table in SE38 get data from data base into itab.
Sending itab to the sap scripts.
data : itab like vbak occurs 0 with header line.

kunnr:
itab-vbeln
itab-erdat
itab-erzet

DATA IN DATA BASE MAY BE MAINTAINED IN THE FORM OF 000000<NUM>


EVEN FOR THE CHARACTERS.

IF <NUM> IS ACCEPTED FROM GUI CAN'T DISPLAY ENTER DATA WHERE


NUMBER IN DATA BASE AS 0000000<NUM>.

REPORT ZGET_VBAK_DATA .

DATA : ITAB LIKE VBAK OCCURS 0 WITH HEADER LINE.


DATA STR(10) VALUE '0000000000'.
PARAMETERS : KUNNR(10) TYPE C.
SHIFT KUNNR RIGHT DELETING TRAILING SPACE.
OVERLAY KUNNR WITH STR.
SELECT * FROM VBAK INTO TABLE ITAB WHERE KUNNR = KUNNR.
LOOP AT ITAB.
WRITE : / ITAB-VBELN , ITAB-ERDAT, ITAB-ERZET.
ENDLOOP.
NEED OF ELEMENT IN SAP SCRIPTS

Element in sap scripts are used to avoid data duplication from the sap script form
templates.
Elements even can be used to identify the area in sapscript forms. Abaper can define
multyple elements in Sap scripts.

Note: if we define an element in sap scripts in 4.6C we must specify write_form in


invoking program else program will be terminated.

But for 4.7 if we use only one write_form can invoke specified element data. But it
can't call other elements data defined sap script.

If Window is specified as Main Window, default existing window can be deleted and
abaper can invoke windows created as main.

Note : If a window is specified as main window then only can invoke from invoking
programs.

if the main window properties are not added by abaper then default will be treated as sub
windows with type as "variable" window or "constant" window.

These sub windows will be called automatically when ever main window is invoked.

To invoke main window we need to use "write_form" function module, single write_form
is enough to call all sub windows defined in the sap scripts.

If the window is specified as Main window then abaper has to call the second window
as main with write_form.
Generating boxes in sap scripts.

/: IS THE SYNTAX TO ADD ABAP STATEMENTS IN SAP SCRIPTS.

/: BOX 5 CH 3CH 10 CH 7 CH FRAME INTENSITY 10

/: BOX WIDTH '17' CM HEIGHT 1 CM FRAME 10 TW INTENSITY 15

/: BOX XPOS '13.5' CM WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW

5TH MARCH

SMARTFORMS OPTIONS
SMARTFORM IS A COLLECTION OF FORMS, STYLES AND TEXT STYLES.
FORM IS A COLLECTION OF
I) GLOBAL SETTINGS
IS A COLLECTION OF
1) FORM ATTRIBUTES
Is the option is similer to sapscript header data. It controls the saved
information of the sap script and output settings as output page format and page settings.
2) Form Interface
Is the option controls the function module arguments as
"import","export","tables" and "exceptions". Using this option abaper can declare
variables in smart forms.

3) Global definitions
if any global definition to be provided locally to the smartforms with out
taking any arguments from invoking program we can use this option. This option is
similer to "MPP" top include file.

II) PAGES AND WINDOWS


is the layout option of sapscript, used to control number of windows and
components to be displayed on smartforms.

navigations to create smartforms

smartforms -> enter name in form (zfrm9301) -> create -> enter short descriptions in
form attributes -> double click on form interface to define any arguments for the
smartforms -> expand pages -> and expand windows -> right click on window -> create
-> text component opens an interface in right panel-> enter text in PC editor or line editor
as a part of sapscript editor -> save the smartform -> activate -> and execute the
smartform to generate function module.
Note : function module name generated by sap for smartforms are autogenerated by sap.

using the name of function module assgned with smartforms can be called by any
program to redirect their data to other devices.

invoking program

CALL FUNCTION '/1BCDWB/SF00000047'.

7TH MARCH
Smart Forms :
Advanced concepts of SAP Scripts.
Smartform = sap scripts + FM + MPP features.

1) SMARTFORMS , DEFAULT
i) No Bugs
ii) Independent on Elements.
2) SMARTFORMS WITH ARGUMENTS.
3) SMARTFORMS WITH IMAGES.

PASSING INTERNAL TABLE AS ARGUMENT FOR SMARTFORMS.

1) What is need of Table in Smartforms?


Used to display internal table data send as argument for the function module.
2) What is Line type..?
Is used to control table row with number of columns.
3) How to control fields to be displayed with boxes
From table option of Table Object we can control table data to be display with
type of pattern and box colors and box shading.
4) How to add The colors for the data ?
Define styles where abaper has a facility to add Paragraphs with font settings and
color settings , these styles can be applied in the sap script form.

5) How to apply the styles in smartforms?


Styles cab be applied for Header data row , Main area row or Footer data row fields,
and even can be assigned for each text is getting added to the smartforms.

Table is an object defined in SmartForms with data as "Header","Main","Footer" areas.


Table is collection of sub Options as

i) table
Boxes and Shadings , color settings, Patterns for boxes and Also Line types.
ii) data
Abaper can use Internal table loop at <itab> options from this to display the data
in main area.
iii) output options
Controls the style to be added for the table.
i) Table Option:
a) Table Painter
controls the patterns, box shadings and colors to be applied for table data.
b) Details
Table Width and line Types , Number of fields in a line.

Navigations to create Smart forms with Table Object.


Smartforms -> name the form ( zfrmitab930) -> create -> in the form interface ,
define an internal table ( ktab like kna1) -> Expand pages and main window -> right
click on Main windows -> add table object -> sap adds Table1 as object with header data
, main area and footer data -> Select Tab Option from table1 object -> Click on Details
from Tab Option to control the table width and Line types.
By default table width is 16 CM, if required change the table width, table is created by
default with Left Justification alignment, if required change it. Sap Generages a line type
as "%Ltype1" with a single field as size of 16 cm, Based on requirements, identify
number of fields to be displayed on smartform, specify number of columns with sizes.
Note : Total Width of Field size should be equal to Table Width.

This Line type can be added for Header, Main and Footer data of Table Object.

click on data tab strip -> define loop statement -> declare Ktab Into Ktab ( where ktab is
internal table defined in form interface for KNA1) table.

for the table object assign line type for Header and Main Area using following

right click on Header of table1 Object -> create -> table line -> open an interface ->
specify line type as "%ltype1" -> based on number of columns defined in line type SAP
adds fields under Header data of Table object -> fields added in the form of cells , each
cell represents a column to be display in the header area.

A cell is also a container of "text" , "graphics" or Address window -> for Each cell
abaper can add text
( Internally Sap Scrit Data )
Repeat the same step for main area and footer data also.

Potrebbero piacerti anche