0% found this document useful (0 votes)
102 views19 pages

Basic Form: WRITE - Output To A List

This document provides details on the WRITE statement in ABAP programming. WRITE outputs data to lists or variables. For output to lists, WRITE can output fields, literals, and field symbols. Position, formatting, and field type determine output. For output to variables, WRITE assigns the value of the source field to the target field while maintaining formatting like decimal places. Offsets and lengths can be static or dynamic.

Uploaded by

Che Fauziah
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views19 pages

Basic Form: WRITE - Output To A List

This document provides details on the WRITE statement in ABAP programming. WRITE outputs data to lists or variables. For output to lists, WRITE can output fields, literals, and field symbols. Position, formatting, and field type determine output. For output to variables, WRITE assigns the value of the source field to the target field while maintaining formatting like decimal places. Offsets and lengths can be static or dynamic.

Uploaded by

Che Fauziah
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

WRITE ( Output to a list ) is a keyword used in SAP ABAP programming.

This tutorial covers its


introduction & syntax details.

WRITE - Output to a list

Basic form
WRITE f.

Additions

1. ... AT pl (position and length specification,


before the field)
2. ... option (formatting option)
3. ... ofmt (output format by field)
4. ... AS CHECKBOX (output as checkbox)
5. ... AS SYMBOL (output as symbol)
6. ... AS ICON (output as icon)
7. ... AS LINE (output as line)
Effect
Outputs the field f in the correct format for its type to the current list. The field f can be:

a field declared by DATA ,


a component of a structure declared by TABLES ,
a field symbol (FIELD-SYMBOLS ),
a text literal which is not language-specific
a language-specific text literal (text symbol).

Examples

TABLES SPFLI.
DATA N TYPE I VALUE 123.

...
WRITE N.
WRITE SPFLI-FLTIME.

FIELD-SYMBOLS .
ASSIGN 'NEW YORK' TO .
WRITE .
WRITE: '---->', SPFLI-DISTANCE.

WRITE: TEXT-001, SPFLI-ARRTIME.

or

WRITE: 'Time:'(001), SPFLI-ARRTIME.

Text symbols can be addressed in two different ways (TEXT-001 or'Time:'(001)) .

Notes
If no explicit position is specified for a field on a new line, it is output on the left (in column 1).
Otherwise, output is one column removed from the previously output field. If a field does not fit
on one line, a new line is started.
You can perform explicit positioning with a position and length specification (see addition 1) or
with ABAP/4 statements (e.g. POSITION ). In this case, the field is always output at the defined
position, even if the line is not quite long enough for it to fit completely.
If a field is too long to fit completely on the line, the excess characters are truncated.
Each field occupies a number of characters in the list. If this number is not explicitly defined (see
addition 1), the system uses a type-specific standard length or the output length specified in the
ABAP/4 Dictionary .

Type-specific output: (len = field length)

Type Standard output length Output


C len left-justified
D 8 left-justified
F 22 right-justified
I 11 right-justified
N len left-justified
P 2*len or 2*len+1 right-justified
T 6 left-justified
X 2*len left-justified

Number fields (types P , I and F ) are always output right-justified, but all other types are left-
justified; if required, blanks are used for padding. With number fields, leading zeros are replaced
by blanks. If there is enough space, types P and I have thousands separators. To accommodate
the decimal point, the output length of type P fields is 1 byte longer.

Addition 1
WRITE AT pl (position and length
specification before the field)

Effect
You can use the position and length specification pl to define the precise output position and
length of a field. The specification consists of:

/ New line
c Output position (1-3 character number or variable)
(l) Output length (1-3 character number or variable)

Combinations are possible.

Examples

DATA: WORD(16), VALUE '0123456789ABCDEF',


COL TYPE I VALUE 5,
LEN TYPE I VALUE 10.
WRITE AT / WORD. "new line
WRITE AT 5 WORD. "column 5
WRITE AT (10) WORD. "output length 10
WRITE AT /5(10) WORD. "new line, column 5, length 10
WRITE AT COL WORD. "column = contents of COL
WRITE AT (LEN) WORD. "output length = contents of LEN
WRITE AT /COL(LEN) WORD. "new line, column = contents of COL
"output length = contents of LEN

Note
The position and length specification must appear before the field. If the position and length
specification contains only constants, you the introductory AT is unnecessary. (In the first four of
the above examples, you can therefore omit AT .) Always write the position and length
specification without gaps and in the specified order. Leave at least one space between the
position and length specification and the field name. For dynamic positioning, see also
POSITION . No output results from positioning to the right of the far right edge of the page.
With explicit column specifications, the field is output from this column, even if it no longer
completely fits on the line or overwrites another field. If the output length is too short, number
fields (types P , I and F are prefixed with an asterisk ('*'), while all other types are truncated on
the right. If you want the abbreviated output of a variable, you should always use WRITE (10)
T100-TEXT rather than WRITE T100-TEXT(10) (sub-field access).
On the one hand, the first form is always allowed and the second form can be forbidden for
certain data types (e.g. TYPE P ). On the other hand, only the first form guarantees the identity
of the variables for GET CURSOR ... FIELD and F1 help.

Addition 2
... option (formatting option)

Effect
You can modify the output of the field f by using one of the special formatting options .

Addition 3
... ofmt (output format by field)

Effect
Outputs the field with the specified output formats (color, intensity, ready for input, ...).
You can use the same output options as for FORMAT . If no specifications are made, the field is
output with the standard formats or with the format set by a preceding FORMAT statement.

Example

DATA F.

FORMAT INTENSIFIED OFF INPUT.


WRITE F INPUT OFF INVERSE COLOR 3.

Note
The format specifications with WRITE apply only for output of the field f . They modify the
currently valid format for this field. This means that, in the above example, the non-highlighted
output remains for the field F . When f has been output, the system reverts to the old format.

Addition 4
... AS CHECKBOX (output as checkbox)

Addition 5
... AS SYMBOL (output as symbol)

Addition 6
... AS ICON (output as icon)

Addition 7
... AS LINE (output as line)

Note
General notes on outputting boxes to lists
When you output a list, this is sometimes combined with vertical and horizontal lines to form
closed boxes:

Vertical lines are output by the system field SY-VLINE or by a field containing " | " (vertical
bar),
Horizontal lines are output by the system field SY-ULINE or by a field containing only " - "
(minus sign),
Vertical and horizontal lines converge (without gaps).

Related 10 ABAP Syntax Tutorials


 MESSAGE (ABAP Keyword)
 CASE ( ABAP Keyword)
 FIELD-GROUPS (ABAP Keyword)
 UNPACK ( SAP ABAP Keyword)
 SET ( SAP ABAP Keyword)
 ENDCASE (ABAP Keyword)
 PARAMETERS (ABAP Keyword)
 SUPPRESS ( SAP ABAP Keyword)
 ENDLOOP (ABAP Keyword)
 NEW-SECTION (ABAP keyword)

Most readed SAP Tutorials

 WRITE - Output to a list ( SAP ABAP Keyword)


WRITE ( Output to a list ) is a keyword used in SAP ABAP programming.This tutorial
covers its introduction & syntax details.
 List of SAP HR TABLES and Infotypes tables
Detailed full list of tables and infotypes used in SAP HR module.
 List of SAP MM Transaction codes
This documentation covers the details of SAP MM Transaction codes
 SELECT-OPTIONS ( SAP ABAP Keyword)
SELECT-OPTIONS is a keyword used in SAP ABAP programming.This tutorial covers
its introduction & syntax details.
 FI Accounts Receivable and Accounts Payable | SAP FI PDF manual
The following topics are an introduction to the Accounts Receivable and Accounts
Payable application components.
 SAP MM Process Flow
The typical procurement cycle for a service or material consists of the following phases:
 SELECT clause ( SAP ABAP Keyword)
SELECT clause is a keyword used in SAP ABAP programming.This tutorial covers its
introduction & syntax details.

WRITE ( Output to a variable ) is a keyword used in SAP ABAP programming.This tutorial


covers its introduction & syntax details.
WRITE - Output to a variable

Variants

1. WRITE f TO g[+off][(len)].
2. WRITE f TO itab[+off][(len)] INDEX idx.

Variant 1
WRITE f TO g[+off][(len)].

Addition

... option

Effect
Assigns the contents of the source field f to the target field g as a new value.

In contrast to MOVE , the format of the target field g is the same as when outputting to a list
with WRITE . The field type C is always used, regardless of the actual data type.

As with list output, the settings in the user's master record for decimal point (period or comma)
and date format are taken into account.

Other formatting options are also possible with list output.

Instead of specifying a static source field f , you can make a dynamic source field specification
(name) . In this case, the contents of the field name is interpreted as the source field name at
runtime and the contents are formatted accordingly.

You can identify the target field g more precisely by specifying the offset and/or length in the
form g+off(len) . Both the offset and the length specifications off and len can also be dynamic.

The return code value SY-SUBRC is undefined.

Example
WRITE ... TO with dynamic source field specification and dynamic offset and length
specification for the target field:

DATA: NAME(5) VALUE 'FIELD',


FIELD(5) VALUE 'Harry',
DEST(18) VALUE 'Robert James Smith',
OFF TYPE I,
LEN TYPE I.

OFF = 7.
LEN = 8.
WRITE (NAME) TO DEST+OFF(LEN).

The field DEST noew contains the value " Robert Harry ith ".

Notes
Only values between 0 and the length of the target field g are allowed as offset specifications.
Any other offset specifications result in a runtime error.
Only values >= 0 are allowed as length specifications. Negative length specifications result in a
runtime error. Excessive length specifications are automatically truncated.
If you specify the field length as the offset or the value 0 as the length, the target field is blank.
In this case, the statement has no effect.

Addition
... option

Effect
Modifies the output format with the aid of special formatting options .

Variant 2
WRITE f TO itab[+off][(len)] INDEX idx.

Additions like variant 1.

Effect
Like variant 1, except that output is to the idx -th line of the internal table itab .

Ayn offset and/or length specifications refer to the table line used for output.

The return code value is set as follows:

SY-SUBRC = 0 Valid index specification, i.e. the internal table itab contains a line with the
index idx .

SY_SUBRC = 4 Index specification is too large, i.e. the internal table itab contains fewer than
idx entries.

Note
Invalid index specifications, i.e. idx <= 0, result in a runtime error.
Note
Runtime errors

WRITE_TO_LENGTH_NEGATIVE : Negative length specification in len .

WRITE_TO_OFFSET_NEGATIVE : Negative offset specification in off .

WRITE_TO_OFFSET_TOOLARGE : Offset specification in off is greater than field length.

TABLE_INVALID_INDEX : Invalid index specification <= 0 in idx (variant 2 only).

Related 10 ABAP Syntax Tutorials


 MODULE (ABAP Keyword)
 CONSTANTS (ABAP Keyword)
 FORM (ABAP Keyword)
 FIELD-GROUPS (ABAP Keyword)
 ADD-CORRESPONDING (ABAP Keyword)
 FREE (ABAP keyword)
 DIVIDE-CORRESPONDING (ABAP Keyword)
 EXPORT (ABAP Keyword)
 PROVIDE (ABAP Keyword)
 SORT ( SAP ABAP Keyword)

Most readed SAP Tutorials

 WRITE - Output to a list ( SAP ABAP Keyword)


WRITE ( Output to a list ) is a keyword used in SAP ABAP programming.This tutorial
covers its introduction & syntax details.
 List of SAP HR TABLES and Infotypes tables
Detailed full list of tables and infotypes used in SAP HR module.
 List of SAP MM Transaction codes
This documentation covers the details of SAP MM Transaction codes
 SELECT-OPTIONS ( SAP ABAP Keyword)
SELECT-OPTIONS is a keyword used in SAP ABAP programming.This tutorial covers
its introduction & syntax details.
 FI Accounts Receivable and Accounts Payable | SAP FI PDF manual
The following topics are an introduction to the Accounts Receivable and Accounts
Payable application components.
 SAP MM Process Flow
The typical procurement cycle for a service or material consists of the following phases:
 SELECT clause ( SAP ABAP Keyword)
SELECT clause is a keyword used in SAP ABAP programming.This tutorial covers its
introduction & syntax details.
 WRITE ( Output formatting options ) is a keyword used in SAP ABAP
programming.This tutorial covers its introduction & syntax details.
 WRITE - Output formatting options

Options

... NO-ZERO
... NO-SIGN
... DD/MM/YY
... MM/DD/YY
... DD/MM/YYYY
... MM/DD/YYYY
... DDMMYY
... MMDDYY
... YYMMDD
... CURRENCY w
... DECIMALS d
... ROUND r
... UNIT u
... EXPONENT e

... USING EDIT MASK mask


... USING NO EDIT MASK

... UNDER g (only with WRITE )


... NO-GAP (only with WRITE )

... LEFT-JUSTIFIED
... CENTERED
... RIGHT-JUSTIFIED

Note
The formatting options UNDER g and NO-GAP are intended only output to lists and
therefore cannot be used with WRITE ... TO .

Option
... NO-ZERO

Effect
If the contents of f are equal to zero, only blanks are output; if f is of type C or N ,
leading zeros are replaced by blanks.

Option
... NO-SIGN
Effect
The leading sign is not output if f is of type I , P or F .

Option
... DD/MM/YY
Option
... MM/DD/YY

Effect
If f is a date field (type D ), the date is output with a 2-character year as specified in the
user's master record. Both of these formatting options have the same value.

Option
... DD/MM/YYYY
Option
... MM/DD/YYYY

Effect
If f is a date field (type D ), the date is output with a 4-character year as specified in the
user's master record. Both of these formatting options have the same value.

Option
... DDMMYY
Option
... MMDDYY

Effect
Date formatting like the additions ... DD/MM/YY and ... MM/DD/YY , but without
separators.

Option
... YYMMDD

Effect
If f is a date field (type D ), the date is output in the format YYMMDD (YY = year, MM
= month, DD = Day).

Option
... CURRENCY w

Effect
Correct format for currency specified in the field w .
Treats the contents of f as a currency amount. The currency specified in w determines
how many decimal places this amount should have.
The contents of w are used as a currency key for the table TCURX ; if there is no entry
for w , the system assumes that the currency amount has 2 decimal places.

Option
... DECIMALS d

Effect
d specifies the number of decimal places for a number field (type I , P or F ) in d . If this
value is smaller than the number of decimal places in the number, the number is rounded.
If the value is greater, the number is padded with zeros.
Since accuracy with floating point arithmetic is up to about 15 decimal places (see
ABAP/4 number types ), up to 17 digits are output with floating point numbers (type F ).
(In some circumstances, 17 digits are needed to differentiate between two neighboring
floating point numbers.) If the output length is not sufficient, as many decimal places as
possible are output. Negative DECIMALS specifications are treated as DECIMALS 0 .

Example
Effect of different DECIMALS specifications:

DATA: X TYPE P DECIMALS 3 VALUE '1.267',


Y TYPE F VALUE '125.456E2'.

WRITE: /X DECIMALS 0, "output: 1


/X DECIMALS 2, "output: 1.27
/X DECIMALS 5, "output: 1.26700
/Y DECIMALS 1, "output: 1.3E+04
/Y DECIMALS 5, "output: 1.25456E+04
/Y DECIMALS 20. "output: 1.25456000000000E+04

Option
... ROUND r

Effect
Scaled output of a field of type P .

The decimal point is first moved r places to the left ( r > 0) or to the right ( r < hour ="
'1.230'.">.
ASSIGN 'First Name' TO .

WRITE: /3 'Name'(001), 15 , 30 'RoomNo', 40 'Age'(002).


...
WRITE: / 'Peterson' UNDER 'Name'(001),
'Ron' UNDER ,
'5.1' UNDER 'RoomNo',
(5) 24 UNDER TEXT-002.

This produces the following output (numbers appear right-justified in their output
fields!):

Name First Name RoomNo Age


Peterson Ron 5.1 24

Option
... NO-GAP

Effect
Suppresses the blank after the field f . Fields output one after the other are then displayed
without gaps.

Example
Output several literals without gaps:

WRITE: 'A' NO-GAP, 'B' NO-GAP, 'C'. "Output: ABC

If NO-GAP was not specified here, the output would have been " A B C " because one
blank is always implicitly generated between consecutive output fields.

Option
... LEFT-JUSTIFIED
... CENTERED
... RIGHT-JUSTIFIED

Effect
Left-justified, centered or right-justified output.
For number fields (types I , P and F ), RIGHT-JUSTIFIED is the standard output format,
but LEFT-JUSTIFIED is used for all other types, as well as for templates.

Examples
Output to a list ( WRITE ):

DATA: FIELD(10) VALUE 'abcde'.

WRITE: / '|' NO-GAP, FIELD LEFT-JUSTIFIED NO-GAP, '|',


/ '|' NO-GAP, FIELD CENTERED NO-GAP, '|',
/ '|' NO-GAP, FIELD RIGHT-JUSTIFIED NO-GAP, '|'.
* Output: |abcde |
* | abcde |
* | abcde|

Formatting in a program field ( WRITE...TO... )

DATA: TARGET_FIELD1(10),
TARGET_FIELD2 LIKE TARGET-FIELD1,
TARGET_FIELD3 LIKE TARGET-FIELD1.

WRITE: '123' LEFT-JUSTIFIED TO TARGET-FIELD1,


'456' CENTERED TO TARGET-FIELD2,
'789' RIGHT-JUSTIFIED TO TARGET-FIELD3.

WRITE: / '|' NO-GAP, TARGET_FIELD1 NO-GAP, '|',


/ '|' NO-GAP, TARGET-FIELD2 NO-GAP, '|',
/ '|' NO-GAP, TARGET_FIELD3 NO-GAP, '|'.

* Output: |123 |
* | 456 |
* | 789|

Notes
Specifying several formatting options

You can use the additions of the first group ( NO-ZERO , NO-SIGN , DD/MM/YY etc.,
CURRENCY , DECIMALS , ROUND , EXPONENT ) simultaneously, provided it
makes sense. You can combine the additions UNDER and NO-GAP with all other
additions in any permutation; however, they are not taken into account until the field f
has been formatted according to all the other options.
Templates, conversion routines and alignment

If you want to format a field using a special conversion routine , all the other additions
(apart from UNDER and NO-GAP ) are ignored. This also applies if the conversion
routine is not explicitly specified, but comes from the ABAP/4 Dictionary .
If you want to format a field using a template , the system first takes into account the
options of the first group, and then places the result in the template. However, if you
specify one of the date-related formatting options ( DD/MM/YY etc.), the template is
ignored.
Finally, the formatted field or the template is copied to the target field according to the
requested alignment . For type C fields, it is the occupied length that is relevant, not the
defined length; this means that trailing blanks are not taken into account.
Combined usage of CURRENCY , DECIMALS and ROUND

The rounding factor (from the right) in

WRITE price CURRENCY c ROUND r DECIMALS d

results from the formula

rounding factor = c + r - d .

If DECIMALS is not specified, d = c applies.

You read this formula in the following manner:

The field price is supposed to be of ABAP/4 type P (or I ); it contains a currency amount.
The CURRENCY specification expresses how many decimal places price is to have and
may differ from the definition of price (the decimal point is not stored internally, but
comes from the type attributes of price ). Normally, price is output with as many decimal
places as the field has internally according to the type attributes or the CURRENCY
specification. You can override this number of output decimal places with DECIMALS .
The addition ROUND addition moves the decimal point r places to the left, if r is
positive, otherwise to the right. This means that a $ amount is output with ROUND 3 in
the unit 1000 $.

According to the above formula, there can also be a "negative" rounding factor; then, the
corresponding number of zeros is appended to the amount price on the right using the
"rounding factor". However, the value of "rounding factor" must be at least equal to -14.
Currency fields and DATA with DECIMALS

If the field price is normally formatted with decimal places (e.g. fields for currency
amounts), these are treated like a CURRENCY specification when rounding, if
CURRENCY was not expressly specified.
If present, the DECIMALS specification defines how many decimal places are to be
output after rounding.
If the DECIMALS and the (explicit or implicit) CURRENCY specifications are different,
rounding takes place according to the above formula, even if no ROUND specification
was made (i.e. r = 0).
If a field in the DATA statement was declared with DECIMALS n , WRITE treats it like
a currency field with n decimal places.

Examples
Sales in pfennigs or lira: 246260
Unit TDM or TLira with 1 decimal place.

DATA SALES TYPE P VALUE 246260.


WRITE SALES CURRENCY 'DEM' ROUND 3 DECIMALS 1. " 2,5 TDM
WRITE SALES CURRENCY 'ITL' ROUND 3 DECIMALS 1. " 246,3 TLira

Sales in pfennigs or lira: 99990


Unit TDM or TLira with 1 decimal place.

SALES = 99990.
WRITE SALES CURRENCY 'DEM' ROUND 3 DECIMALS 1. " 1,0 TDM
WRITE SALES CURRENCY 'ITL' ROUND 3 DECIMALS 1. " 100,0 TLira

Sales in pfennigs or lira: 93860


Unit 100 DM or 100 lira with 2 decimal places:

SALES = 93860.
WRITE SALES CURRENCY 'DEM' ROUND 2 DECIMALS 2. " 9,38 HDM
WRITE SALES CURRENCY 'ITL' ROUND 2 DECIMALS 2. " 938,60 HLira

Sales in pfennigs: 93840


Unit 1 DM without decimal places.

SALES = 93860
WRITE SALES CURRENCY 'DEM' DECIMALS 0. " 938 DM

Sales in pfennigs: 93860


Unit 1 DM without decimal places.

SALES = 93860.
WRITE SALES CURRENCY 'DEM' DECIMALS 0. " 939 DM

Note
Runtime errors

WRITE_CURRENCY_ILLEGAL_TYPE : CURRENCY parameter with WRITE is not


type C
WRITE_ROUND_TOO_SMALL : Rounding parameter is less than -14
WRITE_UNIT-ILLEGAL_TYPE : UNIT parameter with WRITE is not type C
 WRITE ( Output as line )is a keyword used in SAP ABAP programming.This
tutorial covers its introduction & syntax details.
 WRITE - Output as line

Effect
On list output, automatically links certain characters together to form continuous lines or
boxes, if there is no space between them:

vertical lines, output with the system field SY-VLINE or using a field with the contents "
| " (vertical line)
horizontal lines, output with the system field SY-ULINE or using a field with at least 2
consecutive minus signs " -- ".

Exactly how each line segment is output (e.g. whether as straight line, corner, T-piece or
cross) depends on the adjoining characters.
A good rule of thumb sipulates that if the cell adjacent to a line character also contains a
line character, the missing piece required to form a connection is added. If an adjacent
cell does not also contain a line character, the line character is truncated on that side. Line
characters standing on their own remain unchanged.
This technique is sufficient to cope with most cases (e.g. tables, boxes, simple
hierarchies). However, no matter how carefully you use some empty characters and lines,
it is not possible to stop adjacent line characters being joined in an inappropriate way
(e.g. very compact hierarchy diagrams, or densely boxes). The solution here is to output
the required line segment explicitly using the addition ... AS LINE .
The include (or the more comprehensive include ) contains the relevant identifiers for
lines as constants, e.g. LINE_TOP_LEFT_CORNER ,
LINE_BOTTOM_MIDDLE_CORNER .

Note
Lines cannot have any other display attributes. If attributes such as color ( COLOR ),
reverse video ( INVERSE ) or intensified ( INTENSIFIED ) are set, these are ignored on
output. If the ready for input attribute ( INPUT ) is set, the actual characters (minus sign,
vertical line) are displayed.

Example
Output two nested corner segments:

INCLUDE .

ULINE /1(50).
WRITE: / SY-VLINE NO-GAP, LINE_TOP_LEFT_CORNER AS LINE.
ULINE 3(48).
WRITE: / SY-VLINE NO-GAP, SY-VLINE NO-GAP.
 Browse: Home / ABAP / ABAP Syntax / WRITE - Output as icon ( SAP ABAP Keyword)
 WRITE - Output as icon ( SAP ABAP Keyword)
 WRITE ( Output as icon ) is a keyword used in SAP ABAP programming.This tutorial covers its
introduction & syntax details.

 WRITE - Output as icon

Effect
You can output certain characters as icons using the addition ...AS ICON . You should
only address these characters with their system-defined names. The include (or the more
comprehensive include ) contains the relevant identifiers as constants, e.g. ICON_OKAY
(see List of icons ).

Example

INCLUDE .
WRITE: / ICON_OKAY AS ICON, "output as icon
'Text line'.

Note
Although an output length of 2 characters is enough for most icons, some (e.g. the traffic
light icons ICON_RED_LIGHT , ...) have a greater output length.
You can determine the length of an icon with DESCRIBE FIELD ICON_... output length
... .
You cannot print out all list icons. The printable icons are flagged as such in the 'list of
icons' mentioned above.
 Browse: Home / ABAP / ABAP Syntax / WRITE - Output as symbol (ABAP keyword)

 WRITE - Output as symbol (ABAP keyword)


 WRITE ( - Output as symbol )is a keyword used in SAP ABAP programming.This tutorial covers its
introduction & syntax details.

 WRITE - Output as symbol

Effect
You can output certain characters as symbols using the addition ... AS SYMBOL . You
should only address these characters with their system-defined names. The include (or the
more comprehensive include ) contains the relevant identifiers as constants, e.g.
SYM_PHONE , SYM_CIRCLE .
Example

INCLUDE .
WRITE: / SYM_RIGHT_HAND AS SYMBOL, " output as symbol
'Tip, Note',
SYM_LEFT_HAND AS SYMBOL. " output as symbol

Note
An output length of one character is enough for most symbols, but some (e.g. SYM_FAX
) are twice as long.
You can determine the length of a symbol with DESCRIBE FIELD SYM_... OUTPUT-
LENGTH ...
 Browse: Home / ABAP / ABAP Syntax / WRITE - Output as checkbox (ABAP keyword)

 WRITE - Output as checkbox (ABAP keyword)


 WRITE is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax
details.

 WRITE - Output as checkbox

Effect
Outputs the field f as a checkbox. The contents of the first character of f is interpreted as
the "status":

' ' = not selected


'X' = selected

The user can change this as required.

Note
To prevent the user changing the contents of the checkbox, you can use the addition ...
INPUT OFF . The checkbox is then nothing more than a status display and can only be
changed by programming.
In technical terms, a checkbox behaves exactly like an input field with a length of 1
(FORMAT INPUT ).

Examples

DATA: MARKFIELD(1) TYPE C VALUE 'X'.


...
WRITE MARKFIELD AS CHECKBOX. "checkbox selected
MARKFIELD = SPACE.
WRITE MARKFIELD AS CHECKBOX. "deselected
WRITE MARKFIELD AS CHECKBOX INPUT OFF. "deselected, protected

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy