ALV as Hierarchy with aggregation
Hi
I have 5 columns: H1, H2, H3, SUM1, SUM2
For columns SUM1, SUM2:
lo_field = lo_value->if_salv_wd_field_settings~get_field( <fs_col>-id ).
lo_field->if_salv_wd_aggr~create_aggr_rule( ).
lo_aggr_rule = lo_field->if_salv_wd_aggr~get_aggr_rule( ).
lo_aggr_rule->set_aggregation_type( if_salv_wd_c_aggregation=>aggrtype_total ).
For columns H1, H2, H3:
<fs_col>-r_column->if_salv_wd_column_hierarchy~set_hierarchy_column( value = abap_true ).
If i create sort rule for H1,H2,H3 hierarchy automatic sort is broken.
How i can create aggregation on Hierarchy ALV?
hi arjun,
it still doesn't work. when i debug it, the system sets the column hierarchy "false"...
the code is like this now:
DATA:
l_ref_cmp_usage TYPE REF TO if_wd_component_usage,
l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table,
l_value TYPE REF TO cl_salv_wd_config_table.
l_ref_cmp_usage = wd_this->wd_cpuse_salv( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
l_ref_interfacecontroller = wd_this->wd_cpifc_salv( ).
l_value = l_ref_interfacecontroller->get_model( ).
* cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs~set_all(
* r_model = l_value ).
l_value->if_salv_wd_std_functions~set_hierarchy_allowed( abap_true ).
l_value->if_salv_wd_table_settings~set_display_type(
if_salv_wd_c_table_settings=>display_type_hierarchy ).
DATA: lr_column TYPE REF TO cl_salv_wd_column.
lr_column = l_value->if_salv_wd_column_settings~get_column( 'CNOID' ).
lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).
lr_column = l_value->if_salv_wd_column_settings~get_column( 'STOID' ).
lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).
l_value->if_salv_wd_table_hierarchy~set_last_hier_column_as_leaf( abap_true ).
Similar Messages
-
Class Extraction In A Hierarchy with Aggregation
Hi All,
I have a situation in which i use a class extraction method to determine which sub class will be intantiated in an inheritance hierarchy in which the root is an aggregate of some other object. (ie the root and its sub class's descriptors are aggregate descriptors). Because a class indicator will not work for me due to multiple classes corresponding to one indicator type, i went for the class extraction method option.
The problem i am experiencing is that, when i try to map the DB fields of the source object's table to the properties of the aggregate or target object, toplink automatically provides an entry for the class indicator type under the Fields tab prompting me for a class indicator DB column which i do not have or better do not want to provide because i am using a class extractor method and not a class indicator. The only column i can provide here is already used and i cannot have 2 writable mappings to one field.
I would appreciate any help from the forum.
Thanks.Hi All,
I have a situation in which i use a class extraction method to determine which sub class will be intantiated in an inheritance hierarchy in which the root is an aggregate of some other object. (ie the root and its sub class's descriptors are aggregate descriptors). Because a class indicator will not work for me due to multiple classes corresponding to one indicator type, i went for the class extraction method option.
The problem i am experiencing is that, when i try to map the DB fields of the source object's table to the properties of the aggregate or target object, toplink automatically provides an entry for the class indicator type under the Fields tab prompting me for a class indicator DB column which i do not have or better do not want to provide because i am using a class extractor method and not a class indicator. The only column i can provide here is already used and i cannot have 2 writable mappings to one field.
I would appreciate any help from the forum.
Thanks. -
Hi all,
I have developed a program for ALV Tree Hierarchy using OOPs.I followed the SAP demo program.I am not able to get the values in the output.Please can anyone guide me where to correct my program. I am placing the entire code so that you all can also debug and see what is wrong.
*& Report ZZHIERARCHY_TEST1
REPORT zzhierarchy_test1.
DATA : alv_container TYPE REF TO cl_gui_custom_container,
alv_tree TYPE REF TO cl_gui_alv_tree,
gt_fcat TYPE lvc_t_fcat,
gt_vbrk TYPE vbrk OCCURS 0. "Output Table
DATA : gs_hirarchy_header TYPE treev_hhdr.
START-OF-SELECTION.
END-OF-SELECTION.
CALL SCREEN 9100.
*& Module STATUS_9100 OUTPUT
MODULE status_9100 OUTPUT.
SET PF-STATUS 'ALV_TREE'.
IF alv_container IS INITIAL.
PERFORM tree_dev.
ENDIF.
ENDMODULE. " STATUS_9100 OUTPUT
*& Form tree_dev
text
FORM tree_dev .
DATA lv_container_name(20) TYPE c.
lv_container_name = 'ALV_TREE'.
CREATE OBJECT alv_container
EXPORTING
container_name = lv_container_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CREATE OBJECT alv_tree
EXPORTING
parent = alv_container
node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
item_selection = 'X'
no_toolbar = ''
no_html_header = 'X'
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
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
PERFORM build_hirarchy_header CHANGING gs_hirarchy_header.
PERFORM buid_fieldcatalog.
CALL METHOD alv_tree->set_table_for_first_display
EXPORTING
is_hierarchy_header = gs_hirarchy_header
CHANGING
it_outtab = gt_vbrk "Table Must be Empty
it_fieldcatalog = gt_fcat.
PERFORM create_hierarchy.
CALL METHOD alv_tree->frontend_update.
ENDFORM. " tree_dev
*& Form build_hirarchy_header
<--P_GS_HIRARCHY_HEADER text
FORM build_hirarchy_header CHANGING p_gs_hirarchy_header TYPE treev_hhdr.
p_gs_hirarchy_header-heading = 'Company Code'(001).
p_gs_hirarchy_header-tooltip = 'Comapny Code'(002).
p_gs_hirarchy_header-width = 35.
p_gs_hirarchy_header-width_pix = ''.
ENDFORM. " build_hirarchy_header
*& Form buid_fieldcatalog
FORM buid_fieldcatalog .
DATA ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'VBRK'
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LOOP AT gt_fcat INTO ls_fcat.
CASE ls_fcat-fieldname.
WHEN 'NETWR'.
ls_fcat-do_sum = 'X'.
ls_fcat-h_ftype = 'MAX'.
ENDCASE.
MODIFY gt_fcat FROM ls_fcat.
ENDLOOP.
ENDFORM. " buid_fieldcatalog
*& Form create_hierarchy
FORM create_hierarchy .
DATA : lt_vbrk TYPE TABLE OF vbrk,
ls_vbrk TYPE vbrk.
DATA : top_key TYPE lvc_nkey,
company_key TYPE lvc_nkey,
bzirk_key TYPE lvc_nkey.
DATA : lv_bukrs TYPE bukrs,
lv_bukrs_prv TYPE bukrs,
lv_bzirk TYPE bzirk,
lv_bzirk_prv TYPE bzirk.
SELECT * FROM vbrk INTO TABLE lt_vbrk UP TO 500 ROWS.
SORT lt_vbrk BY bukrs .
CALL METHOD alv_tree->add_node
EXPORTING
i_relat_node_key = ''
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = 'Company Code'
IMPORTING
e_new_node_key = top_key
EXCEPTIONS
relat_node_not_found = 1
node_not_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LOOP AT lt_vbrk INTO ls_vbrk.
lv_bukrs = ls_vbrk-bukrs .
lv_bzirk = ls_vbrk-bzirk .
IF lv_bukrs <> lv_bukrs_prv.
lv_bukrs_prv = lv_bukrs.
PERFORM add_node USING lv_bukrs
top_key
CHANGING company_key.
ENDIF.
IF lv_bzirk <> lv_bzirk_prv.
lv_bzirk_prv = lv_bzirk.
PERFORM add_posnr USING lv_bzirk
company_key
CHANGING bzirk_key.
ENDIF.
ENDLOOP.
ENDFORM. " create_hierarchy
*& Form add_node
-->P_LV_BUKRS text
-->P_TOP_KEY text
<--P_COMPANY_KEY text
FORM add_node USING p_lv_bukrs TYPE bukrs
p_top_key TYPE lvc_nkey
CHANGING p_company_key TYPE lvc_nkey .
DATA: l_node_text TYPE lvc_value,
ls_vbrk TYPE vbrk.
l_node_text = 'Company' .
CALL METHOD alv_tree->add_node
EXPORTING
i_relat_node_key = p_top_key
i_relationship = cl_gui_column_tree=>relat_last_child
is_outtab_line = ls_vbrk
i_node_text = l_node_text
IMPORTING
e_new_node_key = p_company_key
EXCEPTIONS
relat_node_not_found = 1
node_not_found = 2
OTHERS = 3.
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. " add_node
*& Form add_posnr
text
-->P_LV_POSNR text
-->P_COMPANY_KEY text
<--P_POSNR_KEY text
FORM add_posnr USING p_lv_bzirk TYPE bzirk
p_company_key TYPE lvc_nkey
CHANGING p_bzirk_key TYPE lvc_nkey.
DATA ls_vbrk TYPE vbrk.
CALL METHOD alv_tree->add_node
EXPORTING
i_relat_node_key = p_company_key
i_relationship = cl_gui_column_tree=>relat_last_child
is_outtab_line = ls_vbrk
i_node_text = 'Sales District'
IMPORTING
e_new_node_key = p_bzirk_key
EXCEPTIONS
relat_node_not_found = 1
node_not_found = 2
OTHERS = 3.
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. " add_posnr
*& Module USER_COMMAND_9100 INPUT
MODULE user_command_9100 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
CALL METHOD alv_container->free.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_9100 INPUTCheck this forum there are many threads on this.
-
Hierarchy with External chars, how the external char automatically derives
Hi All,
We have Profit Center hierarchy. It has 'Profit Center Group' as a external char. We have account also in the aggregation level.
The hierarchy is on Profit Center with Profit Center Group as the parent nodes to the profit centers.
There are multiple hierarchies like legal, and management. We should be able to plan on different hierarchies properply, with Profit Center Group derived / created automatiically as per the hierarchy chosen in the variable.
The Profit Center and Group Profit Center are not in the rows and the account is. We tried to plan on the the account hierarchically with diaggreation turned on.
When Data posted, we wanted the Profti Center Group get derived as per the hierarchy chosen in the variable. Right now a blank Group get's posted in the database.
This worked with the Char Relation of type Hierarchy with Hierarchy value fixed. There is no way, we can define the varialbe hierarchy and also Exit Class is not able to read the source variables.
How to make this based on hier variable, or if Char Relationship definition on the InfoProvider in the Plan Modeler not all needed as the relation between Profit Center and Profti Center Group is already in the hierachy chosen in the variable for Profit Center.
Thanks in advance,
Best Regards,
- ShashiHello Shashi,
derivation can only work, when Profit Center Group is not in the aggregation level. When you have more than one hierarchy on Profit Center (you are using in queries) I suggest that you create one hierarchy on Profit Center with Profit Center Group as foreign characteristics to be used in characteristic relationships. This is then a fixed hierarchy that defines what can be derived from Profit Center for all hierarchies you are using in queries.
Then you need no exit implementation. In addition, the hierarchy used in the characteristic relationship defines the admissible combinations in the cube. The hierarchies used in the query are only views on the cube data, in fact the foreign characteristics in hierarchies used in queries are treated as text nodes.
Regards,
Gregor -
Hi,
In our BO Webi report hierarchy with measure values showing more(almost double value) compare to BW Bex report. Can any one please help on this.
Is it BW problem or BO problem?
I checked in some other threads but it's not given solution.
Thanks,
ManjunathaHi,
Is it BW problem or BO problem? : BO
is it causing problem with hierarchly data only ? without hierarchies data is matching or not?
Post same in SAP BusinessObjects Web Intelligence .
Thanks. -
How to create a hierarchy with postable notes
Hi all,
Please take e look at the following case:
In BPS we want to make a planning on groups of FI-GL-accounts. For the grouping of the GL-account we make use of the Financial Statement functionality in R/3. With a BC DataSource (0GL_ACCOUNT_T011_HIER) this Financial Statement is imported in BW as a hierarchy on InfoObject 0GL_ACCOUNT. As said, we do not want to make a planning on the GL-account but on the groups, i.e. the nodes of the hierarchy. We think in this case we need a BW hierarchy with postable nodes and make the planning on the inner nodes of the hierarchy.
So far so good, but when we execute the Manual planning the system responds with Hierarchy xxxx does not contain any postable nodes Anyone has a clue? Did we forget something?
Thx,
Henk van der Haar.Hi Henk,
For the hierarchy with postable nodes the nodes also have to be captured as characteristic values firstly. For more details refer to the document link below
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/biw/g-i/how to plan in bps using hierarchies with several characteristics.pdf
Some useful threads also on the same.
Hierarchy with Postable nodes
Bbw hierarchy with postable nodes Disabled
Hope it helps.
Cheers
Anurag -
Exit button not working in exe file made with Aggregator
Hi,
I created an .exe file using Aggregator in full screen mode but the exit button on the skin doesn't work. When I click the exit button, the dislay hiccups (wobbles a bit) but the file keeps playing and doesn't close. This is especially problematic since this occurs in full screen. The only way to exit is by hitting the Escape key on the keyboard. The exit button works fine in individual .exe files of the modules; it's just in the aggregated .exe file that the exit button doesn't work. Is there anything special I need to do to make the exit button work with Aggregator?Hi, this is more J2EE related stuff, SAP came with a solution but is taking ages to get the next page after the "Exit" button is pushed:
Go to VisualAdnmin >server(n) >Services >Configuration Adapter >
(Right side Pane) webdynpro >sap.com >tcwddispwda >PropertySheet
default.
Edit the property sheet and change the custom value for the property
"sap.locking.maxWaitInterval" to 200.
Note 1113811, explains why these kind of errors happen.
I still waiting for a better solution from SAP.
Cheers -
How to download alv grid output(with field catalog) into excel file format
Hi all,
How to download alv grid output(with field catalogs) into excel file format and same file has to download to application server.
Please help.
Regards,
Satya.Hi,
On list where alv is displayed, select export icon( green color -> ),select spread sheet.
This will display records in Excel sheet. -
Vendor Hierarchy with Pricing from Info Record
Hi All,
We are currently exploring configuration options available to use a 'Vendor Hierarchy' for price determination during Purchase Order processing - R/3 46C
We also have a specific business requirement that requires our Vendor Hierarchy node prices be maintained in an Info Record (using a 'PB00' type condition type) rather than the 'LH01' and 'LH02' condition types used to maintain price conditions directly in the Vendor Hierarchy.
Does anyone know if it is possible to combine a Vendor Hierarchy with pricing that is sourced from Info Record rather than the standard 'LH01' and 'LH02' Vendor Hierarchy pricing conditions in the standard system?
Thanks,
Ravelle
References:
<a href="http://help.sap.com/saphelp_46c/helpdata/en/12/08464f470311d1894a0000e8323352/frameset.htm">Vendor Hierarchy</a>
<a href="http://help.sap.com/saphelp_46c/helpdata/en/12/084676470311d1894a0000e8323352/content.htm">Vendor Hierarchy - Purchase Order Pricing</a>A solution has not been identified...query closed.
-
How to built a hierarchy with flat file?
Hi Experts,
for a better representation of the report, i need to built a hierarchy with flat file.
The Data load is via Flat file.
Do you have some documentation about that?
Thanks
Cheers
GiloHi Gilo,
Check these docs...
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0403a990-0201-0010-38b3-e1fc442848cb">How to Download a Hierarchy to a Flat File</a>
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/fa/e92637c2cbf357e10000009b38f936/content.htm">Uploading Hierarchies from Flat Files</a>
<a href="http://sapbwneelam.blogspot.com">More Docs...</a>
Hope it Helps
Srini -
Problem in hierarchy with sap table
One problem regarding tree hierarchy with the sap bi table example zmaterial which is having 3 fields which should show as node and there data as sub node suggest me , how to do it I have look around the example but there are of simple node with string concept none of them is of sap table
Hi Sarfaraz,
Go throgh these example programs.
WDR_TEST_TREE
WDT_TREE_TABLE_BY_KEY
and also go throgh this blog.
Dynamic Tree in ABAP WebDynpro
also check this wiki
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/wdabap/organization%2bhierarchy%2bin%2btree%2bstructure%2bas%2bf4%2bhelp
Edited by: suman kumar chinnam on Oct 17, 2008 10:04 AM -
ALV Standard Layout with problem for excel download
Hi, i have a alv grid report with this problem:
I execute the report and see all data ok.
chose the download option to spreadsheet.
*When open the spreadshet only see headers and no data.
The report have a standard Layout with 4 of 12 column selected, if i execute this report and add a new column for the pool the download works fine, if i save this new layout as default and execute the report again the download don't work fine.
¿Some idea? ThxsJust a wild guess. In your system, check the MS excel security settings. Excel->File->options->Trust center settings. We had some similar issues with excel columns visibility when you click on the ALV spreadsheet button or download which was corrected by changing the trust center settings. I don't exctly remember which settings affect this. You may have to compare the settings with another system (If it works fine in some other system which was the case in our issue). Pls ignore if not relevant.
Regards,
Gokul -
Build Hierarchy with nodes with ABAP for custom Infoobject
Hi,
Need to build hierarchy with nodes with abap for custom infoobject.
ThanksHi,
Using information from:
http://help.sap.com/saphelp_nw04/helpdata/en/fa/e92637c2cbf357e10000009b38f936/content.htm
you can bulid flat file with hierarchy data and then load in into BW...
Krzys -
1 question - how can I switch off all nodes, that doesn't included in hierarchy
2 question - In a report I need to use GL hierarchy with CoCode filter. I mean, that for some hierarchy nodes I use A,B an C Company codes, and for others - D & E. Is it possible by using standart BEx functionality.Hi
See some setting whether all unassigned nodes can be filtered out for your hierarchy display......all nodes without hierarchical presence can be placed under unassigned nodes
GL hierarchy with CO code filter....Have your tried a restricted keyfigure...
Regards
N Ganesh -
Hierarchy with External Characteristics
I have a request to create a hierarchy for a BEX query that is based on a combination of WBS Element and COORDER. I see that I can change either of these InfoObjects to allow External Characteristics and I have done this.
This hierarchy is to show costs by Project Manager. Each Project Manager can have many projects and each project can have many WBS Elements plus individual orders or nothing but individual orders. I've built the hierarchy and it works in the query as far as how the results are displayed. But I am only getting costs associated with WBS Elements not with orders. (I should add that we do not post to WBS Elements, we assign WBS Elements to orders and we post costs to orders so WBS Element is an attribute of COORDER).
For instance, one project manager could have 2 projects; Project 1 includes all orders associated with WBS Element 1 (so I assign the value for WBS Element 1 to a node); Project 2 includes all orders related to WBS Element 2 as well as Order 1 and Order 2 (which are assigned WBS Element 3 but I don't want all of the orders assigned to WBS Element 3 so I assing WBS Element 2 to a node, Order 1 to a node and Order 2 to a node).
Here is what it looks like:
1 0HIER_NODE PROGMGR1 (child ID = 2; next = 4)
2 0HIER_NODE PROJECT1 (parent ID = 1; child = 3)
3 0WBS_ELEMT 1 (parent ID = 2)
4 0HIER_NODE PROJECT2 (parent ID = 1; child = 5)
5 OWBS_ELEMT 2 (parent ID = 4, next = 6)
6 0COORDER 1 (parent ID = 4, next = 7)
7 0COORDER 2 (parent ID = 4)
I get all of the costs for both projects that are associated with WBS 1 and 2 but none of the costs for the two orders not related to a specific WBS Element.
I have created a selection variable to use the hieracrchy when selecting the query results. What is the point of assigning External Characteristics in a hierarchy? I understand logically why my query doesn't select the costs associated with the orders since my hierarchy is based on WBS Element not order. I've tried including the WBS Element associated with the individual orders in the hierarchy with the thought of restricting those particular nodes down to the specific orders in a structure in my query but I can't seem to figure that out either.
Can anyone give me any ideas on how to do this?
Thanks,
Barb Bunker
Puget Sound EnergyHello baRbaRa,
How r u ?
You have Kept the 0HIER_NODE for the PROJECT MANAGER. Will there be only one project manager !? Assuming you will have more Project Managers,
0HIER_NODE
|_ZPROJ_MGR
...|_ZPROJECT
......|_ZWBS_ELMT
......|_ZORDERS
If you assign the WBS Element & Orders to PROJECT it should give the costs based on the PROJECT & WBS Element / PROJECT & Orders combinations.
Is this you r looking for ?
Best Regards....
Sankar Kumar
+91 98403 47141
Maybe you are looking for
-
HI all, I am trying to import the data from dev server but i got the error message " Transport control program tp ended with error code 0212" Errors: could not access file as supposed (see SLOG for more info) i think its becase of the
-
iPhoto or .Mac for web gallery questions? I'll try here: Running iPhoto 7.01 and uploaded a web gallery of my niece's wedding. My camera takes QT movies as well and allows you to select movies and even sends a thumbnail with a movie icon on it. But w
-
Hey everyone, I currently have a problem with my W500 (that I had back in 2009 when I bought the laptop) but now it is even worst because it makes my W500 crash. I have again, the "display driver stopped responding & has recovered" error when I use m
-
Since the last updates to the iBook and the iPad, PDF's added to the iBook app when opened to read crash the iBook app. I have resorted to putting the PDF's into GoodReader so that I can read them but I would prefer to read them in iBook. Has anyone
-
TC 500 MB, seems to be backing up my 2 other computers on network (mac mini, iMac G5) without problems (first back-up ethernet, then subsequent ones through airport). Same true for MacBook pro, but now MacBook pro gets stuck in "Preparation" mode and