soo immernoch gleiches Thema
aber schon ein stückchen weiter.
ich habe jetzt über CL_ITEM_TREE_MODEL einen Tree erstellt, der auch Daten anzeigt (Anhang)
mein Problem: Die erste Stufe ist ok - Ordner mit MATERIALNUMMERN - nun gibt es Unterpositionen (wie bei 96012944) diese Unterpositionen sollen allerdings bei allen Ordnern erscheinen??? krieg das nich hin..
hier mein Code:
CLEAR: node_key,
sy-index.
SORT gt_material BY matnr DESCENDING.
LOOP AT gt_material INTO ls_t_material.
node_key = sy-index.
CLEAR item_table.
CLEAR item.
item-item_name = 'Column1'.
item-class = cl_column_tree_model=>item_class_text.
item-text = ls_t_material-matnr+10(8). "#EC NOTEXT
APPEND item TO item_table.
CLEAR item.
item-item_name = 'Column2'.
item-class = cl_column_tree_model=>item_class_text.
item-text = ls_t_material-maktx. "#EC NOTEXT
APPEND item TO item_table.
CLEAR item.
item-item_name = 'Column3'.
item-class = cl_column_tree_model=>item_class_text.
item-text = ls_t_material-werks. "#EC NOTEXT
APPEND item TO item_table.
CLEAR item.
item-item_name = 'Column4'.
item-class = cl_column_tree_model=>item_class_text.
item-text = ls_t_material-lblab. "#EC NOTEXT
APPEND item TO item_table.
CLEAR item.
item-item_name = 'Column5'.
item-class = cl_column_tree_model=>item_class_text.
item-text = ls_t_material-bedar. "#EC NOTEXT
APPEND item TO item_table.
CLEAR item.
item-item_name = 'Column6'.
item-class = cl_column_tree_model=>item_class_text.
item-text = ls_t_material-verfb. "#EC NOTEXT
APPEND item TO item_table.
CLEAR item.
item-item_name = 'Column7'.
item-class = cl_column_tree_model=>item_class_text.
item-text = ls_t_material-mein1. "#EC NOTEXT
APPEND item TO item_table.
CALL METHOD g_tree->add_node
EXPORTING
node_key = node_key "#EC NOTEXT
isfolder = 'X'
item_table = item_table
EXCEPTIONS
node_key_exists = 1
node_key_empty = 2
illegal_relationship = 3
relative_node_not_found = 4
error_in_item_table = 5.
IF sy-subrc <> 0.
* message a001.
ENDIF.
sy-index = sy-index + 1.
CLEAR: ls_t_material.
ENDLOOP.
LOOP AT gt_material INTO ls_t_material.
* Node with key 'Child1'
IF ls_t_material-ebeln IS INITIAL.
CLEAR: sy-index,
node_key.
node_key = sy-index.
CLEAR item_table.
CLEAR item.
item-item_name = 'Column1'.
item-class = cl_column_tree_model=>item_class_text.
item-text = ls_t_material-ebeln. "#EC NOTEXT
APPEND item TO item_table.
CLEAR item.
item-item_name = 'Column2'.
item-class = cl_column_tree_model=>item_class_text.
item-text = ls_t_material-ebelp. "#EC NOTEXT
APPEND item TO item_table.
CLEAR item.
item-item_name = 'Column3'.
item-class = cl_column_tree_model=>item_class_text.
item-text = ls_t_material-werks. "#EC NOTEXT
APPEND item TO item_table.
CLEAR item.
item-item_name = 'Column4'.
item-class = cl_column_tree_model=>item_class_text.
item-text = space. "#EC NOTEXT
APPEND item TO item_table.
CLEAR item.
item-item_name = 'Column5'.
item-class = cl_column_tree_model=>item_class_text.
item-text = ls_t_material-bdmng. "#EC NOTEXT
APPEND item TO item_table.
CLEAR item.
item-item_name = 'Column6'.
item-class = cl_column_tree_model=>item_class_text.
item-text = space. "#EC NOTEXT
APPEND item TO item_table.
CLEAR item.
item-item_name = 'Column7'.
item-class = cl_column_tree_model=>item_class_text.
item-text = ls_t_material-mein2. "#EC NOTEXT
APPEND item TO item_table.
CLEAR item.
item-item_name = 'Column8'.
item-class = cl_column_tree_model=>item_class_text.
item-text = ls_t_material-bdter. "#EC NOTEXT
APPEND item TO item_table.
CALL METHOD g_tree->add_node
EXPORTING
node_key = 'Child1' "#EC NOTEXT
relative_node_key = node_key "#EC NOTEXT
relationship = cl_tree_model=>relat_last_child
isfolder = ' '
item_table = item_table
EXCEPTIONS
node_key_exists = 1
node_key_empty = 2
illegal_relationship = 3
relative_node_not_found = 4
error_in_item_table = 5.
IF sy-subrc <> 0.
* MESSAGE a001.
ENDIF.
ENDIF.
sy-index = sy-index + 1.
CLEAR: ls_t_material.
ENDLOOP.
Gruß Sp89
aktuell.JPG