Advertisement
Kenzuke

Durchschnitt Plätze

Jan 26th, 2020
765
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 0.57 KB | None | 0 0
  1. DATA:
  2. sc type scarr,
  3. sf type sflight,
  4. sp type spfli,
  5. anz type i,
  6. summe_plaetze type i,
  7. avg(4) type p DECIMALS 2.
  8.  
  9. select * from scarr into sc.
  10.   select * from spfli into sp
  11.     where CARRID = sc-CARRID.
  12.   write : / sc-carrid,sc-CARRNAME,sp-CONNID,sp-cityfrom,sp-cityto.
  13. select * from sflight into sf
  14.   where CONNID = sp-CONNID.
  15.   write : / sf-FLDATE,sf-price,sf-currency,sf-seatsocc.
  16.   anz = anz + 1.
  17.   summe_plaetze = summe_plaetze + sf-seatsocc.
  18.   ENDSELECT.
  19.  
  20.     write : / anz.
  21.     avg = summe_plaetze / anz.
  22.     write : / avg.
  23.   ENDSELECT.
  24.   ENDSELECT.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement