ALV Tree and set_table_for_first_display problem
I am trying to create an alv tree. I have some sample code that uses the sflight table and this works fine however when i replace sflight with my internal structure and table it crashes at set_table_for_first_display with a "Field symbol has not been assigned" error.
This is part of the original code that works. *This isn't all the code just the relevant parts.
DATA: gt_sflight TYPE sflight OCCURS 0, " Output-Table
gt_fieldcatalog TYPE lvc_t_fcat, " Field Catalog
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'sflight'
CHANGING
ct_fieldcat = gt_fieldcatalog.
* change fieldcatalog
DATA: ls_fieldcatalog TYPE lvc_s_fcat.
LOOP AT gt_fieldcatalog INTO ls_fieldcatalog.
CASE ls_fieldcatalog-fieldname.
WHEN 'CARRID' OR 'CONNID' OR 'FLDATE'.
ls_fieldcatalog-no_out = 'X'.
ls_fieldcatalog-key = ''.
WHEN 'PRICE' OR 'SEATSOCC' OR 'SEATSMAX' OR 'PAYMENTSUM'.
ls_fieldcatalog-do_sum = 'X'.
ENDCASE.
MODIFY gt_fieldcatalog FROM ls_fieldcatalog.
ENDLOOP.
SELECT * FROM sflight INTO TABLE gt_sflight.
create hierarchy
CALL METHOD tree1->set_table_for_first_display
EXPORTING
it_list_commentary = lt_list_commentary
i_logo = l_logo
i_background_id = 'ALV_BACKGROUND'
i_save = 'A'
is_variant = ls_variant
CHANGING
it_sort = gt_sort
it_outtab = gt_sflight
it_fieldcatalog = gt_fieldcatalog.
Here is the code when I replace gt_sflight with my internal table.
DATA: gt_detailed TYPE ZDT_REPORT1_DETAIL_STRUC occurs 0 , " Output-Table
gt_fieldcatalog TYPE lvc_t_fcat, " Field Catalog
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZDT_REPORT1_DETAIL_STRUC'
CHANGING
ct_fieldcat = gt_fieldcatalog
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
"* change fieldcatalog
DATA: ls_fieldcatalog TYPE lvc_s_fcat.
LOOP AT gt_fieldcatalog INTO ls_fieldcatalog.
CASE ls_fieldcatalog-fieldname.
WHEN 'COMP_DESC' OR 'SUBC_DESC'.
ls_fieldcatalog-no_out = 'X'.
ls_fieldcatalog-key = ''.
WHEN 'DOWNTIME'.
ls_fieldcatalog-do_sum = 'X'.
ENDCASE.
MODIFY gt_fieldcatalog FROM ls_fieldcatalog.
ENDLOOP.
" Select statement to fill gt_detailed
* create hierarchy
CALL METHOD tree1->set_table_for_first_display
EXPORTING
it_list_commentary = lt_list_commentary
i_logo = l_logo
i_background_id = 'ALV_BACKGROUND'
i_save = 'A'
is_variant = ls_variant
CHANGING
it_sort = gt_sort
it_outtab = gt_detailed
it_fieldcatalog = gt_fieldcatalog.
When it runs like this it crashes at set_table_for_first_display
The code I am using as an example is BCALV_TREE_SIMPLE_DEMO. If I have no data in my table it doesn't error when I call set_table_for_first_display.
But it looks like I might have to use that one instead because from what I understand you can use cl_gui_alv_tree_simple when the input table has all the required columns such as sflight but you use cl_gui_alv_tree when you need an internal table.
Similar Messages
-
Report with ALV tree and ALV list?
I need to create a report with layout as same as this one
[http://trangiegie.com/MyFile/output.JPG]
It looks like a report with combination of ALV tree and list. The tree works like a navigation bar. Wonder if there are any demo programs like this. Will appreciate any help.For Tree alone - You can check program : BCALV_TREE_02
Program Name Report title
BCALV_GRID_DND_TREE ALV Grid: Drag and Drop with ALV Tree
BCALV_GRID_DND_TREE_SIMPLE ALV GRID: Drag and drop with ALV tree (simple)
BCALV_TEST_COLUMN_TREE Program BCALV_TEST_COLUMN_TREE
BCALV_TEST_SIMPLE_TREE Program BCALV_TEST_SIMPLE_TREE
BCALV_TREE_01 ALV Tree Control: Build Up the Hierarchy Tree
BCALV_TREE_02 ALV Tree Control: Event Handling
BCALV_TREE_03 ALV Tree Control: Use an Own Context Menu
BCALV_TREE_04 ALV Tree Control: Add a Button to the Toolbar
BCALV_TREE_05 ALV Tree Control: Add a Menu to the Toolbar
BCALV_TREE_06 ALV tree control: Icon column and icon for nodes/items
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_DND ALV tree control: Drag & Drop within a hierarchy tree
BCALV_TREE_DND_MULTIPLE ALV tree control: Drag & Drop within a hierarchy tree
BCALV_TREE_EVENT_RECEIVER Include BCALV_TREE_EVENT_RECEIVER
BCALV_TREE_EVENT_RECEIVER01
BCALV_TREE_ITEMLAYOUT ALV Tree: Change Item Layouts at Runtime
BCALV_TREE_MOVE_NODE_TEST Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO Program BCALV_TREE_SIMPLE_DEMO
BCALV_TREE_VERIFY Verifier for ALV Tree and Simple ALV Tree -
ALV Tree - register event problem
Hi,
I'm trying to register standard events for ALV Tree. when perform register_events it raises exception 'illegal event combination'. does anybody know what is wrong it this code ?
***INCLUDE ZNT_SLORDERHIER_STATUS_0100O01 .
*& Module STATUS_0100 OUTPUT
* text
module STATUS_0100 output.
set pf-status 'MAIN100'.
if tree1 is initial.
perform f_init_tree.
endif.
call method cl_gui_cfw=>flush.
endmodule. " STATUS_0100 OUTPUT
form register_events.
* define the events which will be passed to the backend
data: lt_events type cntl_simple_events,
l_event type cntl_simple_event.
* define the events which will be passed to the backend
l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
append l_event to lt_events.
call method tree1->set_registered_events
exporting
events = lt_events
exceptions
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
if sy-subrc <> 0.
call function 'POPUP_TO_DISPLAY_TEXT_LO'
exporting
titel = 'Error number:'
textline1 = sy-subrc
start_column = 1
start_row = 6. "#EC NOTEXT
endif.
endform. " register_events
form f_init_tree.
perform f_build_fieldcatalog.
* create container for alv-tree
data: l_tree_container_name(30) type c,
l_custom_container type ref to cl_gui_custom_container.
l_tree_container_name = 'TREE1'.
if sy-batch is initial.
create object l_custom_container
exporting
container_name = l_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'. "#EC NOTEXT
endif.
endif.
* create tree control
create object tree1
exporting
parent = l_custom_container
node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple
item_selection = space
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'. "#EC NOTEXT
endif.
* create Hierarchy-header
data l_hierarchy_header type treev_hhdr.
perform f_build_hierarchy_header changing l_hierarchy_header.
* create info-table for html-header
data: lt_list_commentary type slis_t_listheader,
l_logo type sdydo_value.
perform f_build_comment using
lt_list_commentary
l_logo.
* repid for saving variants
data: ls_variant type disvariant.
ls_variant-report = sy-repid.
CLEAR gt_sorder[].
* create emty tree-control
call method tree1->set_table_for_first_display
exporting
is_hierarchy_header = l_hierarchy_header
it_list_commentary = lt_list_commentary
i_logo = l_logo
i_background_id = 'ALV_BACKGROUND'
i_save = 'A'
is_variant = ls_variant
changing
it_outtab = gt_sorder "table must be emty !!
it_fieldcatalog = gt_fieldcatalog.
* create hierarchy
perform f_create_hierarchy.
perform register_events.
endform. " init_tree
form f_build_fieldcatalog.
DATA gs_fieldcat LIKE LINE OF gt_fieldcatalog.
* get fieldcatalog
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'ZVNT_SLALVTREE'
changing
ct_fieldcat = gt_fieldcatalog.
clear gs_fieldcat.
endform.
form f_build_hierarchy_header changing
p_hierarchy_header type treev_hhdr.
p_hierarchy_header-heading = 'Hierarchy Header'. "#EC NOTEXT
p_hierarchy_header-tooltip =
'This is the Hierarchy Header !'. "#EC NOTEXT
p_hierarchy_header-width = 30.
p_hierarchy_header-width_pix = ''.
endform.
form f_build_comment using
pt_list_commentary type slis_t_listheader
p_logo type sdydo_value.
data: ls_line type slis_listheader.
* LIST HEADING LINE: TYPE H
clear ls_line.
ls_line-typ = 'H'.
* LS_LINE-KEY: NOT USED FOR THIS TYPE
ls_line-info = 'ALV-tree: sales order-overview'. "#EC NOTEXT
append ls_line to pt_list_commentary.
* STATUS LINE: TYPE S
p_logo = 'ENJOYSAP_LOGO'.
endform. "build_comment
form f_create_hierarchy.
data: ls_sorder type ty_ZVNT_SLALVTREE,
lt_sorder type ty_ZVNT_SLALVTREE occurs 0.
* get data
select * from ZVNT_SLALVTREE into table lt_sorder up to 200 rows WHERE spras = sy-langu and matnr in s_matnr
and vbeln in s_vbeln.
sort lt_sorder by vbeln.
* add data to tree
data: l_vbeln_key type lvc_nkey,
l_posnr_key type lvc_nkey,
l_last_key type lvc_nkey.
loop at lt_sorder into ls_sorder.
on change of ls_sorder-vbeln.
perform f_add_vbeln_line using ls_sorder
changing l_vbeln_key.
endon.
on change of ls_sorder-posnr.
perform f_add_posnr_line using ls_sorder
l_vbeln_key
changing l_posnr_key.
endon.
perform f_add_complete_line using ls_sorder
l_posnr_key
changing l_last_key.
endloop.
* this method must be called to send the data to the frontend
call method tree1->frontend_update.
endform. " create_hierarchy
form f_add_vbeln_line using ps_sorder type ty_ZVNT_SLALVTREE
p_relat_key type lvc_nkey
changing p_node_key type lvc_nkey.
data: l_node_text type lvc_value,
ls_sorder type ty_ZVNT_SLALVTREE.
* 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 = tree1->c_hierarchy_column_name.
ls_item_layout-style =
cl_gui_column_tree=>style_intensifd_critical.
append ls_item_layout to lt_item_layout.
* add node
l_node_text = ps_sorder-vbeln.
data: ls_node type lvc_s_layn.
ls_node-n_image = space.
ls_node-exp_image = space.
call method tree1->add_node
exporting
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_sorder
is_node_layout = ls_node
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.
endform.
form f_add_posnr_line using ps_sorder type ty_ZVNT_SLALVTREE
p_relat_key type lvc_nkey
changing p_node_key type lvc_nkey.
data: l_node_text type lvc_value,
ls_sorder type ty_ZVNT_SLALVTREE.
* set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-t_image = '@3Y@'.
ls_item_layout-style =
cl_gui_column_tree=>style_intensified.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
append ls_item_layout to lt_item_layout.
* add node
l_node_text = ps_sorder-posnr.
data: relat type int4.
relat = cl_gui_column_tree=>relat_last_child.
call method tree1->add_node
exporting
i_relat_node_key = p_relat_key
i_relationship = relat
i_node_text = l_node_text
is_outtab_line = ls_sorder
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.
endform. " add_connid_line
form f_add_complete_line using ps_sorder type ty_ZVNT_SLALVTREE
p_relat_key type lvc_nkey
changing p_node_key type lvc_nkey.
data: l_node_text type lvc_value.
* set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_item_layout-editable = 'X'.
append ls_item_layout to lt_item_layout.
l_node_text = ps_sorder-posnr.
data: ls_node type lvc_s_layn.
ls_node-n_image = space.
ls_node-exp_image = space.
call method tree1->add_node
exporting
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
is_outtab_line = ps_sorder
i_node_text = l_node_text
is_node_layout = ls_node
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.
endform. " add_complete_line
form exit_program.
call method tree1->free.
leave program.
endform.
Code Formatted by: Alvaro Tejada Galindo on Feb 14, 2008 9:54 AM
Edited by: Lukasz Sekowski on Feb 14, 2008 4:11 PMI've finally fixed the problem:
there was:
item_selection = space
and should be:
item_selection = 'X' -
Netui:tree and portal problem?
I may have found a problem regarding using netui:tree & netui:treenode tags in
a pageflow when that pageflow is placed in a portlet in a portal.
The problem is that expanding and contracting the nodes does not
work in this case....(it does work when the pageflow is NOT placed in a portal.)
I have drilled down on this a bit to see what was happening. Here are my impressions.
This line of code (taken from the page flow taken from the supplied tree tutorial):
[nodeExpanded = getRequest().getParameter(TreeNode.EXPAND_NODE);]
is used to get a refence to the node that was clicked
The constant
[TreeNode.EXPAND_NODE]
equates to the string "netui_treenode".
In the working case (outside of the portal) this parameter and its value
are received in the request passed to the page flow. (and can be used to
change the state of the tree node).
But when running the tree pageflow in the portal (does not work), this parameter
does not exist in the request received by the page flow.
If you examine the html of the tree while running in the portlet and search for
the
string "netui_treenode", you will find that the urls for the node expansion contain
this
parameter (as they should) ....but for some reason this parameter and its value
never get
through the page flow method.
This is the cause of the problem.
Any ideas?This issue is fixed in 8.1 sp3, or if you need a patch for 8.1 sp2, contact support
and ask for the patch for CR129990.
-tanya
"gerry rodman" <[email protected]> wrote:
>
I may have found a problem regarding using netui:tree & netui:treenode
tags in
a pageflow when that pageflow is placed in a portlet in a portal.
The problem is that expanding and contracting the nodes does not
work in this case....(it does work when the pageflow is NOT placed in
a portal.)
I have drilled down on this a bit to see what was happening. Here are
my impressions.
This line of code (taken from the page flow taken from the supplied tree
tutorial):
[nodeExpanded = getRequest().getParameter(TreeNode.EXPAND_NODE);]
is used to get a refence to the node that was clicked
The constant
[TreeNode.EXPAND_NODE]
equates to the string "netui_treenode".
In the working case (outside of the portal) this parameter and its value
are received in the request passed to the page flow. (and can be used
to
change the state of the tree node).
But when running the tree pageflow in the portal (does not work), this
parameter
does not exist in the request received by the page flow.
If you examine the html of the tree while running in the portlet and
search for
the
string "netui_treenode", you will find that the urls for the node expansion
contain
this
parameter (as they should) ....but for some reason this parameter and
its value
never get
through the page flow method.
This is the cause of the problem.
Any ideas? -
ALV total and subtotaling problem
Hi,
I am unable to proceed in total and subtotal using ALV List Display.
Fico Scenario
For each change of Asset Location within same Asset Class:
Column Logic
Location Total Location wise do the Sum of the columns u201CAcquired Valueu201D, u201CSalv/168 Allow Sec 179u201D, Depreciable Basisu201D, u201CPrior Accum Depreciationu201D, u201CDepreciation This Runu201D, Current YTD Depreciationu201D, Current Accum Depreciationu201D and u201CNet Book Valueu201D
Code Done :
FORM summation .
DEFINE m_fieldcat.
add 1 to gs_fieldcat-col_pos.
gs_fieldcat-fieldname = &1.
gs_fieldcat-ref_tabname = 'gt_fieldcat1'.
gs_fieldcat-do_sum = &2.
gs_fieldcat-cfieldname = &3.
append gs_fieldcat to gt_fieldcat1.
END-OF-DEFINITION.
DEFINE m_sort.
add 1 to wa_sort-spos.
wa_sort-fieldname = &1.
wa_sort-up = 'X'.
wa_sort-subtot = &2.
append wa_sort to i_sort.
END-OF-DEFINITION.
m_fieldcat 'ANBTR' 'X' ''.
m_fieldcat 'SALV' 'X' ''.
m_fieldcat 'DEP_BASIC' 'X' ''.
m_fieldcat 'DEP_LAST' 'X' ''.
m_fieldcat 'DEP_CURRUN' 'X' ''.
m_fieldcat 'DEP_CURYTD' 'X' ''.
m_fieldcat 'DEP_ACC' 'X' ''.
m_fieldcat 'NET_BOOK' 'X' ''.
m_sort 'ANLKL' 'X'.
m_sort 'SALV' 'X'.
m_sort 'DEP_BASIC' 'X'.
m_sort 'DEP_LAST' 'X'.
m_sort 'DEP_CURRUN' 'X'.
m_sort 'DEP_CURYTD' 'X'.
m_sort 'DEP_ACC' 'X'.
m_sort 'NET_BOOK' 'X'.
gs_layout-cell_merge = 'X'.
ENDFORM. " SUMMATION
FORM alv_display .
PERFORM build_catlog.
PERFORM eventtab_field USING gs_event.
PERFORM comment_build USING gt_list_top_of_page[].
perform html_top_of_page using top. "TYPE REF TO cl_dd_document.
gv_repid = sy-repid.
gs_variant-report = gv_repid.
gs_layout-colwidth_optimize = 'X'.
gs_layout-colwidth_optimize = 'X'.
gs_layout-info_fieldname = 'LINE_COLOR'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gv_repid
i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
is_layout = gs_layout
is_variant = gs_variant
it_events = gs_event[]
it_fieldcat = gt_fieldcat1[]
i_save = 'A'
TABLES
t_outtab = gt_output[]
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. " ALV_DISPLAY
Any Help or Suggestions needed.
Better if guided with the code as m new to ALV Reports.Hi,
I am unable to proceed in total and subtotal using ALV List Display.
Fico Scenario
For each change of Asset Location within same Asset Class:
Column Logic
Location Total Location wise do the Sum of the columns u201CAcquired Valueu201D, u201CSalv/168 Allow Sec 179u201D, Depreciable Basisu201D, u201CPrior Accum Depreciationu201D, u201CDepreciation This Runu201D, Current YTD Depreciationu201D, Current Accum Depreciationu201D and u201CNet Book Valueu201D
Code Done :
FORM summation .
DEFINE m_fieldcat.
add 1 to gs_fieldcat-col_pos.
gs_fieldcat-fieldname = &1.
gs_fieldcat-ref_tabname = 'gt_fieldcat1'.
gs_fieldcat-do_sum = &2.
gs_fieldcat-cfieldname = &3.
append gs_fieldcat to gt_fieldcat1.
END-OF-DEFINITION.
DEFINE m_sort.
add 1 to wa_sort-spos.
wa_sort-fieldname = &1.
wa_sort-up = 'X'.
wa_sort-subtot = &2.
append wa_sort to i_sort.
END-OF-DEFINITION.
m_fieldcat 'ANBTR' 'X' ''.
m_fieldcat 'SALV' 'X' ''.
m_fieldcat 'DEP_BASIC' 'X' ''.
m_fieldcat 'DEP_LAST' 'X' ''.
m_fieldcat 'DEP_CURRUN' 'X' ''.
m_fieldcat 'DEP_CURYTD' 'X' ''.
m_fieldcat 'DEP_ACC' 'X' ''.
m_fieldcat 'NET_BOOK' 'X' ''.
m_sort 'ANLKL' 'X'.
m_sort 'SALV' 'X'.
m_sort 'DEP_BASIC' 'X'.
m_sort 'DEP_LAST' 'X'.
m_sort 'DEP_CURRUN' 'X'.
m_sort 'DEP_CURYTD' 'X'.
m_sort 'DEP_ACC' 'X'.
m_sort 'NET_BOOK' 'X'.
gs_layout-cell_merge = 'X'.
ENDFORM. " SUMMATION
FORM alv_display .
PERFORM build_catlog.
PERFORM eventtab_field USING gs_event.
PERFORM comment_build USING gt_list_top_of_page[].
perform html_top_of_page using top. "TYPE REF TO cl_dd_document.
gv_repid = sy-repid.
gs_variant-report = gv_repid.
gs_layout-colwidth_optimize = 'X'.
gs_layout-colwidth_optimize = 'X'.
gs_layout-info_fieldname = 'LINE_COLOR'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gv_repid
i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
is_layout = gs_layout
is_variant = gs_variant
it_events = gs_event[]
it_fieldcat = gt_fieldcat1[]
i_save = 'A'
TABLES
t_outtab = gt_output[]
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. " ALV_DISPLAY
Any Help or Suggestions needed.
Better if guided with the code as m new to ALV Reports. -
ALV Tree Problem with Checkboxes
Hello,
i've got a problem.
I have an ALV-Tree and die ALV-Detaillist of the tree are type checkbox.
That's working correct.
But i want to fill initial data in the checkboxes but the checkbox isnt set.
i've done as followed:
CALL METHOD go_alv_tree->set_table_for_first_display
EXPORTING
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
i_default = abap_false
is_hierarchy_header = ls_header
IS_EXCEPTION_FIELD =
IT_SPECIAL_GROUPS =
IT_LIST_COMMENTARY =
I_LOGO =
I_BACKGROUND_ID =
IT_TOOLBAR_EXCLUDING =
CHANGING
it_outtab = <go_data_tab>
IT_FILTER =
it_fieldcatalog = lt_fcat.
fieldcat are several fields all as checkbox.
Then i get a component of the output structure and set a X.
ASSIGN COMPONENT lv_help_arbpl OF STRUCTURE <go_data_struc>
TO <fs_arbl>.
IF <fs_arbl> IS ASSIGNED.
<fs_arbl> = lc_xfeld.
ENDIF.
CALL METHOD go_alv_tree->add_node
EXPORTING
i_relat_node_key = lv_matnr
i_relationship = cl_gui_column_tree=>relat_last_child
is_outtab_line = <go_data_struc>
is_node_layout = ls_layout
IT_ITEM_LAYOUT =
i_node_text = lv_node_text
IMPORTING
e_new_node_key = lv_period
EXCEPTIONS
relat_node_not_found = 1
node_not_found = 2
OTHERS = 3.
in <go_data_struc> the fields which should be set, are set with X.
But after i add all of my nodes and do CALL METHOD p_go_alv_tree->frontend_update, the checkbox is empty but there is an X in the field beside the checkbox.
Thanks in advance.
best regards,
DennisOk i solved the problem.
best regards,
Dennis -
Hi all,
Please help,
I have created ALV tree, with the help of standard program bcalv_tree_01. now i want to create it interative like DOUBLE CLICK on any ITEM or NODE. so i have define class and implement it with two method for event NODE_DOUBLE_CLICK and ITEM_DOUBLE_CLICK. and i have register it. when i display the tree it doesn't expand, but i comments the CALL METHOD gd_tree->set_registered_events it works fine. should i have to implement the event EXPAND_NO_CHILDREN also?
and what should be the code, becoz i am new in alv tree and oops. for sytex please refer BCALV_TREE_01.
please help as soon as possible.
Thanks in advance.Hi!
Ya you have to code for the method EXPAND_NO_CHILDREN
Where you will be defining the childs to the particular node.
the better example for it you can refer to SAPSIMPLE_TREE_CONTROL_DEMO
where
HANDLE_EXPAND_NO_CHILDREN method implemented shows the childs added and METHOD HANDLE_NODE_DOUBLE_CLICK
implemented to handle the doulbe click.
Regards. -
How to change the color of specific row in ALV tree
Hi,
I m using method set_table_for_first_display of a class CL_GUI_ALV_TREE.
The req is to change the color of specific row. Now can anybody tell me how to change the color of ALV tree. As in ALV tree and in this method 'set_table_for_first_display', there is no parameter IS_Layout.
Pls suggest...hi
hope this code will help you.
Reward if help.
REPORT zsharad_test1.
TABLES: ekko.
TYPE-POOLS: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
line_color(4) TYPE c, "Used to store row color attributes
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
*Start-of-selection.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
There are a number of ways to create a fieldcat.
For the purpose of this example i will build the fieldcatalog manualy
by populating the internal table fields individually and then
appending the rows. This method can be the most time consuming but can
also allow you more control of the final product.
Beware though, you need to ensure that all fields required are
populated. When using some of functionality available via ALV, such as
total. You may need to provide more information than if you were
simply displaying the result
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-datatype = 'CURR'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
Set layout field for row attributes(i.e. color)
gd_layout-info_fieldname = 'LINE_COLOR'.
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
FORM display_alv_report.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
IT_EVENTS = GT_XEVENTS
i_save = 'X'
is_variant = z_template
TABLES
t_outtab = it_ekko
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. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
DATA: ld_color(1) TYPE c.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekko.
*Populate field with color attributes
LOOP AT it_ekko INTO wa_ekko.
Populate color variable with colour properties
Char 1 = C (This is a color property)
Char 2 = 3 (Color codes: 1 - 7)
Char 3 = Intensified on/off ( 1 or 0 )
Char 4 = Inverse display on/off ( 1 or 0 )
i.e. wa_ekko-line_color = 'C410'
ld_color = ld_color + 1.
Only 7 colours so need to reset color value
IF ld_color = 8.
ld_color = 1.
ENDIF.
CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
wa_ekko-line_color = 'C410'.
MODIFY it_ekko FROM wa_ekko.
ENDLOOP.
ENDFORM. " DATA_RETRIEVAL -
Hello ABAP Experts.
I am trying to learn OO ABAP although have been using procedural ABAP for many years and I am writing an ALV Tree (which is also a first).
My problem is:
I have written a standard report which has a screen (which contains my ALV Tree) and a subscreen which has a single field which should get populated on double clicking on the node of the tree.
I have written a single class which contains all the logic to build up my ALV Tree and have instantiated this in the PBO of my first screen, in the class I have also set up an event that captures the double clicking of a node, all this seems to work fine.
The ALV Tree is displayed properly first time round and I can double click the node but I'm expecting (probably wrongly) that control is then passed from the class back to my report where I can manipulate the return, in debug after the double click indeed it does return to my calling program (flow logic of the first screen) however on clicking F5 on the debug, the screen is just redisplayed again and my field is still unpopulated but I need it to go into the PBO of my subscreen to display the data but I just can't seem to make this happen, I have also called the subscreen from within my main screen.
I have looked around SDN and although people have had similar problems I can't find a reply that works.
Thanks in advance.data:
ls_events type cntl_simple_event,
lt_events type cntl_simple_events.
DOUBLE_CLICK
clear ls_events.
ls_events-eventid = event_double_click.
ls_events-appl_event = 'X'.
insert ls_events into table lt_events.
call method ir_lb->set_registered_events
exporting
events = lt_events.
If you use pass APPL_EVENT = 'X' then it becomes an application event so PBO and PAI would be called. -
HI
I'm using alv list tree and the problem is that the user can
mark the all line (node or item ) just when he choose on the folder (icon ) and can
choose for the text and not all the line is marked (this is confusing for the user since
when he mark the text and press on right click noting happen just when he mark the all
line include the folder and press right click its open a popup )
what i want is on the tree is similar behavior for se 80 when user open the tree and choose a line
(node or item ) all the line is marked (for instance if choose class is se8o and you expend the
tree and choose method - mark the line all the line is marked include the icon the problem is
in my case that just the text is marked and not the all line )
how can i solve this issue?
i am using this following class and events its work but not mark the all line
cl_gui_list_tree=>eventid_node_context_menu_req
and
on_node_context_menu_select
Regards
James
Edited by: James Herb on Jul 21, 2010 9:29 PMI think you can use parameter itemselection_ in the constructor to have this behavior.
Check this link:
Link: [http://help.sap.com/saphelp_47x200/helpdata/en/1b/2a75bda9fd11d2bd6f080009b4534c/content.htm] -
Hi
I have an ALV Tree and would like to have a Total at the bottom. At the moment it sub totals each node but I would like there to be a complete total of all nodes at the bottom. Is there a way that I can do this?Yes that is what I have in my field catalog. If I remove the X it stops calculating the total of each node. The problem is that I don't have a row at the bottom of the tree to hold the totals. I don't know if this is possible with an ALV Tree.
-
How to expand a Root-Element in ALV-Tree?
Hi,
i use ALV-Tree and try to expand the first hierarchie.
I try this:
TRY.
GR_TREE_NODE = GR_TREE_NODES->ADD_NODE(
RELATED_NODE = ROOT_KEY
*EXPANDER = ABAP_TRUE*
RELATIONSHIP = CL_GUI_COLUMN_TREE=>RELAT_FIRST_CHILD
TEXT = 'Meldungen').
CATCH CX_SALV_MSG.
ENDTRY.
but this element will not be expandet?
I know this for expand all: CALL METHOD GR_TREE_NODES->EXPAND_ALL.
but want to expand only the first hierarch-elemet (root).
Can anyone tell me what i'm doing wrong?
Thanks.
Regards, DieterHi,
solved by this:
GR_TREE_NODE->EXPAND( ).
Regards, Dieter -
Development of alv tree report using classes from basics
Hi,
Need a simple ALV tree report by showing the reason for why we are using the classse so that i can build a ALV report in the same manner.
i have the data from MARA for given materials and their descriptions.Now in the basiv out put MARA information should come and tree out put for the material description when the user selects the maerial.
A hot spot should come on the material and if he opts click the material then MM03 out put should come.
Help me out in this regard
Regards
NarenOk, but the importance of ABAP OO, should not be taken from an example ALV tree, but more in general. There are several good articles on this on SCN. But for example in this particular case (ALV Tree), you should already see the importance as far as object instances and inheritance is concerned. Without much work, you can create an instance of an ALV tree, and all the attributes, methods etc. are there for use. Some of the methods / attributes are inherited from other superclasses.
There are propably even more things to be mentioned here which emphasizes the importance of ABAP OO in ALV tree, but as far as I'm concerned, this is about it for me. -
Get subtotal value of different column of different root_node in alv tree
Dear All,
I am working on hierarchical alv tree and using class "cl_gui_alv_tree"
CALL METHOD g_alv_tree->update_calculations is providing subtotal
I want to get subtotal value for different node(based on node key) and different column
i am using following method
CALL METHOD g_alv_tree->GET_OUTTAB_LINE(if I am passing pamater "node key" it is returning column name with '0' value,not exact subtotal value)
Thanks and regards in advance. Edited by: Gyanendra Dubey on Jan 26, 2012 7:55 AM
Edited by: Gyanendra Dubey on Jan 26, 2012 8:03 AMHi Dubey,
We are currently facing similar issue, would you be able to share your solution?
CALL METHOD g_alv_tree->GET_OUTTAB_LINE is returning 0 value for the subtotal.
Thank you. -
ALV Tree - Color Specific Column based on value in that cell?
Hi Forums,
I have searched the forum and I am unable to find the answer to my question.
I am using an ALV tree and I would like to color a cell RED is the value in the cell is negative.
I have set my field catalog to many different emphasize numbers and no luck either?
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'ORG_TXT'.
ls_fieldcatalog-coltext = text-d02.
ls_fieldcatalog-scrtext_m = text-d02.
ls_fieldcatalog-col_pos = 2.
ls_fieldcatalog-outputlen = '30'.
ls_fieldcatalog-no_out = 'X'.
ls_fieldcatalog-emphasize = 5.
APPEND ls_fieldcatalog TO et_fieldcatalog.
I am using
gr_alv_tree_control TYPE REF TO cl_gui_alv_tree
as my class to display my tree and I have found no methods that would set the color in there either?
What else could be checked?To those interested, i was able to color the TEXT of a First coloumn of the TREE. Using this code:
That said it will not work without BOTH
ls_layout_item-fieldname = gr_alv_tree_control->c_hierarchy_column_name.
ls_layout_item-style =
cl_gui_column_tree=>style_intensifd_critical.
IF ls_vip_display-vip_diff_tot > 0.
ls_layout_item-fieldname = gr_alv_tree_control->c_hierarchy_column_name.
ls_layout_item-style =
cl_gui_column_tree=>style_intensifd_critical.
ENDIF.
IF ls_vip_display-vip_diff > 0.
ls_layout_item-style =
cl_gui_column_tree=>style_intensifd_critical.
ENDIF.
ls_layout_item-t_image = '@GZ@'.
ls_layout_item-style =
cl_gui_column_tree=>style_intensifd_critical.
APPEND ls_layout_item TO lt_layout_item.
* add leaf nodes
CALL METHOD gr_alv_tree_control->add_node
EXPORTING
i_relat_node_key = lv_parent_id
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = lv_node_text
is_outtab_line = ls_vip_display
it_item_layout = lt_layout_item
is_node_layout = ls_node_layout
IMPORTING
e_new_node_key = lv_new_key
EXCEPTIONS
relat_node_not_found = 1
node_not_found = 2
OTHERS = 3.
Anybody else who can shed some light to why both are needed OR possibly how I can change the position of the colored text to a different cell?
Edited by: Keith Warnock on Feb 9, 2011 6:48 PM
Maybe you are looking for
-
I cant download any apps from app store after i update to ios 7
After i update my iphone 4 to ios 7, now i cant download anything from app store, when i tap free or buy button on the app in app store, i have a 4gb free space, it doesnt show any error message, just a grey icon in my screen telling "waiting" then i
-
In text or email, the keyboard will not come up. I have to reset phone or turn it off to get started again. How can i fix this issue?
-
External display problem in Mavericks
Hy all! I've encountered a little but annoying bug in mavericks... I have a Macbook Air 11" Mid 2012 because i carry my mac around all day, but when i'm home i use it with an external monitor. I've bought an IPS 24" AOC full HD LED display, and i've
-
Hi all , we have configured new PRI with MGCP protocol , incoming calls are working problem is with outgoing calls . we have checked all possiblities in called and calling type partition and css . attaching debug of mgcp packets and isdn q931 . pleas
-
Mathematical Formula in a document.
Is it possible to write attractive mathematical formula in Pages? I have a trial version of Pages 09 but I can't figure out how to write formula easily, I need to write loads for my coursework hand-ins. I don't mean spreadsheet type formula that do s