hxxxrz

Untitled

Oct 20th, 2020
774
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. *&---------------------------------------------------------------------*
  2. *& Report ZTM_BC_400_11_SUBROUTINE
  3. *&---------------------------------------------------------------------*
  4. *&
  5. *&---------------------------------------------------------------------*
  6. REPORT ZTM_BC_400_11_SUBROUTINE.
  7.  
  8. TYPES: BEGIN OF ty_flight,
  9.          carrid     TYPE s_carr_id,
  10.          connid     TYPE s_conn_id,
  11.          fldate     TYPE s_date,
  12.          seatsmax   TYPE s_seatsmax,
  13.          seatsocc   TYPE s_seatsocc,
  14.          percentage TYPE p DECIMALS 0,
  15.        END OF ty_flight.
  16.  
  17. DATA: lt_flight TYPE STANDARD TABLE OF ty_flight,
  18.       lv_workarea LIKE LINE OF lt_flight.
  19.  
  20. PARAMETERS p_carrid TYPE s_carr_id.
  21.  
  22. SELECT * FROM sflight
  23.   INTO CORRESPONDING FIELDS OF lv_workarea
  24.   WHERE carrid = p_carrid.
  25.  
  26.   lv_workarea-percentage = lv_workarea-seatsocc / lv_workarea-seatsmax * 100.
  27.  
  28.   INSERT lv_workarea INTO TABLE lt_flight.
  29.  
  30. ENDSELECT.
  31.  
  32. IF sy-subrc = 0.
  33.  
  34.   SORT lt_flight BY percentage.
  35.   PERFORM write_list USING lt_flight.
  36.  
  37. ELSE.
  38.  
  39.   WRITE: 'Не найден аэропорт', p_carrid.
  40.  
  41. ENDIF.
  42.  
  43. FORM write_list USING iv_flight TYPE STANDARD TABLE OF ty_flight.
  44.   DATA lv_workarea LIKE LINE OF iv_flight.
  45.   LOOP AT iv_flight INTO lv_workarea.
  46.     WRITE: / lv_workarea-carrid,
  47.              lv_workarea-connid,
  48.              lv_workarea-fldate,
  49.              lv_workarea-seatsmax,
  50.              lv_workarea-seatsocc,
  51.              lv_workarea-percentage, '%'.
  52.   ENDLOOP.
  53. ENDFORM.
RAW Paste Data