SAP Certification
SAP Download
SAP Companies India
SAP Books
SAP JOBS
SAP jobs in India
SAP ABAP jobs in India
SAP BASIS jobs in India
SAP BI jobs in India
SAP CRM jobs in India
SAP FICO jobs in India
SAP Fresher jobs in India
SAP HR jobs in India
SAP MM jobs in India
SAP PM jobs in India
SAP PP jobs in India
SAP SD jobs in India
SAP XI jobs in India
|
WRITE ( Output to a list ) is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax details.
Show Full Details
WRITE - Output to a list
Basic formWRITE 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).
Show Most Readed SAP Tutorials
Most readed SAP Tutorials
Show Latest Added SAP Tutorials
Latest Added SAP documents
|
"Site covers most of the SAP technical and functional tutorials, articles, interview questions and PDF study materials . List and details of SAP transaction codes ( tcodes ), Tables, report names, Bapi, ABAP programming syntax and keywords are also available in the site.
Information on SAP Certification and training, latest SAP jobs in India, ABAP interview questions are useful for SAP professionals seeking for a career in SAP as a fresher or experienced.ABAP tutorial downloads on BDC, LSMW, BAPI, ALE, IDOC, Smartforms, Sapscripts etc etc are also added.Now you can read from this page about WRITE - Output to a list ( SAP ABAP Keyword)" |