ALV TREE Report
Dear all,
I am currently working on a tree alv report. Here i have 3 levels of heirearchy each heirearchy level has different fields to be displayed. Can anyone please help me out how to build the fieldcatalog when the field changes for each heirearchy level? If anyone can help me with sample report will be rewarded with points.
Example:
1st level - Netwrok Activity -- Display Fields from AFVC table
2nd level - Components of Activity - Display fields from RESB Table
3rd Level - Items of Component - Display fields from STPO table
We dont have such example in BCLAVTREE if so pls help me with some sample code of program how to build fieldcatolog.
Thanks & Regards
Sathish
Hi,
If it's going three level drill down list then you can use can see following piece of code. declaration should be like this.
top_of_page type slis_formname value 'TOP_OF_PAGE',
end_of_page type slis_formname value 'END_OF_PAGE',
user_command type slis_formname value 'USER_COMMAND',
pf_status_set type slis_formname value 'PF_STATUS_SET',
user_command1 type slis_formname value 'USER_COMMAND1',
pf_status_set1 type slis_formname value 'PF_STATUS_SET1',
and displaying the first list will be.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
i_callback_program = name
i_callback_pf_status_set = pf_status_set
i_callback_user_command = user_command
* I_STRUCTURE_NAME =
i_callback_top_of_page = 'TOP-OF-PAGE'
i_grid_title = 'CUSTOMER GROUP WISE REPORT'
is_layout = layout
it_fieldcat = fieldcat_t
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* it_sort = SORT_T
* IT_FILTER =
* IS_SEL_HIDE =
i_default = 'X'
i_save = 'A'
* IS_VARIANT =
* it_events = events_t
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* IT_ADD_FIELDCAT = FIELDCAT_T1
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = it_basic.
and capturing user command will be like this.
form user_command using ucomm like sy-ucomm
selfield type slis_selfield.
case ucomm.
when '&IC1'.
read table it_basic index selfield-tabindex.
perform get_data_first_list using it_basic-kdgrp.
when '&PLEVEL'.
when '&CUST'.
when '&F15'.
leave to screen 0.
endcase.
endform. "user_command
you may be able to display the similar when the double click a line or clicking on a button.
if you want have mulitple header lines on the top of page you can this.
form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader.
wa_header-typ = 'H'.
wa_header-info = xhead.
append wa_header to t_header.
clear wa_header.
concatenate sy-datum+6(2) sy-datum+4(2) sy-datum+0(4) into xhead1
separated by '.'.
wa_header-typ = 'H'.
wa_header-info = xhead1.
append wa_header to t_header.
clear wa_header.
* append t_header.
*append t_header.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
* i_logo = 'Z_LOGO'.
endform. "top-of-page
May it helps you.
Regards.
DS
Similar Messages
-
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. -
ALV Tree Report without using ABAP Objects
Hi all,
I want to know the name of a function module to create ALV Tree in SE38 as a report. I am required to create this ALV Tree Report without using ABAP OBJECTS. Can u pls help me as early as possible.Hi
see this link
http://www.sapdev.co.uk/reporting/alv/alvtree.htm
*& Report ZBCALV_TREE
REPORT ZBCALV_TREE.
class cl_gui_column_tree definition load.
class cl_gui_cfw definition load.
data tree1 type ref to cl_gui_alv_tree.
data mr_toolbar type ref to cl_gui_toolbar.
include <icon>.
include bcalv_toolbar_event_receiver.
include bcalv_tree_event_receiver.
data: toolbar_event_receiver type ref to lcl_toolbar_event_receiver.
data: gt_VBAK type VBAK occurs 0, "Output-Table
gt_fieldcatalog type lvc_t_fcat, "Fieldcatalog
ok_code like sy-ucomm. "OK-Code
start-of-selection.
end-of-selection.
call screen 100.
*& Module STATUS_0100 OUTPUT
text
module STATUS_0100 output.
SET PF-STATUS 'MAIN'.
if tree1 is initial.
perform Zinit_tree.
endif.
call method cl_gui_cfw=>flush.
endmodule. " STATUS_0100 OUTPUT
*& Form Zinit_tree
text
--> p1 text
<-- p2 text
form Zinit_tree .
perform Zbuild_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_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'. "#EC NOTEXT
endif.
create Hierarchy-header
data l_hierarchy_header type treev_hhdr.
perform zbuild_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 Zbuild_comment using
lt_list_commentary
l_logo.
repid for saving variants
data: ls_variant type disvariant.
ls_variant-report = sy-repid.
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_VBAK "table must be emty !!
it_fieldcatalog = gt_fieldcatalog.
create hierarchy
perform Zcreate_hierarchy.
add own functioncodes to the toolbar
perform zchange_toolbar.
register events
perform zregister_events.
endform. " Zinit_tree
*& Form Zbuild_fieldcatalog
text
--> p1 text
<-- p2 text
form Zbuild_fieldcatalog .
get fieldcatalog
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'VBAK'
changing
ct_fieldcat = gt_fieldcatalog.
sort gt_fieldcatalog by scrtext_l.
change fieldcatalog
data: ls_fieldcatalog type lvc_s_fcat.
loop at gt_fieldcatalog into ls_fieldcatalog.
case ls_fieldcatalog-fieldname.
when 'AUART' .
ls_fieldcatalog-no_out = 'X'.
ls_fieldcatalog-key = ''.
endcase.
modify gt_fieldcatalog from ls_fieldcatalog.
endloop.
endform. " Zbuild_fieldcatalog
*& Form zbuild_hierarchy_header
text
<--P_L_HIERARCHY_HEADER text
form zbuild_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. " zbuild_hierarchy_header
*& Form Zbuild_comment
text
-->P_LT_LIST_COMMENTARY text
-->P_L_LOGO text
form Zbuild_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-demo: flight-overview'. "#EC NOTEXT
append ls_line to pt_list_commentary.
STATUS LINE: TYPE S
clear ls_line.
ls_line-typ = 'S'.
ls_line-key = 'valid until'. "#EC NOTEXT
ls_line-info = 'January 29 1999'. "#EC NOTEXT
append ls_line to pt_list_commentary.
ls_line-key = 'time'.
ls_line-info = '2.00 pm'. "#EC NOTEXT
append ls_line to pt_list_commentary.
ACTION LINE: TYPE A
clear ls_line.
ls_line-typ = 'A'.
LS_LINE-KEY: NOT USED FOR THIS TYPE
ls_line-info = 'actual data'. "#EC NOTEXT
append ls_line to pt_list_commentary.
p_logo = 'ENJOYSAP_LOGO'.
endform. " Zbuild_comment
*& Form Zcreate_hierarchy
text
--> p1 text
<-- p2 text
form Zcreate_hierarchy .
data: ls_vbak type vbak,
lt_vbak type vbak occurs 0.
get data
select * from vbak into table lt_vbak
up to 200 rows . "#EC CI_NOWHERE
sort lt_vbak by AUART.
add data to tree
data: l_AUART_key type lvc_nkey.
loop at lt_vbak into ls_vbak.
on change of ls_vbak-AUART.
perform Zadd_AUART_line using ls_vbak
changing l_AUART_key.
endon.
endloop.
calculate totals
call method tree1->update_calculations.
this method must be called to send the data to the frontend
call method tree1->frontend_update.
endform. " Zcreate_hierarchy
*& Form Zadd_AUART_line
text
-->P_LS_vbak text
-->P_0379 text
<--P_L_AUART_KEY text
form Zadd_AUART_line using p_ls_vbak type vbak
p_relat_key type lvc_nkey
changing p_node_key type lvc_nkey.
data: l_node_text type lvc_value,
ls_vbak type vbak.
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 = p_ls_vbak-AUART.
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_vbak
is_node_layout = ls_node
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key .
endform. " Zadd_AUART_line
*& Form zchange_toolbar
text
--> p1 text
<-- p2 text
form zchange_toolbar .
get toolbar control
call method tree1->get_toolbar_object
importing
er_toolbar = mr_toolbar.
check not mr_toolbar is initial.
add seperator to toolbar
call method mr_toolbar->add_button
exporting
fcode = ''
icon = ''
butn_type = cntb_btype_sep
text = ''
quickinfo = 'This is a Seperator'. "#EC NOTEXT
add Standard Button to toolbar (for Delete Subtree)
call method mr_toolbar->add_button
exporting
fcode = 'DELETE'
icon = '@18@'
butn_type = cntb_btype_button
text = ''
quickinfo = 'Delete subtree'. "#EC NOTEXT
add Dropdown Button to toolbar (for Insert Line)
call method mr_toolbar->add_button
exporting
fcode = 'INSERT_LC'
icon = '@17@'
butn_type = cntb_btype_dropdown
text = ''
quickinfo = 'Insert Line'. "#EC NOTEXT
set event-handler for toolbar-control
create object toolbar_event_receiver.
set handler toolbar_event_receiver->on_function_selected
for mr_toolbar.
set handler toolbar_event_receiver->on_toolbar_dropdown
for mr_toolbar.
endform. " zchange_toolbar
*& Form zregister_events
text
--> p1 text
<-- p2 text
form zregister_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_header_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.
message x208(00) with 'ERROR'. "#EC NOTEXT
endif.
set Handler
data: l_event_receiver type ref to lcl_tree_event_receiver.
create object l_event_receiver.
set handler l_event_receiver->handle_node_ctmenu_request
for tree1.
set handler l_event_receiver->handle_node_ctmenu_selected
for tree1.
set handler l_event_receiver->handle_item_ctmenu_request
for tree1.
set handler l_event_receiver->handle_item_ctmenu_selected
for tree1.
endform. " zregister_events
*& Module USER_COMMAND_0100 INPUT
text
module USER_COMMAND_0100 input.
ok_code = sy-ucomm.
clear sy-ucomm.
case ok_code.
when 'EXIT' or 'BACK' or 'CANC'.
perform Zexit_program.
when others.
call method cl_gui_cfw=>dispatch.
endcase.
clear ok_code.
call method cl_gui_cfw=>flush.
endmodule. " USER_COMMAND_0100 INPUT
*& Form Zexit_program
text
--> p1 text
<-- p2 text
form Zexit_program .
call method tree1->free.
leave program.
endform. " Zexit_program
<b>Reward if usefull</b> -
ALV Tree Report--clicking on a row....
Hello Experts,
i have a alv tree report.my requirement is,
"Selecting a row means clicking on record and then click on a another button called YES ,For other functionality i need to capture the row '.
How can i solve this problem.
Thanks,
Sridhar.hi check this..
REPORT z_simpletree.
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 : it_0022 TYPE STANDARD TABLE OF pa0022 INITIAL SIZE 0,
wa_0022 TYPE pa0022.
*Internal table and wa decl for text table t517x
DATA : it_517x TYPE STANDARD TABLE OF t517x INITIAL SIZE 0,
wa_517x TYPE t517x.
*Internal table and wa decl for text table t517T
DATA : it_517t TYPE STANDARD TABLE OF t517t INITIAL SIZE 0,
wa_517t TYPE t517t.
*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 pa0022 INTO CORRESPONDING FIELDS OF TABLE it_0022
UP TO 50 ROWS.
*select data from T517x
SELECT * FROM t517x INTO CORRESPONDING FIELDS OF TABLE it_517x
WHERE langu = 'E'.
*select data from T517T
SELECT * FROM t517t INTO CORRESPONDING FIELDS OF TABLE it_517t
WHERE sprsl = 'E'.
*select data from T519t
SELECT * FROM t519t INTO CORRESPONDING FIELDS OF TABLE it_519t
WHERE sprsl = 'E'.
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 = 'Education'.
wa_node-tlevel = '01'.
wa_node-nlength = '15'.
wa_node-color = '4'.
wa_node-text = 'Infotype 0022'.
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 it_0022 INTO wa_0022.
wa_node-type = 'P'.
wa_node-name = 'PERNR'.
wa_node-tlevel = '02'.
wa_node-nlength = '8'.
wa_node-color = '1'.
wa_node-text = wa_0022-pernr.
wa_node-tlength ='20'.
wa_node-tcolor = 4.
APPEND wa_node TO it_node.
CLEAR wa_node.
*Filling the text of T517t
READ TABLE it_517t INTO wa_517t WITH KEY slart = wa_0022-slart.
wa_node-type = 'P'.
wa_node-name = wa_0022-slart.
wa_node-tlevel = '03'.
wa_node-nlength = '8'.
wa_node-color = '1'.
wa_node-text = wa_517t-stext.
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_519t INTO wa_519t WITH KEY slabs = wa_0022-slabs.
wa_node-type = 'P'.
wa_node-name = wa_0022-slabs.
wa_node-tlevel = '04'.
wa_node-nlength = '8'.
wa_node-color = '2'.
wa_node-text = wa_519t-stext.
wa_node-tlength ='40'.
wa_node-tcolor = 4.
APPEND wa_node TO it_node.
CLEAR wa_node.
*Filling the text of T517x
READ TABLE it_517x INTO wa_517x WITH KEY faart = wa_0022-sltp1.
wa_node-type = 'P'.
wa_node-name = wa_0022-sltp1.
wa_node-tlevel = '05'.
wa_node-nlength = '8'.
wa_node-color = '1'.
wa_node-text = wa_517x-ftext.
wa_node-tlength ='40'.
wa_node-tcolor = 4.
APPEND wa_node TO it_node.
CLEAR wa_node.
wa_node-type = 'P'.
wa_node-tlevel = '06'.
wa_node-nlength = '8'.
wa_node-color = '1'.
wa_node-text = '% Completed'.
wa_node-tlength ='15'.
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 = '3'
color_of_mark = '3'
color_of_link = '1'
color_of_match = '5'
node_length = 30
text_length = 75
use_control = 'L'.ENDFORM. " build_tree
regards,
venkat -
Hierarchial ALV Tree Report.
Hi!
iam designing a module pool to get all the info of the idoc like status record control record etc.the 3 rd screen would be a hierarchial tree structure.All the data would be retrieved from Z tables.
My requirement is on the left side of the pane the tree would contain 6 tables as nodes and these would be constant for all the idoc numbers.On the right side of the screen i would have to populate the complete data from these tables.
When user clicks on the first table only that table data needs to appear.This would be only a display report.
Plz tell me if this logic would work
I will create the tree structure on the left side of the pane with all the 6 tables as default.I would also define a subscren on the right side and would call a table control for the respective tables along with the data populated in them.
Now can i link the double click event of the tree ie the table name to populate the table control in the subscreen.
Please provide suggestions.
thanks
kedarHI Kedar,
What u r trying to do is going to work.
Evn I tried to do the same, but since I ahve less knowledge in ALV class I couldnt do it.
U can refer to DWDM, it is for demo programs...it has ALV tree method -
Problem when printing Alv Tree Report in back ground
Hi,
I am using SUBMIT ...TO SAP-SPOOL WITHOUT SPOOL DYNPRO with GET_PRINT_PARAMETERS FM.Its working fine.
My problem is that my SUBMIT report have TREE STRUCTURE as output so when i am running my program one blank screen is coming with heading DISPLAY LOG TREE because of TREE STRUCTURE.when i click on back button then only further processing happens.
How to avoid this TREE STRUCTURE SCREEN ???
Is there any other way to pass your list o/p to SPOOL other than .....TO SAP-SPOOL..?
Thanks in advance.in foreground when u run ALV report it holds maximum fields and displays in 1 single row, but the case is not in back ground...When any report is run in background, the default size for a line is 255 chars...So, if it more it gets splitted into 2 line item....This is how back ground job works for a report though it is a normal report or alv report.
-
Hi All,
I have requirement to create tree structure report where:-
The Folders structure should appear on left side.
Once clicking on the particular folder in left pane , it should display a report in right pane.
The folder can be nested withing particular folder.
regards,
karthikHi,
Check out sample program BCALV_TREE_DEMO. I don't think it is possible without OOP. Why you don't want OOP? I feel, It is simpler than normal programming.
Thanks,
Vinod. -
Required Sample Programs on Tree Reports using ALV and Reports
Hi Pals,
I require sample progrms on Tree Reports using Function Modules for both ALV and Classical Reports. Send the list of sample programs and function modules used for tree reports.
Regards,
Pradeep.g
<removed by moderator>Check these threads..U can find sample programs.
tree type report
ALVtree reports - Example code and information on creating ALV tree reports
http://www.sapdevelopment.co.uk/reporting/alv/alvtree.htmhttps://alv tree
ALso check this DEMO Program
SAPCOLUMN_TREE_CONTROL_DEMO
CL_GUI_ALV_COLUMN_TREE
Sample code:
http://www.geocities.com/victorav15/sapr3/utilities/zvvooa3.txt -
Hello all,
How do I get a cursor field on ALV Tree report? I have output with po number, vendor no etc. When I double click PO, i shuold display ME23N and on vendor no 'XK03' etc. Double click event is triggered, but how do I check which field is clicked? Anybody pls suggest me.
Thanks,
ChandniHi,
you can use method to get the select lines:
CALL METHOD TREE->GET_SELECTED_NODES
CHANGING
CT_INDEX_OUTTAB = SELECTED_NODES
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
DP_ERROR = 2
FAILED = 3
OTHERS = 4.
or in double click:
METHODS HANDLE_DOUBLE_CLICK
FOR EVENT ITEM_DOUBLE_CLICK OF CL_GUI_ALV_TREE_SIMPLE
IMPORTING FIELDNAME INDEX_OUTTAB GROUPLEVEL.
just read tables with index_outttab
READ TABLE GT_TAB INTO IGT_TAB INDEX INDEX_OUTTAB.
to check which field is clicked use the FIELDNAME field.
regards -
Double Click in ALV TREE doesn't get triggered
Hello All,
Double click event on item in a alv tree report doesn't get triggered. I thought I was doing everything right. Please help me out.
Look at the code below and tell me what else I need to do.
<b>FORM register_events .
Event registration: tell ALV Tree which events shall be passed
from frontend to backend.
DATA: lt_events TYPE cntl_simple_events,
l_event TYPE cntl_simple_event,
l_event_receiver TYPE REF TO lcl_tree_event_receiver.
Frontend registration: get already registered tree events
CALL METHOD g_alv_tree->get_registered_events
IMPORTING
events = lt_events.
Frontend registration: add additional event ids
l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
APPEND l_event TO lt_events.
Frontend registration: provide new event table to alv tree
CALL METHOD g_alv_tree->set_registered_events
EXPORTING
events = lt_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
Register events on backend (ABAP Objects event handling)
CREATE OBJECT l_event_receiver.
SET HANDLER l_event_receiver->node_double_click FOR g_alv_tree.
SET HANDLER l_event_receiver->item_double_click FOR g_alv_tree.
SET HANDLER l_event_receiver->on_function_selected FOR g_toolbar.
ENDFORM. " register_events</b>
When I double click on item on the report double click event doesnt trigger. what could be the problem? Any sample programs?
Thanks,
ChandniHi,
Here is a sample code for you.
report ztree.
TABLES : vbak.
DATA: BEGIN OF mylist OCCURS 50. " Internal table hierarchy
INCLUDE STRUCTURE snodetext.
DATA: END OF mylist.
DATA: f15 TYPE c.
DATA :
BEGIN OF gt_sales OCCURS 0,
vbeln LIKE vbak-vbeln,
kunnr LIKE vbak-kunnr,
matnr LIKE vbap-matnr,
arktx LIKE vbap-arktx,
END OF gt_sales.
SELECT-OPTIONS : s_vbeln FOR vbak-vbeln.
START-OF-SELECTION.
SET PF-STATUS 'ZTREE1'.
SET TITLEBAR 'T1'.
Fill internal table with pseudo-data
PERFORM fill_itab.
Hierarchy output
PERFORM main.
*& Form FILL_ITAB
text
--> p1 text
<-- p2 text
FORM fill_itab .
*Fill the gt_sales table
SELECT vkvbeln vkkunnr vpmatnr vparktx INTO CORRESPONDING FIELDS OF
TABLE gt_sales
FROM ( vbak AS vk INNER JOIN vbap AS vp ON vkvbeln = vpvbeln )
WHERE vk~vbeln IN s_vbeln.
SORT gt_sales BY vbeln kunnr.
*Fill the root
mylist-name = 'Report Tree List'.
mylist-color = 1.
mylist-intensiv = '1'.
mylist-text = 'Report Tree List'.
mylist-tlength = 16.
mylist-tlevel = 1.
mylist-tcolor = 1.
mylist-tintensiv = '1'.
mylist-text1 = 'using "RS_TREE_CONSTRUCT" function'.
mylist-tlength1 = 50.
mylist-tcolor1 = 2.
mylist-tintensiv1 = '0'.
APPEND mylist.
LOOP AT gt_sales.
ON CHANGE OF gt_sales-vbeln.
mylist-name = 'level1'.
mylist-color = 0.
mylist-intensiv = '0'.
mylist-text = 'Sales Document no:'.
mylist-tlength = 20.
mylist-tlevel = 2.
mylist-tcolor = 7.
mylist-tintensiv = '1'.
mylist-text1 = gt_sales-vbeln.
mylist-tlength1 = 30.
mylist-tcolor1 = 2.
mylist-tintensiv1 = '0'.
APPEND mylist.
ENDON.
ON CHANGE OF gt_sales-kunnr.
mylist-name = 'level2'.
mylist-color = 0.
mylist-intensiv = '0'.
mylist-text = 'Customer no:'.
mylist-tlength = 20.
mylist-tlevel = 3.
mylist-tcolor = 5.
mylist-tintensiv = '1'.
mylist-text1 = gt_sales-kunnr.
mylist-tlength1 = 30.
mylist-tcolor1 = 3.
mylist-tintensiv1 = '0'.
APPEND mylist.
ENDON.
mylist-name = 'level3'.
mylist-color = 0.
mylist-intensiv = '0'.
mylist-text = gt_sales-matnr.
mylist-tlength = 15.
mylist-tlevel = 4.
mylist-tcolor = 4.
mylist-tintensiv = '0'.
mylist-text1 = gt_sales-arktx.
mylist-tlength1 = 30.
mylist-tcolor1 = 2.
mylist-tintensiv1 = '0'.
APPEND mylist.
ENDLOOP.
ENDFORM. " FILL_ITAB
*& Form MAIN
text
--> p1 text
<-- p2 text
FORM main .
PERFORM hierarchy. " construct & draw the tree
ENDFORM. " MAIN
*& Form HIERARCHY
text
--> p1 text
<-- p2 text
FORM hierarchy .
PERFORM build_tree.
PERFORM draw_tree.
ENDFORM. " HIERARCHY
FORM BUILD_TREE *
Builds the tree from internal table *
Uses the Function module RS_TREE_CONSTRUCT *
FORM build_tree.
CALL FUNCTION 'RS_TREE_CONSTRUCT'
TABLES
nodetab = mylist
EXCEPTIONS
tree_failure = 1.
ENDFORM. "build_tree
FORM DRAW_TREE *
Builds the tree from internal table *
Uses the Function module RS_TREE_DISPLAY *
FORM draw_tree.
sy-lsind = 0.
CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
EXPORTING
callback_program = 'ZREPORT_TREE'
callback_user_command = 'NODE_SELECT'
IMPORTING
f15 = f15.
ENDFORM. "draw_tree
FORM NODE_SELECT *
Handles selection of nodes *
FORM node_select TABLES knoten STRUCTURE seucomm
USING command
CHANGING exit
list_refresh.
Processing of commands for hierarchy list
CASE command.
WHEN 'DISP'.
CASE knoten-id.
WHEN '000002'.
*Display Sales Order
SET PARAMETER ID 'AUN' FIELD knoten-text1.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
WHEN '000003'.
*Display Customer
SET PARAMETER ID 'KUN' FIELD knoten-text1.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
ENDCASE.
ENDCASE.
list_refresh = 'X'.
ENDFORM. "node_select -
MiniSAP 6.20: ALV tree not working in background
Good day!
SAP provides a sample ALV tree program, BCALV_TREE_DEMO, which could be submitted in the background.
However, it does not work in MiniSAP 6.20. It's kind of bizarre as it works in our Test system.
Does anyone has any idea what's happening.Good day!
The ALV tree report is submitted in the background.
By right, it should produce an ALV tree report in the print spool.
However, it does not seem to work. I checked the program and found there is a logic to check whether it's a background job or not. If it is, it would not create the container.
It's bizarre that it does not work in MiniSAP 6.20 but it works in 6.10 -
Average sum for a column in ALV tree layout
Hi,
I've trying to set an average sum for a column in an ALV tree report. In the field catalog i set the DO_SUM field to 'X' and this will do a total sum, but I can't find out how in the code to do the average sum.
Also to get round this I was going to just set a default display variant with the "average" sum option saved after i had manually selected the columns and set it to this. Problem with this is that when i re-run it, the sum comes back as a total rather than an average. I have tried setting display variants on the SAP example ALV tree programs and the same thing happens.
Does anyone know how i can get round this?
Cheers
Matt.Hi,
In addition to setting DO_SUM = 'X' you need to specify function in H_FTYPE field. It should be set to 'AVG' in your case.
ls_fielcat-do_sum = 'X'.
ls_fieldcat-h_ftype = 'AVG. -
How to handle the check box in the alv tree display
Hello,
in my ALV Tree Report i have a check box in the output.
I have one check box in the selection screen as select all .
if this is selected then all the check boxes in the output must be selected that is (X).
am using CL_GUI_ALV_TREE for this.
Please give me some input how to make that check boxes 'X' in the above mentioned case.
With Regards,
Sumodh.PSumodh,
check this
Re: Select all checkbox in ALV tree
please search before posting
Thanks
Bala Duvvuri -
Hi,
I have an ALV Tree report developed using the OOPS. In my ALV Tree output, I have some buttons which will update the database after clicking. The data is correctly updating in the database. But, it is not getting updated in the ALV Tree display. That means, it is not REFRESHing the ALV Tree display. We have to again execute the program in order to see the updated output.
Could anyone please suggest me how to Refresh the ALV Tree display..?
We can't use the method 'REFRESH_TABLE_DISPLAY' as it is a PRIVATE method is the class CL_GUI_ALV_TREE.
Please share your valuable thoughts.
Thanks & Regards,
Paddu.Hi paddu.
please check out the link mentioned below,this will help u.
How to Refresh data on ALV tree
Regards
Theres -
Is it possible to run an ALV Tree report in background? I tried using these codes:
IF cl_gui_alv_grid=>ontrol
EXPORTING container_name = 'CONTAINER_1'.
CREATE OBJECT l_grid
EXPORTING i_parent = l_control.
ELSE.
CREATE OBJECT l_grid
EXPORTING i_parent = l_dock.
ENDIF.
But I'm getting an error. Is there a way on how I can run this report in background?
Thanks in advance!
BethHi Beth
These controls require frontend to function. However, as I can remember if you pass a dummy container you can still instantiate the control object. Following is an ALV grid example.
<u>e.g.</u>
DATA: g_dock TYPE REF TO cl_gui_docking_container,
g_grid TYPE REF TO cl_gui_alv_grid.
IF cl_gui_alv_grid=>offline( ) is initial.
CREATE OBJECT g_dock.
ENDIF.
CREATE OBJECT g_grid
EXPORTING I_PARENT = g_dock.
You can also check whether it is a background task with the system parameter <b>"sy-batch"</b>.
Hope these may helpyou to construct a similar procedure for ALV Tree.
Kind Regards
*--Serdar
[email protected]
Maybe you are looking for
-
Facebook Notifications and email notifications on ...
Hi Is that possible Facebook Notifications and email notifications on sleeping screen nokia 808 like it had on N9.. On my 808 it shows only msgs and miscalls....any fix?? Thanks
-
I have an Ipod Touch 4G. My computer broke. I now have a new computer . I have NO access to old computer. The itunes on my new computer recognises by Ipod but not the music content already on my ipod. This means it does not show the content in
-
I want to have a replication of Opera mail feature. This feature enables you to aggregate all mail items from across all the e-mail accounts into a single virtual aggregated view. That is, say, we have 3 different mail accounts. In Mozilla Thunderbir
-
Is there a standard report I can use to monitor specific asset master data fields? My customer updates the second description line in the asset master (ANLA-TXA50) for some business process they have. They would like to be able to have a report that
-
Apple TV works wired but doesn't work with Airport
Hello everybody I have the following: o Mac Book Pro 13 o Apple TV o D-Link WiFi Access Point (192.168.1.0/24) o Ethernet Network (also 192.168.1.0/24) o DHCP Server Initially I connected to Apple TV via Ethernet. As long as my Mac Book is wired to t