cancel
Showing results for 
Search instead for 
Did you mean: 

elements in scripts

Former Member
0 Kudos

What are the elements in sap script?

Regards,

swathi

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member196280
Active Contributor
0 Kudos

If you want to print only header once in the first page, for example if your header is in your main window and display header only in first line and all line items followed in main window this type of scenarios can be controlled by elements

In side SAPscript, elements are represented like this

/E -->element name

Ex;

/E 505

-


-


in driver program we call as shown below

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = '505'

WINDOW = 'MAIN'

Note: we can use this elements in any window and also we can also have any number of elements.

Regards,

SaiRam

paruchuri_nagesh
Active Contributor
0 Kudos

You can define text elements (window texts) for each window. On the Form: Request screen, choose Edit ® Text elements.

The print program accesses text elements by name, formats them and prints them in the respective window. That is, the program can decide which text elements should be printed in a particular window. It calls these text elements by name to print them. You must therefore change text element names in the print program if you make any changes to text element names in a form.

In the layout of a text element, you can use only the paragraph and character formats defined in the form.

Example of a text element in an order confirmation:

/E ITEM_LINE

IL &VBDPA-POSNR&,,&VBDPA-MATNR&,,&VBDPA-ARKTX&

/ &'Customerarticlenumber 'VBDPA-IDNKD' '&&'Position

/ 'VBDPA-POSEX&

This example shows a section of a main window of a form, with an item line of an order confirmation. The /E in the tag column is used to identify the text as a text element, ITEM_LINE is the name of the text element

reward if u find use ful

in print program u have to call this fm

CALL FUNCTION 'WRITE_FORM'

  • EXPORTING

ELEMENT = 'e '

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

  • WINDOW = 'window name'

  • IMPORTING

  • PENDING_LINES =

  • EXCEPTIONS

  • ELEMENT = 1

  • FUNCTION = 2

  • TYPE = 3

  • UNOPENED = 4

  • UNSTARTED = 5

  • WINDOW = 6

  • BAD_PAGEFORMAT_FOR_PRINT = 7

  • SPOOL_ERROR = 8

  • CODEPAGE = 9

  • OTHERS = 10

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

regards

Nagesh.paruchuri

Former Member
0 Kudos

In print program you can specify when a certain element should be printed, it gives you a control on the sap script processing and therefore sap script form is more flexible and general.

SAPscript calls the individual text components of a form text elements. To achieve good structuring and readability, you assign a fixed name to each text element in the form. The print program then uses these names to access the elements. This name applies also for translated versions of a text element, while the contents of the text elements depend on the language.

Text elements are related to a window, that is, a print program can call for each window only those text elements that exist in this window. They are used in main and other windows.

The variables used within '&...&' are replaced by the system at output time

/E <element name>

UL &fieldnam& text text

Named element are written when driver program use

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'BOOKING'

TYPE = 'BODY'

WINDOW = 'MAIN'

Unnamed element are written once in MAIN windows, and each time in other windows.

U can use use multiple ELEMENTS in one window.

Thanks

Seshu