How to create multi node /data Tree by using few loops or small code

HI.
I WANT TO CREATE A TREE WHICH IS HAVING MULTI NUMBER OF NODE LEVEL (USER HAVE THE ABILITY TO CREATE AS MANY AS REQUIRED NODE LEVEL OR SUBLEVEL). HOW CAN I POPULATE THE TREE WITH SMALL CODE. AS EVERY NODE LEVEL NEED ON NESTED LOOP. SO HOW CAN I MANAGE TO POPULATE THE NODE WITH FEW LOOPS. OR THERE IS ANY OTHER WAY TO MANAGE THIS PROBLEM.
THANKS

Hi ,
I am trying to do the job , but i do not understand where
is the problem with my loop , i am sending it , could you
see it , and sujjest me , what to do. or if you have time
can you write the code for me. as i am very much needy for
this job.
The Table is as:-
CREATE TABLE TREE_01(
RECORD_NO NUMBER(10), --
OWN_CODE VARCHAR2(10),
PARENT_NO NUMBER(10),
PARENT_CODE VARCHAR2(10),
LEVELL NUMBER(4),
DEPT NUMBER(6),
CONSTRAINT RNO_PK PRIMARY KEY(RECORD_NO));
INSERT INTO TREE_01 VALUES(1,'1',0,'0',2,8540);
INSERT INTO TREE_01 VALUES(2,'2',0,'0',2,8540);
INSERT INTO TREE_01 VALUES(3,'3',0,'0',2,8540);
INSERT INTO TREE_01 VALUES(4,'4',0,'0',2,8540);
INSERT INTO TREE_01 VALUES(5,'1',1,'0',3,8540);
INSERT INTO TREE_01 VALUES(6,'2',1,'0',3,8540);
INSERT INTO TREE_01 VALUES(7,'3',1,'0',3,8540);
INSERT INTO TREE_01 VALUES(8,'1',3,'0',3,8540);
INSERT INTO TREE_01 VALUES(9,'2',3,'0',3,8540);
the loop shoud look like
|_DataProcessing
| |+Work_orders
| |_Programmers File
| | |_James
| | | |+Requests
| | | |+Leves
| | | |_Projects
| | | |_Projects001
| | |+Steven
|+HealthCare
|+Transportation
So the loop should be such that it can be go to any level of any node.
the Code i writter is As follows.
The Following Procedure is called in form leve
When new forms instance.
PROCEDURE REFRESH_TREE2 IS
CURSOR CUR_DEPT IS
     SELECT DEPT
     FROM TREE_01 GROUP BY DEPT;
CURSOR CUR_LOOP1(PARENT1 NUMBER,LEVEL1 NUMBER) IS
     SELECT RECORD_NO,
     OWN_CODE,
     PARENT_NO,
     DEPT ,
     PARENT_CODE,
     LEVELL
     FROM TREE_01
     WHERE LEVELL=LEVEL1
     AND RECORD_NO=PARENT1;
CURSOR CUR_LOOP2(PARENT2 NUMBER,LEVEL2 NUMBER) IS
     SELECT RECORD_NO,
     OWN_CODE,
     PARENT_NO,
     DEPT ,
     PARENT_CODE,
     LEVELL
     FROM TREE_01
     WHERE LEVELL=LEVEL2
     AND RECORD_NO=PARENT2;
CURSOR LEVEL(PARENTNO NUMBER) IS
     SELECT LEVELL FROM TREE_01 WHERE PARENT_NO=PARENTNO
     ORDER BY RECORD_NO;
     V_I NUMBER;
     V_IGNORE NUMBER;
     RG_DEPT RECORDGROUP;
     RG_CABI RECORDGROUP;
     V_INIT_STATE GROUPCOLUMN;
     V_LEVEL GROUPCOLUMN;
     V_LABEL GROUPCOLUMN;
     V_ICON GROUPCOLUMN;
     V_VALUE GROUPCOLUMN;
     V_CHANGE_VALUE VARCHAR2(20);
     V_CHANGE_VALUE1 NUMBER(3);
     V_CHANGE_VALUE2 NUMBER(3);
V_LEVEL_COUNT NUMBER;
BEGIN
     SELECT MAX(LEVELL) INTO V_LEVEL_COUNT FROM TREE_01;
     RG_DEPT:=FIND_GROUP('DEPT');
     if not id_null(RG_DEPT) then
delete_group(RG_DEPT);
end if;
     RG_DEPT:=create_group('DEPT');
     V_INIT_STATE := add_group_column(RG_DEPT, 'INIT_STATE', NUMBER_COLUMN);
     V_LEVEL :=ADD_GROUP_COLUMN(RG_DEPT,'LEVEL',NUMBER_COLUMN);
     V_LABEL :=ADD_GROUP_COLUMN(RG_DEPT,'LABEL',CHAR_COLUMN,40);
     V_ICON :=ADD_GROUP_COLUMN(RG_DEPT,'ICON',CHAR_COLUMN,20);
     V_VALUE :=ADD_GROUP_COLUMN(RG_DEPT,'VALUE',CHAR_COLUMN,15);
     V_I :=1;
     FOR DEPTREC IN CUR_DEPT LOOP
     ADD_GROUP_ROW(RG_DEPT,V_I);
     SET_GROUP_NUMBER_CELL(V_INIT_STATE,V_I,1);
     SET_GROUP_NUMBER_CELL(V_LEVEL ,V_I,1);
     SET_GROUP_CHAR_CELL(V_LABEL ,V_I,FILING.ELOOK_IT(11,0,DEPTREC.DEPT));--MAIN_MINOR));
     SET_GROUP_CHAR_CELL(V_ICON ,V_I,NULL);
     SET_GROUP_CHAR_CELL(V_VALUE ,V_I,TO_CHAR(DEPTREC.DEPT)); --MAIN_MINOR));
     V_I:= V_I +1;
     V_CHANGE_VALUE := DEPTREC.DEPT;
     FOR I IN 1..V_LEVEL_COUNT LOOP
     FOR DEPTREC1 IN CUR_LOOP1(V_CHANGE_VALUE,I) LOOP --MAIN_MINOR,I) LOOP
     ADD_GROUP_ROW(RG_DEPT,V_I);
     SET_GROUP_NUMBER_CELL(V_INIT_STATE,V_I,1);
     SET_GROUP_NUMBER_CELL(V_LEVEL ,V_I,I);
     SET_GROUP_CHAR_CELL(V_LABEL ,V_I,DEPTREC1.RECORD_NO);
     SET_GROUP_CHAR_CELL(V_ICON ,V_I,NULL);
     SET_GROUP_CHAR_CELL(V_VALUE ,V_I,DEPTREC1.RECORD_NO);
     V_I:= V_I +1;
     SELECT count(LEVELL) INTO V_CHANGE_VALUE1
FROM TREE_01
WHERE RECORD_NO=DEPTREC1.RECORD_NO
     AND PARENT_NO=DEPTREC1.PARENT_NO
     AND LEVELL=DEPTREC1.LEVELL;
     SELECT MAX(LEVELL) INTO V_CHANGE_VALUE2
     FROM TREE_01
     WHERE RECORD_NO=DEPTREC1.RECORD_NO
     AND PARENT_NO=DEPTREC1.PARENT_NO
     AND LEVELL=DEPTREC1.LEVELL;
          FOR j IN 1..V_CHANGE_VALUE1 loop
          FOR LVL IN LEVEL(DEPTREC1.RECORD_NO) LOOP
          FOR DEPTREC2 IN CUR_LOOP2(DEPTREC1.RECORD_NO, LVL.LEVELL) LOOP
     ADD_GROUP_ROW(RG_DEPT,V_I);
     SET_GROUP_NUMBER_CELL(V_INIT_STATE,V_I,1);
     SET_GROUP_NUMBER_CELL(V_LEVEL ,V_I,LVL.LEVELL);
     SET_GROUP_CHAR_CELL(V_LABEL ,V_I,DEPTREC2.RECORD_NO);
     SET_GROUP_CHAR_CELL(V_ICON ,V_I,NULL);
     SET_GROUP_CHAR_CELL(V_VALUE ,V_I,DEPTREC2.RECORD_NO);
     V_I:= V_I +1;
     V_CHANGE_VALUE := DEPTREC2.RECORD_NO;
               end loop;
     end loop;
     END LOOP;
     END LOOP;
     END LOOP;
     END LOOP;
     ftree.set_tree_property('NAVIGATOR.NAV_DISPLAY',ftree.record_Group, rg_dept);
     end;

Similar Messages

  • How to create a node with attributes at runtime in webdynpro for ABAP?

    Hi Experts,
             How to create a node with attributes at runtime in webdynpro for ABAP? What classes or interfaces I should use? Please provide some sample code.
    I have checked IF_WD_CONTEXT_NODE_INFO and there is ADD_NEW_CHILD_NODE method. But this is not creating any node. I this this creates only a "node info" object.
    I even check IF_WD_CONTEXT_NODE but i could not find any method that creates a node with attribute.
    Please help!
    Thanks
    Gopal

    Hi
       I am getting the following error while creating a dynamic context node with 2 attributes. Please help me resolve this problem.
    Note
    The following error text was processed in the system PET : Line types of an internal table and a work area not compatible.
    The error occurred on the application server FMSAP995_PET_02 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: IF_WD_CONTEXT_NODE~GET_STATIC_ATTRIBUTES_TABLE of program CL_WDR_CONTEXT_NODE_VAL=======CP
    Method: GET_REF_TO_TABLE of program CL_SALV_WD_DATA_TABLE=========CP
    Method: EXECUTE of program CL_SALV_WD_SERVICE_MANAGER====CP
    Method: APPLY_SERVICES of program CL_SALV_BS_RESULT_DATA_TABLE==CP
    Method: REFRESH of program CL_SALV_BS_RESULT_DATA_TABLE==CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE_DATA of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMPONENT~VIEW_MODIFY of program CL_SALV_WD_A_COMPONENT========CP
    My code is like the following:
    TYPES: BEGIN OF t_type,
                CARRID TYPE sflight-carrid,
                CONNID TYPE sflight-connid,
             END OF t_type.
      Data:  i_struc type table of t_type,
      dyn_node   type ref to if_wd_context_node,
      rootnode_info   type ref to if_wd_context_node_info,
      i_node_att type wdr_context_attr_info_map,
      wa_node_att type line of wdr_context_attr_info_map.
          wa_node_att-name = 'CARRID'.
          wa_node_att-TYPE_NAME = 'SFLIGHT-CARRID'.
          insert wa_node_att into table i_node_att.
          wa_node_att-name = 'CONNID'.
          wa_node_att-TYPE_NAME = 'SFLIGHT-CONNID'.
          insert wa_node_att into table i_node_att.
    clear i_struc. refresh i_struc.
      select carrid connid into corresponding fields of table i_struc from sflight where carrid = 'AA'.
    rootnode_info = wd_context->get_node_info( ).
    rootnode_info->add_new_child_node( name = 'DYNFLIGHT'
                                       attributes = i_node_att
                                       is_multiple = abap_true ).
    dyn_node = wd_context->get_child_node( 'DYNFLIGHT' ).
    dyn_node->bind_table( i_struc ).
    l_ref_interfacecontroller->set_data( dyn_node ).
    I am trying to create a new node. That is
    CONTEXT
    - DYNFLIGHT
    CARRID
    CONNID
    As you see above I am trying to create 'DYNFLIGHT' along with the 2 attributes which are inside this node. The structure of the node that is, no.of attributes may vary based on some condition. Thats why I am trying to create a node dynamically.
    Also I cannot define the structure in the ABAP dictionary because it changes based on condition
    Message was edited by: gopalkrishna baliga

  • How to create multi garnishment order for the same garnishment document

    Hi,
    Can anyone tell me how to create multi garnishment order for the same garnishment document. I tried to copy the entry in IT0195 but the sequence field is grayed out so it will just delete the old record. What configuration should I do to make this possible?
    Thanks a lot in advance.

    hi,
    As far as I got it.
    You cannot have multiple Garnishment order but if a need arises you have to maintain it in IT216.
    For that follow this path goto PA30->pernr->194->change->Garnishment->adjustment.
    Since like order you cannot maintain adjustment also directly.
    Regards,
    Amit
    Reward all helpful replies.

  • How to create Event Node in smartform

    Hi Experts,
    could you please tell me how to create event node in smartform
    Thanks in Advance,
    Thanks&Regards
    Geetha

    HI,
    plz explain your problem in deeply.
    And as per me you first create page and righ click on it
    Then create window as per your requirement.
    if you want to put condition ot events true or false Righ click on your window
    then goto flow logic -> Altenative
    You can found 2 events in Condition.
    So you can assign this events.If you want to put condition or event on test then goto Text here in General Attributes in bottom side you can find even on page.
    Try it.

  • How to get each node in tree?

    how to get each node in tree?
    Message was edited by:
    NikisinProblem

    how to get each node in tree?
    Since (as far as I know) treeNode is an interface, the real question to me is how are you implementing your treeNodes? Are you overriding the toString() method?

  • How to create new node in feature

    Dear Members,
    Culd any one help me out .........
    How to create new node in features..
    Example:  NUMKR
    On defaulting which option to select to create new node?
    Return value
    field for decision operation
    sub feature
    programme
    debugging operation
    error operation
    comment
    How to proceed................????????????

    hi,
    Where you can select the option field for decision operation then select the filed which you want like personal area, subarea, employee group and subgroup.
    and then select the node and then goto create and assign the return value by selecting the option ' Return value'.
    NUMKR -> FILED - PERSKGemployee group)  -> field PERSK(employee sub group) and --> return value.
    thanks,
    Vasu.

  • How to create 3.x data source in bi 7

    Hi Guys,
                 can anyone tell me<b> how to create 3.x data source(emulated) in bi 7.0 </b>
    pls reply  me this is urgent
    ravi

    Ravi,
    Please do not multiply the same question several times. The answer is given in the other replica:
    how to create 3.x filesystem data source(emulated) in bi 7.0

  • Hi, I have Adobe Acrobat Professional.  I need to know how to create multi-links on 300 page docs

    I need to know how to create multi-links on a 300 page document, showing "return to main Menu".  Ideally placed on the bottom right of each page. I have adobe acrobat Professional. 

    Import a picture to be a button, place it, activate HYPERLINK tool, draw a rectangle around the whole button, in the window popping up select the link behaviour, submit with OK.
    Then copy & paste the button object to every page. I don't know whether pasting it on every of the 300 pages can be automated, but if not, it is still done quite fastly.

  • How to create customer master data for walking customer in retail

    hi experts !!!!!!
    for retail industry e.g books trading industry
    how to create customer master data for walking customer in retail
    its dummy or one time customer
    if i create one time customer then same customer number can i use for every new order and every new customer how ?????
    thanks

    Dear Hanumant,
    As per my view,,
    You can use one time customer functionality to full fill your requirement.
    When you create sales order with one time customer system take you to the customer data maintanence screen through that you can maintain the one time customer data.
    Same one time customer number you can use for every new order through maintaining different data.
    I hope this will help you,
    Regards,
    Murali.
    Edited by: Murali Mohan.Tallapaneni on Dec 19, 2008 6:08 AM

  • How to create generic master data  datasource .

    How to create generic master data  datasource which utilises ALE change pointers for extraction of master data.

    Hi,
    For any master data lets say, Material Master, for this you need to create a view
    based on your requirement by selecting one or more tables into your view and
    keeping all the required fields in the view as viewfields and go to RS02 create
    generic data source, select the view option as source and put the view, save and
    activate, at the same time set the delta pointer as to whether Numericpointer/date/timestamp..this way you can create a generic DS then transfer the stru. and at the BW side replicate the source system..and so on..
    Hope this helps..
    Assign points if useful.
    Need further info revert..
    Cheers,
    Pattan.

  • How to create and up date infostructure?

    Hi,
    Can any body tell us how to create and upload data to info structure?
    regards,
    N.Nagaraju

    Hi,
    For maintenance of Infostructures the T-Code is LBWE.
    There you can chage the structure by clicking on Structure Maintenance.
    For creation of InfoSources the T-Code is RSA1.
    Thanks,
    Amit.

  • How to create one node for multiple cards?

    I want a single minor device node to act as the interface to all instances of my pci-cards.
    I have the same pci-cards(pcixxx, xxx).

    You may want to create minor nodes on the fly
    using cloning or makedevice() interface.
    WDD has an example on it in xx_open() section,
    I believe
    Regards,
         Cyril
    I want a single minor device node to act as the
    interface to all instances of my pci-cards.
    I have the same pci-cards(pcixxx, xxx).

  • How to create a muli line text area using JavaFx

    Hi all,
    Since the preview SDK does not contain TextArea any more, I am wondering how to create a muli line text area using JavaFX. The behaviour of this text area/field should be somehow similar to JTextArea in Swing or StyledTextWidget in SWT.
    Does JavaFX have any support for this? What would be a sensible approach to create such a widget?
    Thanks for your suggestions,
    br michael

    This is a pretty old thread (I know I came across this while searching for something similar recently), but I figured I'd throw this out there in case other people might find this useful. As I write this, JavaFX's latest version is 1.3... which may have added the needed functionality since the last post.
    You can now create a multi-line text area using a TextBox and by specifying the nubmer of lines and setting the "multiline" value to true. It may not offer all of the same functionality as JTextArea, but it did the job for what I needed... newlines by pressing enter, scrollbar if text surpasses height, etc.
    Here's a simple example:
    Group {
       content: [
          TextBox {
             text: "This is a multi-line textbox"
             lines: 10  // <-- this may/may not be necessary depending on your situation. Default is 5.
             multiline: true
    }Edited by: loeschg on Jul 29, 2010 2:59 PM

  • How to create a table in the file using java code.?

    HI,
    I should export the data from the view objects to a word document. I have done that but I should
    display the data in the form of a table.
    Kindly come up with the necessary information on how to create a table in the file using java.
    Thanks,
    Phani

    Hi, Thank you for responding to my query.
    The below are the details of my code.
    DCBindingContainer dcBindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding StudentDetailsContent =
    (DCIteratorBinding)dcBindings.get("StudentView1Iterator");
    OutputStreamWriter w = new OutputStreamWriter(outputStream, "UTF-8");
    Row currentRow =
    StudentDetailsContent.getRowSetIterator().first();
    Object a[]= currentRow.getAttributeValues();
    int i;
    for(i=0 ;i<=a.length;i++){
    w.write(a.toString());
    w.write(" ");
    w.flush();
    I am usning this coding to achieve the task of exporting data to file.
    I need to display this information in the table that is where I need help from you people.
    Thanks,

  • How to Create a OLAP Cube in DEV using SSAS from Raw file system backup from Production?

    How to Create a OLAP Cube in DEV using SSAS from Raw file system backup from Production? I dont have a .abf file available. Two paritions in production are missing data. We were able to get back file system backup which contains the files for these two paritions.
    How do I create a cube in Dev using this file system backup.
    we are on SQL Server 2008R2.
    Thanks,

    How to Create a OLAP Cube in DEV using SSAS from Raw file system backup from Production? I dont have a .abf file available. Two paritions in production are missing data. We were able to get back file system backup which contains the files for these two paritions.
    How do I create a cube in Dev using this file system backup.
    we are on SQL Server 2008R2.
    Thanks,

Maybe you are looking for