REPORT yj_alv_interactive_oops.
include y_alv_interactive_oops_dec.
START-OF-SELECTION.
SELECT carrid
connid
FROM spfli INTO TABLE t_spfli
where carrid IN s_carrid.
CALL SCREEN 100.
*--------------------------------------------------------------------**
* Module ALV_OUTPUT
*----------------------------------------------------------------------*
MODULE alv_output OUTPUT.
perform field_cat.
CREATE OBJECT r_container
EXPORTING container_name = 'CUSTOM' .
*EXCEPTIONS CNTL_ERROR = 1
* CNTL_SYSTEM_ERROR = 2
* CREATE_ERROR = 3
* LIFETIME_ERROR = 4
* LIFETIME_DYNPRO_DYNPRO_LINK = 5
* OTHERS = 6
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CREATE OBJECT r_alv_grid
EXPORTING i_parent = r_container.
*EXCEPTIONS ERROR_CNTL_CREATE = 1
* ERROR_CNTL_INIT = 2
* ERROR_CNTL_LINK = 3
* ERROR_DP_CREATE = 4
* OTHERS = 5 .
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL METHOD r_alv_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'FS_SPFLI'
is_layout = w_lay
CHANGING
it_outtab = t_spfli
it_fieldcatalog = t_cat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMODULE.
*&---------------------------------------------------------------------**
* Module STATUS_0100 OUTPUT
*---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'BACK'.
SET TITLEBAR 'BASIC LIST'.
ENDMODULE. " STATUS_0100 OUTPUT*&---------------------------------------------------------------------**&
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'SFLIGHT'.
PERFORM sflight.
* WHEN 'SBOOK'.
* PERFORM SBOOK.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
FORM sflight .
DATA : w_lines TYPE i,
w_lineno TYPE lvc_t_row ,
w_lineno1 TYPE lvc_t_cell,
wa LIKE LINE OF w_lineno,
wa1 LIKE LINE OF w_lineno1,
index TYPE i,
fs_spfli LIKE LINE OF t_spfli.
CALL METHOD r_alv_grid->get_selected_rows
IMPORTING et_index_rows = w_lineno.
LOOP AT w_lineno INTO wa.
READ TABLE t_spfli INDEX wa-index INTO fs_spfli .
IF sy-subrc = 0.
fs_hide-carrid = fs_spfli-carrid.
fs_hide-connid = fs_spfli-connid.
APPEND fs_hide TO t_hide.
ENDIF.
ENDLOOP.
IF NOT t_hide IS INITIAL.
SELECT carrid
connid
fldate
FROM sflight
INTO TABLE t_sflight
FOR ALL ENTRIES IN t_hide
WHERE carrid = t_hide-carrid
AND connid = t_hide-connid.
ENDIF.
CLEAR t_cat.
CLEAR w_lay.
perform field_cat2.
CALL METHOD r_alv_grid->set_table_for_first_display
EXPORTING i_structure_name = 'FS_SFLIGHT'
is_layout = w_lay
CHANGING it_outtab = t_sflight
it_fieldcatalog = t_cat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
ENDIF.
ENDFORM. " SFLIGHT
*&---------------------------------------------------------------------*
*& Form FIELD_CAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form FIELD_CAT .
w_cat-fieldname = 'CARRID'.
w_cat-coltext = 'CARRID'.
w_cat-col_pos = 2.
APPEND w_cat TO t_cat.
CLEAR w_cat.
w_cat-fieldname = 'CONNID'.
w_cat-coltext = 'Connection id'.
w_cat-col_pos = 3.
APPEND w_cat TO t_cat.
CLEAR w_cat.
w_lay-grid_title = 'FLIGHT SCHEDULE'.
w_lay-sel_mode = 'C'.
endform. " FIELD_CAT
*&---------------------------------------------------------------------*
*& Form FIELD_CAT2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form FIELD_CAT2 .
w_cat-fieldname = 'CARRID'.
w_cat-coltext = 'CARRID'.
w_cat-col_pos = 2.
w_cat-key_sel = 'X'.
w_cat-emphasize = 'C700'.
APPEND w_cat TO t_cat.
CLEAR w_cat.
w_cat-fieldname = 'CONNID'.
w_cat-coltext = 'Connection id'.
w_cat-col_pos = 3.
w_cat-lzero = 'YES'.
w_cat-just = 'C'.
w_cat-key_sel = 'X'.
APPEND w_cat TO t_cat.
CLEAR w_cat.
w_cat-fieldname = 'FLDATE'.
w_cat-coltext = 'FLIGHT DATE'.
w_cat-col_pos = 4.
APPEND w_cat TO t_cat.
CLEAR w_cat.
w_lay-grid_title = 'FLIGHT INFORMATION'.
endform. " FIELD_CAT2
*----------------------------------------------------------------------*include y_alv_interactive_oops_dec.
*-----------------------------------------------------------------------*
TYPES: BEGIN OF type_s_spfli,
carrid TYPE spfli-carrid,
connid TYPE spfli-connid,
END OF type_s_spfli.
TYPES: BEGIN OF type_s_sflight,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
END OF type_s_sflight.
*TYPES: BEGIN OF type_s_sbook,
* carrid TYPE sbook-carrid,
* connid TYPE sbook-connid,
* fldate TYPE sbook-fldate,
* bookid TYPE sbook-bookid,
*END OF type_s_sbook.
TYPES: BEGIN OF type_s_hide,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
END OF type_s_hide.
DATA: *fs_spfli TYPE type_s_spfli,
fs_sflight TYPE type_s_sflight,
* fs_sbook TYPE type_s_sbook,
fs_hide TYPE type_s_hide.
DATA : r_container TYPE REF TO cl_gui_custom_container,
r_alv_grid TYPE REF TO cl_gui_alv_grid.
* r_container1 TYPE REF TO cl_gui_custom_container,
* r_alv_grid1 TYPE REF TO cl_gui_alv_grid.
DATA: t_spfli TYPE STANDARD TABLE OF type_s_spfli,
t_sflight LIKE STANDARD TABLE OF fs_sflight,
* t_sbook LIKE STANDARD TABLE OF fs_sbook,
t_hide LIKE TABLE OF fs_hide.
DATA :t_cat TYPE lvc_t_fcat,
w_cat TYPE lvc_s_fcat,
w_lay TYPE lvc_s_layo,
w_sort TYPE lvc_s_sort,
t_sort TYPE lvc_t_sort.
DATA gv_carrid type spfli-carrid.
SELECT-OPTIONS : s_CARRID for gv_carrid.
No comments:
Post a Comment