Scripts

http://learnabaponline.blogspot.in/2013/06/sapscript.html

Tcodes used in Script

SE

How can I debug my SAPscript?

Go to the transaction SE71.
Enter the form name.
Choose the menu Utilities->Activate Debugger to enable debugging.

Or call standard program RSTXDBUG.

To stop debugging, you must print the SAPscript form, and click Exit button in the debugger window when it is displayed.

I have created a SAPscript in language DE. Now I need to translate it to EN. How could I do this?

Open your SAPscript in transaction SE71.
In the Header screen, in the Language Attributes Option, choose Translate to… Option to translate to other languages.

If any text modules or texts have to be translated within the SAPscript, then it can be done using SE63 transaction.

How can I copy SAPscripts from one client to another, or export/import them?

In the transaction SE71, enter the Form name and choose the menu, Utilities->Copy from client to copy SAPscripts from one client to another.

Use RSTXSCRP to import/export SAPscripts.

How can I change the page size of the layout?

In the SAPscript, Goto -> Header -> Basic Settings
Here you could configure the page settings and their orientation.

How to find the Driver Program for the given SAPscript?

  1. Go to the Table TNAPR using SE11
  2. Get the Contents of the Table(CNTRL+SHIFT+F10)
  3. On the Table Content Selection Screen, Type the SAPscript Name for which we have find the Driver Program in the field FONAM and execute(F8)
  4. PGNAM field of the result display contains the Driver Program Name for our SAPscript

How can I get the landscape format in SAPscript?

In the form go to basic settings–> you can find a landscape option –> click on it and at the bottom. You can find the page option enter the page name for which you want to assign ladscape format.

How many MAIN windows are allowed for SAPscript?

SAPscript allows 99 MAIN windows

Each Page can consists up to 99 windows. Each main window is assigned a consecutive
identifying number (0..98).

This is mainly used for label printing or address printing.

Is it possible to create a SAPscript without a main window?

(this can be used for static forms which always print the same number of pages)
Yes, but you must call WRITE_FORM function module at least once (even with a non-existing element or window!)
If there is more than one page, you may need to force the next page to be printed by calling CONTROL_FORM function module with command NEW-PAGE (PAGE2 for example)

Where are the SAPscript form names?

Table STXH, with field values tdobject = ‘FORM’ and tdid = ‘TXT’ and tdname = form name

How to assign own form to a standard print program?

Most of applications use NACE transaction, but there are also Print Workbench, Post-Processing Framework.

How to convert a sapscript to Smart Form?

Start SMARTFORMS transaction, Goto Menu path Utilities -> Migration -> Import SAPscript Form.

To mass migrate, use the following:

  1. Execute the program SF_MIGRATE.
  2. Select the names and the language of the SAPscript forms and choose Execute.
    The system creates the Smart Forms under the names of the SAPscript forms plus the extension _SF.
    It displays a list of the migrated forms.
  3. To change and adapt a form, go to transaction SMARTFORMS. Then activate the changed Smart Form.

What are the different types of windows in SAPscripts?

Windows are defined in the Layout sets which define the position and the text to displayed.

The different types of windows are:

  • MAIN – Main Window
    The main window is a continous window which can extend over several pages. If the text in the main window fills up a page, a new page is created.
    Only one main window can be defined in the SAPscript whereas up to 100 instances of main window can be created in a page.
  • VAR – Variable Window
    This window can have the variable contents displayed on them. The contents of the window cannot exceed the window size. The content can be formatted for each page.
  • CONST – Constant Window
    The constant window can have a fixed content and is formatted only once.

Elements

How do I create Boxes in SAPscript?

You can create Boxes in the SAPscript using the BOX command specifying the x,y co-ordinates and the width and the height

/: BOX XPOS '0' CM YPOS '0.5' CM WIDTH '9.2' CM HEIGHT '3.5' CM FRAME 8 TW

How can I create a Shaded box?

Use the addition INTENSITY in the BOX command to apply gray shading to the boxes.

/: POSITION XORIGIN '2' CM YORIGIN '7.5' CM
/: BOX WIDTH '18' CM HEIGHT '1.25' CM INTENSITY 15

This will create a box with the given height and width and shading it with 15% intensity (you also need to provide X,Y positions).

How do I set tabs between the fields in display?

To enter a tab, use ,, (2 commas). Then, in the Paragraph Format tab, create a new paragraph format. In the “Tabs” Tab, enter the tab position and the alignment for the fields.

How do I create standard texts for the SAPscripts?

You can create standard texts using the transaction SO10. Then to insert these standard texts in the SAPscript choose the menu, Insert->Text->Standard and choose the standard text that you want to choose.

Alternatively, you can display standard texts in your SAPscripts using the command:

/: INCLUDE ZSTEXT OBJECT TEXT ID ST LANGUAGE EN
  • where ZSTEXT refers to the Standard Text name.

How can I Word Wrap the text being displayed in SAPscript?

Use the Function Module RKD_WORD_WRAP to wrap the text and use this for output.

How can I display barcodes in SAPscripts?

Create a character format in the SAPscript.
Choose the Bar Code for the character format.

And finally to display barcodes, in the command enter:

<C1>&vbeln&</>
  • where C1 is the character format created and vbeln is the variable for which the barcode is to be created.

How can I print logos in SAPscripts?

TIFF files (*.tif):

  • Use the program RSTXLDMC to convert the TIFF file to standard text.
  • Print this using the INCLUDE command:
  • INCLUDE ZLOGO OBJECT TEXT ID ST
    Bitmap files (*.bmp)
  • Go to transaction SE78
  • Choose BMAP under GRAPHICS
  • Choose Import Graphic (F5)
  • Select the image and upload
  • In SE71 choose Insert->Graphics and then choose the image for display

How can I prevent page-break in the message that is to be displayed?

Enclose the text that you want to prevent page-break in PROTECT… ENDPROTECT
SAPscript will ensure that each line of this text is printed together on the same page.

Ie.If SAPscript finds that the text cannot be printed on that page completely a implicit page break occurs and the text is printed on the next page

/: PROTECT
*  Text
*  Within
*  The same page
/: ENDPROTECT

What are the various text formatting options in SAPscript?

SAP Library – SAPscript – Formatting options

Formatting option

Meaning

Comment

&symbol(N)& Display N first characters of symbol
&symbol(Z)& Omit leading zeros
&symbol(S)& Omit leading sign
&symbol(<)& Display leading sign to the Left (you may also use /: SET SIGN LEFT) forum: Ignored if the domain has “sign” option disabled (sign is never printed in that case)
&symbol(>)& Display leading sign to the right (you may also use /: SET SIGN RIGHT) forum: Ignored if the domain has “sign” option disabled (sign is never printed in that case)
&symbol(C)& Compress spaces
&symbol(.N)& Display upto N decimal places Do not use a field related to a currency code or unit of measure (as these last define the number of decimals), otherwise you’ll get error SSFCOMPOSER602 (Field &2: Incorrect formatting option “&1”) while outputting the form
&symbol(T)& Omit thousands separator
&symbol(R)& Right justified
&symbol(I)& Suppress output of the initial value
&symbol(K)& Ignore conversion routine forum: “K option works only for Character-like variables (char, date, time, numc), string and Integer. It doesn’t work for packed, float and other types (see routine CONVERT_SYMBOLVALUE in include LSTXVFCD)”

You may combine options, for example: &symbol(8R)& which means right-aligned inside 8 characters

Which are frequently Used System Variables in SAPscript?

&DATE& Currentdate
&DAY& Day
&MONTH& Month
&YEAR& Year
&TIME& Time of the day
&HOURS& Hours
&MINUTES& Minutes
&SECONDS& Seconds
&PAGE& Page
&NEXTPAGE& Next page number
&SPACE& Blank
&ULINE& Underline
&VLINE& Vertical line
&NAME_OF_MONTH& Name of the Month
&SAPSCRIPT-FORMPAGES& Total number of pages in currently formatted layout set
&SAPSCRIPT-JOBPAGES& Total number of pages in currently formatted print request

For more information:

How can I format the date being displayed in the SAPscript?

The date fields in SAPscripts can be formatted using the SET DATE MASK control command.

/: SET DATE MASK = 'MMMM DD, YY'

This displays the date as : September 26, 07

The following are the codes that can be used in the date mask:

YY Year (2 digits)
YYYY Year (4 Digits)
MM Month (2 Digits)
MMM Month Name (Abbreviated)
MMMM Month Name (Full)
DD Day as two digits
DDD Day name (Abbreviated)
DDDD Day name

Using the SET DATE MASK causes the subsequent date fields to be displayed using the same formatting. To return to the default formatting use the following command:

/: SET DATE MASK = ' '

For more information, see SAP Library – SAPscript – Formatting Date Fields: SET DATE MASK

How can I format the time in the SAPscript?

Similar to SET DATE MASK for date fields we can use SET TIME MASK for formatting time fields.

/: SET TIME MASK = 'HH hrs MM min SS sec'

This displays the time as : 11 hrs 43 min 37 sec’

The following are the codes that can be used in the time mask:

HH Hours
MM Minutes
SS Seconds

The time formatting can be reset to the default setting using:

/: SET TIME MASK = ' '

For more information, see SAP Library – SAPscript – Formatting Date Fields: SET TIME MASK

What is the difference between the SAPscript texts, ‘Customer &KNA1-KUNNR&’ and ‘&Customer KNA1-KUNNR&’?

What is the use of the POSITION and SIZE command in SAPscripts?

The POSITION command is used to x, y coordinate position which is used by the BOX command. The offset from the current window positions are specified which could be either positive or negative.

/: POSITION XORIGIN '2' CM YORIGIN '-1.5' CM

Similarly the SIZE command sets the width and height parameters.

/: SIZE WIDTH '10' TW HEIGHT '10' TW

Control commands

How to Use the New-Window Command?

You can use the NEW-WINDOW command to call the other main window explicitly in the form, even if the current main window is not full. We can create upto 99 Main Windows. This Main windows are generally used to create labels or to write Addresses.Need to write this in the Main window.

/: NEW-WINDOW

How can I trigger new page in SAPscripts?

Use the command NEW-PAGE to trigger a new page in SAPscript.

/: NEW-PAGE

You can explicitly trigger a page not in sequence by specifying the name pf page with the command NEW-PAGE

/: NEW-PAGE <pagename>

How can I set the header and footer in the main window?

The TOP…ENDTOP and BOTTOM…ENDBOTTOM commands are used to set the header and footer texts in the main window respectively.
These texts will be displayed on the start and end of every new page in the output.

To disable these texts enclose empty commands between the commands.
Eg.:

/: TOP
/: ENDTOP

What the conditional statements used in SAPscripts?

The following conditional statements are used in SAPscripts:

/: IF...ELSE/ELSEIF...ENDIF
/: CASE...ENDCASE

How can I insert symbols in Smartforms?

Select the Text node.
Change Editor (Click the button above Check near the Editor)
Go to menu Include->Characters->SAP Symbols
Choose the SAP symbol that you want to insert.

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 transaction code for logo uploading?

SE78

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

 What is the standard program used for uploading the logo to script?

RSTXLDMC

 How can you send forms from one client to other?

SE71, Utilities -> Copy from client…

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 select desired paper size in sapscript?

In Basic settings.

How do you backup script layout sets?

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

How do you use tabsets in layouts?

Use this Std program RSTXSCRP.

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

2) Whenever you need that Export into SAP.

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’

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.

BC Style and Form Maintenance
BC Style and Form Maintenance
Forms: Components and Techniques
Header Data
Paragraph Formats and Attributes
Character Formats and Attributes
Windows
Pages
Page Windows
Text Elements
Main Window
Displaying Versions of Forms
Including Graphics
Using Boxes, Lines, and Shading
Styles
Using Styles
Releasing Styles
Forms
Design Tools
Releasing Forms
Transporting, Copying, and Comparing Styles and Fo
SAPscript Control Commands
Level 3: Document: Syntax of Control CommandsSyntax of Control Commands
Level 3: Document: Explicit Page Break: NEW-PAGEExplicit Page Break: NEW-PAGE
Level 3: Document: Preventing Page Breaks: PROTECTPreventing Page Breaks: PROTECT
Level 3: Document: Next Main Window: NEW-WINDOWNext Main Window: NEW-WINDOW
Level 3: Document: Assigning a Value to a Text Symbol: DEFINEAssigning a Value to a Text Symbol: DEFINE
Formatting Date Fields: SET DATE MASK
Formatting Time Fields: SET TIME MASK
Country-Dependent Formatting: SET COUNTRY
Position of the Leading Sign: SET SIGN
Initializing Numbered Paragraphs: RESET
Including Other Texts: INCLUDE
Changing the Style: STYLE
Formatting Addresses: ADDRESS
Setting a Header Text in the Main Window: TOP
Setting a Footer Text in the Main Window: BOTTOM
Conditional Text: IF
Finding a Match: CASE
Calling ABAP Subroutines: PERFORM
Level 3: Document: Inserting Print Controls: PRINT-CONTROLInserting Print Controls: PRINT-CONTROL
Level 3: Document: Boxes, Lines, Shading: BOX, POSITION, SIZEBoxes, Lines, Shading: BOX, POSITION, SIZE
Hexadecimal Data: HEX, ENDHEX
Summing a Program Symbol: SUMMING
SAPscript Symbols
Level 2: Node: Program Symbols. Trigger this link to expandLevel 2: Node: Program Symbols. Trigger this link to expandProgram Symbols
Standard Symbols
Text Symbols
Formatting Options
Using TrueType Fonts
Formatting Conventions
Printing Labels
Analyzing Problems when Printing with Forms
Page Layout
Level 2: Node: Form Tree. Selected. Trigger this link to expandLevel 2: Node: Form Tree. Selected. Trigger this link to expandForm Tree
Administering Graphics

http://help.sap.com/saphelp_nw2004s/helpdata/en/d1/8031c3454211d189710000e8322d00/frameset.htm

Leave a comment