Interactive ALV

 * INTERACTIVE ALV-REUSE_ALV_GRID_DISPLAY* 

type-pools : slis.

types : begin of ty_flight,

        carrid type sflight-carrid,

        connid type sflight-connid,

        fldate type sflight-fldate,

        price type sflight-price,

        seatsmax type sflight-seatsmax,

        seatsocc type sflight-seatsocc,

       end of ty_flight.

types : begin of ty_spfli,

        carrid type spfli-carrid,

        connid type spfli-connid,

        countryfr type spfli-countryfr,

        countryto type spfli-countryto,

        airpfrom type spfli-airpfrom,

        airpto type spfli-airpto,

        cityfrom type spfli-cityfrom,

        cityto type spfli-cityto,

       end of ty_spfli.

data : it_flight type table of ty_flight,

          wa_flight type ty_flight.

data : it_spfli type table of ty_spfli,

          wa_spfli type ty_spfli.

data : it_fieldcat type slis_t_fieldcat_alv,

          wa_fieldcat type slis_fieldcat_alv.

data : it_fieldcat1 type slis_t_fieldcat_alv,

           wa_fieldcat1 type slis_fieldcat_alv.

data : wa_layout type slis_layout_alv.

data : wa_layout1 type slis_layout_alv.

data : it_header type slis_t_listheader,

          wa_header type slis_listheader.

data : it_header1 type slis_t_listheader,

           wa_header1 type slis_listheader.

select-options : s_carrid for wa_flight-carrid.

start-of-selection.

 select * from sflight into corresponding fields of table it_flight where carrid in s_carrid.

  wa_fieldcat-row_pos = 1.

  wa_fieldcat-col_pos = 1.

  wa_fieldcat-fieldname = ‘CARRID’.

  wa_fieldcat-tabname = ‘IT_FLIGHT’.

  wa_fieldcat-ref_tabname = ‘SFLIGHT’.

  wa_fieldcat-key = ‘X’.

  wa_fieldcat-seltext_s = ‘FLIGHT CODE’.

  append wa_fieldcat to it_fieldcat.

  clear wa_fieldcat.

  wa_fieldcat-row_pos = 1.

  wa_fieldcat-col_pos = 2.

  wa_fieldcat-fieldname = ‘CONNID’.

  wa_fieldcat-tabname = ‘IT_FLIGHT’.

  wa_fieldcat-ref_tabname = ‘SFLIGHT’.

  wa_fieldcat-key = ‘X’.

  append wa_fieldcat to it_fieldcat.

  clear wa_fieldcat.

  wa_fieldcat-row_pos = 1.

  wa_fieldcat-col_pos = 3.

  wa_fieldcat-fieldname = ‘FLDATE’.

  wa_fieldcat-tabname = ‘IT_FLIGHT’.

  wa_fieldcat-ref_tabname = ‘SFLIGHT’.

  wa_fieldcat-key = ‘X’.

  append wa_fieldcat to it_fieldcat.

  clear wa_fieldcat.

  wa_fieldcat-row_pos = 1.

  wa_fieldcat-col_pos = 4.

  wa_fieldcat-fieldname = ‘PRICE’.

  wa_fieldcat-tabname = ‘IT_FLIGHT’.

  wa_fieldcat-ref_tabname = ‘SFLIGHT’.

  wa_fieldcat-emphasize = ‘C515’.

  append wa_fieldcat to it_fieldcat.

  clear wa_fieldcat.

  wa_fieldcat-row_pos = 1.

  wa_fieldcat-col_pos = 5.

  wa_fieldcat-fieldname = ‘SEATSMAX’.

  wa_fieldcat-tabname = ‘IT_FLIGHT’.

  wa_fieldcat-ref_tabname = ‘SFLIGHT’.

  wa_fieldcat-emphasize = ‘C615’.

  append wa_fieldcat to it_fieldcat.

  clear wa_fieldcat.

  wa_fieldcat-row_pos = 1.

  wa_fieldcat-col_pos = 6.

  wa_fieldcat-fieldname = ‘SEATSOCC’.

  wa_fieldcat-tabname = ‘IT_FLIGHT’.

  wa_fieldcat-ref_tabname = ‘SFLIGHT’.

  wa_fieldcat-emphasize = ‘C300’.

* wa_fieldcat-no_out = ‘X’.

  append wa_fieldcat to it_fieldcat.

  clear wa_fieldcat.

 WA_LAYOUT-NO_COLHEAD = ‘X’.

 WA_LAYOUT-NO_VLINE = ‘X’.

 WA_LAYOUT-NO_HLINE = ‘X’.

 WA_LAYOUT-EDIT = ‘X’.

 WA_LAYOUT-zebra = ‘X’.

  wa_layout-colwidth_optimize = ‘X’.


call function ‘REUSE_ALV_GRID_DISPLAY’

   exporting

     i_callback_program          = sy-cprog

     i_callback_user_command  =       ‘DISPLAY_SECOND_ALV’ 

     i_callback_top_of_page  = ‘DISPLAY_LOGO’ ” 

     i_grid_title   = ‘Flight Details’

     is_layout      = wa_layout

     it_fieldcat    = it_fieldcat

    tables

      t_outtab       = it_flight.


*———————————————————*

form display_logo.

  wa_header-typ = ‘H’.

  wa_header-info  = ‘INDIAN AIRLINES’.

  append wa_header to it_header.

  clear wa_header.

  call function ‘REUSE_ALV_COMMENTARY_WRITE’

    exporting

      it_list_commentary     = it_header

     i_logo                           = ‘AEROPLANE’.

  refresh it_header.

 

endform.                    “DISPLAY_LOGO


*———————————————————-*

form display_second_alv

  using     ok_code type sy-ucomm

               selfield type slis_selfield.

  case ok_code.

    when ‘&IC1’.” fcode for double click

      read table it_flight into wa_flight index               selfield-tabindex.

select * from spfli into corresponding fields of table it_spfli where carrid = wa_flight-carrid.

      wa_fieldcat1-row_pos = 1.

      wa_fieldcat1-col_pos = 1.

      wa_fieldcat1-fieldname = ‘CARRID’.

      wa_fieldcat1-tabname = ‘IT_SPFLI’.

      wa_fieldcat1-ref_tabname = ‘SPFLI’.

      wa_fieldcat1-key = ‘X’.

      wa_fieldcat1-seltext_s = ‘FLIGHT CODE’.

      append wa_fieldcat1 to it_fieldcat1.

      clear wa_fieldcat1.

      wa_fieldcat1-row_pos = 1.

      wa_fieldcat1-col_pos = 2.

      wa_fieldcat1-fieldname = ‘CONNID’.

      wa_fieldcat1-tabname = ‘IT_SPFLI’.

      wa_fieldcat1-ref_tabname = ‘SPFLI’.

      wa_fieldcat1-key = ‘X’.

      wa_fieldcat1-seltext_s = ‘FLIGHT CONN’.

      append wa_fieldcat1 to it_fieldcat1.

      clear wa_fieldcat1.

      wa_fieldcat1-row_pos = 1.

      wa_fieldcat1-col_pos = 3.

      wa_fieldcat1-fieldname = ‘COUNTRYFR’.

      wa_fieldcat1-tabname = ‘IT_SPFLI’.

      wa_fieldcat1-ref_tabname = ‘SPFLI’.

      wa_fieldcat1-seltext_s = ‘COUNTRY FROM’.

      append wa_fieldcat1 to it_fieldcat1.

      clear wa_fieldcat1.

      wa_fieldcat1-row_pos = 1.

      wa_fieldcat1-col_pos = 4.

      wa_fieldcat1-fieldname = ‘COUNTRYTO’.

      wa_fieldcat1-tabname = ‘IT_SPFLI’.

      wa_fieldcat1-ref_tabname = ‘SPFLI’.

      wa_fieldcat1-seltext_s = ‘COUNTRY TO’.

      append wa_fieldcat1 to it_fieldcat1.

      clear wa_fieldcat1.

      wa_fieldcat1-row_pos = 1.

      wa_fieldcat1-col_pos = 5.

      wa_fieldcat1-fieldname = ‘AIRPFROM’.

      wa_fieldcat1-tabname = ‘IT_SPFLI’.

      wa_fieldcat1-ref_tabname = ‘SPFLI’.

      wa_fieldcat1-seltext_s = ‘AIRPORT FROM’.

      append wa_fieldcat1 to it_fieldcat1.

      clear wa_fieldcat1.

      wa_fieldcat1-row_pos = 1.

      wa_fieldcat1-col_pos = 6.

      wa_fieldcat1-fieldname = ‘AIRPTO’.

      wa_fieldcat1-tabname = ‘IT_SPFLI’.

      wa_fieldcat1-ref_tabname = ‘SPFLI’.

      wa_fieldcat1-seltext_s = ‘AIRPORT TO’.

      append wa_fieldcat1 to it_fieldcat1.

      clear wa_fieldcat1.

      wa_fieldcat1-row_pos = 1.

      wa_fieldcat1-col_pos = 7.

      wa_fieldcat1-fieldname = ‘CITYFROM’.

      wa_fieldcat1-tabname = ‘IT_SPFLI’.

      wa_fieldcat1-ref_tabname = ‘SPFLI’.

      wa_fieldcat1-seltext_s = ‘CITY FROM’.

      append wa_fieldcat1 to it_fieldcat1.

      clear wa_fieldcat1.

      wa_fieldcat1-row_pos = 1.

      wa_fieldcat1-col_pos = 8.

      wa_fieldcat1-fieldname = ‘CITYTO’.

      wa_fieldcat1-tabname = ‘IT_SPFLI’.

      wa_fieldcat1-ref_tabname = ‘SPFLI’.

      wa_fieldcat1-seltext_s = ‘CITY TO’.

      append wa_fieldcat1 to it_fieldcat1.

      clear wa_fieldcat1.

      wa_layout1-zebra = ‘X’.

      wa_layout1-colwidth_optimize = ‘X’.


call function ‘REUSE_ALV_GRID_DISPLAY’

       exporting

         i_callback_program        = sy-cprog

         I_CALLBACK_TOP_OF_PAGE        =                       ‘PAGE_HEAD1’

         is_layout                 = wa_layout1

         it_fieldcat               = it_fieldcat1

        tables

          t_outtab                 = it_spfli.

  endcase.

 

endform.                    “DISPLAY_SECOND_ALV

 

FORM PAGE_HEAD1.

  wa_header1-typ = ‘H’.

  wa_header1-info  = ‘JET AIRLINES’.

  append wa_header1 to it_header1.

  clear wa_header1.

  call function ‘REUSE_ALV_COMMENTARY_WRITE’

    exporting

      it_list_commentary       = it_header1

     i_logo                             = ‘AEROPLANE’.

  REFRESH IT_HEADER1.

 

  ENDFORM.


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s