Please plan your SCN wiki tasks accordingly.
SAPScript Transaction codes
SE71 - Form painter
SE72 - Style maintenance
SE78 - SapScript Graphics Management
SO10 - Create standard text module
Reading Text in SAPScripts
If you only need to output the text, you don't need to used READ_TEXT like in an ABAP program,
just use the INCLUDE command in SAPScript.
It will read the text and output it to your form.
The Syntax is like this:
/: INCLUDE &T166K-TXNAM& OBJECT &T166K-TDOBJECT& ID &T166K-TDID& LANGUAGE &EKKO-SPRAS&
SAP Scripts Boxes/Lines/Shading
Setting default parameters for a box:
You can use the POSITION and SIZE commands to set default parmeters for a box.
/: BOX XPOS '11.21' MM YPOS '5.31' MM HEIGHT '10' MM WIDTH '20' MM INTENSITY 10 FRAME 0 TW
You can write:
/: POSITION XORIGIN '11.21' YORIGIN '5.31' MM
/: SIZE HEIGHT '2' MM WIDTH '76' MM
/: BOX FRAME 10 TW INTENSITY 10
This can be usefull if you gave several boxes that share the same parameters.
If you want to set the position realtively to the window use POSITION WINDOW
to set the position to the top/left start of the window. Then use POSITION
to set the current position relatively to the start of the Window.
Note that you uses "+" or "-" in the ORIGIN position to the set the position relatively.
/: POSITION WINDOW
/: POSITION XORIGIN '+5' MM YORIGIN '+10' MM
the position is now 5 MM from the left and 10 MM from the top of the window
NOTE: After using the position command you can move the current position
realtively to the last used position
/: POSITION XORIGIN '+10' MM YORIGIN '+20' MM
Now the position will be X = 15 and Y = 30
Drawing a line. You can draw a line by setting the Height or Weidth to 0
and add a frane. E.g. a horizontal line:
/: SIZE HEIGHT '0' MM WIDTH '200' MM
/: BOX FRAME 10 TW XPOS '11.21' MM YPOS '14.81' MM INTENSITY 100
SAP Printer commands in SAPScripts
The command line in the editor must be as follows:
/: PRINT-CONTROL xxxxx
/: PRINT-CONTROL 'xxxxx'
where xxxxx stands for the five-character name of the print control.
/: PRINT-CONTROL ZM100
The complete printer command normally resides in the print control.
If characters belonging to the print command follow after the print control in the text (only useful for the HPL2 printer driver for PCL-5 printers), the text line following after the PRINT-CONTROL command should begin with an equals sign (=) in the format column.
/: PRINT-CONTROL SESCP = *c5G
If you do not use the equals sign, a space character is inserted between the print control SESCP and the character *c5G.
Different font on the same line
You can have different font on the same line by defining a character format.
For example B for bold text and U for Underline.
In your SAPScript apply like this :
<U>Underline Text</> <B>Bold Text</>
Retrieving data without modifying the original called program
- Retrieving data without modifying the original called program
- Put this script code in your sapscripts
- /: PERFORM GET_BARCODE IN PROGRAM ZSCRIPTPERFORM
- /: USING &PAGE&
- /: USING &NEXTPAGE&
- /: CHANGING &BARCODE&
- /: ENDPERFORM
- / &BARCODE&
- Submitted by : SAP Basis, ABAP Programming and Other IMG Stuff
- End of Program
Print Footer notes only on the last page
Command to used in your sapscripts :-
/: IF &NEXTPAGE& EQ 0
whatever footer you want.
Orientations in SAPSCRIPT
Each form may only have a single orientation but you can create two forms and include them in the same spool output.
In your ABAP program:
1. call function 'OPEN_FORM', don't pass a value in 'FORM'
2. call function 'START_FORM', include parameter 'FORM' passing the name of your first form
3. call function 'WRITE_FORM' as normal to output each element
4. call function 'END_FORM'
5. call function 'START_FORM', include parameter 'FORM' passing the name of your second form
6. call function 'WRITE_FORM' as normal to output each element
7. call function 'END_FORM'
8. call function 'CLOSE_FORM'
Repeat the 'START_FORM' ... 'END_FORM' sequence as required.
While using Scripts, if u don't want to break a
paragraph text which aparts to another page
i.e. if u wanna display the paragraph with out
breaking in between two pages, u have to use
SAPScripts - Developing SAPScript in different languages
Developing SAPScript in different languages
You can goto transaction SE63 and translate the scripts into different languages.
In SE63, click Translation -> Long Texts -> Sapscripts -> Forms
Those language you can convert to have already been pre-installed in the system.
SE63 is the best way to translate since it offers check options.
However, it does not mean that it is 100% full proof that everything is correct.
How to convert Sapscript spools request to PDF?
SAP have created a standard program RSTXPDFT4 to convert your Sapscripts spools into a PDF format.
Specify the spool number and you will be able to download the sapscripts spool into your local harddisk.
It look exactly like what you see during a spool display.
Please note that it is not restricted to sapsciprts spool only. Any reports in the spool can be converted using the program 'RSTXPDFT4'.
How to Upload graphics (IMAGE) to your Sapscript?
Command in your Sapscript
/: INCLUDE Z_YOUR_LOGO OBJECT TEXT ID ST LANGUAGE E
These are the steps to be followed for uploading graphics in R/3 system
1. First save the file as BMP
2. Open the BMP file in IMaging (Goto -> Programs -> Accessories -> Imaging) and
make it Zoom as 100% and save as *.TIFF
3. Open SE38 and execute program RSTXLDMC
4. Give your TIFF file path name
5. Select Bcol (for Color)
6. TEXT ID will be ZHEX-MACRO-*.
7. Inplace of * write your own logo name (ZCOMPANYLOGO)
8. Execute the program
9. Now Goto SE71 create your ZFORM
10. Create logo window
11. Goto text element of logo window
In 4.6x :-
1. Goto SE71 Change the mode to GRAPHICAL
2. Choose the Graph Tabstrips
3. Now type in some name for the LOGO WINDOW
4. Press the IMPORT BUTTON and then IMPORT the BMP file from your DESKTOP
5. The code will be written automatically. You just need to drag and drop wherever you want
the graphics to be.
Please note that in 4.6c onwards, you can also used Windows Bitmap file ( .BMP).
Import/Export SapScript form from PC file
How do you backup sapscript layout sets? Can you download and upload? How?
Use ABAP program: RSTXSCRP
It will download and upload your sapscripts as a text file in your local harddisk.
Picture doesn't show in Print Preview
You have uploaded the picture as .TIF in Sap using ABAP RSTXLDMC and have also add the statement
/: INCLUDE ZHEX-SAMPLE-PICTURE OBJECT TEXT ID ST LANGUAGE EN
in your SapScript but the problem is that in print preview it's not displaying the picture.
It is normal that the picture doesn't show in print preview and you will be able to see the object only after printing.
Don't let this bother you as long as the picture is shown on the hardcopy printout.
Delete Load program for SAPScript
Occassionally, when you make frequent changes to your SAPScript, the system can get out of sync.
When you view the form, the old data get display without your changes.
This can be fixed by deleting the SAPScript LOAD with program RSTXDELL.
Q: We get the total number of pages as expected by using 'SAPSCRIPT-FORMPAGES' in a duplex layout. In our case duplex case is always 'Terms & Conditions'. We do not want the number of pages as in duplex printing. What is the best possible solution?
A: On the Terms & Conditions page, Change the Page counter mode to 'HOLD' to keep the page counter from incrementing when you print the Term & Conditions.
Q: Can I Print a logo on an Invoice?
A: Save a Logo using Paintshop Pro or Corel Draw as Tiff file. Use RSTXLDMC to convert the logo to standard text in SapScript. When the program is executed, the path and file name have to be correctly specified.
Process could be like the following:
Enter file name C:\MAIL\COMPLOGO.TIF
Resolution for Tiff file
Shift to right
UOM = CM
Line width for text = 132
Text name ZHEX-MACRO-COMPLOGO
Text ID ST
Text language = E
Width & Height according to PS scaling
Number of Tiff gray levels (2,4,9) 2
Then Create a new window 'COMP' with attributes;
Window COMP description Company Logo
Window type CONST
Left margin 7.00 CH window width 10.00 CH
Upper margin LN window height 8.00 LN
Finally in the text element , mention
/: INCLUDE 'ZHEX-MACRO-COMPLOGO' OBJECT TEXT ID ST LANGUAGE 'E'.
Please note that if object name is not indicated as 'ZHEX...', the logo may not be printed!
You will not be able to see the logo in a test print. The same will be printed in actual printout.
If you are using two logos in the same layout, the names of the logos should be unique. Say 'ZHEX-MACRO-LOGO1' and 'ZHEX-MACRO-LOGO2'. Else all the information will be overwritten.
If the logo is not EXACTLY TIFF 6.0, the same will not be printed.