*&---------------------------------------------------------------------*
*& 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:[Link]'
TABLES
DATA_TAB = itab1.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
endcase.