Delete tree nodes from Table

I have created a tree table
create table subforums (
id          NUMBER(5) primary key,
parent_id     references subforums,
name          varchar2(100)
And now i dont know how to delete a tree with a specified id and all of his children.
I tried to find out but i couldnt

Hi,
When you delete a node and all of its children, what do you want to do with the grandchildren? If you want to set their parent_id to NULL, do that in a separate UPDATE statement first, then DELETE the original node and all its remaining descendants, as show below.
If, when you say "children", you mean "descendants" (including
children,
children of children,
children of children of children,
and so on, to any level,
) then do a CONNECT BY query to find their primary keys, and DELETE everything in that list, like this:
DELETE  subforms
WHERE   id  IN
        SELECT  id
        FROM    subforms
        START WITH        id = :specified_id
        CONNECT BY  PRIOR id = parent_id
        );

Similar Messages

  • How to delete a node from a node network

    How do I delete a node from a node network?
    <P>
    <OL>
    <LI>Follow the instructions on page 30 of the Calendar Server (CS) 3.x Admin Guide,
    and page 62 of the CS 4.0 Admin Guide "Deleting (excluding) a Node from the
    Network".
    <LI>Shut down the Directory Server.
    <LI>Backup the LDAP directory to an LDIF file.
    <LI>Edit this LDIF file and delete references to the
    6 calendar reserved users for the node to be deleted.
    <LI>Restore the LDAP directory with this changed LDIF file.
    <LI>Run unidbfix -export -n all
    <LI>Edit the resulting remotenodes.ini
    files and delete all
    references to the node to be deleted.
    <LI>Run unidbfix -import -n all
    <LI>Start the Directory Server.
    <LI>Start the Calendar Server.
    <P>
    Note: This next step is for Calendar Server 3.x * ONLY *
    <P>
    <LI>Run unireqdump -delete
    to delete all requests to the node
    to be deleted.
    </OL>

    Divya wrote:
    Hi,
    I'm using forms6i.
    I want to delete unselected nodes from a tree
    How can it be done??
    ThanksIf you mean empty branches as unselected nodes,
    set Allow Empty Branches property to 'No' in the Trees property.

  • Deleting the values from table control

    HI,
    I need to remove the selected line from the Table control on my screen.
    The point is that the Internal table does not have any records,.
    for example in the Customer Create screen,
    while entering the bank details we will enter it in a tbale contraol.
    but the records doesnt exist in the database. but the record gets deleted from the table control only if we press delete button.
    please guide me.
    please note : I want to delete the record from Table Control on the screen and I dont have any corresponding database records..
    regards

    Hi..
    The solution to your problem - deleting values from table control.
    Here: it_wizard is the internal table which is holding the value of table control.
             wa_wizard is the work are of the internal table it_wizard.
             it_delete is the internal table which holds the deleted record of table control.
             wa_delete is the work area of the internal table it_delete
    Also here the field ZSEL is the character field which is used to select the entire record in the table control.
    LOOP AT it_wizard into wa_wizard WHERE zsel = 'X'.
           MOVE-CORRESPONDING wa_wizard TO wa_delete.
           APPEND wa_delete TO it_delete.
           delete table it_wizard from wa_wizard.
    DELETE  FROM zfin_goods WHERE ZFG = WA_delete-ZFG.
    ENDLOOP
    if sy-subrc eq 0.
    Message 'Delete Successful' type 'S'.
    endif.
    The above code will delete the record from both the table control.internal table and the database table.
    I think this will help you to great extent.
    Ward regards,
    Bhuvaneswari
    Edited by: BHUVANESWARI THIRUNAVUKKARASU on Jan 7, 2009 10:39 AM

  • How to Delete the node from cluster when the machine crashed?

    In an three nodes Rac of 11g r2,How to delete the node from cluster when the machine crashed?
    There is now way to repair the machine and have to add a new one.
    What is step to follow up?

    hi
    IF YOU WANT TO DELETE RAC1 NODE
    check $./olsnodes
    1) delete the instance using dbca from any active nodes
    crs_stat -t
    srvctl stop asm -n rac1
    2) delete listener
    3) delete oracle_home from oracle user
    $ORACLE_HOME/bin/runInstaller -updatenodelist ORACLE_HOME=<db_home> "CLUSTER_NODES={RAC1}
    4)delete asm home
    $ORACLE_HOME/bin/runInstaller -updatenodelist ORACLE_HOME=<asm_home> "CLUSTER_NODES={RAC1}
    5) update cluster node
    $ORACLE_HOME/bin/runInstaller -updatenodelist ORACLE_HOME=<db_home> "CLUSTER_NODES={active nodes like rac2,rac3}
    6) update ASm home
    $ORACLE_HOME/bin/runInstaller -updatenodelist ORACLE_HOME=<asm_home> "CLUSTER_NODES={active nodes like rac2,rac3}
    cd $ORA_CRS_HOME
    cd crs/opmn/conf
    check for
    $cat ons.config
    remoteport=6200
    cd crs_home/bin
    $./racgons remove_config rac1:6200
    $ go to crs home
    and $ORA_CRS_HOME/crs/install/rootdelete.sh
    $ORA_CRS_HOME/crs/install/rootdeletenode.sh
    check for ./olsnodes

  • How to hide a tree node from the GUI but still keep it in the tree model?

    Hi, All
    I used a JTree in my project in which I have a DefaultTreeModel to store all the tree structure and a JTree show it on the screen. But for some reason, I want to hide some of the nodes from the user, but I don't want to remove them from the tree model because later on I still need to use them.
    I searched on the web, some people suggested method to hide the root node, but that's not appliable to my project because I want to hide some non-root nodes; Some people also suggested to collapse the parent node when there are child to hide, it is not appliable to me either, because there still some other childnodes (sibling of the node to hide) I want to show.
    How can I hide some of the tree node from the user? Thanks for any information.
    Linda

    Here's an example using a derivation of DefaultTreeModel that shows (or does not show) two types of Sneech (appologies to the good Dr Zeus) by overiding two methods on the model.
    Now, there are many things wrong with this example (using instanceof, for example), but it's pretty tight and shows one way of doing what you want.
    Note: to make it useful, you''d have to change the implementation of setShowStarBelliedSneeches() to do something more sophisticated than simply firing a structure change event on the root node. You'd want to find all the star bellied sneech nodes and call fireTreeNodesRemoved(). That way the tree would stay expanded rather than collapse as it does now.
    import javax.swing.JTree;
    import javax.swing.JScrollPane;
    import javax.swing.JOptionPane;
    import javax.swing.JCheckBox;
    import javax.swing.JPanel;
    import javax.swing.tree.TreePath;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.DefaultMutableTreeNode;
    import java.awt.Dimension;
    import java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Enumeration;
    class FilteredTree
         private class PlainBelliedSneech {
              public String toString() { return "Plain Bellied Sneech"; }
         private class StarBelliedSneech {
              public String toString() { return "Star Bellied Sneech"; }
         private class FilteredTreeModel
              extends DefaultTreeModel
              private boolean mShowStarBelliedSneeches= true;
              private DefaultMutableTreeNode mRoot;
              FilteredTreeModel(DefaultMutableTreeNode root)
                   super(root);
                   mRoot= root;
              public Object getChild(Object parent, int index)
                   DefaultMutableTreeNode node=
                        (DefaultMutableTreeNode) parent;
                   if (mShowStarBelliedSneeches)
                        return node.getChildAt(index);
                   int pos= 0;
                   for (int i= 0, cnt= 0; i< node.getChildCount(); i++) {
                        if (((DefaultMutableTreeNode) node.getChildAt(i)).getUserObject()
                                            instanceof PlainBelliedSneech)
                             if (cnt++ == index) {
                                  pos= i;
                                  break;
                   return node.getChildAt(pos);
              public int getChildCount(Object parent)
                   DefaultMutableTreeNode node=
                        (DefaultMutableTreeNode) parent;
                   if (mShowStarBelliedSneeches)
                        return node.getChildCount();
                   int childCount= 0;
                   Enumeration children= node.children();
                   while (children.hasMoreElements()) {
                        if (((DefaultMutableTreeNode) children.nextElement()).getUserObject()
                                            instanceof PlainBelliedSneech)
                             childCount++;
                   return childCount;
              public boolean getShowStarBelliedSneeches() {
                   return mShowStarBelliedSneeches;
              public void setShowStarBelliedSneeches(boolean showStarBelliedSneeches)
                   if (showStarBelliedSneeches != mShowStarBelliedSneeches) {
                        mShowStarBelliedSneeches= showStarBelliedSneeches;
                        Object[] path= { mRoot };
                        int[] childIndices= new int[root.getChildCount()];
                        Object[] children= new Object[root.getChildCount()];
                        for (int i= 0; i< root.getChildCount(); i++) {
                             childIndices= i;
                             children[i]= root.getChildAt(i);
                        fireTreeStructureChanged(this, path, childIndices, children);
         private FilteredTree()
              final DefaultMutableTreeNode root= new DefaultMutableTreeNode("Root");
              DefaultMutableTreeNode parent;
              DefaultMutableTreeNode child;
              for (int i= 0; i< 2; i++) {
                   parent= new DefaultMutableTreeNode(new PlainBelliedSneech());
                   root.add(parent);
                   for (int j= 0; j< 2; j++) {
                        child= new DefaultMutableTreeNode(new StarBelliedSneech());
                        parent.add(child);
                        for (int k= 0; k< 2; k++)
                             child.add(new DefaultMutableTreeNode(new PlainBelliedSneech()));
                   for (int j= 0; j< 2; j++)
                        parent.add(new DefaultMutableTreeNode(new PlainBelliedSneech()));
                   parent= new DefaultMutableTreeNode(new StarBelliedSneech());
                   root.add(parent);
                   for (int j= 0; j< 2; j++) {
                        child= new DefaultMutableTreeNode(new PlainBelliedSneech());
                        parent.add(child);
                        for (int k= 0; k< 2; k++)
                             child.add(new DefaultMutableTreeNode(new StarBelliedSneech()));
                   for (int j= 0; j< 2; j++)
                        parent.add(new DefaultMutableTreeNode(new StarBelliedSneech()));
              final FilteredTreeModel model= new FilteredTreeModel(root);
              JTree tree= new JTree(model);
    tree.setShowsRootHandles(true);
    tree.putClientProperty("JTree.lineStyle", "Angled");
              tree.setRootVisible(false);
              JScrollPane sp= new JScrollPane(tree);
              sp.setPreferredSize(new Dimension(200,400));
              final JCheckBox check= new JCheckBox("Show Star Bellied Sneeches");
              check.setSelected(model.getShowStarBelliedSneeches());
              check.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        model.setShowStarBelliedSneeches(check.isSelected());
              JPanel panel= new JPanel(new BorderLayout());
              panel.add(check, BorderLayout.NORTH);
              panel.add(sp, BorderLayout.CENTER);
              JOptionPane.showOptionDialog(
                   null, panel, "Sneeches on Beeches",
                   JOptionPane.DEFAULT_OPTION,
                   JOptionPane.PLAIN_MESSAGE,
                   null, new String[0], null
              System.exit(0);
         public static void main(String[] argv) {
              new FilteredTree();

  • WD ABAP: selecting a tree node from program and scroll to it

    Hi guys!
    I am using a tree in Web Dynpro ABAP. I would like to select/highlight one node from the coding, without user interaction. Is it possible? I couldn't find any (obvious) way so far...
    If it is possible, then let us go a little bit further. Suppose, that the tree grew so big, that cannot fit in the container. Suppose, that you can scroll the tree up/down to see all the nodes. Now, if you mark one tree node from the coding, is it possible somehow, that you scroll the tree automatically, so that the selected node is visible?
    I am interested in any solutions within WD ABAP.
    If you can only answer one of the questions, that is also appreciated!
    Thanks for the help in advance.
    Best regards,
    Janos Kis
    Aerospace&Defense(ERP)

    Hi Thomas,
    thanks for the advice, it works, I have already tried it. The tree node in the lead selection appears highlighted.
    The scrolling doesn't work, though. I have tried to put the tree in a scroll container, and I have also tried it without (relying on the browser to scroll). Neither of them worked, it doesn't scroll to the selected node, it remains offscreen. Can you think of a way, to bring it automatically within the visible range? Ideas, anyone?
    Actually we would like to implement a search function in the tree, and show the result within the tree (highlight the node, expand, if necessary, and bring it on the screen, if off-screen)
    A negative answer is good enough for me, so that I know, that I can stop looking for a solution. Thanks in advance.
    Janos

  • Reduce Size or delete unwanted entries from tables AllDocStreams,AllDocVersions,EventCache,EventLog of Sharepoint 2010 content database

    Size or delete unwanted  entries from tables AllDocStreams,AllDocVersions,EventCache,EventLog  of Sharepoint 2010 content database:
    We using  powershell  scripts to migrate data between   two  sharepoint  2010 sites .
    While  doing migration  we  delete all  document libraries  & list  form  destination  site  and then run  powershell to migrate data from  source to destination. We following this  process
    twice in a week.
    But in doing  so  we found the above mention tables (AllDocStreams,AllDocVersions,EventCache,EventLog ) of destination Sharepoint Content database  are growing at an alarming rate. 
    Wish to know  how  could get rid of  unwanted  data stored in these tables.

    Hi,
    This is old thread but here is your answer for some of the tables you mentioned
    http://blogs.msdn.com/b/sowmyancs/archive/2012/06/29/alldocversions-amp-alldocstreams-table-size-after-upgrading-to-sharepoint-2010.aspx
    Cheers

  • Delete an entry from table T527X.

    Hello Gurus,
    How can we delete an entry from table T527X from se11/se16? Or is there any other transaction by which we can delete this entry? I can not delete the org unit as this org unit is not having any name and the ID is: 00000000. I created this entry using SE11 -> utilities -> Create entry.
    Thanks,
    Chakri.

    When you say select the entry or you double clicking?
    You can try this.. simply select the check box against that entr in the displayed list and then use the menu option Table Entry--> Delete
    Other than, this I can't think of another option.. ofcourse you can always have  a simple custom program  with a couple of lines of code to delete a table entry.
    ~Suresh

  • I cannot delete multiple entries from table

    Hi
    i am trying to delete multiple entries from table while keeping some data.
    for example I have the following table
    Plant                            Item
    US101                         777
    US101                         888
    US101                         999
    US101                         666
    I want to keep the  rows where the item is 777 and 888 for plant US101 and keep delete the rest data
    I wrote the following code
    Delete source_package where Plant = 'US101' and Item NE '777' or '888'.
    but all the rows get deleted.
    I tried deleting single row and it worked.
    Delete source_package where Plant = 'US101' and Item NE '777' .
    How can I delete multiple rows.
    thanks

    Hi Bhat Vaidya,
    Plz refer the following code.. IT will solve ur problem..
    REPORT  ZSDN_TEST.
    data: BEGIN OF it_data OCCURS 10,
            plant(4),
            item_num TYPE string,
          END OF it_data.
    data: str type string.
    data: it_final like it_data OCCURS 10 WITH HEADER LINE.
    it_data-plant = 'US01'. it_Data-item_num = 777.  append it_data.
    it_data-plant = 'US01'. it_Data-item_num = 888.  append it_data.
    it_data-plant = 'US01'. it_Data-item_num = 999.  append it_data.
    it_data-plant = 'US01'. it_Data-item_num = 666.  append it_data.
    delete it_data where plant = 'US01' and item_num ne 777 and item_num ne 888.
    LOOP AT it_data.
    write:it_data-plant,it_data-item_num.
    skip.
    ENDLOOP.
    Regards,
    Apoorv

  • Add/Edit/Delete Tree Nodes using CL_GUI_ALV_TREE

    Hi All,
    I am looking for an example of program with CL_GUI_ALV_TREE that have a functionality of add a tree node, edit a tree node, and delete a tree node.
    I have already looked the BCALV_TREE* demo program but could not able to find a program to add/edit/delete node tree elements.
    Any info on this.
    Thanks
    aRs

    Hello aRs
    Here is a sample report showing how to delete nodes in an ALV tree. The report was copied from BCALV_TREE_01. Search for added code:
    *$ADDED: begin
    *$ADDED: end[/code]
    When you display the tree expand the first folder completely. When entering 'DELETE' into the command field directly the first flight date node will be deleted.
    REPORT ZUS_SDN_BCALV_TREE_01_DELNODE.
    based on: REPORT  bcalv_tree_01.
    Purpose:
    ~~~~~~~~
    This report shows the essential steps to build up a hierarchy
    using an ALV Tree Control (class CL_GUI_ALV_TREE).
    Note that it is not possible to build up this hierarchy
    using a simple ALV Tree Control (class CL_GUI_ALV_TREE_SIMPLE).
    To check program behavior
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    Start this report. The hierarchy tree consists of nodes for each
    month on top level (this level can not be build by a simple ALV Tree
    because there is no field for months in our output table SFLIGHT.
    Thus, you can not define this hierarchy by sorting).
    Nor initial calculations neither a special layout has been applied
    (the lines on the right do not show anything).
    Note also that this example does not build up and change the
    fieldcatalog of the output table. For this reason, all fields
    of the output table are shown in the columns although the fields
    CARRID and FLDATE are already placed in the tree on the left.
    (Of course, this is not a good style. See BCALV_TREE_02 on how to
    hide columns).
    Essential steps (Search for '§')
    ~~~~~~~~~~~~~~~
    1.Usual steps when using control technology.
       1a. Define reference variables.
       1b. Create ALV Tree Control and corresponding container.
    2.Create Hierarchy-header
    3.Create empty Tree Control
    4.Create hierarchy (nodes and leaves)
       4a. Select data
       4b. Sort output table according to your conceived hierarchy
       4c. Add data to tree
    5.Send data to frontend.
    6.Call dispatch to process toolbar functions
    *$ADDED: begin
    DATA:
      gd_del_nkey      TYPE lvc_nkey.
    *$ADDED: end
    §1a. Define reference variables
    DATA: g_alv_tree         TYPE REF TO cl_gui_alv_tree,
          g_custom_container TYPE REF TO cl_gui_custom_container.
    DATA: gt_sflight      TYPE sflight OCCURS 0,      "Output-Table
          ok_code LIKE sy-ucomm,
          save_ok LIKE sy-ucomm,           "OK-Code
          g_max TYPE i VALUE 255.
    END-OF-SELECTION.
      CALL SCREEN 100.
    *&      Module  PBO  OUTPUT
          process before output
    MODULE pbo OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAINTITLE'.
      IF g_alv_tree IS INITIAL.
        PERFORM init_tree.
        CALL METHOD cl_gui_cfw=>flush
          EXCEPTIONS
            cntl_system_error = 1
            cntl_error        = 2.
        IF sy-subrc NE 0.
          CALL FUNCTION 'POPUP_TO_INFORM'
            EXPORTING
              titel = 'Automation Queue failure'(801)
              txt1  = 'Internal error:'(802)
              txt2  = 'A method in the automation queue'(803)
              txt3  = 'caused a failure.'(804).
        ENDIF.
      ENDIF.
    ENDMODULE.                             " PBO  OUTPUT
    *&      Module  PAI  INPUT
          process after input
    MODULE pai INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
      CASE save_ok.
        WHEN 'EXIT' OR 'BACK' OR 'CANC'.
          PERFORM exit_program.
    *$ADDED: begin
        WHEN 'DELETE'.
          CALL METHOD g_alv_tree->delete_subtree
            EXPORTING
              i_node_key                = gd_del_nkey
             I_UPDATE_PARENTS_EXPANDER = SPACE
              i_update_parents_folder   = 'X'
            EXCEPTIONS
              node_key_not_in_model     = 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.
          CALL METHOD g_alv_tree->frontend_update.
    *$ADDED: end
        WHEN OTHERS.
    §6. Call dispatch to process toolbar functions
          CALL METHOD cl_gui_cfw=>dispatch.
      ENDCASE.
      CALL METHOD cl_gui_cfw=>flush.
    ENDMODULE.                             " PAI  INPUT
    *&      Form  init_tree
          text
    -->  p1        text
    <--  p2        text
    FORM init_tree.
    §1b. Create ALV Tree Control and corresponding Container.
    create container for alv-tree
      DATA: l_tree_container_name(30) TYPE c.
      l_tree_container_name = 'CCONTAINER1'.
      CREATE OBJECT g_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'(100).
      ENDIF.
    create tree control
      CREATE OBJECT g_alv_tree
        EXPORTING
            parent              = g_custom_container
            node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
            item_selection      = 'X'
            no_html_header      = 'X'
            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.
    §2. Create Hierarchy-header
    The simple ALV Tree uses the text of the fields which were used
    for sorting to define this header. When you use
    the 'normal' ALV Tree the hierarchy is build up freely
    by the programmer this is not possible, so he has to define it
    himself.
      DATA l_hierarchy_header TYPE treev_hhdr.
      PERFORM build_hierarchy_header CHANGING l_hierarchy_header.
    §3. Create empty Tree Control
    IMPORTANT: Table 'gt_sflight' must be empty. Do not change this table
    (even after this method call). You can change data of your table
    by calling methods of CL_GUI_ALV_TREE.
    Furthermore, the output table 'gt_outtab' must be global and can
    only be used for one ALV Tree Control.
      CALL METHOD g_alv_tree->set_table_for_first_display
        EXPORTING
          i_structure_name    = 'SFLIGHT'
          is_hierarchy_header = l_hierarchy_header
        CHANGING
          it_outtab           = gt_sflight. "table must be empty !
    §4. Create hierarchy (nodes and leaves)
      PERFORM create_hierarchy.
    §5. Send data to frontend.
      CALL METHOD g_alv_tree->frontend_update.
    wait for automatic flush at end of pbo
    ENDFORM.                               " init_tree
    *&      Form  build_hierarchy_header
          build hierarchy-header-information
         -->P_L_HIERARCHY_HEADER  strucxture for hierarchy-header
    FORM build_hierarchy_header CHANGING
                                   p_hierarchy_header TYPE treev_hhdr.
      p_hierarchy_header-heading = 'Month/Carrier/Date'(300).
      p_hierarchy_header-tooltip = 'Flights in a month'(400).
      p_hierarchy_header-width = 30.
      p_hierarchy_header-width_pix = ' '.
    ENDFORM.                               " build_hierarchy_header
    *&      Form  exit_program
          free object and leave program
    FORM exit_program.
      CALL METHOD g_custom_container->free.
      LEAVE PROGRAM.
    ENDFORM.                               " exit_program
    *&      Form  create_hierarchy
          text
    -->  p1        text
    <--  p2        text
    FORM create_hierarchy.
      DATA: ls_sflight TYPE sflight,
            lt_sflight TYPE sflight OCCURS 0,
            l_yyyymm(6) TYPE c,            "year and month of sflight-fldate
            l_yyyymm_last(6) TYPE c,
            l_carrid LIKE sflight-carrid,
            l_carrid_last LIKE sflight-carrid.
      DATA: l_month_key TYPE lvc_nkey,
            l_carrid_key TYPE lvc_nkey,
            l_last_key TYPE lvc_nkey.
    §4a. Select data
      SELECT * FROM sflight INTO TABLE lt_sflight UP TO g_max ROWS.
    §4b. Sort output table according to your conceived hierarchy
    We sort in this order:
       year and month (top level nodes, yyyymm of DATS)
         carrier id (next level)
            day of month (leaves, dd of DATS)
      SORT lt_sflight BY fldate0(6) carrid fldate6(2).
    Note: The top level nodes do not correspond to a field of the
    output table. Instead we use data of the table to invent another
    hierarchy level above the levels that can be build by sorting.
    §4c. Add data to tree
      LOOP AT lt_sflight INTO ls_sflight.
    Prerequesite: The table is sorted.
    You add a node everytime the values of a sorted field changes.
    Finally, the complete line is added as a leaf below the last
    node.
        l_yyyymm = ls_sflight-fldate+0(6).
        l_carrid = ls_sflight-carrid.
    Top level nodes:
        IF l_yyyymm <> l_yyyymm_last.      "on change of l_yyyymm
          l_yyyymm_last = l_yyyymm.
    *Providing no key means that the node is added on top level:
          PERFORM add_month USING    l_yyyymm
                                 CHANGING l_month_key.
    The month changed, thus, there is no predecessor carrier
          CLEAR l_carrid_last.
        ENDIF.
    Carrier nodes:
    (always inserted as child of the last month
    which is identified by 'l_month_key')
        IF l_carrid <> l_carrid_last.      "on change of l_carrid
          l_carrid_last = l_carrid.
          PERFORM add_carrid_line USING    ls_sflight
                                           l_month_key
                                  CHANGING l_carrid_key.
        ENDIF.
    Leaf:
    (always inserted as child of the last carrier
    which is identified by 'l_carrid_key')
        PERFORM add_complete_line USING  ls_sflight
                                         l_carrid_key
                                CHANGING l_last_key.
      ENDLOOP.
    ENDFORM.                               " create_hierarchy
    *&      Form  add_month
    FORM add_month  USING     p_yyyymm TYPE c
                              p_relat_key TYPE lvc_nkey
                    CHANGING  p_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value,
            ls_sflight TYPE sflight,
            l_month(15) TYPE c.            "output string for month
    get month name for node text
      PERFORM get_month USING p_yyyymm
                        CHANGING l_month.
      l_node_text = l_month.
    add node:
    ALV Tree firstly inserts this node as a leaf if you do not provide
    IS_NODE_LAYOUT with field ISFOLDER set. In form 'add_carrid_line'
    the leaf gets a child and thus ALV converts it to a folder
    automatically.
      CALL METHOD g_alv_tree->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_sflight
        IMPORTING
          e_new_node_key   = p_node_key.
    ENDFORM.                               " add_month
    FORM add_carrid_line USING     ps_sflight TYPE sflight
                                   p_relat_key TYPE lvc_nkey
                         CHANGING  p_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value,
            ls_sflight TYPE sflight.
    add node
    ALV Tree firstly inserts this node as a leaf if you do not provide
    IS_NODE_LAYOUT with field ISFOLDER set. In form 'add_carrid_line'
    the leaf gets a child and thus ALV converts it to a folder
    automatically.
      l_node_text =  ps_sflight-carrid.
      CALL METHOD g_alv_tree->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_sflight
        IMPORTING
          e_new_node_key   = p_node_key.
    ENDFORM.                               " add_carrid_line
    *&      Form  add_complete_line
    FORM add_complete_line USING   ps_sflight TYPE sflight
                                   p_relat_key TYPE lvc_nkey
                         CHANGING  p_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value.
      WRITE ps_sflight-fldate TO l_node_text MM/DD/YYYY.
    add leaf:
    ALV Tree firstly inserts this node as a leaf if you do not provide
    IS_NODE_LAYOUT with field ISFOLDER set.
    Since these nodes will never get children they stay leaves
    (as intended).
      CALL METHOD g_alv_tree->add_node
        EXPORTING
          i_relat_node_key = p_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          is_outtab_line   = ps_sflight
          i_node_text      = l_node_text
        IMPORTING
          e_new_node_key   = p_node_key.
    *$ADDED: begin
      IF ( ps_sflight-fldate = '20040522' ).  " first flight date
        IF ( gd_del_nkey IS INITIAL ).  " collect only first date
          gd_del_nkey = p_node_key.
        ENDIF.
      ENDIF.
    *$ADDED: end
    ENDFORM.                               " add_complete_line
    *&      Form  GET_MONTH
          text
         -->P_P_YYYYMM  text
         <--P_L_MONTH  text
    FORM get_month USING    p_yyyymm
                   CHANGING p_month.
    Returns the name of month according to the digits in p_yyyymm
      DATA: l_monthdigits(2) TYPE c.
      l_monthdigits = p_yyyymm+4(2).
      CASE l_monthdigits.
        WHEN '01'.
          p_month = 'January'(701).
        WHEN '02'.
          p_month = 'February'(702).
        WHEN '03'.
          p_month = 'March'(703).
        WHEN '04'.
          p_month = 'April'(704).
        WHEN '05'.
          p_month = 'May'(705).
        WHEN '06'.
          p_month = 'June'(706).
        WHEN '07'.
          p_month = 'July'(707).
        WHEN '08'.
          p_month = 'August'(708).
        WHEN '09'.
          p_month = 'September'(709).
        WHEN '10'.
          p_month = 'October'(710).
        WHEN '11'.
          p_month = 'November'(711).
        WHEN '12'.
          p_month = 'December'(712).
      ENDCASE.
      CONCATENATE p_yyyymm+0(4) '->' p_month INTO p_month.
    ENDFORM.                               " GET_MONTH
    /code
    Regards
      Uwe

  • Display Tree Nodes from LDIF

    I have to read the contents form an ldif file and display it with in a tree, in that the first dn, should be displayed as root dn, and next as child nodes with all the properties of dn.
    I displayed all the dn's but am not understanding how to take root dn and child nodes. please help me if any one know.
    Thanks,
    Raga

    Hi,
    When you delete a node and all of its children, what do you want to do with the grandchildren? If you want to set their parent_id to NULL, do that in a separate UPDATE statement first, then DELETE the original node and all its remaining descendants, as show below.
    If, when you say "children", you mean "descendants" (including
    children,
    children of children,
    children of children of children,
    and so on, to any level,
    ) then do a CONNECT BY query to find their primary keys, and DELETE everything in that list, like this:
    DELETE  subforms
    WHERE   id  IN
            SELECT  id
            FROM    subforms
            START WITH        id = :specified_id
            CONNECT BY  PRIOR id = parent_id
            );

  • Code to delete a node from the tab that satisfy the given condition

    Hi Experts,
    I have a scenario of escalation i.e.,  Deletion of the message details from the table of a tab when that row of details move to second tab based on status condition. I am unable to delete the escalated row details from first tab.
    Can any one provide me the code..
    Thanks & Regards,
    Priya

    Hi Priya,
    Let me know whether my following assumption is right or worng !!
    You have two tables in different tabs and trying to move some rows from table1 in tab1 to table2 in tab2.But you can;t able to delete the rows in table1 of tab1 ..is that correct ??
    You can use wdContext.node<NodeName>().removeElement(IWDNodeElement) to delete a row from a table.
    Ex :
    wdContext.nodeEmployee().removeElement(wdContext.nodeEmployee().getElementAt(0));
    will remove the first element from the node.
    Regards,Anilkumar

  • How to delete a row from table control

    I have created a push button on the screen for delete.
    its getting stored in ok_code.
    'FLAG' is the name of the mark on the table control.
    I am getting probs in this line.
    I am not getting anything in mark_field.
    ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
    The code is:
    MODULE tablctrl2_user_command INPUT.
      PERFORM user_ok_tc USING    'TABLCTRL2'
                                  'I_ZSKILLEMP'
                                  'FLAG'
                         CHANGING ok_code.
    ENDMODULE.
    FORM user_ok_tc USING    p_tc_name TYPE dynfnam
                             p_table_name
                             p_mark_name
                    CHANGING p_ok      LIKE sy-ucomm.
    -BEGIN OF LOCAL DATA----
      DATA: l_ok              TYPE sy-ucomm,
            l_offset          TYPE i.
    -END OF LOCAL DATA----
    Table control specific operations                                    *
      evaluate TC name and operations                                    *
      SEARCH p_ok FOR p_tc_name.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      l_offset = strlen( p_tc_name ) + 1.
      l_ok = p_ok+l_offset.
    execute general and TC specific operations                           *
      CASE l_ok.
        WHEN 'INSR'.                      "insert row
          PERFORM fcode_insert_row USING    p_tc_name
                                            p_table_name.
          CLEAR p_ok.
        WHEN 'DELE'.                      "delete row
          PERFORM fcode_delete_row USING    p_tc_name
                                            p_table_name
                                            p_mark_name.
          CLEAR p_ok.
    FORM fcode_delete_row
                  USING    p_tc_name           TYPE dynfnam
                           p_table_name
                           p_mark_name   .
    -BEGIN OF LOCAL DATA----
      DATA l_table_name       LIKE feld-name.
      FIELD-SYMBOLS <tc>         TYPE cxtab_control.
      FIELD-SYMBOLS <table>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <wa>.
      FIELD-SYMBOLS <mark_field>.
    -END OF LOCAL DATA----
      ASSIGN (p_tc_name) TO <tc>.
    get the table, which belongs to the tc                               *
      CONCATENATE p_table_name '[]' INTO l_table_name. "table body
      ASSIGN (l_table_name) TO <table>.                "not headerline
    delete marked lines                                                  *
      DESCRIBE TABLE <table> LINES <tc>-lines.
      LOOP AT <table> ASSIGNING <wa>.
      access to the component 'FLAG' of the table header                 *
        ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
        IF <mark_field> = 'X'.
          DELETE <table> INDEX syst-tabix.
          IF sy-subrc = 0.
            <tc>-lines = <tc>-lines - 1.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.

    Hi...
    i got the same prob...but got the solution too...
    you have to take an internal table of same type of dbase table..and maintain a flag in it...which will be get filled automatically with 'X'.
    here is the code..go throug it..
    REPORT  YH642_DIALOG_TABLECONTROL.
    CALL SCREEN 999.
    DATA:
      W_INDEX TYPE I.
    DATA:
      W_UCOMM LIKE SY-UCOMM.
    ***&SPWIZARD: DATA DECLARATION FOR TABLECONTROL 'TAB'
    *&SPWIZARD: DEFINITION OF DDIC-TABLE
    TABLES:   YH642_RAM.
    DATA:
      BEGIN OF DDTAB,
        TAB_FLAG  TYPE C,
        MANDT  LIKE YH642_RAM-MANDT,
        EID    LIKE YH642_RAM-EID,
        ENAME  LIKE YH642_RAM-ENAME,
        MOBILE LIKE YH642_RAM-MOBILE,
      END OF DDTAB.
    *&SPWIZARD: TYPE FOR THE DATA OF TABLECONTROL 'TAB'
    TYPES: BEGIN OF T_TAB,
             TAB_FLAG TYPE C,
             MANDT LIKE YH642_RAM-MANDT,
             EID LIKE YH642_RAM-EID,
             ENAME LIKE YH642_RAM-ENAME,
             MOBILE LIKE YH642_RAM-MOBILE,
           END OF T_TAB.
    *&SPWIZARD: INTERNAL TABLE FOR TABLECONTROL 'TAB'
    DATA:     G_TAB_ITAB   TYPE T_TAB OCCURS 0,
              H_TAB_ITAB   TYPE T_TAB OCCURS 0,
              G_TAB_WA     TYPE T_TAB. "work area
    DATA:     G_TAB_COPIED.           "copy flag
    *&SPWIZARD: DECLARATION OF TABLECONTROL 'TAB' ITSELF
    CONTROLS: TAB TYPE TABLEVIEW USING SCREEN 0999.
    *&SPWIZARD: LINES OF TABLECONTROL 'TAB'
    DATA:     G_TAB_LINES  LIKE SY-LOOPC.
    DATA:     OK_CODE LIKE SY-UCOMM.
    *&SPWIZARD: OUTPUT MODULE FOR TC 'TAB'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: COPY DDIC-TABLE TO ITAB
    MODULE TAB_INIT OUTPUT.
      IF G_TAB_COPIED IS INITIAL.
    *&SPWIZARD: COPY DDIC-TABLE 'YH642_RAM'
    *&SPWIZARD: INTO INTERNAL TABLE 'g_TAB_itab'
        SELECT * FROM YH642_RAM
           INTO CORRESPONDING FIELDS
           OF TABLE G_TAB_ITAB.
        G_TAB_COPIED = 'X'.
        H_TAB_ITAB[] = G_TAB_ITAB[].
        REFRESH CONTROL 'TAB' FROM SCREEN '0999'.
      ENDIF.
    ENDMODULE.                    "TAB_INIT OUTPUT
    *&SPWIZARD: OUTPUT MODULE FOR TC 'TAB'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: MOVE ITAB TO DYNPRO
    MODULE TAB_MOVE OUTPUT.
      MOVE-CORRESPONDING G_TAB_WA TO DDTAB.
    ENDMODULE.                    "TAB_MOVE OUTPUT
    *&SPWIZARD: OUTPUT MODULE FOR TC 'TAB'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: GET LINES OF TABLECONTROL
    MODULE TAB_GET_LINES OUTPUT.
      G_TAB_LINES = SY-LOOPC.
    ENDMODULE.                    "TAB_GET_LINES OUTPUT
    *&SPWIZARD: INPUT MODULE FOR TC 'TAB'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: MODIFY TABLE
    MODULE TAB_MODIFY INPUT.
      MOVE-CORRESPONDING DDTAB TO G_TAB_WA.
      MODIFY G_TAB_ITAB
        FROM G_TAB_WA
        INDEX TAB-CURRENT_LINE.
    ENDMODULE.                    "TAB_MODIFY INPUT
    *&SPWIZARD: INPUT MODULE FOR TC 'TAB'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: PROCESS USER COMMAND
    MODULE TAB_USER_COMMAND INPUT.
      OK_CODE = SY-UCOMM.
      PERFORM USER_OK_TC USING    'TAB'
                                  'G_TAB_ITAB'
                                  'TAB_FLAG'
                         CHANGING OK_CODE.
      SY-UCOMM = OK_CODE.
    ENDMODULE.                    "TAB_USER_COMMAND INPUT
      INCLUDE TABLECONTROL_FORMS                                         *
    *&      Form  USER_OK_TC                                               *
    FORM USER_OK_TC USING    P_TC_NAME TYPE DYNFNAM
                             P_TABLE_NAME
                             P_MARK_NAME
                    CHANGING P_OK      LIKE SY-UCOMM.
    &SPWIZARD: BEGIN OF LOCAL DATA----
      DATA: L_OK              TYPE SY-UCOMM,
            L_OFFSET          TYPE I.
    &SPWIZARD: END OF LOCAL DATA----
    *&SPWIZARD: Table control specific operations                          *
    *&SPWIZARD: evaluate TC name and operations                            *
      SEARCH P_OK FOR P_TC_NAME.
      IF SY-SUBRC <> 0.
        EXIT.
      ENDIF.
      L_OFFSET = STRLEN( P_TC_NAME ) + 1.
      L_OK = P_OK+L_OFFSET.
      L_OK = 'DELE'.
    *&SPWIZARD: execute general and TC specific operations                 *
      CASE L_OK.
        WHEN 'INSR'.                      "insert row
          PERFORM FCODE_INSERT_ROW USING    P_TC_NAME
                                            P_TABLE_NAME.
          CLEAR P_OK.
        WHEN 'DELE'.           "delete row
         MESSAGE 'Are you really going to delete??' type 'I'.
          PERFORM FCODE_DELETE_ROW USING    P_TC_NAME
                                            P_TABLE_NAME
                                            P_MARK_NAME.
          CLEAR P_OK.
        WHEN 'P--' OR                     "top of list
             'P-'  OR                     "previous page
             'P+'  OR                     "next page
             'P++'.                       "bottom of list
          PERFORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME
                                                L_OK.
          CLEAR P_OK.
        WHEN 'L--'.                       "total left
          PERFORM FCODE_TOTAL_LEFT USING P_TC_NAME.
        WHEN 'L-'.                        "column left
          PERFORM FCODE_COLUMN_LEFT USING P_TC_NAME.
        WHEN 'R+'.                        "column right
          PERFORM FCODE_COLUMN_RIGHT USING P_TC_NAME.
        WHEN 'R++'.                       "total right
          PERFORM FCODE_TOTAL_RIGHT USING P_TC_NAME.
        WHEN 'MARK'.                      "mark all filled lines
          PERFORM FCODE_TC_MARK_LINES USING P_TC_NAME
                                            P_TABLE_NAME
                                            P_MARK_NAME   .
          CLEAR P_OK.
        WHEN 'DMRK'.                      "demark all filled lines
          PERFORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
                                              P_TABLE_NAME
                                              P_MARK_NAME .
          CLEAR P_OK.
        WHEN 'SASCEND'   OR
             'SDESCEND'.                  "sort column
          PERFORM FCODE_SORT_TC USING P_TC_NAME
                                      l_ok.
      ENDCASE.
    ENDFORM.                              " USER_OK_TC
    *&      Form  FCODE_INSERT_ROW                                         *
    FORM FCODE_INSERT_ROW
                  USING    P_TC_NAME           TYPE DYNFNAM
                           P_TABLE_NAME             .
    &SPWIZARD: BEGIN OF LOCAL DATA----
      DATA L_LINES_NAME       LIKE FELD-NAME.
      DATA L_SELLINE          LIKE SY-STEPL.
      DATA L_LASTLINE         TYPE I.
      DATA L_LINE             TYPE I.
      DATA L_TABLE_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>                 TYPE CXTAB_CONTROL.
      FIELD-SYMBOLS <TABLE>              TYPE STANDARD TABLE.
      FIELD-SYMBOLS <LINES>              TYPE I.
    &SPWIZARD: END OF LOCAL DATA----
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
      CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
      ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline
    *&SPWIZARD: get looplines of TableControl                              *
      CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_LINES_NAME.
      ASSIGN (L_LINES_NAME) TO <LINES>.
    *&SPWIZARD: get current line                                           *
      GET CURSOR LINE L_SELLINE.
      IF SY-SUBRC <> 0.                   " append line to table
        L_SELLINE = <TC>-LINES + 1.
    *&SPWIZARD: set top line                                               *
        IF L_SELLINE > <LINES>.
          <TC>-TOP_LINE = L_SELLINE - <LINES> + 1 .
        ELSE.
          <TC>-TOP_LINE = 1.
        ENDIF.
      ELSE.                               " insert line into table
        L_SELLINE = <TC>-TOP_LINE + L_SELLINE - 1.
        L_LASTLINE = <TC>-TOP_LINE + <LINES> - 1.
      ENDIF.
    *&SPWIZARD: set new cursor line                                        *
      L_LINE = L_SELLINE - <TC>-TOP_LINE + 1.
    *&SPWIZARD: insert initial line                                        *
      INSERT INITIAL LINE INTO <TABLE> INDEX L_SELLINE.
      <TC>-LINES = <TC>-LINES + 1.
    *&SPWIZARD: set cursor                                                 *
      SET CURSOR LINE L_LINE.
    ENDFORM.                              " FCODE_INSERT_ROW
    *&      Form  FCODE_DELETE_ROW                                         *
    FORM FCODE_DELETE_ROW
                  USING    P_TC_NAME           TYPE DYNFNAM
                           P_TABLE_NAME
                           P_MARK_NAME   .
    &SPWIZARD: BEGIN OF LOCAL DATA----
      DATA L_TABLE_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>         TYPE CXTAB_CONTROL.
      FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <WA>.
      FIELD-SYMBOLS <MARK_FIELD>.
    &SPWIZARD: END OF LOCAL DATA----
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
      CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
      ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline
    *&SPWIZARD: delete marked lines                                        *
      DESCRIBE TABLE <TABLE> LINES <TC>-LINES.
      LOOP AT <TABLE> ASSIGNING <WA>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
        ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
        IF <MARK_FIELD> = 'X'.
          W_INDEX = SYST-TABIX.
          DELETE <TABLE> INDEX SYST-TABIX.
          IF SY-SUBRC = 0.
            <TC>-LINES = <TC>-LINES - 1.
          ENDIF.
        ENDIF.
      ENDLOOP.
      READ TABLE H_TAB_ITAB INDEX W_INDEX INTO G_TAB_WA.
      IF SY-SUBRC EQ 0.
        MOVE-CORRESPONDING G_TAB_WA TO YH642_RAM.
        DELETE YH642_RAM.
      ENDIF.
    ENDFORM.                              " FCODE_DELETE_ROW
    *&      Form  COMPUTE_SCROLLING_IN_TC
          text
         -->P_TC_NAME  name of tablecontrol
         -->P_OK       ok code
    FORM COMPUTE_SCROLLING_IN_TC USING    P_TC_NAME
                                          P_OK.
    &SPWIZARD: BEGIN OF LOCAL DATA----
      DATA L_TC_NEW_TOP_LINE     TYPE I.
      DATA L_TC_NAME             LIKE FELD-NAME.
      DATA L_TC_LINES_NAME       LIKE FELD-NAME.
      DATA L_TC_FIELD_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>         TYPE CXTAB_CONTROL.
      FIELD-SYMBOLS <LINES>      TYPE I.
    &SPWIZARD: END OF LOCAL DATA----
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get looplines of TableControl                              *
      CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_TC_LINES_NAME.
      ASSIGN (L_TC_LINES_NAME) TO <LINES>.
    *&SPWIZARD: is no line filled?                                         *
      IF <TC>-LINES = 0.
    *&SPWIZARD: yes, ...                                                   *
        L_TC_NEW_TOP_LINE = 1.
      ELSE.
    *&SPWIZARD: no, ...                                                    *
        CALL FUNCTION 'SCROLLING_IN_TABLE'
             EXPORTING
                  ENTRY_ACT             = <TC>-TOP_LINE
                  ENTRY_FROM            = 1
                  ENTRY_TO              = <TC>-LINES
                  LAST_PAGE_FULL        = 'X'
                  LOOPS                 = <LINES>
                  OK_CODE               = P_OK
                  OVERLAPPING           = 'X'
             IMPORTING
                  ENTRY_NEW             = L_TC_NEW_TOP_LINE
             EXCEPTIONS
                 NO_ENTRY_OR_PAGE_ACT  = 01
                 NO_ENTRY_TO           = 02
                 NO_OK_CODE_OR_PAGE_GO = 03
                  OTHERS                = 0.
      ENDIF.
    *&SPWIZARD: get actual tc and column                                   *
      GET CURSOR FIELD L_TC_FIELD_NAME
                 AREA  L_TC_NAME.
      IF SYST-SUBRC = 0.
        IF L_TC_NAME = P_TC_NAME.
    *&SPWIZARD: et actual column                                           *
          SET CURSOR FIELD L_TC_FIELD_NAME LINE 1.
        ENDIF.
      ENDIF.
    *&SPWIZARD: set the new top line                                       *
      <TC>-TOP_LINE = L_TC_NEW_TOP_LINE.
    ENDFORM.                              " COMPUTE_SCROLLING_IN_TC
    *&      Form  FCODE_TC_MARK_LINES
          marks all TableControl lines
         -->P_TC_NAME  name of tablecontrol
    FORM FCODE_TC_MARK_LINES USING P_TC_NAME
                                   P_TABLE_NAME
                                   P_MARK_NAME.
    &SPWIZARD: EGIN OF LOCAL DATA----
      DATA L_TABLE_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>         TYPE CXTAB_CONTROL.
      FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <WA>.
      FIELD-SYMBOLS <MARK_FIELD>.
    &SPWIZARD: END OF LOCAL DATA----
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
      CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
      ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline
    *&SPWIZARD: mark all filled lines                                      *
      LOOP AT <TABLE> ASSIGNING <WA>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
        ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
        <MARK_FIELD> = 'X'.
      ENDLOOP.
    ENDFORM.                                          "fcode_tc_mark_lines
    *&      Form  FCODE_TC_DEMARK_LINES
          demarks all TableControl lines
         -->P_TC_NAME  name of tablecontrol
    FORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
                                     P_TABLE_NAME
                                     P_MARK_NAME .
    &SPWIZARD: BEGIN OF LOCAL DATA----
      DATA L_TABLE_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>         TYPE CXTAB_CONTROL.
      FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <WA>.
      FIELD-SYMBOLS <MARK_FIELD>.
    &SPWIZARD: END OF LOCAL DATA----
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
      CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
      ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline
    *&SPWIZARD: demark all filled lines                                    *
      LOOP AT <TABLE> ASSIGNING <WA>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
        ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
        <MARK_FIELD> = SPACE.
      ENDLOOP.
    ENDFORM.                                          "fcode_tc_mark_lines
    *&      Module  STATUS_0999  OUTPUT
          text
    MODULE STATUS_0999 OUTPUT.
      SET PF-STATUS 'SS_STD'.
      SET TITLEBAR 'TITLE'.
    ENDMODULE.                 " STATUS_0999  OUTPUT
    *&      Module  USER_COMMAND_0999  INPUT
          text
    MODULE USER_COMMAND_0999 INPUT.
      DATA:
        H_TAB_WA LIKE G_TAB_WA.
      CASE W_UCOMM.
        WHEN 'BACK'.
          LEAVE PROGRAM.
        WHEN 'TAB_MODI' OR 'SAVE'.
          LOOP AT G_TAB_ITAB INTO G_TAB_WA.
          FORMAT   INPUT OFF.
            MOVE-CORRESPONDING G_TAB_WA TO YH642_RAM.
            READ TABLE H_TAB_ITAB WITH KEY EID = G_TAB_WA-EID INTO H_TAB_WA.
            IF SY-SUBRC EQ 0.
              IF G_TAB_WA NE H_TAB_WA.
                MODIFY YH642_RAM.
              ENDIF.
            ELSE.
              INSERT  YH642_RAM.
            ENDIF.
          ENDLOOP.
    SORT  G_TAB_ITAB.
      ENDCASE.
    *CALL SCREEN 700.
    ENDMODULE.                 " USER_COMMAND_0999  INPUT

  • Deleting Tree Node

    Hello All
    I am Creating a Tree and It is going to Populate only when the Node is Expanded.
    I.E. the Child records are created only when the Node is Expanded.
    What we Did is that when we are creating a Parent Node, we are populating a dummy child node to the Parent Node, so that the + sign will be shown.
    Now when I am Expanding the + sign, it has to delete the Dummy child node and then create the Child nodes under the Dummy one.
    For this One I am unable to Find a solution.
    PLEASE HELP ME REGARDING THIS ONE.
    THIS PROBLEM IS RELATING TO FORMS

    In the when-tree-node-expanded trigger.
    Store the system.trigger_node. This is the parent.
    Search, starting with the parent, for a child which has the value/label that you gave the dummy node. Did you find one? If yes then delete it.
    If you didn't find one then you stop as you've already expanded this node I guess.
    After you delete the child you must then add the new children. So loop through the code that produces the list of new children you want, and add them under the parent that you started with.
    Hope this helps.

  • Delete a column froma  table that is used in multiple interfaces

    Is there a way to delete a column from a table where the table is being used in an interface ? The only way I could find so far was to delete the interface, delete the column then recreate the interface.
    Otherwise deleting warns that the object is referred to by another object and lists the interfaces.
    unfortunately the table in question is being referred to in multiple interfaces, so I'd prefer not to have to recreate all of them.
    Many thanks

    You can delete all the mappings (source an target) which refer to this column and then physically delete the column.
    It's long but maybe better than dropping the whole interfaces using this column.
    Regards and Merry Christmas
    Brice

Maybe you are looking for