FUNCTION z_wm_gate_exit_popup.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_LRNUM) TYPE ZLRNUM OPTIONAL
*" VALUE(I_TRNUM) TYPE ZTRUNM OPTIONAL
*" VALUE(I_ASN) TYPE VBELN_VL OPTIONAL
*" EXPORTING
*" REFERENCE(E_DATA) TYPE ZD2S_WM_DOC_LR
*"----------------------------------------------------------------------
DATA: lt_doc_lr TYPE TABLE OF zd2s_wm_doc_lr,
ls_doc_lr TYPE zd2s_wm_doc_lr.
REFRESH: gt_emp[],lt_doc_lr[].
CLEAR: gs_emp ,g_data,ls_doc_lr.
PERFORM select_data USING i_trnum.
PERFORM display_fullscreen.
CALL SCREEN 2000 STARTING AT 7 1 ENDING AT 76 14.
IF NOT g_data IS INITIAL.
IF ok_code = 'RELA'.
e_data = g_data.
* DELETE FROM zd2s_wm_doc_lr WHERE trunm = e_data-trunm.
IF sy-subrc = 0.
* MESSAGE s064(zdicv_wm) WITH ls_doc_lr-zablad ls_doc_lr-lrnum.
COMMIT WORK.
ELSE.
ROLLBACK WORK.
ENDIF.
ENDIF.
ENDIF.
ENDFUNCTION.
*----------------------------------------------------------------------*
* CLASS lcl_event_handler DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_handler DEFINITION FINAL .
PUBLIC SECTION.
* Handles the Even when user clicks on any row..
METHODS:handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id .
ENDCLASS. "lcl_event_handler DEFINITION
*&---------------------------------------------------------------------*
*& METHOD handle_hotspot_click.
*&---------------------------------------------------------------------*
*& On double clicking a particulat row
*&---------------------------------------------------------------------*
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_hotspot_click .
CLEAR : gs_emp.
* BREAK melumal.
READ TABLE gt_emp INTO gs_emp WITH KEY radio = icon_radiobutton.
IF sy-subrc NE 0.
CLEAR gs_emp .
READ TABLE gt_emp INTO gs_emp INDEX e_row_id.
IF gs_emp-radio = icon_radiobutton.
gs_emp-radio = icon_wd_radio_button_empty.
MODIFY gt_emp INDEX e_row_id FROM gs_emp
TRANSPORTING radio.
ELSE.
gs_emp-radio = icon_radiobutton.
MODIFY gt_emp INDEX e_row_id FROM gs_emp TRANSPORTING radio.
ENDIF.
ELSE .
gs_emp-radio = icon_wd_radio_button_empty.
MODIFY gt_emp INDEX sy-tabix FROM gs_emp
TRANSPORTING radio.
CLEAR gs_emp.
READ TABLE gt_emp INTO gs_emp INDEX e_row_id .
IF sy-subrc = 0.
gs_emp-radio = icon_radiobutton.
MODIFY gt_emp INDEX e_row_id FROM gs_emp
TRANSPORTING radio.
ENDIF.
ENDIF .
* CALL METHOD cl_gui_cfw=>set_new_ok_code
* EXPORTING
* new_code = 'REFRESH'
** IMPORTING
** rc =
.
grid_name = gv_grid .
PERFORM refresh_alv USING grid_name .
ENDMETHOD . "handle_hotspot_click
ENDCLASS . "lcl_event_handler IMPLEMENTATION
*----------------------------------------------------------------------*
***INCLUDE LZ_WM_GATE_EXITF01 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form SELECT_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM select_data USING p_i_trunm.
SELECT * FROM zd2s_wm_doc_lr
INTO TABLE gt_emp
WHERE trunm = p_i_trunm.
ENDFORM. " SELECT_DATA
*&---------------------------------------------------------------------*
*& Form DISPLAY_FULLSCREEN
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display_fullscreen .
LOOP AT gt_emp INTO gs_emp.
gs_emp-radio = icon_wd_radio_button_empty.
MODIFY gt_emp FROM gs_emp TRANSPORTING radio .
ENDLOOP.
ENDFORM. " DISPLAY_FULLSCREEN
*&---------------------------------------------------------------------*
*& Form FIELDCATATALOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fieldcatatalog .
REFRESH: lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-reptext = 'Release'.
ls_fieldcat-fieldname = 'RADIO'.
ls_fieldcat-ref_table = 'GT_EMP'.
ls_fieldcat-icon = 'X'. "Icons
ls_fieldcat-hotspot = 'X'. "Hotspot(Hand Symbol)
ls_fieldcat-col_pos = '1'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-reptext = 'Unloading Point'.
ls_fieldcat-fieldname = 'ZABLAD'.
ls_fieldcat-ref_table = 'GT_EMP'.
ls_fieldcat-key = 'X'.
ls_fieldcat-outputlen = '20'.
ls_fieldcat-col_pos = '2'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-reptext = 'LR Number'.
ls_fieldcat-fieldname = 'LRNUM'.
ls_fieldcat-ref_table = 'GT_EMP'.
ls_fieldcat-outputlen = '20'.
ls_fieldcat-col_pos = '3'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-reptext = 'Truck Number'.
ls_fieldcat-fieldname = 'TRUNM'.
ls_fieldcat-ref_table = 'GT_EMP'.
ls_fieldcat-outputlen = '15'.
ls_fieldcat-fix_column = 'X'.
ls_fieldcat-col_pos = '4'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ls_fieldcat-reptext = 'ASN Number'.
ls_fieldcat-fieldname = 'VBELN'.
ls_fieldcat-ref_table = 'GT_EMP'.
ls_fieldcat-outputlen = '15'.
ls_fieldcat-fix_column = 'X'.
ls_fieldcat-col_pos = '4'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR: ls_fieldcat.
ENDFORM. " FIELDCATATALOG
*&---------------------------------------------------------------------*
*& Form REFRESH_ALV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_GRID_NAME text
*----------------------------------------------------------------------*
FORM refresh_alv USING p_grid_name TYPE REF TO cl_gui_alv_grid...
* define local data
DATA:ls_stable TYPE lvc_s_stbl.
ls_stable-row = abap_true.
ls_stable-col = abap_true.
CALL METHOD p_grid_name->refresh_table_display
EXPORTING
is_stable = ls_stable
EXCEPTIONS
finished = 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.
ENDFORM. " REFRESH_ALV
*----------------------------------------------------------------------*
***INCLUDE LZ_WM_GATE_EXITO01 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module STATUS_2000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_2000 OUTPUT.
SET PF-STATUS 'RADIO'.
SET TITLEBAR 'RADIO'.
"lcl_event_handler DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_event_handler IMPLEMENTATION
*----------------------------------------------------------------------*
DATA: go_handler TYPE REF TO lcl_event_handler .
DATA: lt_exclude TYPE ui_functions,
ls_exclude TYPE ui_func.
REFRESH : lt_exclude[].
CLEAR: ls_exclude.
IF go_container IS INITIAL .
CREATE OBJECT go_container
EXPORTING
container_name = 'GC_CON'.
*********************************************************
**Create object alv Grid
*********************************************************
CREATE OBJECT gv_grid
EXPORTING
i_parent = go_container.
*---Excluded all Buttons
ls_exclude = cl_gui_alv_grid=>mc_fc_excl_all.
APPEND ls_exclude TO lt_exclude.
CLEAR ls_exclude.
***Perform to design field catalog
PERFORM fieldcatatalog.
ls_layout-cwidth_opt = 'X' .
ls_layout-grid_title = text-t01.
CREATE OBJECT go_handler .
SET HANDLER:
go_handler->handle_hotspot_click FOR gv_grid .
"*********************************************************
**Call method set table for first display
*********************************************************
CALL METHOD gv_grid->set_table_for_first_display
EXPORTING
is_layout = ls_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_outtab = gt_emp[]
it_fieldcatalog = lt_fieldcat[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
CALL METHOD gv_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
CALL METHOD cl_gui_cfw=>flush.
ELSE.
CALL METHOD gv_grid->set_frontend_layout
EXPORTING
is_layout = ls_layout.
CALL METHOD gv_grid->refresh_table_display.
ENDIF.
ENDMODULE. " STATUS_2000 OUTPUT
*----------------------------------------------------------------------*
***INCLUDE LZ_WM_GATE_EXITI01 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_2000 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_2000 INPUT.
CASE ok_code.
WHEN 'BACK'.
LEAVE PROGRAM .
WHEN 'CANC'.
* grid_name = gv_grid .
* PERFORM refresh_alv USING grid_name .
SET SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM .
* WHEN 'REFRESH' .
* grid_name = gv_grid .
* PERFORM refresh_alv USING grid_name .
WHEN 'RELA' .
READ TABLE gt_emp INTO gs_emp WITH KEY radio = icon_radiobutton.
IF sy-subrc = 0.
CLEAR: g_data.
g_data = gs_emp.
ENDIF.
SET SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_2000 INPUT
No comments:
Post a Comment