2008 Jul 15 9:40 AM
Hi All,
Please can anybody explain how to get sum and totals in ALV tree list display, when use FM 'RS_TREE_LIST_DISPLAY'.
Thanks.
Hi All,
Please can anybody explain how to get sum and totals in ALV tree list display, when use FM 'RS_TREE_LIST_DISPLAY'.
Thanks.
2008 Jul 15 9:50 AM
hi ,
this code will help you to constuct alv treee...
Tree Alv
&----
*& Report ZPRITREE2
*&
&----
*&
*&
&----
REPORT ZPRITREE2.
parameters: p_werks like marc-werks.
type pool declarations for tree
*type-pools : fibs,stree.
*Data declaration for additional node information
data : t_node type snodetext.
*Internal table and wa decl for nodes
data : it_node like table of t_node initial size 0,
wa_node like t_node.
*Internal table and wa decl for Education table PA0022
data : itab_mara type standard table of marc initial size 0,
wa_mara like line of itab_mara .
*Internal table and wa decl for text table t517x
data : it_maktx type standard table of makt initial size 0,
wa_maktx like line of it_maktx.
*Internal table and wa decl for text table t517T
data : it_lgort type standard table of mard initial size 0,
wa_lgort like line of it_lgort.
*Internal table and wa decl for text table t519T
data : it_519t type standard table of t519t initial size 0,
wa_519t type t519t.
*initialization event
initialization.
*Start of selection event
start-of-selection.
*Select the data for tree
perform fetch_data.
*Build the hierarchy for tree
perform build_hierarchy.
*Build Tree for display
perform build_tree.
&----
*& Form fetch_data
&----
text
----
--> p1 text
<-- p2 text
----
form fetch_data .
*select data from PA0022
select * from marc into corresponding fields of table itab_mara up to 50
rows where werks = P_werks.
*select data from T517x
select * from makt into corresponding fields of table it_maktx .
where langu = 'E'.
*select data from T517T
select * from mard into corresponding fields of table it_lgort .
endform. " fetch_data
&----
*& Form build_hierarchy
&----
text
----
--> p1 text
<-- p2 text
----
form build_hierarchy .
*Building the nodes and hierarchy for tree
clear : it_node[], wa_node.
wa_node-type = 'T'.
wa_node-name = 'plant'.
wa_node-tlevel = '01'.
wa_node-nlength = '15'.
wa_node-color = '4'.
wa_node-text = p_werks.
wa_node-tlength ='20'.
wa_node-tcolor = 3.
append wa_node to it_node.
clear wa_node.
*Filling the values of internal table into tree
loop at itab_mara into wa_mara.
wa_node-type = 'P'.
wa_node-name = 'material'.
wa_node-tlevel = '02'.
wa_node-nlength = '8'.
wa_node-color = '1'.
wa_node-text = wa_mara-matnr.
wa_node-tlength ='20'.
wa_node-tcolor = 4.
append wa_node to it_node.
clear wa_node.
*
*Filling the text of T517t
break devuser.
read table it_maktx into wa_maktx with key matnr = wa_mara-matnr.
wa_node-type = 'P'.
wa_node-name = 'description'.
wa_node-tlevel = '03'.
wa_node-nlength = '15'.
wa_node-color = '1'.
wa_node-text = wa_maktx-maktx.
wa_node-tlength ='40'.
wa_node-tcolor = 4.
append wa_node to it_node.
clear wa_node.
*Filling the text of T519t
read table it_lgort into wa_lgort with key matnr = wa_mara-matnr werks
= p_werks .
wa_node-type = 'P'.
wa_node-name = 'storage location'.
wa_node-tlevel = '03'.
wa_node-nlength = '25'.
wa_node-color = '2'.
wa_node-text = wa_lgort-lgort.
wa_node-tlength ='40'.
wa_node-tcolor = 4.
append wa_node to it_node.
clear wa_node.
endloop.
endform. " build_hierarchy
&----
*& Form build_tree
&----
text
----
--> p1 text
<-- p2 text
----
form build_tree .
*Fm for constructing the tree
call function 'RS_TREE_CONSTRUCT'
tables
nodetab = it_node.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*FM for displaying the tree
call function 'RS_TREE_LIST_DISPLAY'
exporting
callback_program = sy-repid
check_duplicate_name = '1'
color_of_node = '4'
color_of_mark = '3'
color_of_link = '1'
color_of_match = '5'
node_length = 30
text_length = 75
use_control = 'L'.
endform. " build_tree
.....
and wat you want to further achive please explain...
priyank dixit
2008 Jul 15 9:56 AM
Thanks for the reply.
I urgently need how to get the sum and totals if there are currency nodes.
Thanks.
2008 Jul 15 9:56 AM
Hi,
The FM RS_TREE_LIST_DISPLAY is not for ALV kind of Function module. The FM is just used to display some contents in tree format. Unfortunately it dont have the option to total or subtotal any values.
If you want all these options in a Tree then you should go for Object oriented ALV for Tree.
Check the following programs on how they used the Tree display for ALV
BCALV_TREE_01
BCALV_TREE_03
BCALV_TREE_05
BCALV_TREE_06
BCALV_TREE_DEMO
Else.,
you need to calculate the total yourself and add it as a value for each node in the tree.
Cheers
Kothand
2008 Jul 21 12:32 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |