Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Elements in sapscript

Former Member
0 Likes
4,357

Good morning all.

What are elements of sapscripts?

Why and how will I use them?

Thanks.

7 REPLIES 7
Read only

Former Member
0 Likes
1,996

Hi

A variable in SAPscript is called a symbol. There are the following types.

• System symbol (e.g. the number of the current page)

• Standard symbol (usable in any document)

• Program symbol (value from the print program)

• Text symbol (“local variable”)

The value of a symbol is text for using within SAPscript code and is represented by the symbol-name enclosed by ampersands. On seeing the tell-tale ampersands in SAPscript code, you sometimes need to figure out the symbol type.

goto any PAGEWINDOW's Text elements in Script (SE71)

from the Menu-> INSERT-> Symbols

you find all symbols here

System symbols

System symbols in a SAPscript form are comparable to system fields like SY-UZEIT in an ABAP program, and include these. The graphical editor offers three types of system symbol.

1. General system symbols

See the table TTSXY. PAGE is the most widely used. The list given in our BC460 training manuals is out of date.

2. SAPscript system symbols

See the dictionary structure SAPSCRIPT. SAPSCRIPT-FORMPAGES is the most widely used.

3. ABAP system symbols

For the ABAP system field SY-UNAME, say, the symbol is SYST-UNAME. [SYST is the dictionary structure for ABAP system fields.]

Sample code:

  • User: &SYST-UNAME&

  • Page &PAGE& of &SAPSCRIPT-FORMPAGES(C3)&

Standard symbols

Standard symbols are maintained centrally (in the table TTDTG via transaction SE75) for use in any document. Menu path:

Tools

Form Printout

Administration

Settings

Some standard symbols are SAP-standard and others are custom. Curiously, table TTDTG is cross-client although SAPscript forms are not.

The value of a standard symbol has to be defined for each language used. This gives a way to make a single SAPscript form multi-lingual.

We can take advantage to an extent of the central maintenance, though there is no guarantee that the available standard symbols will used in every appropriate context.

Standard symbols complicate searching a SAPscript form, since text like ‘Charity registration 211581’ may be hiding in a standard symbol.

Text symbols

A text symbol is declared and assigned to within the SAPscript code, and so obviously applies only to the current document. The command DEFINE is used, requiring /: in the tag column, as in the following examples.

/: DEFINE &COMP_NAME& = ‘University of Warwick’

/: DEFINE &WS_RATE& = &TAX_SUMM_C&

SCRIPT COMMANDS

ADDRESS : Formatting of Address

BOTTOM, ENDBOTTOM : Define Footer text in a window

BOX, POSITION, SIZE : Boxes, Lines and Shading

CASE, ENDCASE : Case Distinction

DEFINE : Value assignment to text symbols

HEX, ENDHEX : Hexadecimal values

IF, ENDIF : Conditional text output

INCLUDE : Include other texts

NEW-PAGE : Explicit forms feed

NEW-WINDOW : Next window main

PRINT-CONTROL : Insert print control character

PROTECT...ENDPROTECT : Protect from page break

RESET : Initialize outline paragraphs

SET COUNTRY : Country-specific formating

SET DATE MASK : Formating of date fields

SET SIGN : Position of +/- sign

SET TIME MASK : Formating of time fields

STYLE : Change style

SUMMING : Summing variables

TOP : Set header text in window MAIN

<b>Reward points for useful Answers</b>

Regards

Anji

Read only

Former Member
0 Likes
1,996

hi,

Refer to this related thread

Regards,

Santosh

Read only

Former Member
0 Likes
1,996

<b>" SAPscript Tutorial - Main elements -</b>

" 1.Language

Language in which the data coming on to the layout set will be printed. Generally, this will be the language that has been set up as default in the SAP system

"2. Header

Section to define the various attributes of the layout set on a global level. Changing these attributes will affect all the components of the layout set.

The various components of the header are explained below

<b>" Administration Information</b>

This shows the information about the layout set – details of the designer, details of changes occurring to the design, development class of the layout set and the language details for the layout set

<b>" Standard Attributes</b>

Description - Brief description or title of the layout set

Default paragraph - The base paragraph that is globally applicable to the document. This can be overridden at lower level of the layout set by using other paragraphs

Tab Stop - The base tab-stop that is globally applicable to the document. These can be overridden at lower level of the layout set by using other tab stops

First Page - The start page of the layout set

Page Format

Orientation - The direction of printing the data on a page – P for portrait (vertical) and L for landscape (horizontal)

Lines per inch

Characters/inch

<b>" Font Attributes</b>

Here the various attributes and the base font applicable to the document can be defined. This font setting can be overridden at a lower level using the character strings

" 3. Paragraphs

Used to define the start and end positions for the different texts and objects that need to be printed on the output document.

" 4.Character Strings

Used to define the fonts and the formatting and printing styles for each and every character that needs to be printed on the output document. The start of the character string is indicated by <string name>, while the end of the character string is indicated by </>

" 5.Pages

The designer needs to organise the template as a series of pages. When an actual output document is printed, it will refer to each page for putting the data coming from the ABAP program. The order of pages is also taken from the template i.e the layout set defined.

" 6.Windows

Various parts of the output document can be conveniently organised on the pages using windows. Thus the data stream coming from the ABAP program can be logically grouped into various parts and can be placed on different locations on a page

There are 2 main types of windows that can be used in a layout set:

<b>MAIN</b> - A layout set can have only one MAIN window which is created by default. This window can flow over multiple pages.

<b>CONSTANT</b> - A layout set can have any number of constant windows. A constant window can be used once per page

" 7.Text Elements

Any text that needs to be written on the output document should be placed within a text element. This includes constant text as well as variable data like internal table data coming from the ABAP program.

It is advisable to group logically related data within one text element.

The fields of various tables defined in the ABAP program will be included under these text elements. These fields are carriers of data. Every field should be included in a pair of & characters. (e.g. &aufk-aufnr&)

" 8.Page Windows

All the windows that form a page of the layout set.

Choose the window and click the Text Elements button to go to the Layout Set Editor. This consists of 2 parts

The small space on the left is for specifying the type of command, while the window adjacent to it is for writing the command or the text that needs to go under a text element.

reward points if it is usefull ..... enjoy the weekend

Girish

Read only

Former Member
0 Likes
1,996

Hi,

A element in a statement is command line area which we can call various time using WRITE_FORM.

e.;g.

in sapscript

/E  ULINE
/: ****************************************************************************

where /E represents element with name ULINE

now u can use this in write_form using element parameter in various locations... without duplicating codes...

Jogdand M B

Read only

Former Member
0 Likes
1,996

<b>Elements in SAP Script</b>

  • They are predefined text components which are determined in the layout set definition. They can be accessed with one name.

  • Elements are related to the window in which they are defined.

  • Elements have to be called explicitly. You also have to specify the window.

  • Window MAIN is always the default.

Regards,

Pavan.

Read only

0 Likes
1,996

Thank you.

How can I use the element from abap side that I have defined in the layout set?

Thank you.

Read only

Former Member
0 Likes
1,996

Layout set and Print program and the layout set has windows in it