alv tree
来源:互联网 发布:淘宝网碎花连衣裙 编辑:程序博客网 时间:2024/04/30 11:16
*&---------------------------------------------------------------------**& Report BCALV_TREE_SIMPLE_DEMO **& **&---------------------------------------------------------------------**& **& **&---------------------------------------------------------------------*
report bcalv_tree_simple_demo.
class cl_gui_column_tree definition load.class cl_gui_cfw definition load.
data tree1 type ref to cl_gui_alv_tree_simple.
include <icon>.include bcalv_simple_event_receiver.
data: gt_sflight type sflight occurs 0, "Output-Table gt_fieldcatalog type lvc_t_fcat, "Fieldcatalog gt_sort type lvc_t_sort, "Sortiertabelle ok_code like sy-ucomm. "OK-Code
start-of-selection.
end-of-selection.
call screen 100.
*&---------------------------------------------------------------------**& Form BUILD_FIELDCATALOG*&---------------------------------------------------------------------** text*----------------------------------------------------------------------*form build_fieldcatalog.* get fieldcatalog call function 'LVC_FIELDCATALOG_MERGE' exporting i_structure_name = 'SFLIGHT' changing ct_fieldcat = gt_fieldcatalog.
* change fieldcatalog data: ls_fieldcatalog type lvc_s_fcat. loop at gt_fieldcatalog into ls_fieldcatalog. case ls_fieldcatalog-fieldname. when 'CARRID' or 'CONNID' or 'FLDATE'. ls_fieldcatalog-no_out = 'X'. ls_fieldcatalog-key = ''. when 'PRICE' or 'SEATSOCC' or 'SEATSMAX' or 'PAYMENTSUM'. ls_fieldcatalog-do_sum = 'X'. endcase. modify gt_fieldcatalog from ls_fieldcatalog. endloop.
endform. " BUILD_FIELDCATALOG*&---------------------------------------------------------------------**& Form BUILD_OUTTAB*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*form build_outtab.
select * from sflight into table gt_sflight.* up to 1 rows.
endform. " BUILD_OUTTAB
*&---------------------------------------------------------------------**& Form BUILD_SORT_TABLE*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*form build_sort_table.
data ls_sort_wa type lvc_s_sort.
* create sort-table ls_sort_wa-spos = 1. ls_sort_wa-fieldname = 'CARRID'. ls_sort_wa-up = 'X'. ls_sort_wa-subtot = 'X'. append ls_sort_wa to gt_sort.
ls_sort_wa-spos = 2. ls_sort_wa-fieldname = 'CONNID'. ls_sort_wa-up = 'X'. ls_sort_wa-subtot = 'X'. append ls_sort_wa to gt_sort.
ls_sort_wa-spos = 3. ls_sort_wa-fieldname = 'FLDATE'. ls_sort_wa-up = 'X'. append ls_sort_wa to gt_sort.
endform. " BUILD_SORT_TABLE*&---------------------------------------------------------------------**& Module PBO OUTPUT*&---------------------------------------------------------------------** text*----------------------------------------------------------------------*module pbo output. if tree1 is initial. perform init_tree. endif. set pf-status 'MAIN100'.
endmodule. " PBO OUTPUT*&---------------------------------------------------------------------**& Module PAI INPUT*&---------------------------------------------------------------------** text*----------------------------------------------------------------------*module pai input.
case ok_code. when 'EXIT' or 'BACK' or 'CANC'. perform exit_program.
when others. call method cl_gui_cfw=>dispatch. endcase. clear ok_code.endmodule. " PAI INPUT*&---------------------------------------------------------------------**& Form exit_program*&---------------------------------------------------------------------** free object and leave program*----------------------------------------------------------------------*form exit_program.
call method tree1->free. leave program.
endform. " exit_program*&---------------------------------------------------------------------**& Form register_events*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*form register_events.* define the events which will be passed to the backend data: lt_events type cntl_simple_events, l_event type cntl_simple_event.
* define the events which will be passed to the backend l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req. append l_event to lt_events. l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req. append l_event to lt_events. l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req. append l_event to lt_events. l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children. append l_event to lt_events. l_event-eventid = cl_gui_column_tree=>eventid_header_click. append l_event to lt_events. l_event-eventid = cl_gui_column_tree=>eventid_item_keypress. append l_event to lt_events.
call method tree1->set_registered_events exporting events = lt_events exceptions cntl_error = 1 cntl_system_error = 2 illegal_event_combination = 3.
* set Handler data: l_event_receiver type ref to lcl_tree_event_receiver. create object l_event_receiver. set handler l_event_receiver->on_add_hierarchy_node for tree1.endform. " register_events*&---------------------------------------------------------------------**& Form build_header*&---------------------------------------------------------------------** build table for html_header*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*form build_comment using pt_list_commentary type slis_t_listheader p_logo type sdydo_value.
data: ls_line type slis_listheader.** LIST HEADING LINE: TYPE H clear ls_line. ls_line-typ = 'H'.* LS_LINE-KEY: NOT USED FOR THIS TYPE ls_line-info = 'ALV-tree-simple-Demo: flight-overview'. "#EC NOTEXT append ls_line to pt_list_commentary.* STATUS LINE: TYPE S clear ls_line. ls_line-typ = 'S'. ls_line-key = 'valid to'. "#EC NOTEXT ls_line-info = 'January 29 1999'. "#EC NOTEXT append ls_line to pt_list_commentary. ls_line-key = 'time'. ls_line-info = '2.00 pm'. "#EC NOTEXT append ls_line to pt_list_commentary.* ACTION LINE: TYPE A clear ls_line. ls_line-typ = 'A'.* LS_LINE-KEY: NOT USED FOR THIS TYPE ls_line-info = 'up-to-date data'. "#EC NOTEXT append ls_line to pt_list_commentary.
p_logo = 'ENJOYSAP_LOGO'.endform.*&---------------------------------------------------------------------**& Form init_tree*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*FORM init_tree. perform build_fieldcatalog.
perform build_outtab.
perform build_sort_table.
* create container for alv-tree data: l_tree_container_name(30) type c, l_custom_container type ref to cl_gui_custom_container. l_tree_container_name = 'TREE1'.
create object l_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.
* create tree control create object tree1 exporting i_parent = l_custom_container i_node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple i_item_selection = 'X' i_no_html_header = '' i_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.
* create info-table for html-header data: lt_list_commentary type slis_t_listheader, l_logo type sdydo_value. perform build_comment using lt_list_commentary l_logo.
* repid for saving variants data: ls_variant type disvariant. ls_variant-report = sy-repid.
* register events perform register_events.
* create hierarchy call method tree1->set_table_for_first_display exporting it_list_commentary = lt_list_commentary i_logo = l_logo i_background_id = 'ALV_BACKGROUND' i_save = 'A' is_variant = ls_variant changing it_sort = gt_sort it_outtab = gt_sflight it_fieldcatalog = gt_fieldcatalog.
* expand first level call method tree1->expand_Tree exporting i_level = 1.
* optimize column-width call method tree1->column_optimize exporting i_start_column = tree1->c_hierarchy_column_name i_end_column = tree1->c_hierarchy_column_name.
ENDFORM. " init_tree
- alv tree
- alv tree
- ALV Tree 学习总结
- alv tree 总结
- alv tree 上下文菜单
- ALV TREE学习笔记
- ALV tree应用实例
- alv tree 总结
- ABAP ALV Tree
- ALV tree展BOM
- ALV TREE + 动态显示列
- 实战SAP:【总结】ALV TREE
- alv tree 添加工具栏按钮
- alv tree 添加新文件夹
- ABAP ALV代替ALV TREE显示层级关系
- ALV Tree Demo using RS_TREE_LIST_DISPLAY and RS_TREE_CONSTRUCT
- ALV,TABLE TREE等一些控件{转载}
- ALV,TABLE TREE等一些控件
- myeclipse6.0下布置jsf项目错误解决
- 《黑客帝国》揭开的新世界
- 为什么jsp与mysql连接后过段时间就取不出数据
- Hibernate2.1.2 Reference中关于 composite id的叙述
- alv tree
- alv tree
- oracle job任务异常案例诊断
- JAVA编码转换
- Unicode编码
- C中一个有趣的打印
- php ajax 开发中的注意事项
- 配置vlan
- struts2.0的ONGL
- 关于收集的用户和角色的资料