REPORT zalv.
*----------------------------------------------------------------------*
* CLASS lcl_event_handler DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION .
METHODS:
*--Double-click control
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column,
*--Context-Menu
handle_context_menu_request
FOR EVENT context_menu_request OF cl_gui_alv_grid
IMPORTING e_object,
*-- User Command
handle_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm,
*-- After user command
handle_after_user_command
FOR EVENT after_user_command OF cl_gui_alv_grid
IMPORTING e_ucomm e_saved e_not_processed,
*-- Toolbar
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
*-- Menu button
handle_menu_button
FOR EVENT menu_button OF cl_gui_alv_grid
IMPORTING e_object e_ucomm,
*-- Data Change
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed,
*-- F1 Help
handle_onf1
FOR EVENT onf1 OF cl_gui_alv_grid
IMPORTING e_fieldname es_row_no er_event_data.
ENDCLASS. "lcl_event_handler DEFINITION
*--- ALV Grid instance reference
DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid .
*--- Name of the custom control added on the screen
DATA gc_custom_control_name TYPE scrfname VALUE 'CC_ALCV' .
*--- Custom container instance reference
DATA gr_ccontainer TYPE REF TO cl_gui_custom_container .
DATA: gr_dock_ccontainer TYPE REF TO cl_gui_docking_container..
*--- Field catalog table
DATA gt_fieldcat TYPE lvc_t_fcat .
*--- Layout structure
DATA gs_layout TYPE lvc_s_layo .
*--- Exclusion table
DATA gt_exclude TYPE ui_functions.
*--- Sort table
DATA gt_sort TYPE lvc_t_sort.
*--- Filter table
DATA gt_filt TYPE lvc_t_filt.
*--- Hyperlink table
DATA gt_hype TYPE lvc_t_hype.
DATA gr_event_handler TYPE REF TO lcl_event_handler .
*--- Internal table holding list data
DATA BEGIN OF gt_list OCCURS 0 .
INCLUDE STRUCTURE sflight .
DATA rowcolor(4) TYPE c .
DATA cellcolors TYPE lvc_t_scol .
DATA carrid_handle TYPE int4 . " hyperlink
DATA ptype_dd_hndl TYPE int4 . " DDLB
DATA cellstyles TYPE lvc_t_styl . " Cell Styles
DATA END OF gt_list .
CALL SCREEN 100.
*----------------------------------------------------------------------*
* CLASS lcl_event_handler IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_handler IMPLEMENTATION .
METHOD handle_double_click.
PERFORM handle_double_click USING e_row e_column .
ENDMETHOD . "handle_double_click
METHOD handle_context_menu_request.
PERFORM handle_context_menu_request USING e_object.
ENDMETHOD. "handle_context_menu_request
METHOD handle_user_command.
PERFORM handle_user_command USING e_ucomm.
ENDMETHOD. "handle_user_command
METHOD handle_after_user_command.
ENDMETHOD. "handle_after_user_command
METHOD handle_toolbar.
PERFORM handle_toolbar USING e_object.
ENDMETHOD. "handle_toolbar
METHOD handle_menu_button.
PERFORM handle_menu_button USING e_object e_ucomm.
ENDMETHOD. "handle_menu_button
METHOD handle_data_changed.
PERFORM handle_data_changed USING er_data_changed.
ENDMETHOD. "handle_data_changed
METHOD handle_onf1.
PERFORM f1_help USING e_fieldname es_row_no .
er_event_data->m_event_handled = 'X' .
ENDMETHOD. "handle_onf1
ENDCLASS. "lcl_event_handler IMPLEMENTATION
*&---------------------------------------------------------------------*
*& Module DISPLAY_ALV OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE display_alv OUTPUT.
PERFORM display_alv.
ENDMODULE. " DISPLAY_ALV OUTPUT
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display_alv .
PERFORM get_data.
IF gr_alvgrid IS INITIAL .
**----Creating custom container instance
* CREATE OBJECT gr_ccontainer
* EXPORTING
* container_name = gc_custom_control_name
* 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.
**--Exception handling
* ENDIF.
*----------------------------------------------------------------------------------
* Create docking container
CREATE OBJECT gr_dock_ccontainer
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90 " 90% yet not full-screen size
EXCEPTIONS
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.
CALL METHOD gr_dock_ccontainer->set_extension
EXPORTING
extension = 99999 " full-screen size !!!
EXCEPTIONS
cntl_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*----------------------------------------------------------------------------------
*----Creating ALV Grid instance
CREATE OBJECT gr_alvgrid
EXPORTING
i_parent = gr_dock_ccontainer"gr_ccontainer
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5 .
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
*--Creating an instance for the event handler
CREATE OBJECT gr_event_handler .
SET HANDLER gr_event_handler->handle_double_click FOR gr_alvgrid .
SET HANDLER gr_event_handler->handle_context_menu_request FOR gr_alvgrid .
SET HANDLER gr_event_handler->handle_user_command FOR gr_alvgrid .
SET HANDLER gr_event_handler->handle_after_user_command FOR gr_alvgrid.
SET HANDLER gr_event_handler->handle_toolbar FOR gr_alvgrid.
SET HANDLER gr_event_handler->handle_menu_button FOR gr_alvgrid.
SET HANDLER gr_event_handler->handle_data_changed FOR gr_alvgrid.
SET HANDLER gr_event_handler->handle_onf1 FOR gr_alvgrid.
*----Preparing field catalog.
PERFORM prepare_field_catalog CHANGING gt_fieldcat .
*----Preparing layout structure
PERFORM prepare_layout CHANGING gs_layout .
*----Preparing functions to be excluded
PERFORM exclude_tb_functions CHANGING gt_exclude.
*----Preparing Sort table
PERFORM prepare_sort_table CHANGING gt_sort.
*----Preparing filter table
PERFORM prepare_filter_table CHANGING gt_filt.
*----Preparing hyperlink table
PERFORM prepare_hyperlinks_table CHANGING gt_hype.
*----Preparing DDLB table
PERFORM prepare_drilldown_values.
*--functions
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
* I_BUFFER_ACTIVE =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
* IS_VARIANT =
i_save = 'U'
* I_DEFAULT = 'X'
is_layout = gs_layout
* IS_PRINT =
* IT_SPECIAL_GROUPS =
it_toolbar_excluding = gt_exclude
it_hyperlink = gt_hype
CHANGING
it_outtab = gt_list[]
it_fieldcatalog = gt_fieldcat
it_sort = gt_sort
it_filter = gt_filt
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4 .
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
ELSE .
CALL METHOD gr_alvgrid->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
finished = 1
OTHERS = 2 .
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
ENDIF .
ENDFORM. " DISPLAY_ALV
*&---------------------------------------------------------------------*
*& Form PREPARE_FIELD_CATALOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_GT_FIELDCAT text
*----------------------------------------------------------------------*
FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat .
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
ct_fieldcat = pt_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
LOOP AT pt_fieldcat INTO ls_fcat .
CASE ls_fcat-fieldname .
WHEN 'CARRID' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'Airline Carrier ID' .
ls_fcat-web_field = 'CARRID_HANDLE'.
ls_fcat-drdn_field = 'PTYPE_DD_HNDL'.
MODIFY pt_fieldcat FROM ls_fcat .
WHEN 'PAYMENTSUM' .
* ls_fcat-no_out = 'X' .
ls_fcat-do_sum = 'X'.
MODIFY pt_fieldcat FROM ls_fcat .
ENDCASE .
ENDLOOP .
ENDFORM. " PREPARE_FIELD_CATALOG
*&---------------------------------------------------------------------*
*& Form PREPARE_LAYOUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_GS_LAYOUT text
*----------------------------------------------------------------------*
FORM prepare_layout CHANGING ps_layout TYPE lvc_s_layo.
ps_layout-zebra = 'X' .
ps_layout-grid_title = 'Flights' .
ps_layout-smalltitle = 'X' .
ps_layout-sel_mode = 'B' .
ps_layout-info_fname = 'ROWCOLOR'.
ps_layout-ctab_fname = 'CELLCOLORS'.
ps_layout-stylefname = 'CELLSTYLES'.
* ps_layout-no_merging = 'X'.
ENDFORM. " PREPARE_LAYOUT
*&---------------------------------------------------------------------*
*& Form EXCLUDE_TB_FUNCTIONS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_GT_EXCLUDE text
*----------------------------------------------------------------------*
FORM exclude_tb_functions CHANGING pt_exclude TYPE ui_functions.
DATA ls_exclude TYPE ui_func.
ls_exclude = cl_gui_alv_grid=>mc_fc_maximum .
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_minimum .
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_subtot .
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_sum .
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_average .
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_mb_sum .
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_mb_subtot .
ENDFORM. " EXCLUDE_TB_FUNCTIONS
*&---------------------------------------------------------------------*
*& Form PREPARE_SORT_TABLE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_GT_SORT text
*----------------------------------------------------------------------*
FORM prepare_sort_table CHANGING pt_sort TYPE lvc_t_sort.
DATA ls_sort TYPE lvc_s_sort .
ls_sort-spos = '1' .
ls_sort-fieldname = 'CARRID' .
ls_sort-up = 'X' . "A to Z
ls_sort-down = space .
APPEND ls_sort TO pt_sort .
ls_sort-spos = '2' .
ls_sort-fieldname = 'SEATSOCC' .
ls_sort-up = space .
ls_sort-down = 'X' . "Z to A
APPEND ls_sort TO pt_sort .
ENDFORM. " PREPARE_SORT_TABLE
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'ALV'.
SET TITLEBAR 'ALV'.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
LEAVE TO SCREEN 0.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Form PREPARE_FILTER_TABLE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_GT_FILT text
*----------------------------------------------------------------------*
FORM prepare_filter_table CHANGING pt_filt TYPE lvc_t_filt .
DATA ls_filt TYPE lvc_s_filt .
ls_filt-fieldname = 'FLDATE' .
ls_filt-sign = 'E' .
ls_filt-option = 'BT' .
ls_filt-low = '20070101' .
ls_filt-high = '20071231' .
APPEND ls_filt TO pt_filt .
ENDFORM. " PREPARE_FILTER_TABLE
*&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_data .
DATA ld_color(1) TYPE c.
DATA ls_cellcolor TYPE lvc_s_scol .
DATA ls_style TYPE lvc_s_styl .
SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE gt_list." WHERE SEATSOCC > 0.
LOOP AT gt_list.
** Coloring Row
ld_color = ld_color + 1.
* Only 7 colours so need to reset color value
IF ld_color = 8.
ld_color = 1.
ENDIF.
CONCATENATE 'C' ld_color '00' INTO gt_list-rowcolor.
* Coloring Cell
IF gt_list-seatsocc < 0.
ls_cellcolor-fname = 'SEATSOCC' .
ls_cellcolor-color-col = '6' .
ls_cellcolor-color-int = '1' .
APPEND ls_cellcolor TO gt_list-cellcolors.
ENDIF.
* Hyper Links
IF gt_list-carrid = 'AA'.
gt_list-carrid_handle = '1' .
ELSEIF gt_list-carrid = 'LH'.
gt_list-carrid_handle = '2' .
ELSEIF gt_list-carrid = 'AZ'..
gt_list-ptype_dd_hndl = '1'.
ENDIF.
IF gt_list-planetype = '747-400'.
ls_style-fieldname = 'SEATSMAX' .
ls_style-style = cl_gui_alv_grid=>mc_style_button .
APPEND ls_style TO gt_list-cellstyles .
ENDIF.
** Makes the field Editable
IF gt_list-fldate < class="L1S52">AND gt_list-cellstyles IS INITIAL.
CLEAR ls_style.
ls_style-fieldname = 'FLDATE'.
ls_style-style = cl_gui_alv_grid=>mc_style_enabled.
APPEND ls_style TO gt_list-cellstyles .
ENDIF.
MODIFY gt_list.
ENDLOOP.
ENDFORM. " GET_DATA
*&---------------------------------------------------------------------*
*& Form PREPARE_HYPERLINKS_TABLE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_GT_HYPE text
*----------------------------------------------------------------------*
FORM prepare_hyperlinks_table CHANGING pt_hype TYPE lvc_t_hype.
DATA ls_hype TYPE lvc_s_hype .
ls_hype-handle = '1' .
ls_hype-href = 'http://www.aa.com/' .
APPEND ls_hype TO pt_hype .
ls_hype-handle = '2' .
ls_hype-href = 'http://www.lufthansa.com/' .
APPEND ls_hype TO pt_hype .
ENDFORM. " PREPARE_HYPERLINKS_TABLE
*&---------------------------------------------------------------------*
*& Form PREPARE_DRILLDOWN_VALUES
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM prepare_drilldown_values .
DATA lt_ddval TYPE lvc_t_drop .
DATA ls_ddval TYPE lvc_s_drop .
ls_ddval-handle = '1' .
ls_ddval-value = 'JFK-12' .
APPEND ls_ddval TO lt_ddval .
ls_ddval-handle = '1' .
ls_ddval-value = 'JSF-44' .
APPEND ls_ddval TO lt_ddval .
ls_ddval-handle = '1' .
ls_ddval-value = 'KMDA-53' .
APPEND ls_ddval TO lt_ddval .
ls_ddval-handle = '1' .
ls_ddval-value = 'SS3O/N' .
APPEND ls_ddval TO lt_ddval .
CALL METHOD gr_alvgrid->set_drop_down_table
EXPORTING
it_drop_down = lt_ddval.
ENDFORM. " PREPARE_DRILLDOWN_VALUES
*&---------------------------------------------------------------------*
*& Form HANDLE_DOUBLE_CLICK
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_E_ROW text
* -->P_E_COLUMN text
* -->P_ES_ROW_NO text
*----------------------------------------------------------------------*
FORM handle_double_click USING p_row
p_column.
BREAK-POINT.
ENDFORM. " HANDLE_DOUBLE_CLICK
*&---------------------------------------------------------------------*
*& Form HANDLE_CONTEXT_MENU_REQUEST
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_E_OBJECT text
*----------------------------------------------------------------------*
FORM handle_context_menu_request USING p_object TYPE REF TO cl_ctmenu.
CALL METHOD p_object->add_function
EXPORTING
fcode = 'CREA'
text = 'Create Booking'.
ENDFORM. " HANDLE_CONTEXT_MENU_REQUEST
*&---------------------------------------------------------------------*
*& Form HANDLE_TOOLBAR
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_E_OBJECT text
*----------------------------------------------------------------------*
FORM handle_toolbar USING p_object TYPE REF TO cl_alv_event_toolbar_set.
*0 Button (normal)
*1 Menu and default button
*2 Menu
*3 Separator
*4 Radio button
*5 Checkbox
*6 Menu entry
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
MOVE 3 TO ls_toolbar-butn_type.
APPEND ls_toolbar TO p_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 'PER' TO ls_toolbar-function. "#EC NOTEXT
MOVE icon_display_text TO ls_toolbar-icon.
MOVE 'Passenger Info'(201) TO ls_toolbar-quickinfo.
MOVE 'Passenger Info'(201) TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled. "#EC NOTEXT
APPEND ls_toolbar TO p_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 'EXCH' TO ls_toolbar-function. "#EC NOTEXT
MOVE 2 TO ls_toolbar-butn_type.
MOVE icon_calculation TO ls_toolbar-icon.
MOVE 'Payment in Other Currencies'(202) TO ls_toolbar-quickinfo.
MOVE ' ' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled. "#EC NOTEXT
APPEND ls_toolbar TO p_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 'CHNG' TO ls_toolbar-function. "#EC NOTEXT
MOVE icon_change TO ls_toolbar-icon.
MOVE 'Change Date of Flight'(202) TO ls_toolbar-quickinfo.
MOVE ' ' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled. "#EC NOTEXT
APPEND ls_toolbar TO p_object->mt_toolbar.
ENDFORM. " HANDLE_TOOLBAR
*&---------------------------------------------------------------------*
*& Form HANDLE_MENU_BUTTON
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_E_OBJECTE text
* -->P_E_UCOMM text
*----------------------------------------------------------------------*
FORM handle_menu_button USING p_object TYPE REF TO cl_ctmenu
p_ucomm TYPE syucomm.
CASE p_ucomm .
WHEN 'EXCH' .
CALL METHOD p_object->add_function
EXPORTING
fcode = 'EU'
text = 'Euro'.
CALL METHOD p_object->add_function
EXPORTING
fcode = 'TRL'
text = 'Turkish Lira'.
ENDCASE .
ENDFORM. " HANDLE_MENU_BUTTON
*&---------------------------------------------------------------------*
*& Form HANDLE_USER_COMMAND
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_E_UCOMM text
*----------------------------------------------------------------------*
FORM handle_user_command USING p_ucomm TYPE syucomm.
DATA lt_selected_rows TYPE lvc_t_roid .
DATA ls_selected_row TYPE lvc_s_roid .
CALL METHOD gr_alvgrid->get_selected_rows
IMPORTING
et_row_no = lt_selected_rows.
CASE p_ucomm.
WHEN 'CHNG'.
CALL METHOD gr_alvgrid->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
ENDCASE.
ENDFORM. " HANDLE_USER_COMMAND
*&---------------------------------------------------------------------*
*& Form HANDLE_DATA_CHANGED
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_ER_DATA_CHANGED text
*----------------------------------------------------------------------*
FORM handle_data_changed USING pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.
DATA : ls_mod_cell TYPE lvc_s_modi ,
lv_value TYPE lvc_value .
* BREAK-POINT.
SORT pr_data_changed->mt_mod_cells BY row_id .
LOOP AT pr_data_changed->mt_mod_cells INTO ls_mod_cell WHERE fieldname = 'FLDATE'.
CALL METHOD pr_data_changed->get_cell_value
EXPORTING
i_row_id = ls_mod_cell-row_id
i_fieldname = 'FLDATE'
IMPORTING
e_value = lv_value.
IF lv_value > sy-datum.
CALL METHOD pr_data_changed->add_protocol_entry
EXPORTING
i_msgid = 'SU'
i_msgno = '000'
i_msgty = 'E'
i_msgv1 = 'This date cannot be in year 2009'
i_msgv2 = lv_value
i_msgv3 = 'The value is set to Today`s date'
i_fieldname = ls_mod_cell-fieldname
i_row_id = ls_mod_cell-row_id.
CALL METHOD pr_data_changed->modify_cell
EXPORTING
i_row_id = ls_mod_cell-row_id
i_fieldname = ls_mod_cell-fieldname
i_value = sy-datum.
ENDIF.
ENDLOOP.
ENDFORM. " HANDLE_DATA_CHANGED
*&---------------------------------------------------------------------*
*& Form F1_HELP
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_E_FIELDNAME text
* -->P_ES_ROW_NO text
*----------------------------------------------------------------------*
FORM f1_help USING p_fieldname
p_es_row_no.
ENDFORM. " F1_HELP
About Me
Blog Archive
Thursday, October 30, 2008
Report Find User Exits & BAdis
REPORT zfind_enhancements.
TABLES : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir, sxs_attrt , tstct.
DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.
DATA : field1(30).
DATA : v_devclass LIKE tadir-devclass.
DATA wa_tadir TYPE tadir.
PARAMETERS : p_tcode LIKE tstc-tcode,
p_pgmna LIKE tstc-pgmna .
START-OF-SELECTION.
IF NOT p_tcode IS INITIAL.
SELECT SINGLE * FROM tstc WHERE tcode EQ p_tcode.
ELSEIF NOT p_pgmna IS INITIAL.
tstc-pgmna = p_pgmna.
ENDIF.
IF sy-subrc EQ 0.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name = tstc-pgmna.
MOVE : tadir-devclass TO v_devclass.
IF sy-subrc NE 0.
SELECT SINGLE * FROM trdir
WHERE name = tstc-pgmna.
IF trdir-subc EQ 'F'.
SELECT SINGLE * FROM tfdir
WHERE pname = tstc-pgmna.
SELECT SINGLE * FROM enlfdir
WHERE funcname = tfdir-funcname.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'FUGR'
AND obj_name EQ enlfdir-area.
MOVE : tadir-devclass TO v_devclass.
ENDIF.
ENDIF.
SELECT * FROM tadir INTO TABLE jtab
WHERE pgmid = 'R3TR'
AND object IN ('SMOD', 'SXSD')
AND devclass = v_devclass.
SELECT SINGLE * FROM tstct
WHERE sprsl EQ sy-langu
AND tcode EQ p_tcode.
FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
WRITE:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
SKIP.
IF NOT jtab[] IS INITIAL.
WRITE:/(105) sy-uline.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
* Sorting the internal Table
SORT jtab BY object.
DATA : wf_txt(60) TYPE c,
wf_smod TYPE i ,
wf_badi TYPE i ,
wf_object2(30) TYPE c.
CLEAR : wf_smod, wf_badi , wf_object2.
* Get the total SMOD.
LOOP AT jtab INTO wa_tadir.
AT FIRST.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1 sy-vline,
2 'Enhancement/ Business Add-in',
41 sy-vline ,
42 'Description',
105 sy-vline.
WRITE:/(105) sy-uline.
ENDAT.
CLEAR wf_txt.
AT NEW object.
IF wa_tadir-object = 'SMOD'.
wf_object2 = 'Enhancement' .
ELSEIF wa_tadir-object = 'SXSD'.
wf_object2 = ' Business Add-in'.
ENDIF.
FORMAT COLOR COL_GROUP INTENSIFIED ON.
WRITE:/1 sy-vline,
2 wf_object2,
105 sy-vline.
ENDAT.
CASE wa_tadir-object.
WHEN 'SMOD'.
wf_smod = wf_smod + 1.
SELECT SINGLE modtext INTO wf_txt
FROM modsapt
WHERE sprsl = sy-langu
AND name = wa_tadir-obj_name.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WHEN 'SXSD'.
* For BADis
wf_badi = wf_badi + 1 .
SELECT SINGLE text INTO wf_txt
FROM sxs_attrt
WHERE sprsl = sy-langu
AND exit_name = wa_tadir-obj_name.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
ENDCASE.
WRITE:/1 sy-vline,
2 wa_tadir-obj_name HOTSPOT ON,
41 sy-vline ,
42 wf_txt,
105 sy-vline.
AT END OF object.
WRITE : /(105) sy-uline.
ENDAT.
ENDLOOP.
WRITE:/(105) sy-uline.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No.of Exits:' , wf_smod.
WRITE:/ 'No.of BADis:' , wf_badi.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(105) 'No userexits or BADis exist'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(105) 'Transaction does not exist'.
ENDIF.
AT LINE-SELECTION.
DATA : wf_object TYPE tadir-object.
CLEAR wf_object.
GET CURSOR FIELD field1.
CHECK field1(8) EQ 'WA_TADIR'.
READ TABLE jtab WITH KEY obj_name = sy-lisel+1(20).
MOVE jtab-object TO wf_object.
CASE wf_object.
WHEN 'SMOD'.
SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
WHEN 'SXSD'.
SET PARAMETER ID 'EXN' FIELD sy-lisel+1(20).
CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.
ENDCASE.
TABLES : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir, sxs_attrt , tstct.
DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.
DATA : field1(30).
DATA : v_devclass LIKE tadir-devclass.
DATA wa_tadir TYPE tadir.
PARAMETERS : p_tcode LIKE tstc-tcode,
p_pgmna LIKE tstc-pgmna .
START-OF-SELECTION.
IF NOT p_tcode IS INITIAL.
SELECT SINGLE * FROM tstc WHERE tcode EQ p_tcode.
ELSEIF NOT p_pgmna IS INITIAL.
tstc-pgmna = p_pgmna.
ENDIF.
IF sy-subrc EQ 0.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name = tstc-pgmna.
MOVE : tadir-devclass TO v_devclass.
IF sy-subrc NE 0.
SELECT SINGLE * FROM trdir
WHERE name = tstc-pgmna.
IF trdir-subc EQ 'F'.
SELECT SINGLE * FROM tfdir
WHERE pname = tstc-pgmna.
SELECT SINGLE * FROM enlfdir
WHERE funcname = tfdir-funcname.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'FUGR'
AND obj_name EQ enlfdir-area.
MOVE : tadir-devclass TO v_devclass.
ENDIF.
ENDIF.
SELECT * FROM tadir INTO TABLE jtab
WHERE pgmid = 'R3TR'
AND object IN ('SMOD', 'SXSD')
AND devclass = v_devclass.
SELECT SINGLE * FROM tstct
WHERE sprsl EQ sy-langu
AND tcode EQ p_tcode.
FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
WRITE:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
SKIP.
IF NOT jtab[] IS INITIAL.
WRITE:/(105) sy-uline.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
* Sorting the internal Table
SORT jtab BY object.
DATA : wf_txt(60) TYPE c,
wf_smod TYPE i ,
wf_badi TYPE i ,
wf_object2(30) TYPE c.
CLEAR : wf_smod, wf_badi , wf_object2.
* Get the total SMOD.
LOOP AT jtab INTO wa_tadir.
AT FIRST.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1 sy-vline,
2 'Enhancement/ Business Add-in',
41 sy-vline ,
42 'Description',
105 sy-vline.
WRITE:/(105) sy-uline.
ENDAT.
CLEAR wf_txt.
AT NEW object.
IF wa_tadir-object = 'SMOD'.
wf_object2 = 'Enhancement' .
ELSEIF wa_tadir-object = 'SXSD'.
wf_object2 = ' Business Add-in'.
ENDIF.
FORMAT COLOR COL_GROUP INTENSIFIED ON.
WRITE:/1 sy-vline,
2 wf_object2,
105 sy-vline.
ENDAT.
CASE wa_tadir-object.
WHEN 'SMOD'.
wf_smod = wf_smod + 1.
SELECT SINGLE modtext INTO wf_txt
FROM modsapt
WHERE sprsl = sy-langu
AND name = wa_tadir-obj_name.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WHEN 'SXSD'.
* For BADis
wf_badi = wf_badi + 1 .
SELECT SINGLE text INTO wf_txt
FROM sxs_attrt
WHERE sprsl = sy-langu
AND exit_name = wa_tadir-obj_name.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
ENDCASE.
WRITE:/1 sy-vline,
2 wa_tadir-obj_name HOTSPOT ON,
41 sy-vline ,
42 wf_txt,
105 sy-vline.
AT END OF object.
WRITE : /(105) sy-uline.
ENDAT.
ENDLOOP.
WRITE:/(105) sy-uline.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No.of Exits:' , wf_smod.
WRITE:/ 'No.of BADis:' , wf_badi.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(105) 'No userexits or BADis exist'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(105) 'Transaction does not exist'.
ENDIF.
AT LINE-SELECTION.
DATA : wf_object TYPE tadir-object.
CLEAR wf_object.
GET CURSOR FIELD field1.
CHECK field1(8) EQ 'WA_TADIR'.
READ TABLE jtab WITH KEY obj_name = sy-lisel+1(20).
MOVE jtab-object TO wf_object.
CASE wf_object.
WHEN 'SMOD'.
SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
WHEN 'SXSD'.
SET PARAMETER ID 'EXN' FIELD sy-lisel+1(20).
CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.
ENDCASE.
Subscribe to:
Posts (Atom)