12-14-2007 10:35 AM
Hi all,
Please guid me how to change the ALV grid output of a report to ALV Tree Hirarchical display.Requirement is to change the output from ALV Grid to Tree Hirarchy.
Thanks in advance.
Pavan
12-14-2007 10:39 AM
Hi Pavan,
Plz have a look at this for the sample program.
----
***INCLUDE ZDEMO_ALVTREEO01 .
----
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS1'.
SET TITLEBAR 'xxx'.
If ALVtree already exists then it mush not be re-created as this
will cause a runtime error.
IF gd_tree IS INITIAL.
Create ALVtree (must be performed within screen PBO module)
PERFORM create_alvtree_container.
PERFORM create_object_in_container.
PERFORM create_empty_alvtree_control.
PERFORM create_alvtree_hierarchy.
ENDIF.
CALL METHOD cl_gui_cfw=>flush.
ENDMODULE. " STATUS_0100 OUTPUT
----
INCLUDE ZDEMO_ALVTREEF01 *
----
&----
*& Form CREATE_ALVTREE_CONTAINER
&----
Create container for ALVtree report
----
form create_alvtree_container.
Create container for alv-tree
gd_tree_container_name = 'SCREEN_CONTAINER'.
create object gd_custom_container
exporting
container_name = gd_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'.
endif.
endform. " CREATE_ALVTREE_CONTAINER
&----
*& Form CREATE_OBJECT_IN_CONTAINER
&----
Create ALVtree object in container
----
form create_object_in_container.
Create tree control
create object gd_tree
exporting
parent = gd_custom_container
node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
item_selection = 'X'
no_html_header = ''
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'.
endif.
endform. " CREATE_OBJECT_IN_CONTAINER
&----
*& Form BUILD_REPORT_TITLE
&----
Build table for ALVtree header
----
<-> p1 Header details
<-> p2 Logo value
----
FORM build_report_title CHANGING
pt_report_title TYPE slis_t_listheader
pa_logo TYPE sdydo_value.
DATA: ls_line TYPE slis_listheader,
ld_date(10) TYPE c.
List Heading Line(TYPE H)
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-key "Not Used For This Type(H)
ls_line-info = 'PO ALVTree Display'.
APPEND ls_line TO pt_report_title.
Status Line(TYPE S)
ld_date(2) = sy-datum+6(2).
ld_date+2(1) = '/'.
ld_date3(2) = sy-datum4(2).
ld_date+5(1) = '/'.
ld_date+6(4) = sy-datum(4).
ls_line-typ = 'S'.
ls_line-key = 'Date'.
ls_line-info = ld_date.
APPEND ls_line TO pt_report_title.
Action Line(TYPE A)
CLEAR ls_line.
ls_line-typ = 'A'.
CONCATENATE 'Report: ' sy-repid INTO ls_line-info SEPARATED BY space.
APPEND ls_line TO pt_report_title.
ENDFORM. " BUILD_REPORT_TITLE
&----
*& Form CREATE_EMPTY_ALVTREE_CONTROL
&----
Create empty tree control
----
FORM create_empty_alvtree_control.
Create emty tree-control
CLEAR: it_emptytab.
REFRESH: it_emptytab.
CALL METHOD gd_tree->set_table_for_first_display
EXPORTING
is_hierarchy_header = gd_hierarchy_header
it_list_commentary = gd_report_title
i_logo = gd_logo
i_background_id = 'ALV_BACKGROUND'
i_save = 'A'
is_variant = gd_variant
CHANGING
it_outtab = it_emptytab "Must be empty
it_fieldcatalog = gd_fieldcat.
ENDFORM. " CREATE_EMPTY_ALVTREE_CONTROL
&----
*& Form CREATE_ALVTREE_HIERARCHY
&----
text
----
Builds ALV tree display, (inserts nodes, subnodes etc)
----
form create_alvtree_hierarchy.
data: ls_sflight type sflight,
lt_sflight type sflight occurs 0.
data: ld_ebeln_key type lvc_nkey,
ld_ebelp_key type lvc_nkey.
loop at it_ekko into wa_ekko.
perform add_ekko_node using wa_ekko
''
changing ld_ebeln_key.
loop at it_ekpo into wa_ekpo where ebeln eq wa_ekko-ebeln.
perform add_ekpo_line using wa_ekpo
ld_ebeln_key
changing ld_ebelp_key.
endloop.
endloop.
calculate totals
call method gd_tree->update_calculations.
this method must be called to send the data to the frontend
call method gd_tree->frontend_update.
endform. " CREATE_ALVTREE_HIERARCHY
&----
*& Form ADD_EKKO_NODE
&----
text
----
-->P_WA_EKPO text
-->P_0553 text
<--P_EBELN_KEY text
----
form add_ekko_node using ps_ekko like wa_ekko
value(p_relate_key)
changing p_node_key.
data: ld_node_text type lvc_value,
ls_sflight type sflight.
Set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-t_image = '@3P@'.
ls_item_layout-fieldname = gd_tree->c_hierarchy_column_name.
ls_item_layout-style = cl_gui_column_tree=>style_default.
ld_node_text = ps_ekko-ebeln.
append ls_item_layout to lt_item_layout.
Add node
call method gd_tree->add_node
exporting
i_relat_node_key = p_relate_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = ld_node_text
is_outtab_line = ps_ekko
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.
endform. " ADD_EKKO_NODE
&----
*& Form ADD_EKPO_LINE
&----
text
----
-->P_WA_EKPO text
-->P_LD_EBELN_KEY text
<--P_LD_EBELP_KEY text
----
form add_ekpo_line using ps_ekpo like wa_ekpo
value(p_relate_key)
changing p_node_key.
data: ld_node_text type lvc_value,
ls_sflight type sflight.
Set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-t_image = '@3P@'.
ls_item_layout-fieldname = gd_tree->c_hierarchy_column_name.
ls_item_layout-style = cl_gui_column_tree=>style_default.
ld_node_text = ps_ekpo-ebelp.
append ls_item_layout to lt_item_layout.
Add node
call method gd_tree->add_node
exporting
i_relat_node_key = p_relate_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = ld_node_text
is_outtab_line = ps_ekpo
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.
endform. " ADD_EKPO_LINE
Refer this link http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_basic.htm for more details.
Reward if useful.
Regards,
Chitra Parameswaran.
12-14-2007 10:39 AM
Hi Pavan,
Plz have a look at this for the sample program.
----
***INCLUDE ZDEMO_ALVTREEO01 .
----
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS1'.
SET TITLEBAR 'xxx'.
If ALVtree already exists then it mush not be re-created as this
will cause a runtime error.
IF gd_tree IS INITIAL.
Create ALVtree (must be performed within screen PBO module)
PERFORM create_alvtree_container.
PERFORM create_object_in_container.
PERFORM create_empty_alvtree_control.
PERFORM create_alvtree_hierarchy.
ENDIF.
CALL METHOD cl_gui_cfw=>flush.
ENDMODULE. " STATUS_0100 OUTPUT
----
INCLUDE ZDEMO_ALVTREEF01 *
----
&----
*& Form CREATE_ALVTREE_CONTAINER
&----
Create container for ALVtree report
----
form create_alvtree_container.
Create container for alv-tree
gd_tree_container_name = 'SCREEN_CONTAINER'.
create object gd_custom_container
exporting
container_name = gd_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'.
endif.
endform. " CREATE_ALVTREE_CONTAINER
&----
*& Form CREATE_OBJECT_IN_CONTAINER
&----
Create ALVtree object in container
----
form create_object_in_container.
Create tree control
create object gd_tree
exporting
parent = gd_custom_container
node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
item_selection = 'X'
no_html_header = ''
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'.
endif.
endform. " CREATE_OBJECT_IN_CONTAINER
&----
*& Form BUILD_REPORT_TITLE
&----
Build table for ALVtree header
----
<-> p1 Header details
<-> p2 Logo value
----
FORM build_report_title CHANGING
pt_report_title TYPE slis_t_listheader
pa_logo TYPE sdydo_value.
DATA: ls_line TYPE slis_listheader,
ld_date(10) TYPE c.
List Heading Line(TYPE H)
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-key "Not Used For This Type(H)
ls_line-info = 'PO ALVTree Display'.
APPEND ls_line TO pt_report_title.
Status Line(TYPE S)
ld_date(2) = sy-datum+6(2).
ld_date+2(1) = '/'.
ld_date3(2) = sy-datum4(2).
ld_date+5(1) = '/'.
ld_date+6(4) = sy-datum(4).
ls_line-typ = 'S'.
ls_line-key = 'Date'.
ls_line-info = ld_date.
APPEND ls_line TO pt_report_title.
Action Line(TYPE A)
CLEAR ls_line.
ls_line-typ = 'A'.
CONCATENATE 'Report: ' sy-repid INTO ls_line-info SEPARATED BY space.
APPEND ls_line TO pt_report_title.
ENDFORM. " BUILD_REPORT_TITLE
&----
*& Form CREATE_EMPTY_ALVTREE_CONTROL
&----
Create empty tree control
----
FORM create_empty_alvtree_control.
Create emty tree-control
CLEAR: it_emptytab.
REFRESH: it_emptytab.
CALL METHOD gd_tree->set_table_for_first_display
EXPORTING
is_hierarchy_header = gd_hierarchy_header
it_list_commentary = gd_report_title
i_logo = gd_logo
i_background_id = 'ALV_BACKGROUND'
i_save = 'A'
is_variant = gd_variant
CHANGING
it_outtab = it_emptytab "Must be empty
it_fieldcatalog = gd_fieldcat.
ENDFORM. " CREATE_EMPTY_ALVTREE_CONTROL
&----
*& Form CREATE_ALVTREE_HIERARCHY
&----
text
----
Builds ALV tree display, (inserts nodes, subnodes etc)
----
form create_alvtree_hierarchy.
data: ls_sflight type sflight,
lt_sflight type sflight occurs 0.
data: ld_ebeln_key type lvc_nkey,
ld_ebelp_key type lvc_nkey.
loop at it_ekko into wa_ekko.
perform add_ekko_node using wa_ekko
''
changing ld_ebeln_key.
loop at it_ekpo into wa_ekpo where ebeln eq wa_ekko-ebeln.
perform add_ekpo_line using wa_ekpo
ld_ebeln_key
changing ld_ebelp_key.
endloop.
endloop.
calculate totals
call method gd_tree->update_calculations.
this method must be called to send the data to the frontend
call method gd_tree->frontend_update.
endform. " CREATE_ALVTREE_HIERARCHY
&----
*& Form ADD_EKKO_NODE
&----
text
----
-->P_WA_EKPO text
-->P_0553 text
<--P_EBELN_KEY text
----
form add_ekko_node using ps_ekko like wa_ekko
value(p_relate_key)
changing p_node_key.
data: ld_node_text type lvc_value,
ls_sflight type sflight.
Set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-t_image = '@3P@'.
ls_item_layout-fieldname = gd_tree->c_hierarchy_column_name.
ls_item_layout-style = cl_gui_column_tree=>style_default.
ld_node_text = ps_ekko-ebeln.
append ls_item_layout to lt_item_layout.
Add node
call method gd_tree->add_node
exporting
i_relat_node_key = p_relate_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = ld_node_text
is_outtab_line = ps_ekko
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.
endform. " ADD_EKKO_NODE
&----
*& Form ADD_EKPO_LINE
&----
text
----
-->P_WA_EKPO text
-->P_LD_EBELN_KEY text
<--P_LD_EBELP_KEY text
----
form add_ekpo_line using ps_ekpo like wa_ekpo
value(p_relate_key)
changing p_node_key.
data: ld_node_text type lvc_value,
ls_sflight type sflight.
Set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-t_image = '@3P@'.
ls_item_layout-fieldname = gd_tree->c_hierarchy_column_name.
ls_item_layout-style = cl_gui_column_tree=>style_default.
ld_node_text = ps_ekpo-ebelp.
append ls_item_layout to lt_item_layout.
Add node
call method gd_tree->add_node
exporting
i_relat_node_key = p_relate_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = ld_node_text
is_outtab_line = ps_ekpo
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.
endform. " ADD_EKPO_LINE
Refer this link http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_basic.htm for more details.
Reward if useful.
Regards,
Chitra Parameswaran.
12-14-2007 10:39 AM
Hi,
Hope this sample code will help:
&----
*& Report Z_50657_ALV_EX4 *
*& *
&----
*& Program Name: Test Program for ALV *
Developer Name: ADCDEV (Rahul Kavuri ) *
Description: This program demonstrates Hierarchical List Display
*& using VBAP and VBAK as Item and Header Tables *
*& Date:12th April 2006
&----
REPORT Z_50657_ALV_EX4
NO STANDARD PAGE HEADING
LINE-COUNT 65(3)
LINE-SIZE 220
MESSAGE-ID ZZ.
************************************************************************
Type Pools *
************************************************************************
TYPE-POOLS: SLIS.
************************************************************************
Tables *
************************************************************************
TABLES: VBAK, "Sales Document: Header Data
VBAP. "Sales Document: Item Data
************************************************************************
Internal Tables *
************************************************************************
Internal table to hold data from VBAK
DATA: BEGIN OF IT_VBAK OCCURS 0,
VBELN LIKE VBAK-VBELN, "Sales Document
AUDAT LIKE VBAK-AUDAT, "Document date
AUART LIKE VBAK-AUART, "Sales Document Type
NETWR LIKE VBAK-NETWR, "Net Value of the Sales Order
EXPAND TYPE C,
END OF IT_VBAK.
Internal table to hold data from VBAP
DATA: BEGIN OF IT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN, "Sales Document
POSNR LIKE VBAP-POSNR, "Sales Document Item
MATNR LIKE VBAP-MATNR, "Material Number
PSTYV LIKE VBAP-PSTYV, "Sales document item category
CHARG LIKE VBAP-CHARG, "Batch Number
END OF IT_VBAP.
************************************************************************
Data Declarations and Variables *
************************************************************************
work area to retain fieldcatalog values and internal table for catalog
DATA: X_FIELDCAT_VBAK TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT_VBAK TYPE SLIS_T_FIELDCAT_ALV.
DATA: X_FIELDCAT_VBAP TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT_VBAP TYPE SLIS_T_FIELDCAT_ALV.
DATA: IT_KEYINFO TYPE SLIS_KEYINFO_ALV.
DATA: IT_HEADER TYPE SLIS_TABNAME,
IT_ITEM TYPE SLIS_TABNAME.
DATA: X_SORT TYPE SLIS_SORTINFO_ALV,
IT_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA: L_LAYOUT TYPE SLIS_LAYOUT_ALV.
************************************************************************
Selection-Screen *
************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
*Sales Document and Sales Document Type as input fields
SELECT-OPTIONS : S_VBELN FOR VBAK-VBELN,
S_AUART FOR VBAK-AUART.
SELECTION-SCREEN END OF BLOCK B1.
************************************************************************
INITIALIASATION *
************************************************************************
INITIALIZATION.
Assigning Internal Table Names
IT_HEADER = 'IT_VBAK'.
IT_ITEM = 'IT_VBAP'.
CLEAR IT_KEYINFO.
IT_KEYINFO-HEADER01 = 'VBELN'.
comparing the keys and relating the header and item internal tables
IT_KEYINFO-ITEM01 = 'VBELN'.
IT_KEYINFO-HEADER02 = SPACE.
IT_KEYINFO-ITEM02 = 'POSNR'.
************************************************************************
At Selection-Screen *
************************************************************************
AT SELECTION-SCREEN.
PERFORM VALIDATION.
************************************************************************
Start of Selection *
************************************************************************
START-OF-SELECTION.
*POPULATION OF DATA INTO INTERNAL TABLE ITAB
PERFORM GET_DATA.
*MERGE FIELDCATALOGUES OF IT_VBAP AND IT_VBAK
PERFORM FIELDCATALOG_MERGE.
*CHANGE LAYOUT ACCORDING TO THE REQUIREMENTS
PERFORM LAYOUT_CHG.
*USE SORT FUNCTION SO AS TO GET SUBTOTALS AND GRAND TOTAL
PERFORM SORT_FUNC.
*FINAL DISPLAY ACCORDING TO THE HIERARCHY
PERFORM FINAL_DISPLAY.
************************************************************************
End of Selection *
************************************************************************
FORM VALIDATION.
SELECT SINGLE VBELN
FROM VBAK
INTO VBAK-VBELN
WHERE VBELN IN S_VBELN.
IF SY-SUBRC <> 0.
MESSAGE I000 WITH 'NO SALES DOCUMENT RECORD FOUND'.
STOP.
ENDIF.
SELECT SINGLE AUART
FROM VBAK
INTO VBAK-AUART
WHERE AUART IN S_AUART.
IF SY-SUBRC <> 0.
MESSAGE I000 WITH 'THE MENTIONED DATE HAS NO RECORDS'.
STOP.
ENDIF.
ENDFORM. "VALIDATION
&----
*& Form GET_DATA
&----
text
----
FORM GET_DATA.
SELECT VBELN
AUDAT
AUART
NETWR FROM VBAK
INTO TABLE IT_VBAK
WHERE VBELN IN S_VBELN AND AUART IN S_AUART.
SORT IT_VBAK BY VBELN.
SELECT VBELN
POSNR
MATNR
PSTYV
CHARG FROM VBAP
INTO TABLE IT_VBAP
FOR ALL ENTRIES IN IT_VBAK
WHERE VBELN = IT_VBAK-VBELN.
ENDFORM. "GET_DATA
&----
*& Form FIELDCATALOG_MERGE
&----
text
----
FORM FIELDCATALOG_MERGE.
X_FIELDCAT_VBAK-FIELDNAME = 'NETWR'.
X_FIELDCAT_VBAK-TABNAME = 'IT_VBAK'.
X_FIELDCAT_VBAK-DO_SUM = 'X'.
APPEND X_FIELDCAT_VBAK TO IT_FIELDCAT_VBAK.
CLEAR X_FIELDCAT_VBAK.
X_FIELDCAT_VBAK-FIELDNAME = 'AUART'.
X_FIELDCAT_VBAK-TABNAME = 'IT_VBAK'.
APPEND X_FIELDCAT_VBAK TO IT_FIELDCAT_VBAK.
CLEAR X_FIELDCAT_VBAK.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_VBAK'
I_INCLNAME = SY-REPID
CHANGING
CT_FIELDCAT = IT_FIELDCAT_VBAK.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_VBAP'
I_INCLNAME = SY-REPID
CHANGING
CT_FIELDCAT = IT_FIELDCAT_VBAK.
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. "FIELDCATALOG_MERGE
&----
*& Form LAYOUT_CHG
&----
text
----
FORM LAYOUT_CHG.
L_LAYOUT-ZEBRA = 'X'.
L_LAYOUT-SUBTOTALS_TEXT = 'SUBTOTAL'.
L_LAYOUT-TOTALS_TEXT = 'TOTAL'.
L_LAYOUT-EXPAND_FIELDNAME = 'EXPAND'.
L_LAYOUT-EXPAND_ALL = 'X'.
ENDFORM. "LAYOUT_CHG
&----
*& Form SORT_FUNC
&----
text
----
FORM SORT_FUNC.
X_SORT-SPOS = 1.
X_SORT-FIELDNAME = 'AUART'.
X_SORT-TABNAME = 'IT_VBAK'.
X_SORT-UP = 'X'.
APPEND X_SORT TO IT_SORT.
CLEAR X_SORT.
X_SORT-SPOS = 2.
X_SORT-FIELDNAME = 'NETWR'.
X_SORT-TABNAME = 'IT_VBAK'.
X_SORT-UP = 'X'.
X_SORT-SUBTOT = 'X'.
APPEND X_SORT TO IT_SORT.
CLEAR X_SORT.
ENDFORM. "SORT_FUNC
&----
*& Form FINAL_DISPLAY
&----
text
----
FORM FINAL_DISPLAY.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = IT_FIELDCAT_VBAK
IT_SORT = IT_SORT
I_TABNAME_HEADER = IT_HEADER
I_TABNAME_ITEM = IT_ITEM
IS_KEYINFO = IT_KEYINFO
TABLES
T_OUTTAB_HEADER = IT_VBAK
T_OUTTAB_ITEM = IT_VBAP
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
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. "FINAL_DISPLAY
Reward points if found helpful ..
Cheers,
Chandra Sekhar.
12-14-2007 10:40 AM
go thru dis program for heirachical tree
BCALV_TREE_01
hope dis helps..
reward if it does