2007 May 04 5:09 AM
Hi,
Is it possible to make my alv Tree ediabtle on a cell or colomn basis.
If yes, can anybody give some examples....Full Marks
Regards,
Gaurav.
Hi,
Is it possible to make my alv Tree ediabtle on a cell or colomn basis.
If yes, can anybody give some examples....Full Marks
Regards,
Gaurav.
2007 May 04 5:13 AM
Hi Gaurav.
Check the programs, start with BCALV.
It wil be useful to you.
Thanks.
Message was edited by:
Eashwar Subramanian
2007 May 04 5:17 AM
2007 May 04 5:50 AM
Hi Gaurav,
use this class :
"CL_GUI_COLUMN_TREE"
Refer this code :
data :CUS_CNTR TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
SPLIT_CNTR TYPE REF TO CL_GUI_EASY_SPLITTER_CONTAINER,
data : TREE TYPE REF TO CL_GUI_COLUMN_TREE,
*&----CREATING OBJECT FOR MAIN CUSTOM CONTAINER HAVING NAME
*&----'CUSTOM_CONTROL'
CREATE OBJECT cus_cntr
EXPORTING
PARENT =
container_name = 'CUSTOM_CONTROL'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CREATE OBJECT split_cntr
EXPORTING
LINK_DYNNR =
LINK_REPID =
METRIC = cntl_metric_dynpro
parent = cus_cntr
orientation = 1
sash_position = 40
with_border = 1
NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " BUILD_CONTAINER
&----
*& Form TREE_STRUCTURE
&----
text
----
--> p1 text
<-- p2 text
----
FORM tree_structure .
*FOR COLUMN HEADING OF COLUMN TREE
hhdr-heading = 'Object Name'.
hhdr-width = 40.
*&-----CREATING OBJECT FOR TREE STRUCTURE FOR TOP LEFT SPLITTER
*&-----CONTAINER
CREATE OBJECT tree
EXPORTING
LIFETIME =
parent = split_cntr->top_left_container
SHELLSTYLE =
node_selection_mode =
cl_gui_column_tree=>node_sel_mode_single
HIDE_SELECTION =
item_selection = 'X'
hierarchy_column_name = 'COLUMN1'
hierarchy_header = hhdr
NO_HIERARCHY_COLUMN =
NAME =
EXCEPTIONS
LIFETIME_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
ILLEGAL_NODE_SELECTION_MODE = 4
FAILED = 5
ILLEGAL_COLUMN_NAME = 6
others = 7
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*&----CALLING METHOD FOR ADDING COLUMN IN TREE
CALL METHOD tree->add_column
EXPORTING
name = 'COLUMN2'
HIDDEN =
DISABLED =
ALIGNMENT =
width = 40
WIDTH_PIX =
HEADER_IMAGE =
header_text = 'Description'
HEADER_TOOLTIP =
EXCEPTIONS
COLUMN_EXISTS = 1
ILLEGAL_COLUMN_NAME = 2
TOO_MANY_COLUMNS = 3
ILLEGAL_ALIGNMENT = 4
DIFFERENT_COLUMN_TYPES = 5
CNTL_SYSTEM_ERROR = 6
FAILED = 7
PREDECESSOR_COLUMN_NOT_FOUND = 8
others = 9
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
.
***&---ASSIGNING TEXT AND OTHER ATTRIBUTES TO THE NODES OF TREE
DATA : node TYPE mtreesnode,
item TYPE mtreeitm.
REFRESH : item_table , node_table.
prog_name = trdir-name.
CLEAR i_objlist.
*ROOT NODE
CLEAR node.
node-node_key = '001'.
node-isfolder = 'X'.
node-expander = 'X'.
APPEND node TO node_table.
CLEAR item.
item-node_key = '001'.
item-item_name = 'COLUMN1'.
item-class = cl_gui_column_tree=>item_class_text.
item-text = prog_name.
APPEND item TO item_table.
CLEAR item.
item-node_key = '001'.
item-item_name = 'COLUMN2'.
item-class = cl_gui_column_tree=>item_class_text.
item-text = p_text.
APPEND item TO item_table.
*Dict.Structures
READ TABLE i_objlist WITH KEY type = 'T'.
IF sy-subrc = 0.
CLEAR node.
node-node_key = '111'.
node-relatkey = '001'.
node-relatship = cl_gui_column_tree=>relat_first_child.
node-isfolder = 'X'.
node-expander = 'X'.
APPEND node TO node_table.
CLEAR item.
item-node_key = '111'.
item-item_name = 'COLUMN1'.
item-class = cl_gui_column_tree=>item_class_text.
item-text ='Dict.Structures'.
APPEND item TO item_table.
ENDIF.
*Types
READ TABLE i_objlist WITH KEY type = 'Y'.
IF sy-subrc = 0.
CLEAR node.
node-node_key = '112'.
node-relatkey = '001'.
node-relatship = cl_gui_column_tree=>relat_first_child.
node-isfolder = 'X'.
node-expander = 'X'.
APPEND node TO node_table.
CLEAR item.
item-node_key = '112'.
item-item_name = 'COLUMN1'.
item-class = cl_gui_column_tree=>item_class_text.
item-text ='Types'.
APPEND item TO item_table.
ENDIF.
*Fields
READ TABLE i_objlist WITH KEY type = 'D'.
IF sy-subrc = 0.
CLEAR node.
node-node_key = '113'.
node-relatkey = '001'.
node-relatship = cl_gui_column_tree=>relat_first_child.
node-isfolder = 'X'.
node-expander = 'X'.
APPEND node TO node_table.
CLEAR item.
item-node_key = '113'.
item-item_name = 'COLUMN1'.
item-class = cl_gui_column_tree=>item_class_text.
item-text ='Fields'.
APPEND item TO item_table.
ENDIF.
****Events
***READ TABLE I_OBJLIST WITH KEY TYPE = 'Z'.
***IF SY-SUBRC = 0.
CLEAR node.
node-node_key = '114'.
node-relatkey = '001'.
node-relatship = cl_gui_column_tree=>relat_first_child.
node-expander = 'X'.
APPEND node TO node_table.
***
CLEAR item.
item-node_key = '114'.
item-item_name = 'COLUMN1'.
item-class = cl_gui_column_tree=>item_class_text.
item-text ='Events'.
APPEND item TO item_table.
***ENDIF.
*Screens
READ TABLE i_objlist WITH KEY type = 'S'.
IF sy-subrc = 0.
CLEAR node.
node-node_key = '115'.
node-relatkey = '001'.
node-relatship = cl_gui_column_tree=>relat_first_child.
node-expander = 'X'.
APPEND node TO node_table.
CLEAR item.
item-node_key = '115'.
item-item_name = 'COLUMN1'.
item-class = cl_gui_column_tree=>item_class_text.
item-text ='Screens'.
APPEND item TO item_table.
ENDIF.
*Transactions
IF i_tcode IS NOT INITIAL.
CLEAR node.
node-node_key = '116'.
node-relatkey = '001'.
node-relatship = cl_gui_column_tree=>relat_first_child.
node-expander = 'X'.
APPEND node TO node_table.
CLEAR item.
item-node_key = '116'.
item-item_name = 'COLUMN1'.
item-class = cl_gui_column_tree=>item_class_text.
item-text ='Transactions'.
APPEND item TO item_table.
ENDIF.
*Includes
IF i_incl IS NOT INITIAL.
CLEAR node.
node-node_key = '117'.
node-relatkey = '001'.
node-relatship = cl_gui_column_tree=>relat_first_child.
node-expander = 'X'.
APPEND node TO node_table.
CLEAR item.
item-node_key = '117'.
item-item_name = 'COLUMN1'.
item-class = cl_gui_column_tree=>item_class_text.
item-text ='Includes'.
APPEND item TO item_table.
ENDIF.
*CLASS(DEFINITION)
READ TABLE i_objlist WITH KEY type = 'L'.
IF sy-subrc = 0.
CLEAR node.
node-node_key = '118'.
node-relatkey = '001'.
node-relatship = cl_gui_column_tree=>relat_first_child.
node-isfolder = 'X'.
node-expander = 'X'.
APPEND node TO node_table.
CLEAR item.
item-node_key = '118'.
item-item_name = 'COLUMN1'.
item-class = cl_gui_column_tree=>item_class_text.
item-text ='Class(Definition)'.
APPEND item TO item_table.
ENDIF.
*CLASS(IMPLEMENTATION)
READ TABLE i_objlist WITH KEY type = 'P'.
IF sy-subrc = 0.
CLEAR node.
node-node_key = '119'.
node-relatkey = '001'.
node-relatship = cl_gui_column_tree=>relat_first_child.
node-isfolder = 'X'.
node-expander = 'X'.
APPEND node TO node_table.
CLEAR item.
item-node_key = '119'.
item-item_name = 'COLUMN1'.
item-class = cl_gui_column_tree=>item_class_text.
item-text ='Class(Implementation)'.
APPEND item TO item_table.
ENDIF.
*PBO
READ TABLE i_objlist WITH KEY type = 'O'.
IF sy-subrc = 0.
CLEAR node.
node-node_key = '120'.
node-relatkey = '001'.
node-relatship = cl_gui_column_tree=>relat_first_child.
node-expander = 'X'.
APPEND node TO node_table.
CLEAR item.
item-node_key = '120'.
item-item_name = 'COLUMN1'.
item-class = cl_gui_column_tree=>item_class_text.
item-text ='PBO Module'.
APPEND item TO item_table.
ENDIF.
*PAI
READ TABLE i_objlist WITH KEY type = 'M'.
IF sy-subrc = 0.
CLEAR node.
node-node_key = '121'.
node-relatkey = '001'.
node-relatship = cl_gui_column_tree=>relat_first_child.
node-expander = 'X'.
APPEND node TO node_table.
CLEAR item.
item-node_key = '121'.
item-item_name = 'COLUMN1'.
item-class = cl_gui_column_tree=>item_class_text.
item-text ='PAI Module'.
APPEND item TO item_table.
ENDIF.
*SUBROUTINES
READ TABLE i_objlist WITH KEY type = 'U'.
IF sy-subrc = 0.
CLEAR node.
node-node_key = '122'.
node-relatkey = '001'.
node-relatship = cl_gui_column_tree=>relat_first_child.
node-expander = 'X'.
APPEND node TO node_table.
CLEAR item.
item-node_key = '122'.
item-item_name = 'COLUMN1'.
item-class = cl_gui_column_tree=>item_class_text.
item-text ='Subroutines'.
APPEND item TO item_table.
ENDIF.
*GUI STATUS
READ TABLE i_objlist WITH KEY type = 'C'.
IF sy-subrc = 0.
CLEAR node.
node-node_key = '123'.
node-relatkey = '001'.
node-relatship = cl_gui_column_tree=>relat_first_child.
node-expander = 'X'.
APPEND node TO node_table.
CLEAR item.
item-node_key = '123'.
item-item_name = 'COLUMN1'.
item-class = cl_gui_column_tree=>item_class_text.
item-text ='GUI Status'.
APPEND item TO item_table.
ENDIF.
CALL METHOD tree->add_nodes_and_items
EXPORTING
node_table = node_table
item_table = item_table
item_table_structure_name = 'MTREEITM'
EXCEPTIONS
failed = 1
cntl_system_error = 2
error_in_tables = 3
dp_error = 4
table_structure_name_not_found = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " TREE_STRUCTURE
Reward points if helpful.
Regards,
Hemant
2007 May 04 6:06 AM
hi
good
ALV Tree Can be editable,
follow the below process.
1- Go to Se38
2-put BCALV*
3-press F4
you ll find lots of example related to ALV TREE,test them and use them as per your requirement.
thanks
mrutyun^
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |