REPORT z18_06.
DATA: g_alv_tree TYPE REF TO cl_gui_alv_tree,
g_custom_container TYPE REF TO cl_gui_custom_container.
DATA: gt_sflight TYPE sflight OCCURS 0,
ok_code LIKE sy-ucomm,
save_ok LIKE sy-ucomm,
g_max TYPE i VALUE 255.
END-OF-SELECTION.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module PBO OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
IF g_alv_tree IS INITIAL.
PERFORM init_tree.
ENDIF.
ENDMODULE. " PBO OUTPUT
*&---------------------------------------------------------------------*
*& Form INIT_TREE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM init_tree .
DATA: l_tree_container_name(30).
l_tree_container_name = 'CCONTAINER1'.
CREATE OBJECT g_custom_container
EXPORTING
container_name = l_tree_container_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'(100).
ENDIF.
CREATE OBJECT g_alv_tree
EXPORTING
parent = g_custom_container
node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple
item_selection = 'X'
no_html_header = 'X'
no_toolbar = ''
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
DATA: l_hierarchy_header TYPE treev_hhdr.
PERFORM build_hierarchy_header CHANGING l_hierarchy_header.
CALL METHOD g_alv_tree->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
is_hierarchy_header = l_hierarchy_header
CHANGING
it_outtab = gt_sflight. "table must be empty !
PERFORM create_hierarchy.
CALL METHOD g_alv_tree->frontend_update.
ENDFORM. " INIT_TREE
*&---------------------------------------------------------------------*
*& Form BUILD_HIERARCHY_HEADER
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_L_HIERARCHY_HEADER text
*----------------------------------------------------------------------*
FORM build_hierarchy_header CHANGING p_hierarchy_header TYPE treev_hhdr.
p_hierarchy_header-heading = 'Month/Carrier/Date'(300).
p_hierarchy_header-tooltip = 'Flights in a month'(400).
p_hierarchy_header-width = 30.
p_hierarchy_header-width_pix = ' '.
ENDFORM. " BUILD_HIERARCHY_HEADER
*&---------------------------------------------------------------------*
*& Form CREATE_HIERARCHY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM create_hierarchy .
DATA: ls_sflight TYPE sflight,
lt_sflight TYPE sflight OCCURS 0,
l_carrid LIKE sflight-carrid,
l_carrid_last LIKE sflight-carrid.
DATA: l_node_key TYPE lvc_nkey,
l_node_key2 TYPE lvc_nkey,
l_node_key3 TYPE lvc_nkey,
l_node_text TYPE lvc_value,
l_relat_key TYPE lvc_nkey,
l_first_flg TYPE c.
SELECT * FROM sflight INTO TABLE lt_sflight UP TO g_max ROWS.
l_relat_key = ''.
l_node_text = 'AIRPLANE'.
CALL METHOD g_alv_tree->add_node
EXPORTING
i_relat_node_key = l_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
IMPORTING
e_new_node_key = l_node_key.
SORT lt_sflight BY carrid fldate.
LOOP AT lt_sflight INTO ls_sflight.
AT NEW carrid.
l_relat_key = l_node_key.
l_node_text = ls_sflight-carrid.
l_first_flg = 'X'.
CALL METHOD g_alv_tree->add_node
EXPORTING
i_relat_node_key = l_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
* is_outtab_line = ls_sflight
IMPORTING
e_new_node_key = l_node_key2.
ENDAT.
IF l_first_flg = 'X'.
l_relat_key = l_node_key2.
l_node_text = ls_sflight-fldate.
l_first_flg = 'X'.
CALL METHOD g_alv_tree->add_node
EXPORTING
i_relat_node_key = l_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_sflight
IMPORTING
e_new_node_key = l_node_key3.
ENDIF.
AT END OF carrid.
CLEAR l_first_flg.
ENDAT.
ENDLOOP.
ENDFORM. " CREATE_HIERARCHY
*&---------------------------------------------------------------------*
*& Module PAI INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE pai INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'EXIT' OR 'BACK' OR 'CANC'.
PERFORM exit_program.
WHEN OTHERS.
* §6. Call dispatch to process toolbar functions
CALL METHOD cl_gui_cfw=>dispatch.
ENDCASE.
CALL METHOD cl_gui_cfw=>flush.
ENDMODULE. " PAI INPUT
*&---------------------------------------------------------------------*
*& Form EXIT_PROGRAM
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM exit_program .
CALL METHOD g_custom_container->free.
LEAVE PROGRAM.
ENDFORM. " EXIT_PROGRAM
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
671 | 직원 데이터 [1] | sapjoy | 2024.07.02 | 244 |
670 | REPORT Z99_24. | sapjoy | 2024.05.21 | 84 |
669 | REPORT Z06_01. | sapjoy | 2024.04.21 | 61 |
668 | REPORT z05_36 | sapjoy | 2023.02.08 | 271 |
667 | API | sapjoy | 2022.11.03 | 351 |
666 | z15_21_drag | sapjoy | 2022.02.24 | 307 |
665 | Z18_06_DRAGCLASS | sapjoy | 2022.02.23 | 334 |
664 | REPORT Z21_01 | sapjoy | 2015.10.28 | 2276 |
663 | subroutine pool | sapjoy | 2013.11.16 | 3314 |
662 | REPORT Z20_01. | sapjoy | 2012.08.02 | 5097 |
661 | REPORT Z19_02. | sapjoy | 2012.08.02 | 3953 |
660 | REPORT z19_01. | sapjoy | 2012.08.02 | 3559 |
» | REPORT z18_06. | sapjoy | 2012.08.02 | 3195 |
658 | REPORT z18_05 | sapjoy | 2012.08.02 | 3384 |
657 | REPORT z18_04 . | sapjoy | 2012.08.02 | 3388 |
656 | REPORT z18_03. | sapjoy | 2012.08.02 | 4598 |
655 | REPORT z18_02. | sapjoy | 2012.08.02 | 3124 |
654 | REPORT z18_01. | sapjoy | 2012.08.02 | 3152 |
653 | REPORT z17_23 | sapjoy | 2012.08.02 | 2539 |
652 | REPORT z17_22 | sapjoy | 2012.08.02 | 2307 |