The write command used to be the bread and butter of SAP report writing
where a user wanted to view the data on screen. This is not used as much
for report writing as easier more advanced techniques are available
such as the advance list viewer (ALV). This does not mean this is no
longer used but its use is more for batch programs so that message
appear in the output log, reports that only need a simple message output
and other output uses where a report consisting of columns of data is
not appropriate.
Below is an ABAP code extract that demonstrates and explains the basic functionally of the write command.
write:/10(45) 'Total No of Employees entered:', gd_records, "/10 indents 10 chars
/10(45) 'Number of Employees processed successfully:', "(45) sets field lenth
gd_success. "displays variable
NEW-LINE. "moves to a new line
describe table it_error lines gd_lines. "gets number of records in a table
check gd_lines gt 0. "check there are some error records
skip 2. "skips 2 lines
write:/10 'Unsuccessful Employee records'. "(10) makes field take up 10 chars
write:/10 sy-uline(67). "sy-uline(67) display a line 67 chars long
write:/10 sy-vline, "sy-vline creates a vertical line
(10) 'Employee' COLOR COL_HEADING, sy-vline, "COLOR changes background colour
(50) 'Description' COLOR COL_HEADING, sy-vline.
write:/10 sy-uline(67). "display a line 67 chars long
loop at it_error into wa_error. "loops at err table
write:/10 sy-vline, "sy-vline creates a vertical line
(10) wa_error-pernr, sy-vline, "(10) makes field take up 10 chars
(50) wa_error-text, sy-vline.
endloop.
write:/10 sy-uline(67). "display a line 67 chars long
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant
Contact : serkurumsal@yandex.com
Social Plugin