Thursday, May 3, 2007

Sample Sapscripts Label Printing Program

TABLES : ZPACK,ZTRN.
DATA: BEGIN OF ITAB OCCURS 0, ZPKSLIP_NO LIKE ZTRN-ZPKSLIP_NO, ZCARTON_NO LIKE ZPACK-ZCARTON_NO, END OF ITAB.
DATA MVAR(12) TYPE C. DATA MCTR(6) TYPE C.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001. SELECT-OPTIONS: ZSLIP FOR ZTRN-ZPKSLIP_NO NO-EXTENSION NO INTERVALS OBLIGATORY default 6. SELECTION-SCREEN END OF BLOCK B1.
SELECT * FROM ZPACK INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE ZPKSLIP_NO EQ ZSLIP-LOW .
CALL FUNCTION 'OPEN_FORM' EXPORTING FORM = 'ZTEST_RAJ'.
DO 4 TIMES.
MCTR = 100000 + SY-INDEX. MCTR = MCTR+1(5). CONCATENATE '55C/06/' MCTR INTO MVAR.
DO 80 TIMES. ITAB-ZPKSLIP_NO = MVAR. ITAB-ZCARTON_NO = SY-INDEX. APPEND ITAB. CLEAR ITAB. ENDDO.
ENDDO.
SORT ITAB BY ZPKSLIP_NO ZCARTON_NO.
CALL FUNCTION 'START_FORM' EXPORTING FORM = 'ZTEST_RAJ'.
LOOP AT ITAB.
AT NEW ZPKSLIP_NO.
CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT = '101' WINDOW = 'MAIN'.
ENDAT.
CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT = '102' WINDOW = 'MAIN'.
AT END OF ZPKSLIP_NO.
CALL FUNCTION 'END_FORM'.
CALL FUNCTION 'START_FORM' EXPORTING FORM = 'ZTEST_RAJ'.
ENDAT.
ENDLOOP.
CALL FUNCTION 'END_FORM'.
CALL FUNCTION 'CLOSE_FORM'.
In sap script write : /E 101 P1 ,,&ITAB-ZPKSLIP_NO(R)& P1 /E 102 P1 ,,&ITAB-ZCARTON_NO(R)&

A Sample SAP Scripts Reports

CALL FUNCTION 'OPEN_FORM'
* EXPORTING
* APPLICATION = 'TX'
* ARCHIVE_INDEX =
* ARCHIVE_PARAMS =
* DEVICE = 'PRINTER'
* DIALOG = 'X'
* FORM = 'ZSCRIPT1'
* LANGUAGE = SY-LANGU
* OPTIONS =
* MAIL_SENDER =
* MAIL_RECIPIENT =
* MAIL_APPL_OBJECT =
* RAW_DATA_INTERFACE = '*'
* SPONUMIV =
* IMPORTING
* LANGUAGE =
* NEW_ARCHIVE_PARAMS =
* RESULT =
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'START_FORM'
EXPORTING
* ARCHIVE_INDEX =
FORM = 'ZFORM1'
* LANGUAGE = ' '
* STARTPAGE = 'X'
PROGRAM = 'ZSCRIPT1'
* MAIL_APPL_OBJECT =
* IMPORTING
* LANGUAGE =
* EXCEPTIONS
* FORM = 1
* FORMAT = 2
* UNENDED = 3
* UNOPENED = 4
* UNUSED = 5
* SPOOL_ERROR = 6
* CODEPAGE = 7
* OTHERS = 8
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
* ELEMENT = ' '
* FUNCTION = 'SET'
* TYPE = 'BODY'
WINDOW = 'HEADER'
* IMPORTING
* PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
OTHERS = 9
.
IF SY-SUBRC <> 0.
write:/ 'ERROR IN HEADER'.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
* ELEMENT = ' '
* FUNCTION = 'SET'
* TYPE = 'BODY'
WINDOW = 'MAIN'
* IMPORTING
* PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
OTHERS = 9
.
IF SY-SUBRC <> 0.
write:/ 'ERROR IN HEADER'.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
* ELEMENT = ' '
* FUNCTION = 'SET'
* TYPE = 'BODY'
WINDOW = 'FOOTER'
* IMPORTING
* PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
OTHERS = 9
.
IF SY-SUBRC <> 0.
write:/ 'ERROR IN HEADER'.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'END_FORM'
* IMPORTING
* RESULT =
* EXCEPTIONS
* UNOPENED = 1
* BAD_PAGEFORMAT_FOR_PRINT = 2
* SPOOL_ERROR = 3
* CODEPAGE = 4
* OTHERS = 5
.
CALL FUNCTION 'CLOSE_FORM'
* IMPORTING
* RESULT =
* RDI_RESULT =
* TABLES
* OTFDATA =
* EXCEPTIONS
* UNOPENED = 1
* BAD_PAGEFORMAT_FOR_PRINT = 2
* SEND_ERROR = 3
* SPOOL_ERROR = 4
* CODEPAGE = 5
* OTHERS = 6
.Can you explain the difference between 1.open_form and Start form 2.end_form and Close_form.
whether all 4 modules are required in the driver pgm .
Open_form => It assign the form and printer, It should be first. Start_form => It start Writing mode. You can use write_form in loop to write more than one lines befor End_form. End_form => It end writing mode of current page and will require to start again through Start_form. Close_form=> it end the Form. After this you can not start again for created file.

FAQ for Sap Scripts

What is the difference between a script & a report ?

Script is a form which has a layout set as per the company standards and can be used for external use too. Generally reports are designed for internal use for in house users

What are the components/elements in sap script ?
Layout set and Print program and the layout set has windows in it.

Can you create a script with out a main window ?
No

How many main windows can be created for a script ?
99

How can we use tables in sap scripts?
We can access structures and the tables tat are updated during runtime. Else you have to pass the structure values to the table in the print program.

How to print a logo in a sap script?
Upolad in the R3 using Se78 and use the Include statement in the script.

When we need to modify standard scripts (eg:medruck) given by sap?
When the client goes for customization of the form

What is the use of transaction code NACE in sap scripts?

You can track the form and the print program used for that form

What is the table name that will contain all the script form names and print program names?

TNAPR

Can you assign your own form to a standard print program? how?
Yes. thru NACE

What is the use of PROTECT & ENDPROTECT?
Keeps the block of text in the same page.

How to add extra functionality to a standard print program with out touching the print program? Thru subroutine programs

What is sub routine pool in sap script?
when it is used?
Its an Abap prog of type sub routine pool, it is used for calculating certain variables, eg DUE date for an Invoice. You pass the values from the form thru ITCSY structure intot he prgram.

How to read text in sapscripts?
SO10

What is the difference between paragraph & character format?
Self explanatory definition

How to use a sapscript for multiple languages ?
(english, germany etc) Copy the script in each lang or you have an option to click 'TO all Languages'

How to download/upload sapscripts from & to your PC ?
SE78 or RSTXLDMC

What is the difference between scripts & smart forms?
Scripts are client-dependent but SF are client Independent

Sapscripts and abap programs are client dependent or not? Why?
Scripts are client dependent. / Reports are client Independent.

What is the transaction code for logo uploading?
SE78

What is the standard program used for uploading the logo to script?
RSTXLDMC FM to upload image in tiff format.

How can you send forms from one client to other?
SE71, Utilities -> Copy from client...

What does open_form, write_form, close_form do?
Again its self-explanatory

What is the diffrence between open_form and close_form?
open_form is used to open the form/initiate the form. close_form is used to conclude the open_form.

How to convert a sapscript to smart form?
tcode SMARTFORMS, I think its menu Utilities you have an option.. Migrate Scripts to Smartforms.
How to send a smartform result through mail?
I think you have to configure the output type. Not sure..

How to select desired paper size in sapscript?
In Basic settings.

How to print the Page Nos in Forms. Every page I want to print 1 of 10 , 2 of 10 , 3 of 0 ...etc. PAGE &PAGE& OF &SAPSCRIPT-FORMPAGES&

How to debugg a script?
This can done in two ways: In the form Utilities->debugger / RSTXDBUG FM for debugging script

The Procedure for debugging SAP script is: Generally SAP script contains the Layout and corresponding print program. First go to SE71 and enter ur script name. In the same screen go to Utilities->click on activate debugger option. Now go to SE 38 and enter ur Print Program name and execute the program. Now you can debug the script Page wise and window wise.

Questions on PO SapScripts MEDRUCK

1. When do you modified MEDRUCK? ( IF I SAID I HAVE WORKED ON SCRIPTS).

Generally, we modify existing sap scripts provided by SAP rather than creating one. Unless you have to do something new for your client like Labels or Packaging card, etc., MEDRUCK is the form for PO.

2. I want to know the procedure to create a purchase order using MEDRUCK.
You don't create a PO using MEDRUCK. MEDRUCK is the form used to print a PO that has been created.

3. What are the usual changes to be done on MEDRUCK?
Goto SE71, there is an option in Utilities as COPY ffrom Source client (000). Copy the from MEDRUCK into a Zname form. The common changes wud b inserting a logo, using Std text for Terms and Conditions, alignment of windows as per client requirement, get xtra data if client is asking for somethign more.

4. How can I access my data from DB to SCRIPTS?
There are structures used in Scripts which hold the data entered by the user. These structures are used to get data from Database.

5. Please send me the one examples in full length.
Look at MEDRUCK form and it would have a print program. you can find in tcode NACE.

SapScript Question

1) How do you backup script layout sets?

2) What type of variables normally used in script to o/p data?

3) How do you use tabsets in layouts?

1) Use this Std program RSTXSCRP.

i) First Export to Presentation file(.doc).

ii) Whenever you need that Export into SAP.

2) Normally we call them as Program symbols. Those are defined in Driver program. We can use in Script as for exp. &itab-matnr& Other variables ---System symbols : ex &page& ---Std symbols : ---Text symbols :We define them in script editor itself. Ex : /: Define &mysymbol& = 'XX'

3) We can control the tab feed in a paragraph with tab positions. The tab stops us define in the paragraph format replace the tab spacing we defined in the header data of the form. However, this depends on the extent to which we have defined tab stops in the paragraph format. If there are fewer tabs in the paragraph formats than in the header data, the tab stops of the header data are used for the rest of the line.

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: Run RSTXLDMC Enter file name C:\MAIL\COMPLOGO.TIF Resolution for Tiff file Absolute X-position Absolute Y-position Absolute positioning Reserved height Shift to right UOM = CM Text title Line width for text = 132 Text name ZHEX-MACRO-COMPLOGO Text ID ST Text language = E Postscript scaling 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.
See OSS notes 5995, 18045, 39031 for some inputs.

Details information about SAP Barcodes

What I need to do to print a barcode in sapscript?

A barcode solution consists of the following:
- a barcode printer
- a barcode reader
- a mobile data collection application/program

A barcode label is a special symbology to represent human readable information such as a material number or batch number
in machine readable format.

There are different symbologies for different applications and different industries. Luckily, you need not worry to much about that as the logistics supply chain has mostly standardized on 3 of 9 and 128 barcode symbologies - which all barcode readers support and which SAP support natively in it's printing protocols.

You can print barcodes from SAP by modifying an existing output form.

Behind every output form is a print program that collects all the data and then pass it to the form. The form contains the layout as well as the font, line and paragraph formats. These forms are designed using SAPScript (a very easy but frustratingly simplistic form format language) or SmartForms that is more of a graphical form design tool.

Barcodes are nothing more than a font definition and is part of the style sheet associated with a particular SAPScript form. The most important aspect is to place a parameter in the line of the form that points to the data element that you want to represent as barcode on the form, i.e. material number. Next you need to set the font for that parameter value to one of the supported barcode symbologies.

The next part of the equation can be a bit tricky as you will need to get a printer to print that barcode font. Regular laser printers does not normally print barcode fonts, only specialized industrial printers that is specifically designed to support that protocol and that uses specialized label media and heat transfer (resin) ribbon to create the sharp image required for barcodes.

Not to fear though, there are two ways to get around this:
- You can have your IT department do some research -
most laser printers can accept a font cartridge/dimm chip (similar to computer memory), called a BarDIMM that will allow a laser printer to support the printing of barcodes.
- Secondly, you can buy software that you can upload in your SAP print Server that will convert the barcode symbology as an image that will print on a regular laser printer. I found that this option results in less sharper barcodes. This option is really if you need to convert a large quantity of printers (>10) to support barcodes.
- Thirdly, you can buy a third party software like Barcode.dll and install on your frontend PC connected to the laser printer.

Now you have a barcode printed - what next?
Well there are two options, depending on your business requirements:
- You can use an existing SAP transaction on a regular workstation and get a barcode wedge reader to hook up between the keyboard and the PC. These wedge readers comes in a wand or scanner format. There are even wireless wedge scanners available that allows you to roam a few yards from the workstation to scan a label. This approach is mostly used where you want to prevent human errors in typing in long material, batch or serial numbers in receiving or issuing of material. The problem is that it's just replacing the keyboard input and you are basically locked down in one location and have to bring all the material to that location to process.
- Another solution is to use SAPConsole transactions
or write your own ABAP Dialog programs that will fit onto a barcode enabled wireless handheld terminal and that will follow the business logic as executed on the shop floor.

These programs are highly complex exercises in industrial engineering and ergonomics because of the limited screen sizes and limited ability to accept keyboard input. The user is instructed step-by-step and only scan and push F-keys to interact with the SAP system. Scan, scan, beep, beep, enter - highly automated

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.

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.

Import/Export SapScript form from PC file How do you backup sapscript layout sets? Can you download and upload? How?

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.

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

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 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'

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.

SAPscripts How to calculate Totals and Subtotals

I have some doubs in BDC and SMART FORMS. I want to change the material number using the transaction code MM02 through BDC.

In scripts and smartforms how to calculate totals and subtotals?

To calculate totals and sub totals in sap scripts you have to use subroutines.

Say if you have to add the unit price (KOMVD-KBERT) then in the main window whereever tat value is picked write this routine

/: DEFINE &TOT_PRICE&
/: PERFORM F_GET_PRICE IN PROGRAM /:USING &KOMVD-KBERT& /:CHANGING &TOT_PRICE& /:ENDPERFORM

Then write the variable where ever you want it to be printed (mostly it will be in footer window)

Then create subroutine pool program and you have to write the code.

FORM F_GET_PRICE tables int_cond structure itcsy
outt_cond structure itcsy. data : value type kbert.

statics value1 type kbert.
Read int_cond table index 1.
value = int_cond-value.

value1 = value1 + value.

Read outt_cond table index 1.
outt_cond-value = value1.
Modify outt_cond index 1.

ENDFORM.

Retrieving data without modifying the original called program

REPORT ZSCRIPTPERFORM.
FORM GET_BARCODE TABLES IN_PAR STRUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.
DATA: PAGNUM LIKE SY-TABIX, "page number
NEXTPAGE LIKE SY-TABIX. "number of next pageREAD TABLE IN_PAR WITH KEY 'PAGE'.

CHECK SY-SUBRC = 0.

PAGNUM = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'NEXTPAGE'.

CHECK SY-SUBRC = 0.NEXTPAGE = IN_PAR-VALUE.
READ TABLE OUT_PAR WITH KEY 'BARCODE'.
CHECK SY-SUBRC = 0.IF PAGNUM = 1.
OUT_PAR-VALUE = '|'. "First pageELSE.
OUT_PAR-VALUE = '||'. "Next page
ENDIF.
IF NEXTPAGE = 0.
OUT_PAR-VALUE+2 = 'L'. "Flag: last page
ENDIF.
MODIFY OUT_PAR INDEX SY-TABIX.
ENDFORM.

Protect...Endprotect

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 protect...endprotect.

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.

Print Footer notes only on the last page

Command to used in your sapscripts :-

/: IF &NEXTPAGE& EQ 0

whatever footer you want.

/: ENDIF

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 :

Underline Text Bold Text

SAP Printer commands in SAPScripts

The command line in the editor must be as follows:

/: PRINT-CONTROL xxxxx

or

/: PRINT-CONTROL 'xxxxx'

where xxxxx stands for the five-character name of the print control.

Example:
/: 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.

Example:
/: 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.

Refer to OSS note 5996 - How can SAPscript include printer commands?

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.

Instead of:
/: 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

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&

SAPScript Important Programs

Here are some useful programs for SAPSCRIPT development/search ...

RSTXFCAT - Program to find out SAP Scirpt names (Search Program)

RSTXCDM1 - SAPscript: Sample Program for Form Printing

RSTXCNVR - Converting SAPscript standard text to RAW format (ASCII)

RSTXCPDF - Routines for Converting OTF Format to PDF Format

RSTXDBUG - Activate/Deactivate Form Debugger

RSTXFCAT - Find Forms
RSTXFCPY - Copy Forms Between Clients

RSTXFCOM - Comparison of Two Forms

RSTXFCON - SAPscript: Conversion of Page Format for Forms

RSTXFINF - Comprehensive Information about a Specific Form

RSTXHTML - Conversion of SAPscript Texts (ITF) to HTML

RSTXICON - List of SAP icons and their names and SAP numbers
RSTXSYMB - List of SAP symbols and their names as well as SAP number

RSTXR3TR - Transport Program For SAPscript Transport Objects

RSTXSCAT - Find Styles

RSTXSF01 - TrueType font installation for SAPscript/SmartForms

RSTXTCAT - Find Standard Texts

SAPScript Transaction codes

SE71 - Form painter

SE72 - Style maintenance

SE78 - SapScript Graphics Management

SO10 - Create standard text module

Free Certification Material