Suppressing empty nodes in ALV tree grid

Hi,  I'm writing an ALV tree report with financial data broken down by cost element hierarchy. We've determined that the maximum number of levels in our hierarchy is seven so have to build the program to accept seven node levels. Most times when it runs it will find fewer than seven nodes.  Is there an easy to to suppress empty columns in the report so that the end user does not not see a bunch of empty nodes in the report?

Expand or Collapse Branches or Hide Areas
You are able to expand and collapse the branches of the tree structure individually or together. Beyond that you are able to make a node or an item completely invisible.
Methods
Function                                       Class                                   Method
Expand individual branch               CL_SALV_NODE                  EXPAND 
Collapse individual branch                                                        COLLAPSE
Expand all branches                    CL_SALV_NODES                EXPAND_ALL
Collapse all branches                                                              COLLAPSE_ALL
Change visibility of a node            CL_SALV_NODE                  SET_VISIBLE
Check whether the node is visible                                             IS_VISIBLE
Change visibility of an item             CL_SALV_ITEM                 SET_VISIBLE
Check whether the item is visible                                             IS_VISIBLE

Similar Messages

  • Runtime error while i add a node in ALV Tree in oops

    i am adding a node to alv tree using oop am passing a work area and when i execute it is going for a dump and it says UC_OBJECTS_NOT_CONVERTIBLE
    and the below where it is bold and italic it is where the dump is occuring
    METHOD ADD_NODE.
    FIELD-SYMBOLS: <TAB1> TYPE standard TABLE,
    <wa> type any.
    assign mt_outtab->* to <tab1>.
    insert line in outtab
    DATA: L_INDEX TYPE SY-TABIX.
    if is_outtab_line is initial.
    create initial line
    data l_dref_wa type ref to data.
    create data l_dref_wa like line of <tab1>.
    assign l_dref_wa->* to <wa>.
    l_index = 0.
    append <wa> to <Tab1>.
    else.
    APPEND IS_OUTTAB_LINE TO <TAB1>. endif.
    L_INDEX = SY-TABIX.
    add node to model
    CALL METHOD ME->ADD_MODEL_NODE
    EXPORTING
    I_RELAT_NODE_KEY = I_RELAT_NODE_KEY
    I_RELATIONSHIP = I_RELATIONSHIP
    IS_NODE_LAYOUT = IS_NODE_LAYOUT
    IT_ITEM_LAYOUT = IT_ITEM_LAYOUT
    I_NODE_TEXT = I_NODE_TEXT
    I_INDEX_OUTTAB = L_INDEX
    IMPORTING
    E_NEW_NODE_KEY = E_NEW_NODE_KEY.
    ENDMETHOD.

    HI Mohsin,
    please refer to the below ....
    might be helpful for u .....
    https://scn.sap.com/thread/2050188
    http://scn.sap.com/message/6407195
    http://r0005001.benxbrain.com/de%28bD1lbiZjPTAwMQ==%29/index.do?onInputProcessing=brai_thread&001_thread_id=1759814%20&001_temp=R3TR|PROG|RCSBI010||P01|
    Hope thiw will help ....
    Regards,
    AKS

  • ALV Tree/Grid: maximum columns

    Hello.
    How many columns can have a maximum of ALV Tree/Grid?
    Thanks.
    P.S. Sorry, self-solved: OO ALV : Maximum number of columns, Daixiong Jiang.

    Hello Emir
    Call the static method <b>cl_gui_cfw=>set_new_okcode</b> with your required ok-code. The short description of this methods says <i>"Be careful: This sets a new Fcode in Eventhandler for PAI",</i> exactly what you want.
    Regards
       Uwe

  • How to eliminate empty node space from tree when rendered property is false

    Hi
    I have created a menu Tree for my ADF BC application while working in JDev 10.1.3.3.
    I have tried two methods, first is by creating a menu model as discussed in example in ADF Developers Guide Book Section 19.2.1. Second by creating two view objects and creating the menu tree from my database table.
    Depending on the logged in user I want to decide whether to show or not to show a menu tree option to the user. For this purpose I have implemented a function in a managed bean that calls a pl/sql stored procedure to decide if the user has access to a certain component. In first case I have set the rendered property of the menu item to #{menuTree.shown}, where shown is an attribute in the menu model whose value is properly set using java functions that call pl/sql function in turn. In second method, I have also tried to set the rendered property and calling a function that returns true or false based on if the user has access to the menu option.
    Problem
    When rendered property is returned as false, although the menu option is not displayed but an empty space is displayed in my tree and remaining nodes and/or menu options are displayed with an ugly gap.
    How I can remove this unwanted gap, is there a way?
    Regards,
    Amir
    1st option:
    My menu tree:
    <af:menuTree var="menuTree" value="#{menuModel.model}">
    <f:facet name="nodeStamp">
    <af:commandMenuItem text="#{menuTree.label}"
    action="#{menuTree.getOutcome}"
    _rendered="#{menuTree.shown}_"/>
    </f:facet>
    </af:menuTree>
    2nd option:
    <af:tree value="#{bindings.MainMenuView.treeModel}" var="node">
    <f:facet name="nodeStamp">
    <af:switcher facetName="#{node.hierType.name}">
    <f:facet name="MainMenuViewNode">
    <af:outputText value="#{node.Name}" _rendered="#{userInfo.mainNodeOk}"_ />
    </f:facet>
    <f:facet name="SubMenuViewNode">
    <af:commandLink text="#{node.Name}" _rendered="#{userInfo.mainNodeOk}_">
    <af:setActionListener from="#{node.destinationUrl}"
    to="#{menuTree.getOutcome}"/>
    </af:commandLink>
    </f:facet>
    </af:switcher>
    Edited by: Amir Khan on Jan 12, 2009 8:54 PM

    Hi,
    if this reproduces in JDeveloper 10.1.3.4 then this sounds like a bug that you should file
    Frank

  • ALV Tree Grid...

    How can I make a ALV grid like the one I created with REUSE_ALV_GRID_DISPLAY but with tree structure..
    I saw a few examples but almost all of them are like text output.. And the ones with graphical looking outputs are like SAP's menü, and doesn't seem like grid at all.
    Well, I hope there is any way to do this.

    If you are looking for a FM like REUSE_ALV_GRID_DISPLAY, no.   But the class is very easy to use. you can look into BCALV_TEST_SIMPLE_TREE or if you are newer release of SAP, you can also look into SALV_DEMO_TREE_SIMPLE.
    Albert

  • Editing of a  Column of ALV Tree(OOPS) node

    is it possible to edit a column of node of ALV tree.
    i am using ALV class "CL_GUI_ALV_TREE".
    After searching existing threads, for the same issue..i found the following.
    1) Editable Tree ALV
      ( displays pop up window where user can change values and then transfer these changes back to ALV tree)
    2) Editable Field in ALV TREE Display Using OOPs
         (this approach is not working for ALV Tree)
    But i want to edit directly coulmn of a node of ALV tree.
    is it possible in  OOPS ALV Tree?
    if it possible, can any one provide the sample code,

    As you already noticed, this is not possible, but you may edit your fields outside the tree and bring your changes back to tree. I struggled with the same once but eventually used described alternative. If you use saplink you may check upgrade [chain and rename|http://code.google.com/p/saplink-chain-and-rename/downloads/list] where this approach is released. The code is free so you will be able to study and copy whatever you need from it.
    Editing in a pop up is also an alternative here.
    Regards
    Marcin

  • Sample Program for Creating ALV Tree

    Hello Guys,
    Can some One Send me some sample program for creating ALV Tree.
    my Requirement is like below Diagram.
    ALV Tree |   ALV GrId
       |
       |
    I want to also about event in ALV , As per requirement when user select (Double click or press any push button) a node of ALV Tree That Node (Contain Sales order and as a child billing Doc No)  In the ALV Grid All the details about Sales order Will be display.
    Please guide me.
    Thanks
    Swati....

    Hi..
    check the following demo programs:
    RSDEMO_DRAG_DROP_EDIT_TREE
    RSDEMO_DRAG_DROP_TREE_MULTI
    BCALV_GRID_DND_TREE
    BCALV_GRID_DND_TREE_SIMPL
    BCALV_TEST_COLUMN_TREE
    BCALV_TEST_SIMPLE_TREE
    BCALV_TREE_01
    BCALV_TREE_02
    BCALV_TREE_03
    BCALV_TREE_04
    BCALV_TREE_05
    BCALV_TREE_06
    BCALV_TREE_DEMO
    BCALV_TREE_DND
    BCALV_TREE_DND_MULTIPLE
    BCALV_TREE_EVENT_RECEIVER
    BCALV_TREE_EVENT_RECEIVER
    BCALV_TREE_ITEMLAYOUT
    BCALV_TREE_MOVE_NODE_TEST
    BCALV_TREE_SIMPLE_DEMO
    BCALV_TREE_VERIFY
    hope this helps..
    -kothai

  • ALV TREE in Web Dynpro

    Hi guys,
    I am trying to display data from the internal table to ALV tree by using TreeByKeyTableColumn.
    can anyone please help me out or suggest proper way to display.
    thanks,

    >
    Kalpana Arumugam wrote:
    > Hi ,
    >      I was telling abt the SAP LOGON release version ( 640 Final Release ) and ofcourse not the WAS version . WAS is 7 0 only .
    >     The example which is given by you is not having any sample data . So im not able to find the tree .
    >  Now i have created a tree structure . But could you help me out in adding child nodes to the corresponding parent node in alv tree ?  .
    >
    > Thanks in advance .
    Although you might not have the sample data to run the application, you should still be able to look at the source code of the application. Also don't be confused by the File Upload prompt of the test applications.  It just is there if you want to override the data in the database.  If you just press the upload button without specifying the file it will instead read the data from the database.  If you database tables are empty, you can run the program BCALV_GENERATE_ALV_T_T2.
    Now as far as adding child nodes - that isn't exactly how things work with the ALV TREE. You don't actually have a heirarchy of nodes like when creating a tree element.  You can only set set columns as hierarchy columns.  It then uses sorting and grouping based upon these columns to make a psedo tree. However your data has to remain flat.
    For example you can take the flat SFLIGHT data in the example and define a hierarchy column of CARRID and CONNID.
    http://www.flickr.com/photos/tjung/2802287945/
    You then get output that looks like this:
    http://www.flickr.com/photos/tjung/2802287971/
    If you simply change the hierarchy column definition to add the Departure Date, the output changes (without any changes to the underlying data structure):
    http://www.flickr.com/photos/tjung/2802287989/

  • Editable Field in ALV Tree Control

    Hello All,
    Can anyone tell me how can i make a field editable in an Alv Tree grid. I have tried with fiedcatalog-edit = 'X'. but that doesn't work. 
    also please provide a piece of code to be clear ...
    Thanks,
    Ravi Aswani

    hI ,
    Data : LI_fieldcat  type lvc_t_fcat,
              ls_fcat type lvc_s_fcat.
    IF OKCODE = 'MAIN'.
          CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
        I_BUFFER_ACTIVE              =
          i_structure_name             = 'ZCUS'
        I_CLIENT_NEVER_DISPLAY       = 'X'
        I_BYPASSING_BUFFER           =
        I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = LI_fieldcat[]            .
      LOOP AT LI_FIELDCAT INTO LS_FCAT.
        CASE ls_fcat-fieldname.
          WHEN 'KUNNR'.
            ls_fcat-col_pos = 1.
          WHEN 'NAME1'.
            ls_fcat-edit = 'X'.
            ls_fcat-col_pos = 2.
          WHEN 'ORT01'.
            ls_fcat-edit = 'X'.
            ls_fcat-col_pos = 3.
            ls_fcat-drdn_hndl = '1'.
            ls_fcat-outputlen = 20.
          WHEN 'LAND1'.
            ls_fcat-edit = 'X'.
            ls_fcat-col_pos = 4.
        ENDCASE.
        MODIFY LI_fieldcat FROM ls_fcat.
      ENDLOOP.
    ENDIF.
    With this The internal Table contains 4 fields Kunnr Name1 Ort01 Land1 Here Kunnr is the Key field so , it is not editable , reaming fields are Editable.
    There u must write the Modify statement.
    check it once
    Regards
    Krishna

  • Creating Context Menu in ALV tree defined inside DOCKING CONTAINER

    Dear Experts.
    Can you please tell me which EVENTS should i use in CLASS: CL_GUI_SIMPLE_TREE to get a Context menu after right click on any tree node in ALV Tree which has been defined inside a Docking Container.
    Regards Arnab.

    Hi,
    Check Program SAPSIMPLE_TREE_CONTEXT_MEN_DEM and check event node_context_menu_request
    Hope this helps you.
    Thanks,
    Prashanth
    Edited by: Prashanth KR on Jun 2, 2009 7:50 AM

  • Empty nodes using JhsTreeMenuPageTemplate

    Hi guys,
    JHeadstart version 11.1.1.2.46
    I'm using the JhsTreeMenuPageTemplate as my page template to generate my menu's in the tree structure. I also have "Authorize using group permissions" set which sets the "rendered" attribute of each "itemNode" in the menu to the group name. The problem I have is that for roles that do not have all group permissions, the empty node on the tree menu is still shown (just the link/text is not rendered). This looks terribly messy if a role only has a few permissions. How can I prevent the itemNode (and groupNodes) from being created at all if the user does not have the permission for that menu item ?
    Cheers,
    Brent

    Brent:
    According to this post (Dynamic Tree menu rendering problem by Steven, JHS 11.1.1.3 is scheduled for release next week or the week after....
    Mary
    UofW

  • Multiple fields in node level of a ALV tree

    Hi gems,
    Hope U all doing well.
    In a requirement, I have few fields (say 10) to display in hierarchy. There will be 3 fields in 1st level, 3 fields in 2nd level and 4 fields in last level.
    I tried using ALV tree...but couldn't able to get any idea to display more than 1 fields in 1st or 2nd level node.
    Is it possible through ALV TREE? If yes, then how? I am new to oops. So please give me a bit detailed info.
    Thanks,
    Surajit

    you must have the same number of columns on all lines (but you may display them empty)
    Have a look at BCALV_TREE_DEMO program

  • ALV Tree, Expanded node do not show data in certain column

    Hi all,
    I need your help regard to below problem.
    I have an ALV grid in which one of the columns has F4 (search help). If search help is called by pressing a F4 button a dialog box will be shown with ALV tree on it.
    The ALV Tree has 2 columns which are: hierarchy column and one other column called WBS column. At the first show, all expanded node show data contained in WBS column, but if I click to expand a collapsed node, data is not shown in WBS column for the new expanded rows, only shows data in hierarchy column. How to show data in WBS column for the new expanded rows..?
    Basically if at the first show I expand all node, data in WBS column are shown for all rows. It seems that the Expand Node event doesn't update all column data to be shown.
    Please share if anyone of you has faced this kind of problem. Thank you.
    Regards,
    Ramses Hutahaean
    Edited by: Ramses Hutahaean on Feb 29, 2012 1:38 PM

    Hi Fenja,
    as the click-events only raise the node_key (at least I couldn't detect another information), I assume the only way is maintaining an internal helper table by yourself which you build up in parallel when creating the tree and its nodes.
    The (hashed) table might contain 2 columns:
    1. node_key (as table key)
    2. reference to an object
    When a click-event is raised, you look up the corresponding object reference in your table.
    Regards,
    Ulrich

  • Print empty nodes in a Huffman binary Tree

    Hi,
    I have constructed a binary huffman tree, and I need to print the empty nodes as a character '-'. As I am using the array structure to build the huffman tree, I am very confused how I can go about it. This is my code. Any help will be appreciated:
    import java.util.*;
    import java.io.*;
    import java.lang.*;
    public class Huffman
        static char letters;
        static int frequency;
        static char frequency1;
        static int alphabet;
        static char frqtable [][];
        static char treetable[][];
        static TreeNode myTree[];
        static int i = 0;
        static int j = 0;
        static Scanner in = new Scanner(System.in);
        static int index = 0;
        static Vector temp = new Vector();
        static String finalarray[];
        public static void main (String args[])throws IOException{
            setFrequencyTable();
            treetable = frqtable;
            sortArray(treetable);
            buildHuffmanTree(treetable, alphabet);
           // printGeneralTree();
         public static void setFrequencyTable() throws IOException{
            System.out.println ("Please enter number of distinct alphabet");
            alphabet = in.nextInt();
            frqtable = new char[alphabet][2];
           for (int count = 0; count<alphabet; count++){
                System.out.println ("Enter the character");
                letters = (char) System.in.read();
                frqtable[i][j] = letters;
                System.out.println ("Enter frequency");
                frequency = in.nextInt();
                frequency1 = Integer.toString(frequency).charAt(0); ;
                frqtable[i][j+1] = frequency1;
                i = i+1;
                j = 0;
        public static void sortArray (char[][]treetable){
            char templetter;
            char tempfrq;
          for (int j=0; j < frqtable.length; j++) {
            for (int i=0; i < frqtable.length-1; i++) {
                  if((treetable[1]) < (treetable[i+1][1])){
    tempfrq = (treetable[i][1]);
    templetter = (treetable[i][0]);
    (treetable[i][1]) = (treetable[i+1][1]);
    (treetable[i][0]) = (treetable[i+1][0]);
    (treetable[i+1][1]) = tempfrq;
    (treetable[i+1][0]) =templetter;
    public static void levelorderTraversal(TreeNode root) {
    levelorderHelper( root);
    System.out.println();
    private static void levelorderHelper( TreeNode node ) {
    if( node == null )
    return;
    queue( node ); // queues root
    qLeftqRight( index ); // queues Left/Right node of the node at 'index'
    printIt(); // prints contents of queue
    private static boolean queue( TreeNode n ) {
    if( n != null ){ // if child exists, queue it
    temp.addElement( n );
    return true;
    }else{
    return false;
    private static void qLeftqRight( int i ) { // for each queued node, queue its children
    while( i < temp.size() ) {
    TreeNode tmp = (TreeNode) temp.elementAt( i );
    if (tmp.leaf == false){
    queue( tmp.left );
    queue( tmp.right );
    i++;
    private static void printIt() {
    finalarray = new String[temp.size()];
    for( int x = 0; x < temp.size(); x++ ) {
    TreeNode t = (TreeNode) temp.elementAt( x );
    if(t.ch == '\0'){
    finalarray[x] = Integer.toString(t.count);
    }else{
    finalarray[x]=Character.toString(t.ch);
    public static void buildHuffmanTree(char [][] treetable, int alphabet){
    myTree = new TreeNode [alphabet];
    TreeNode leftNode, rightNode;
    TreeNode newNode = null;
    for ( int i = 0; i < alphabet; i++ ){
    myTree[i] = new TreeNode (treetable[i][0], Character.getNumericValue(treetable[i][1]));
    for (int j =((myTree.length)-1); j>0; j--){
    newNode = new TreeNode(myTree[j], myTree[j-1]);
    myTree[j] = null;
    myTree[j-1] =null;
    if(j!=1){
    for(int c = 0; c<(j-1); c++){
    if(myTree[c].count <= newNode.count){
    for(int x = alphabet-1; x>c; x--){
    myTree[x] = myTree[x-1];
    myTree[c] = newNode;
    c= j-1;
    }else{
    myTree[0] = newNode;
    levelorderTraversal(myTree[0]);
    for(int i = 0; i < finalarray.length; i++){
    System.out.println(finalarray[i]);
    public class TreeNode{ 
    final boolean leaf;
    int count;
    final char ch;
    final TreeNode left,
    right;
    public TreeNode ( char ch, int count )
    {  this.leaf  = true;
    this.count = count;
    this.ch = ch;
    this.left = null;
    this.right = null;
    public char getChar(){
    return ch;
    public TreeNode ( TreeNode left, TreeNode right)
    {  this.leaf  = false;
    this.count = left.count + right.count;
    this.left = left;
    this.right = right;
    this.ch ='\0';

    doobybug wrote:
    The finalarray actually prints the array.No, finalarray IS and array. It doesn't print anything.
    The problem I think is with the TreeNode class where a leaf states the left and right nodes as null, but if I instantiate them to '-' they will continue to assign empty nodes until the program runs out of memory!!I don't know what you're saying here, but it sounds like you think that you have to set the Node to '-' in order to be able to print '-'. Really all you have to do is
    for each node {
      if the node is empty {
        print -
      else {
        print whatever you print for non-empty nodes
    }Or if an "empty" node is still a Node object, just with certain attribute values, then just create a toString method in the Node class that returns "-" when the Node is empty.
    Really, if you know how to iterate over your nodes, and you know how to determine whether a node is empty, then your problem is solved, there's nothing else to it.

  • Problem with same layout (variant) for two ALV Grid and ALV Tree

    Hello!
    I have two docking containers on the screen. On the left i have cl_gui_alv_tree, on the right cl_salv_table.
    When a user set a default layout for ALV Grid (or ALV Tree), raport starts and sets this layout in both objects (tree and grid).
    How to avoid this?

    Hi,
    Take Two radio buttons.
    First radion button display the two containers in grid format,
    second radio button display the two containers in tree format base on user selection.
    CREATE OBJECT G_DOCING_CONTAINER
        EXPORTING PARENT = G_CUSTOM_CONTAINER."G_CONTAINER.
    DISPLAY THE DATA IN GRID FORMATA
    CREATE OBJECT r_grid
        EXPORTING
          i_parent          = G_DOCING_CONTAINER
    CALL METHOD g_docing_container->set_width
          EXPORTING
            width      = 1300.
    DISPLAY THE GRID DATA IN SECOND CONTAINER
    CREATE OBJECT r_grid1
        EXPORTING
          i_parent          = G_DOCING_CONTAINER
    CALL METHOD g_docing_container->set_width
          EXPORTING
            width      = 1300.
    OTHERWISE WE CAN DISPLAY THE TWO CONTAINERS DATA IN A GRID FORMAT
    CREATE OBJECT g_tree
        EXPORTING
          parent                = g_docing_container"g_custom_container
    IF R1 = 'X'.  "FOR GRID DISPLAY
    CALL METHOD r_grid1->set_table_for_first_display
    CALL METHOD r_grid2->set_table_for_first_display
    ELSE.
    ************TREE DISPLAY
    ENDIF.
    regards,
    muralii

Maybe you are looking for

  • Multi-touch gestures suddenly stop working

    Hi! I'm having problems with multi-touch gestures in browsers such as Safari, Chrome. Suddenly, 'double tap zoom' stops working during browsers use. Also, when I pinch to zoom, pinch to unzoom stops working. I'm using a MBPR 15" mid 2012, OS X Maveri

  • Leap year issue in depriciation

    Hi All, I have an asset which is acquired on 16th January 2008. 2008 being a leap year should calculate depriciation according to 366 days in a year. However it is calculation on the basis of 365 days in a year. Where should this setting of leap year

  • Capital One VentureOne Approval- How long until card is received?

    My husband applied for a VentureOne card on June 20th and was apporved, but the screen just said "Congratulations, you're approved!" and it did not show a limit or APR. It did say we would receive the card in 7-11 business days. He chatted with a rep

  • AUTHORITY_CHECK for report transaction

    Hi All, I have around 100 Reporting Customized T-codes Question: How to put in security for these t-codes ? Thanks Vidyar

  • This trigger giving mutation error? any body can tell why?

    Hi All, Could any body tell me where is the problem in my trigger. my tables are. 1) EMP :- emp_id,emp_movement_status 2) EMPLOYEES_DAILY_MOVEMENT :- emp_id,transaction_time,transaction_remarks. if i delete a entry from transactions_table, it has to