Académique Documents
Professionnel Documents
Culture Documents
*"--------------------------------------------------------------------*
* internal table to hold flight schedule data *
*"--------------------------------------------------------------------*
data :
t_spfli type standard table
of type_s_spfli
initial size 0.
*"--------------------------------------------------------------------*
* work area to hold flight schedule data *
*"--------------------------------------------------------------------*
data
wa_spfli type type_s_spfli.
*"--------------------------------------------------------------------*
* top-of-page event *
*"--------------------------------------------------------------------*
top-of-page.
perform list_headings.
*"--------------------------------------------------------------------*
* top-of-page during line-selection event *
*"--------------------------------------------------------------------*
top-of-page during line-selection.
perform headings.
*"--------------------------------------------------------------------*
* start-of-selection event *
*"--------------------------------------------------------------------*
start-of-selection.
perform retrieve_spfli.
*"--------------------------------------------------------------------*
* end-of-selection event *
*"--------------------------------------------------------------------*
end-of-selection.
*"--------------------------------------------------------------------*
* at user-command event *
*"--------------------------------------------------------------------*
at user-command.
if sy-lsind lt 2.
case sy-ucomm.
when 'sflight'.
perform display_sflight.
when 'selectall'.
perform display_all.
when 'deselecta'.
perform deselect_all.
endcase. " case sy-ucomm.
endif. " if sy-lsind lt 2.
*&---------------------------------------------------------------------*
*& form retrieve_spfli
*&---------------------------------------------------------------------*
* this subroutine retrieves the flight schedule data from spfli *
*----------------------------------------------------------------------*
* there are no interface parameters to be passed to this subroutine. *
*----------------------------------------------------------------------*
form retrieve_spfli .
*&---------------------------------------------------------------------*
*& form display_sflight
*&---------------------------------------------------------------------*
* this subroutine displays the flight details for user selected *
* records.
*----------------------------------------------------------------------*
* there are no interface parameters to be passed to this subroutine. *
*----------------------------------------------------------------------*
form display_sflight.
do lw_lines times.
read line lw_linno field value :
w_box into w_box,
wa_spfli-carrid into lwa_spfli-carrid,
wa_spfli-connid into lwa_spfli-connid,
wa_spfli-check into wa_spfli-check.
elseif lw_count eq 0.
message 'select at least one record'(003) type 'e'.
else.
select carrid " airline carrid.
connid " connection id
fldate " fight date.
seatsmax " maximum no.of seats
seatsocc " occupied no.of seats
into table lt_sflight
from sflight
for all entries in lt_spfli
where carrid eq lt_spfli-carrid
and connid eq lt_spfli-connid.
if sy-subrc eq 0.
set pf-status space.
loop at lt_sflight into lwa_sflight.
write :
/ lwa_sflight-carrid,
10 lwa_sflight-connid,
25 lwa_sflight-fldate,
45 lwa_sflight-seatsmax,
57 lwa_sflight-seatsocc.
endloop.
else.
message 'no data found'(004) type 'e'.
endif. " if sy-subrc eq 0.
clear lwa_sflight.
endif. " if lw_count=0 and w_index>= 27.
do lw_lines times.
if wa_spfli-check ne '*'.
w_box = 'x'.
modify line lw_linno field value w_box .
endif. " if wa_spfli-check ne '*'.
add 1 to lw_linno.
clear wa_spfli-check.
enddo. " do lw_lines times.
data:
lw_lines type i, " holds no.of lines in t_spfli
lw_linno type i value 5,
lw_count type i.
do lw_lines times.
read line lw_linno field value
wa_spfli-check into wa_spfli-check.
if wa_spfli-check ne '*'.
w_box = ' '.
modify line lw_linno field value w_box .
add 1 to lw_count .
endif. " if wa_spfli-check ne '*'.
add 1 to lw_linno.
clear wa_spfli-check.
enddo. " do lw_lines times.