Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *&---------------------------------------------------------------------*
- *& Report ZTORO_TEST
- *&
- *&---------------------------------------------------------------------*
- *&
- *&
- *&---------------------------------------------------------------------*
- REPORT ZTORO_TEST.
- *DATA: sflight TYPE STANDARD TABLE OF sflight.
- TYPES: BEGIN OF ty_data_general_additional,
- miwarpl type mhio-warpl,
- mabnum type mhio-ABNUM,
- row_color type char4,
- END OF ty_data_general_additional.
- TYPES: BEGIN OF ty_data_general,
- iwerk type viaufks-IWERK,
- swerk type viaufks-SWERK,
- bukrs type viaufks-bukrs,
- auart type viaufks-auart,
- aufnr type viaufks-aufnr,
- ktext type viaufks-ktext,
- gstrp type viaufks-gstrp,
- gltrp type viaufks-gltrp,
- ftrms type viaufks-ftrms,
- addat type viaufks-addat,
- tplnr type viaufks-tplnr,
- pltxt type iflotx-pltxt,
- equnr type viaufks-equnr,
- eqktx type eqkt-eqktx,
- bautl type viaufks-bautl,
- plnty type viaufks-plnty,
- plnnr type viaufks-plnnr,
- plnal type viaufks-plnal,
- zaehl type viaufks-zaehl,
- strat type plko-strat,
- warpl type viaufks-warpl,
- wapos type viaufks-wapos,
- abnum type mhio-abnum,
- plandate type mhio-gstrp,
- mzaehl type mhis-zaehl,
- zpuffn type t351p-puffn,
- zsttag type mpos-zsttag,
- * kzyk1 type t351p-kzyk1,
- point type mmpt-point,
- kridate type imrg-idate,
- checkidate type imrg-idate
- .
- include TYPE ty_data_general_additional.
- TYPES: END OF ty_data_general.
- data: gt_data type TABLE OF ty_data_general.
- CLASS lcl_test DEFINITION INHERITING FROM zcl_falv.
- PUBLIC SECTION.
- class-data:
- mr_changed type REF TO CL_ALV_CHANGED_DATA_PROTOCOL,
- mo_container type REF TO CL_GUI_CONTAINER,
- mo_bdc TYPE REF TO zalrcl_bdc_ext.
- methods: get_data,
- prepare_layout.
- PROTECTED SECTION.
- "redefinition of event handler
- METHODS:
- EVF_MENU_BUTTON REDEFINITION ,
- evf_user_command REDEFINITION ,
- menu_1_1,
- menu_1_2,
- menu_1_3,
- menu_1_4,
- menu_1_5,
- menu_1_6,
- menu_1_7,
- menu_1_8,
- hide_additional IMPORTING iv type abap_bool OPTIONAL.
- PRIVATE SECTION.
- METHODs show_applog.
- METHODs hide_applog .
- ENDCLASS. "lcl_test DEFINITION
- DATA falv TYPE REF TO lcl_test.
- DATA: lo_falv TYPE REF TO zcl_falv.
- CLASS lcl_test2 DEFINITION INHERITING FROM zcl_falv.
- PUBLIC SECTION.
- PROTECTED SECTION.
- PRIVATE SECTION.
- ENDCLASS.
- *----------------------------------------------------------------------*
- * CLASS lcl_test IMPLEMENTATION
- *----------------------------------------------------------------------*
- *
- *----------------------------------------------------------------------*
- CLASS lcl_test IMPLEMENTATION.
- * METHOD EVF_BEFORE_USER_COMMAND.
- * BREAK-POINT.
- * ENDMETHOD.
- METHOD menu_1_1.
- data:
- lt_ROW_NO TYPE LVC_T_ROID,
- lv_warpl type rmipm-warpl,
- lv_LRMDT type rmipm-LRMDT
- .
- FIELD-SYMBOLS: <fs_outab> like LINE OF gt_data,
- <fs_no> like LINE OF lt_ROW_NO.
- me->GET_SELECTED_ROWS(
- importing
- ET_ROW_NO = lt_ROW_NO
- ).
- LOOP AT lt_ROW_NO ASSIGNING <fs_no> .
- CLEAR: lv_warpl, lv_LRMDT.
- READ TABLE gt_data ASSIGNING <fs_outab> INDEX <fs_no>-ROW_ID.
- CASE <fs_outab>-WARPL.
- WHEN space.
- mr_changed->ADD_PROTOCOL_ENTRY(
- exporting
- I_MSGID = 'ZALR_BC'
- I_MSGTY = 'E'
- I_MSGNO = 000
- I_MSGV1 = 'Работы не подлежат планированию в ППР/ нет плана '
- I_FIELDNAME = 'WARPL'
- I_ROW_ID = <fs_no>-ROW_ID
- ).
- CONTINUE.
- WHEN OTHERS.
- lv_warpl = <fs_outab>-WARPL.
- CASE <fs_outab>-POINT.
- WHEN space.
- data: lt_fields TYPE TABLE OF SVAL.
- FIELD-SYMBOLS: <fs_sval> like LINE OF lt_fields.
- APPEND INITIAL LINE TO lt_fields ASSIGNING <fs_sval>.
- <fs_sval>-TABNAME = 'MPOS'.
- <fs_sval>-FIELDNAME = 'ZSTTAG'.
- CALL FUNCTION 'POPUP_GET_VALUES'
- EXPORTING
- * NO_VALUE_CHECK = ' '
- POPUP_TITLE = 'Введите дата начала ППР'
- * START_COLUMN = '5'
- * START_ROW = '5'
- * IMPORTING
- * RETURNCODE =
- TABLES
- FIELDS = lt_fields
- EXCEPTIONS
- ERROR_IN_FIELDS = 1
- OTHERS = 2
- .
- IF SY-SUBRC <> 0.
- * Implement suitable error handling here
- mr_changed->ADD_PROTOCOL_ENTRY(
- exporting
- I_MSGID = sy-MSGID
- I_MSGTY = sy-MSGTY
- I_MSGNO = sy-MSGNO
- I_MSGV1 = sy-MSGV1
- I_MSGV2 = sy-MSGV2
- I_MSGV3 = sy-MSGV3
- I_MSGV4 = sy-MSGV4
- I_FIELDNAME = 'ZSTTAG'
- I_ROW_ID = <fs_no>-ROW_ID
- * I_TABIX = lv
- ).
- else.
- READ TABLE lt_fields ASSIGNING <fs_sval> INDEX 1.
- LV_LRMDT = <fs_outab>-ZSTTAG = <fs_sval>-VALUE.
- ENDIF.
- WHEN OTHERS.
- "! Нужно спросить у консультанта
- mr_changed->ADD_PROTOCOL_ENTRY(
- exporting
- I_MSGID = 'ZALR_BC'
- I_MSGTY = 'E'
- I_MSGNO = 000
- I_MSGV1 = 'Для заказа Торо '
- I_MSGV2 = <fs_outab>-AUFNR
- I_MSGV3 = ' нет даты начального пкета ППР/дата КР'
- I_FIELDNAME = 'AUFNR'
- I_ROW_ID = <fs_no>-ROW_ID
- ).
- CONTINUE.
- ENDCASE.
- ENDCASE.
- ENDLOOP.
- ENDMETHOD.
- METHOD menu_1_2.
- endmethod.
- METHOD menu_1_3.
- endmethod.
- METHOD menu_1_4.
- endmethod.
- METHOD menu_1_5.
- endmethod.
- METHOD menu_1_6.
- endmethod.
- METHOD menu_1_7.
- endmethod.
- METHOD menu_1_8.
- DATA falv2 TYPE REF TO lcl_test2.
- DATA: lo_falv2 TYPE REF TO zcl_falv.
- LCL_TEST2=>create( exporting i_subclass = cl_abap_classdescr=>describe_by_name( p_name = 'LCL_TEST2' )
- I_POPUP = abap_true
- CHANGING ct_table = gt_data rv_falv = lo_falv2 ) .
- falv2 ?= lo_falv2.
- falv2->display( ).
- me->DISPLAY( ).
- endmethod.
- METHOD prepare_layout.
- me->hide_additional( ).
- me->layout->SET_SEL_MODE( IV_VALUE = 'A' ).
- me->LAYOUT->SET_INFO_FNAME( 'ROW_COLOR' ).
- "In default when we use full screen FALV, Grid toolbar is switched off, we must turn it on )
- me->layout->set_no_toolbar( abap_false ).
- me->add_button(
- EXPORTING
- iv_function = zcl_falv_dynamic_status=>b_01
- iv_icon = icon_activate
- iv_butn_type = me->BUTTON_MENU
- iv_text = 'Операции'
- ).
- me->add_button(
- EXPORTING
- iv_function = zcl_falv_dynamic_status=>b_02
- iv_icon = icon_active_inactive
- iv_butn_type = me->BUTTON_MENU
- iv_text = 'Массовые операции'
- ).
- mo_container = me->split_container->GET_CONTAINER( ROW = 2 COLUMN = 1 ).
- CREATE OBJECT mr_changed
- EXPORTING
- I_CALLING_ALV = me.
- FIELD-SYMBOLS: <fs_fcat> like LINE OF me->FCAT.
- LOOP AT me->FCAT ASSIGNING <fs_fcat>.
- <fs_fcat>-COLTEXT = <fs_fcat>-SCRTEXT_L.
- ENDLOOP.
- mr_changed->MT_FIELDCATALOG = me->FCAT.
- ENDMETHOD.
- METHOD hide_additional.
- data:
- lo_struct_descr type REF TO cl_abap_structdescr,
- lt_struct_fields type cl_abap_structdescr=>COMPONENT_TABLE,
- ls type TY_DATA_GENERAL_ADDITIONAL.
- FIELD-SYMBOLS: <fs_struct> like LINE OF LT_STRUCT_FIELDS.
- CASE IV.
- WHEN abap_true.
- lo_struct_descr ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA( ls ).
- LT_STRUCT_FIELDS = lo_struct_descr->GET_COMPONENTS( ).
- LOOP AT LT_STRUCT_FIELDS ASSIGNING <fs_struct>.
- me->COLUMN( |{ <fs_struct>-NAME }| )->SET_NO_OUT( abap_true ).
- ENDLOOP.
- WHEN OTHERS.
- ENDCASE.
- ENDMETHOD.
- method get_data.
- FIELD-SYMBOLS: <fs> like LINE OF gt_data.
- SELECT *
- from viaufks
- into CORRESPONDING FIELDS OF TABLE gt_data.
- ENDMETHOD.
- METHOD hide_applog.
- IF split_container IS NOT INITIAL.
- split_container->set_row_sash(
- EXPORTING
- id = 1 " Row Splitter Bar ID
- type = split_container->type_sashvisible " Attribute
- value = 0 " Value
- EXCEPTIONS
- cntl_error = 1
- cntl_system_error = 2
- OTHERS = 3
- ).
- IF sy-subrc <> 0.
- ENDIF.
- split_container->set_row_height(
- EXPORTING
- id = 2 " Row ID
- height = 0 " Height
- EXCEPTIONS
- cntl_error = 1
- cntl_system_error = 2
- OTHERS = 3
- ).
- IF sy-subrc <> 0.
- ENDIF.
- ENDIF.
- ENDMETHOD. "hide_applog
- METHOD show_applog.
- IF split_container IS NOT INITIAL.
- split_container->set_row_sash(
- EXPORTING
- id = 1 " Row Splitter Bar ID
- type = split_container->type_sashvisible " Attribute
- value = 1 " Value
- EXCEPTIONS
- cntl_error = 1
- cntl_system_error = 2
- OTHERS = 3
- ).
- IF sy-subrc <> 0.
- ENDIF.
- split_container->get_row_height(
- EXPORTING
- id = 2 " Row ID
- IMPORTING
- result = height " Result Code
- EXCEPTIONS
- cntl_error = 1
- cntl_system_error = 2
- OTHERS = 3
- ).
- IF sy-subrc EQ 0 AND height EQ 0.
- split_container->set_row_height(
- EXPORTING
- id = 2 " Row ID
- height = 15 " Height
- IMPORTING
- result = result
- EXCEPTIONS
- cntl_error = 1
- cntl_system_error = 2
- OTHERS = 3
- ).
- IF sy-subrc <> 0.
- ENDIF.
- ENDIF.
- ENDIF.
- ENDMETHOD.
- METHOD EVF_MENU_BUTTON.
- CASE e_ucomm.
- WHEN zcl_falv_dynamic_status=>b_01.
- e_object->ADD_FUNCTION(
- exporting
- FCODE = 'Menu_1_1'
- TEXT = 'Рассчитать плановые даты ППР' ).
- e_object->ADD_FUNCTION(
- exporting
- FCODE = 'Menu_1_2'
- TEXT = 'Создать отзывы ППР за период').
- e_object->ADD_FUNCTION(
- exporting
- FCODE = 'Menu_1_3'
- TEXT = 'Изменить плановые даты' ).
- e_object->ADD_FUNCTION(
- exporting
- FCODE = 'Menu_1_4'
- TEXT = 'Пропуск отзыва' ).
- e_object->ADD_FUNCTION(
- exporting
- FCODE = 'Menu_1_5'
- TEXT = 'Ввести дату последего КР' ).
- e_object->ADD_FUNCTION(
- exporting
- FCODE = 'Menu_1_6'
- TEXT = 'Новый отсчет наработки после КР' ).
- e_object->ADD_FUNCTION(
- exporting
- FCODE = 'Menu_1_7'
- TEXT = 'Добавить данные ППР' ).
- e_object->ADD_FUNCTION(
- exporting
- FCODE = 'Menu_1_8'
- TEXT = 'Открыть данные о наработке' ).
- WHEN zcl_falv_dynamic_status=>b_02.
- e_object->ADD_FUNCTION(
- exporting
- FCODE = 'MyMenuFunc2'
- TEXT = 'MyMenuFunc2'
- ).
- ENDCASE.
- ENDMETHOD.
- METHOD evf_user_command.
- IF mr_changed is not INITIAL.
- mr_changed->REFRESH_PROTOCOL( ).
- mr_changed->FREE( ).
- ENDIF.
- CASE e_ucomm.
- WHEN 'Menu_1_1'.
- me->menu_1_1( ).
- WHEN 'Menu_1_2'.
- me->menu_1_2( ).
- WHEN 'Menu_1_3'.
- me->menu_1_3( ).
- WHEN 'Menu_1_4'.
- me->menu_1_4( ).
- WHEN 'Menu_1_5'.
- me->menu_1_5( ).
- WHEN 'Menu_1_6'.
- me->menu_1_6( ).
- WHEN 'Menu_1_7'.
- me->menu_1_7( ).
- WHEN 'Menu_1_8'.
- me->menu_1_8( ).
- ENDCASE.
- me->SOFT_REFRESH( ).
- IF mr_changed->mt_protocol IS NOT INITIAL.
- mr_changed->DISPLAY_PROTOCOL(
- exporting
- I_CONTAINER = mo_container ).
- show_applog( ).
- ELSE.
- hide_applog( ).
- ENDIF.
- ENDMETHOD. "evt_user_command
- ENDCLASS. "lcl_test IMPLEMENTATION
- CLASS LCL_TEST2 IMPLEMENTATION.
- ENDCLASS.
- START-OF-SELECTION.
- lcl_test=>create( exporting i_subclass = cl_abap_classdescr=>describe_by_name( p_name = 'LCL_TEST' )
- i_applog_embedded = 'X'
- CHANGING ct_table = gt_data rv_falv = lo_falv ) .
- falv ?= lo_falv.
- falv->title_v1 = 'ZDEMO_FALV05'.
- falv->gui_status->fully_dynamic = abap_true .
- falv->GET_DATA( ).
- falv->prepare_layout( ).
- falv->display( ).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement