0% found this document useful (0 votes)
46 views

'Employee No' 'Employee Name' 'Company Code'

This document contains ABAP code that extracts employee data from different tables and displays it in interactive reports. It defines data types and internal tables to store employee numbers, names, company codes. It selects data from tables PA0001 and PA0002, and displays it with line selection options to show additional details or add checkboxes. User commands allow selecting or deselecting all rows, or downloading the data to a text file.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

'Employee No' 'Employee Name' 'Company Code'

This document contains ABAP code that extracts employee data from different tables and displays it in interactive reports. It defines data types and internal tables to store employee numbers, names, company codes. It selects data from tables PA0001 and PA0002, and displays it with line selection options to show additional details or add checkboxes. User commands allow selecting or deselecting all rows, or downloading the data to a text file.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

*&---------------------------------------------------------------------*

*& Report ZPROG_PRACTICE


*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZPROG_PRACTICE.
types : begin of ty_itab,
pernr type persno,
ename type ename,
bukrs type bukrs,
end of ty_itab.
data : itab type table of ty_itab,
wa type ty_itab.

types : begin
pernr
nachn
vorna

of ty_itab1,
type persno,
type nachn,
type vorna,

end of ty_itab1.

data : itab1 type table of ty_itab1,


wa1 type ty_itab1.
data : v_box type c.

write :/'employee no',20 'employee name',35 'company code'.

select pernr ename bukrs from pa0001 into table itab up to 30 rows .
loop at itab into wa.
write :/ wa-pernr,20 wa-ename,35 wa-bukrs.
endloop.

at line-selection.
case sy-lsind.
when

1.

select pernr nachn vorna from pa0002 into table itab1 up to 30 rows.
write :/'employee no',20 'first name',35 'last name'.
loop at itab1 into wa1.
write :/ wa1-pernr,20 wa1-nachn, 35 wa1-vorna.

endloop.

when 2.

set pf-status 'ZSTATUS'.

write :/'employee no',20 'first name',35 'last name'.


loop at itab1 into wa1.
write :/ v_box as checkbox, wa1-pernr,20 wa1-nachn,35 wa1-vorna.
endloop.

endcase.
at user-command.
case sy-ucomm.
when 'SALL'.
v_box = 'X'.

loop at itab1 into wa1.


write :/ v_box as checkbox, wa1-pernr,20 wa1-nachn,35 wa1-vorna.
endloop.
when 'DALL'.
v_box = space.
loop at itab1 into wa1.
write :/ v_box as checkbox, wa1-pernr,20 wa1-nachn,35 wa1-vorna.
endloop.
when 'DOWNLOAD'.

v_box = 'X'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'E:download.txt'
TABLES
DATA_TAB = itab1.

IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
endcase.

You might also like