2010 Jul 20 12:01 PM
Hi Guys,
I'm trying to display data in alv tree.it is 2 level tree(i.e. header and details).But it is showing only the headers.If I comment the part where header is added,then all items are displayed.I guess somehow levels of tree is getting set as 1.
Please help me on the same
2010 Jul 20 12:15 PM
Hi Vivek ,
Please use the code below for reference ..
*& 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
You can refer to the whole code in link:[http://www.sapdev.co.uk/reporting/alv/alvtree/alvtree_basic.htm]
Hope this helps.
Regards,
Chitra
Hi Guys,
I'm trying to display data in alv tree.it is 2 level tree(i.e. header and details).But it is showing only the headers.If I comment the part where header is added,then all items are displayed.I guess somehow levels of tree is getting set as 1.
Please help me on the same
2010 Jul 20 12:15 PM
Hi Vivek ,
Please use the code below for reference ..
*& 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
You can refer to the whole code in link:[http://www.sapdev.co.uk/reporting/alv/alvtree/alvtree_basic.htm]
Hope this helps.
Regards,
Chitra
2010 Jul 20 12:19 PM
Hi,
This is a basic question.
There are several standard reports in your SAP system. Look for BCALVTREE in se38.
May it helps you.
Regards.
DS.
2010 Jul 21 6:14 AM
Thansk Deepak for your reply.
I've been trying.but not finding anything.In another program that I had created,it is working perfectly fine.and i've taken code from there only.This is a already existing module pool in which i'm trying to add a new modal screen.But at any time only one level of hierarchy is displaying only.How to solve that
2010 Jul 21 6:41 AM
Hi,
Well you can visit this links for your reference.
[ALV tree|http://www.sapdev.co.uk/reporting/alv/alvtree/alvtree_mainsetup.htm]
You can find more help on ALV tree through this link.
Furthermore you can get sample codes of alv tree on sap-technical and other useful sites like abapprogramming.
May it helps you.
Regards.
DS
2012 Jan 12 6:38 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |