*&---------------------------------------------------------------------*
*& Report  ZERN_PRGO2                                                  *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  zern_prgo2 NO STANDARD PAGE HEADING .
TABLES:scarr,sflight.
DATA :gt_spfli   LIKE spfli OCCURS 0 WITH HEADER LINE,
      gt_scarr   LIKE scarr OCCURS 0 WITH HEADER LINE,
      gt_sflight LIKE sflight OCCURS 0 WITH HEADER LINE.

DATA: bos TYPE i,
      v(1) TYPE c VALUE '|'.
*PARAMETERS: P_CARRID LIKE SCARR-CARRID.




SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
SELECT-OPTIONS: s_carrid FOR scarr-carrid,
                s_fldate FOR sflight-fldate,
                s_bk FOR bos.
SELECTION-SCREEN END OF BLOCK b1.

INITIALIZATION.

TOP-OF-PAGE.
  PERFORM top_of_page_0.


START-OF-SELECTION.
  PERFORM get_data.


AT LINE-SELECTION.

  IF sy-lsind EQ 1.
    PERFORM write.
  ELSEIF sy-lsind EQ 2.
    PERFORM write2.
  ENDIF.

TOP-OF-PAGE DURING LINE-SELECTION.

  IF sy-lsind EQ 1.
    PERFORM top_of_page_1.
  ELSEIF sy-lsind EQ 2.
    PERFORM top_of_page_2.
  ENDIF.
*&---------------------------------------------------------------------*
*&      Form  get_data
*&---------------------------------------------------------------------*

FORM get_data.


  SELECT * FROM scarr INTO TABLE gt_scarr." WHERE CARRID EQ P_CARRID.

  LOOP AT gt_scarr.
    WRITE:/ v, 3(6) gt_scarr-carrid   HOTSPOT ON CENTERED  COLOR 4,v,
                    gt_scarr-carrname HOTSPOT ON CENTERED  COLOR 5,v.
    HIDE: gt_scarr-carrid.
    ULINE /1(33).
  ENDLOOP.
  CLEAR gt_scarr.
ENDFORM.                    "GET_DATA




*---------------------------------------------------------------------*
*       FORM WRITE                                                    *
*---------------------------------------------------------------------*

FORM write.
  SELECT * FROM spfli INTO TABLE gt_spfli WHERE
                    carrid = gt_scarr-carrid.

  CLEAR  :gt_scarr.
  LOOP AT gt_spfli.
    WRITE : / v, 3(6) gt_spfli-carrid   HOTSPOT ON CENTERED  COLOR 2,v,
                (6)   gt_spfli-connid   HOTSPOT ON CENTERED  COLOR 3,v,
                (8)   gt_spfli-airpfrom            CENTERED  COLOR 1,v,
                (6)   gt_spfli-airpto              CENTERED  COLOR 4,v.
    HIDE: gt_spfli-carrid , gt_spfli-connid.
    ULINE /1(39).
  ENDLOOP.

ENDFORM.                    " write
*&---------------------------------------------------------------------*
*&      Form  WRITE2
*&---------------------------------------------------------------------*

FORM write2 .
  DATA : lv_bkoltuk TYPE i.
  SELECT * FROM sflight INTO TABLE gt_sflight WHERE
                    carrid = gt_spfli-carrid AND
                    connid = gt_spfli-connid.

  LOOP AT gt_sflight.
    lv_bkoltuk = gt_sflight-seatsmax - gt_sflight-seatsocc.

    WRITE : / v, 3(6) gt_sflight-carrid     CENTERED  COLOR 1,v,
                  (6) gt_sflight-connid     CENTERED  COLOR 4,v,
                  (10) gt_sflight-fldate    DD/MM/YYYY  COLOR 6,v,
                  (7) gt_sflight-planetype  CENTERED  COLOR 7,v,
                  (8) gt_sflight-seatsmax   CENTERED  COLOR 5,v,
                  (9) gt_sflight-seatsocc   CENTERED  COLOR 2,v,
                  (10)lv_bkoltuk            CENTERED  COLOR 3,v.

    ULINE /1(78).
  ENDLOOP.
  CLEAR : gt_spfli.
ENDFORM.                                                    " WRITE2
*&---------------------------------------------------------------------*
*&      Form  tOP_of_page_0
*&---------------------------------------------------------------------*

FORM top_of_page_0 .
  ULINE /1(33).
  WRITE : / v,'CARRID'    COLOR 4 INTENSIFIED OFF,v,
         (20) 'CARRNAME'  COLOR 5 INTENSIFIED OFF,v.
  ULINE /1(33).
ENDFORM.                    " tOP_of_page_0
*&---------------------------------------------------------------------*
*&      Form  tOP_of_page_1
*&---------------------------------------------------------------------*

FORM top_of_page_1 .
  ULINE /1(39).

  WRITE : / v,'CARRID'    COLOR 2   INTENSIFIED OFF ,v,
              'CONNID'    COLOR 3   INTENSIFIED OFF,v,
              'AIRPFROM'  COLOR 1   INTENSIFIED OFF,v,
              'AIRPTO'    COLOR 4   INTENSIFIED OFF,v.

  ULINE /1(39).
ENDFORM.                    " tOP_of_page_1
*&---------------------------------------------------------------------*
*&      Form  tOP_of_page_2
*&---------------------------------------------------------------------*

FORM top_of_page_2 .
  ULINE /1(78).

  WRITE : / v,'CARRID'     COLOR 1   INTENSIFIED OFF,v,
              'CONNID'     COLOR 4   INTENSIFIED OFF,v,
          (10) 'F. DATE'    COLOR 6   INTENSIFIED OFF,v,
              'Plan T.'    COLOR 7   INTENSIFIED OFF,v,
              'SEAT MAX'   COLOR 5   INTENSIFIED OFF,v,
              'SEAT OCCU'  COLOR 2   INTENSIFIED OFF,v,
         (10) 'SEAT FREE'  COLOR 3,v.
  ULINE /1(78).
ENDFORM.                    " tOP_of_page_2


Serkan AKKAVAK
Bilgisayar Mühendisi
serkurumsal@yandex.com
SAP ve ABAP ile ilgili tüm sorularınızı gönderebilirsiniz.