Simple Classical Report
Go to TCode: SE38 and provide the program name say ‘ZREPORT1’.
Then click on Create button.
Maintain below Code:
*&---------------------------------------------------------------------*
*& Report ZREPORT1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZREPORT1
line-size 80
line-count 30(5)
no standard page heading.
tables: mara.
data: begin of fs occurs 0,
matnr type mara-matnr,
mbrsh type mara-mbrsh,
meins type mara-meins,
mtart type mara-mtart,
end of fs.
select-options: material for mara-matnr.
initialization.
material-low = '1'.
material-high = '1000'.
append material.
At selection-screen.
if material-low = ' '.
message I100(zkmessage).
elseif material-high = ' '.
message I100(Zkmessage).
endif.
start-of-selection.
select mara~matnr mara~mbrsh mara~meins mara~mtart into table fs[] from mara where matnr in material.
loop at fs[] into fs.
write:/ fs-matnr under 'Material',
fs-mbrsh under 'Industry',
fs-meins under 'Units',
fs-mtart under 'Material Type'.
endloop.
end-of-selection.
write:/25 'Classical report created by SAPFIRST' color 7.
uline.
skip.
top-of-page.
write:/ 'Classical report containing the general material data from the table mara' color 6.
uline.
write:/ 'Material' color 1,
'Industry' color 2,
'Units' color 3,
'Material Type' color 4.
uline.
end-of-page.
skip.
write:/ 'Page Number', Sy-pagno,
'Date',sy-datum.
Ctrl + S - To save the program.
Ctrl + F2 - To check syntax errors.
Ctrl + F3 – To Activate the program.
Note :
SY-PAGNO - System Field to display the Page Number.
SY-DATUM - System Field to Display the System date.
Press the F8 to execute the program.
Again Press F8 to display the data.
Output :