2007 Mar 20 5:24 PM
Hello all,
I'm new to alv tree components and i meet some problems (hope someone will be able to help me).
&----
*& Form init_tree
&----
text
----
FORM init_tree.
DATA : gt_fieldcatalog type lvc_t_fcat.
DATA : wt_test TYPE TABLE OF zbudget_edit.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZBUDGET_EDIT'
CHANGING
ct_fieldcat = gt_fieldcatalog.
sort gt_fieldcatalog by scrtext_l.
change fieldcatalog
DATA : ls_fieldcatalog type lvc_s_fcat.
loop at gt_fieldcatalog into ls_fieldcatalog.
case ls_fieldcatalog-fieldname.
when 'KOSTLG' or 'KOSTL'.
ls_fieldcatalog-no_out = 'X'.
ls_fieldcatalog-key = ''.
endcase.
modify gt_fieldcatalog from ls_fieldcatalog.
endloop.
wt_test[] = wt_edit[]. "data tables
data ls_sort_wa type lvc_s_sort.
create sort-table
ls_sort_wa-spos = 1.
ls_sort_wa-fieldname = 'KOSTLG'.
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 = 'KOSTL'.
ls_sort_wa-up = 'X'.
ls_sort_wa-subtot = 'X'.
append ls_sort_wa to gt_sort.
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 = wt_test
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. "plus
Well, my problem is that program returns me an error (GETWA_NOT_ASSIGNED) when i add :
ls_sort_wa-spos = 2.
ls_sort_wa-fieldname = 'KOSTL'.
ls_sort_wa-up = 'X'.
ls_sort_wa-subtot = 'X'.
append ls_sort_wa to gt_sort.
In fact i'd like such an alv :
kostlg/kostl |--
|
kostlg1
kostl1
kostl2
kostlg2
etc etc...
I've been through many examples but didn't find why an error occurs.
Please help me guys,
Thank you.
Hello all,
I'm new to alv tree components and i meet some problems (hope someone will be able to help me).
&----
*& Form init_tree
&----
text
----
FORM init_tree.
DATA : gt_fieldcatalog type lvc_t_fcat.
DATA : wt_test TYPE TABLE OF zbudget_edit.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZBUDGET_EDIT'
CHANGING
ct_fieldcat = gt_fieldcatalog.
sort gt_fieldcatalog by scrtext_l.
change fieldcatalog
DATA : ls_fieldcatalog type lvc_s_fcat.
loop at gt_fieldcatalog into ls_fieldcatalog.
case ls_fieldcatalog-fieldname.
when 'KOSTLG' or 'KOSTL'.
ls_fieldcatalog-no_out = 'X'.
ls_fieldcatalog-key = ''.
endcase.
modify gt_fieldcatalog from ls_fieldcatalog.
endloop.
wt_test[] = wt_edit[]. "data tables
data ls_sort_wa type lvc_s_sort.
create sort-table
ls_sort_wa-spos = 1.
ls_sort_wa-fieldname = 'KOSTLG'.
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 = 'KOSTL'.
ls_sort_wa-up = 'X'.
ls_sort_wa-subtot = 'X'.
append ls_sort_wa to gt_sort.
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 = wt_test
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. "plus
Well, my problem is that program returns me an error (GETWA_NOT_ASSIGNED) when i add :
ls_sort_wa-spos = 2.
ls_sort_wa-fieldname = 'KOSTL'.
ls_sort_wa-up = 'X'.
ls_sort_wa-subtot = 'X'.
append ls_sort_wa to gt_sort.
In fact i'd like such an alv :
kostlg/kostl |--
|
kostlg1
kostl1
kostl2
kostlg2
etc etc...
I've been through many examples but didn't find why an error occurs.
Please help me guys,
Thank you.
2007 Mar 20 5:42 PM
Hi,
Make sure that KOSTL field is available in WT_TEST also.
aRs
2007 Mar 20 5:49 PM
Hello aRs,
Yes i'm sure KOSTL is available in WT_TEST.
The problem is that when i another element in GT_SORT, this error appears...
Thanks anyway
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |