2011年5月18日星期三

Tut7

&---------------------------------------------------------------------*
*& Report  ZBMC_7_2
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZBMC_7_2.
tables: sbook, scustom.

constants: eol type i value 90.

parameters: airline like sbook-carrid.

top-
of-page.
format color col_heading.
write'List of Flight Bookings'84 'Page ' no-gap, (2) sy-pagno.
uline.
write: / 'Booking        Customer    Carrier   Connection       Flight',
          
at eol space.
write: / 'Id             Id          Id        Id               Date',
         
at eol space.
uline.
skip 1.

start-
of-selection.
select * from sbook
   
where carrid = airline
   
order by customid.
   
write: /  sbook-bookid  color col_total,
         
16(8) sbook-customid color COL_TOTAL,
         
28 sbook-carrid,
         
38 sbook-connid,
         
55 sbook-fldate.
   
hide: sbook-customid.
endselect.

end-of-selection.
  
clear sbook-customid.

at line-selection.
  
check not sbook-customid is initial.
  
select single * from scustom
                  
where id = sbook-customid.
  
skip 5.
  
write:  'Customer Id:'25(8) scustom-id color COL_TOTAL.
  
skip 2.
  
write:  'Customer Name:'25 scustom-name color col_total.
  
skip 2.
  
write:  'Customer City:'25 scustom-city color col_total.

  
clear sbook-customid.

top-
of-page during line-selection.
  
format color col_heading.
  
write'Cusromer Details'84 'Page ' no-gap, (2) sy-pagno.
  
uline.


 


 

*&---------------------------------------------------------------------*
*& Report  ZBMC_7_1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZBMC_7_1 NO STANDARD PAGE HEADING.

tables: spfli.
constants: eol type i value 90.

top-
of-page.
format color col_heading.
write'List of Flight Connections'84 'Page ' no-gap, (2) sy-pagno.
uline.
write: / 'Carrier        Connection       City                  City',
          
at eol space.
write: / 'Id             Id               From                  To',
         
at eol space.
uline.
skip 1.

start-
of-selection.
select * from spfli.
   
write: /  spfli-carrid color col_total,
         
16 spfli-connid color COL_TOTAL,
         
33 spfli-cityfrom,
         
55 spfli-cityto.
   
hide: spfli-carrid, spfli-connid.
endselect.

end-of-selection.
  
clear spfli-carrid.

at line-selection.
  
check not spfli-carrid is initial.
  
skip 10.
  
write'The Airline you have chosen is: '40 spfli-carrid color 4.
  
skip 2.
  
write'The Flight Connection is: '40 spfli-connid color 4.
  
clear spfli-carrid.


 


 

*---------------------------------------------------------------------*
*& Report  ZBMC_7_3
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZBMC_7_3.
tables: sbook, scustom.

parameters: airline like sbook-carrid.
constants: col1 type i value 10,
           col2 
type i value 77.
data:      lin1 type i,
           lin2 
type i.

start-
of-selection.
select * from sbook
    
where carrid = airline
    
order by customid.

  
write: / sbook-bookid, sbook-customid, sbook-carrid, sbook-connid,
           sbook-fldate.
  
hide:    sbook-carrid, sbook-connid, sbook-fldate, sbook-customid.
endselect.

*end-of-selection.
  
If sy-subrc <> 0.
       
write :/ 'No Records Found'.
       
Exit.
  
Endif.

  
clear sbook-customid.

at line-selection.
  
check not SBOOK-CUSTOMID is initial.
  
set titlebar 'WIN' with sbook-carrid sbook-connid sbook-fldate.
  
format color col_normal.
  
if sy-curow < 14.
     lin1 = 
15.
     lin2 = 
18.
  
else.
     lin1 = 
04.
     lin2 = 
8.
  
endif.
  
window starting at col1 lin1
         ending   
at col2 lin2.
  
select single * from scustom
         
where id eq sbook-customid.
   
write: / 'Customer Information'.
   
uline.
   
write: / 'Cust Id:'15 scustom-id,
          / 
'Cust Name:', scustom-name under scustom-id,
          / 
'Cust City:', scustom-city under scustom-name.
   
uline.
   
clear SBOOK-CUSTOMID.


 


 

*&---------------------------------------------------------------------*
*& Report  ZBMC_7_4
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZBMC_7_4.
tables: sflight, sbook.

data: itabbk like sbook occurs 0
      
with header line.

Start-
of-selection.

Select * from sflight.

  
write: / sflight-carrid, sflight-connid, sflight-fldate.
  
hide:    sflight-carrid, sflight-connid, sflight-fldate.

Endselect.

end-of-selection.
  
If sy-subrc <> 0.
    
Write: / 'No record Found'.
    
Exit.
  
Endif.

  
clear sflight-carrid.
  
set pf-status 'BASE'.
  
set titlebar 'BAS'.

at user-command.
   
case sy-ucomm.
     
when 'BOOK'.
     
perform display1.
     
when 'SRT1'.
     sy-lsind = 
1.
     
sort itabbk by order_date.
     
perform display2.
     
when 'SRT2'.
     sy-lsind = 
1.
     
sort itabbk by loccuram.
     
PERFORM display2.

endcase.


form display1.
 
check not sflight-carrid is initial.
 
set pf-status 'SORT'.
 
set titlebar 'BKS'.
 
select * from sbook into table itabbk
          
where carrid = sflight-carrid
          
and   connid = sflight-connid
          
and   fldate = sflight-fldate.
    
  
if sy-subrc ne 0.
      
skip 5.
      
write'No bookings found'.
   
Else.
      
Perform display2.
   
endif.
   
clear sflight-carrid.
 
endform.


form display2.
  
loop at itabbk.
    
write: /    itabbk-carrid,
             
16 itabbk-connid,
             
25 itabbk-fldate,
             
37 itabbk-bookid,
             
46 itabbk-order_date,
             
57(8) itabbk-loccuram.
   
endloop.
endform.

没有评论: