How can i write Recursive Program in PL/SQL

Hi, i am new to Pl/sql Programming can any one suggest me with an example.
I need to implenet this logic in one of my Procedure functionality

I have to find whether my Userkey belongs to some groups and in that Gr
oups there can be many more subgroup which means my user is indirectly
associated with all Groups and Sub Groups so i need to check with the levels
till the time there is no SubGroups associated with my the Main Group G1 are
there.Seems you just need the hierarchy query:
SQL> SELECT groups.grp, level
  2  from
  3  (
  4  select 'Group' grp, null parent from dual
  5  union all
  6  select 'Subgroup 1', 'Group' from dual
  7  union all
  8  select 'Subgroup 2', 'Group' from dual
  9  union all
10  select 'SubSub 1', 'Subgroup 2' from dual
11  union all
12  select 'SubSub 2', 'Subgroup 1' from dual
13  ) groups
14  start with grp = (select grp from
15  (
16   select 'Key1' key, 'Subgroup 1' grp from dual
17   union all
18   select 'Key2' key, 'Subgroup 2' grp from dual
19  ) userkeys
20  where key = 'Key1'
21  )
22  connect by prior groups.grp = groups.parent
23  /
GRP             LEVEL
Subgroup 1          1
SubSub 2            2Rgds.

Similar Messages

  • How can I write a program that compiles without warnings?

    I tried the following with the 1.5 beta-compiler (build 28; I think):
    class Y {
         public static final class Pair<X,Y> {
           private X fst;
           private Y snd;
           public Pair(X fst, Y snd) {this.fst=fst; this.snd=snd;}
           public X getFirst() { return fst; }
           public Y getSecond() { return snd; }
           public String toString() { return "("+fst+","+snd+")"; }
      public static void main(String... args) {
         Pair[] pairArr = new Pair[10];              // supposed to be an array of Pair<Integer,Integer>
         for (int i=0; i<pairArr.length; i++)
             pairArr[i] = new Pair<Integer,Integer>(i,i);
         for (int i=0; i<pairArr.length; i++) {
             Pair<Integer,Integer> p = pairArr; // unchecked warning
         System.out.println(p);
         Integer first = p.getFirst();
         Integer second = p.getSecond();
    // ... more stuff ...
    It turns out that I get an unchecked warning when I extract an element from the array of pairs. Okay, that's fine. How can I avoid the warning? I had expected that an explicit cast would help.
      Pair<Integer,Integer> p = (Pair<Integer,Integer> )pairArr;
    With a cast I'm telling the compiler: "I _know_ what I'm doing; please trust me." But the compiler still issues a warning.
    How can I write a warning-free program in this case? The only thing I can think of, is not using the parameterized type Pair in its parameterized form. But it's not the idea of Java Generics that I refrain from using parameterized types. What am I missing?

    It turns out that I get an unchecked warning when I
    extract an element from the array of pairs. Okay,
    that's fine. How can I avoid the warning? I had
    expected that an explicit cast would help.
    Pair<Integer,Integer> p = (Pair<Integer,Integer>
    )pairArr;
    With a cast I'm telling the compiler: "I _know_ what
    I'm doing; please trust me."  But the compiler still
    issues a warning.  Yes, but at least you were able to change the warning from "unchecked assignment" to "unchecked cast" which is a little shorter ;-)
    Seriously , since arrays of generic types are disallowed, there is probably no way to get rid of these warnings - which makes a strong point for eliminating "unchecked" warnings altogether (see the other thread "selectively suppressing compiler warnings")
    Cheerio,
    Gernot

  • How can I write the program

    I would like to know how can i Change the program so that the Message'What is the sum of X and Y' can be shown in a GUI after I click the Start Button.
    The program is shown below. Please help me,Thank You Very Much!
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class client2 {
    public static void main(String[] args){
    Frame f = new ClientFrame("Client");
    f.setSize(400,400);
    f.setVisible(true);
    class ClientFrame extends JFrame{
    JPanel StartPanel = new JPanel();
    JPanel OutputPanel = new JPanel();
    String Question;
    JLabel label=new JLabel(Question);
    Button GameStart = new Button("Start the Game");     
    Container c=this.getContentPane();
    public ClientFrame(String title){
    super (title);
    c.setLayout (new BorderLayout());
    StartPanel.add(GameStart);
    OutputPanel.add(label);
    c.add(StartPanel,BorderLayout.NORTH);
    c.add(OutputPanel,BorderLayout.CENTER);
    GameStart.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent Evt) {
    GameStart.setEnabled(false);     
    Integer x=10;
    Integer y=20;
    Question ="What is the sum of "+x+ "and" +y;
    System.out.println("Java rules!");
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent evt) {
    System.exit(0);
    }

    This code won't even compile.
    Anyway, you should set the field Question's value to the String, when you declare it, before you use it in the label.
    Also, you should name your local variables with names that start with lower-case letters. That's one of Java's naming conventions, and it makes your code easier to read.

  • How can we write BDC program to upload data in to line items(VA01) ?

    Error in processing BDC table control program...
    How can i populate data through bdc program dynamically, when some of the lines are in disable mode....
    for e.g ...
    in va01 transaction code ....
    1 to 5 lines are not in disable mode....
    but 5 to 10 lines are in disable mode...
    so hw u process those remaining disable lines at runtime and populate data in to the fields of line items...through bdc program..

    hi..friends.,
    yea actually this question has been raised by interviewer ...
    but just the same i replied as you did...
    but he told that we can upload the data....towards in to disabled line items
    at run time..with using change trasaction va02..with implementing bdc programm...
    so i just want to know the steps of how to perform it..
    Can anyone....my friends..
    byeeee.....

  • How can i write jstl with jsp in sql:update ,when it give sqlException"

    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql_rt"%>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
    <sql:query var="login" dataSource="jdbc:mysql://localhost/user,com.mysql.jdbc.Driver,user,parul">
    SELECT * FROM login;
    </sql:query>
    <html>
    <head>
    <title>login information</title>
    </head>
    <body>
    <h1>login information</h1>
    <table border="1">
    <tr>
    <th>id</th>
    <th>login</th>
    <th colspan="2">password</th>
    </tr>
    <c:forEach var="round" items="${login.rows}" >
    <tr>
    <td>${round.id}</td>
    <td>${round.login}</td>
    <td colspan="2">${round.password}</td>
    </tr>
    </c:forEach><tr>
    <form name="round-input" action="round_process.jsp" method="POST">
    <td><input name="id" type="text" size="20" /></td>
    <td><input name="login" type="text" size="20" /></td>
    <td><input name="password" type="text" size="20" /></td>
    <td><input type="submit" value="Update" /></td>
    </form>
    </tr>
    </table>
    </body>
    </html>
    it pass the parameter in round_process.jsp
    <!--
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql_rt" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
    -->
    <sql:query var="login" dataSource="jdbc:mysql://localhost/user,com.mysql.jdbc.Driver,user,parul">
    SELECT * FROM login WHERE id=?
    <sql:param value="${param.id}"/>
    </sql:query>
    <sql:update>
    INSERT INTO login(id,login,password)VALUES(?,?,?)
    <sql:param value="${param.id}"/>
    <sql:param value="${param.login}"/>
    <sql:param value="${param.password}"/>
    </sql:update>
    <c:redirect url="round-input.jsp"/>
    when i execute the second .jsp page it will show an exception and error that is
    javax.servlet.ServletException: Unable to get connection, DataSource invalid: "null"
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
         org.apache.jsp.round_005fprocess_jsp._jspService(round_005fprocess_jsp.java:87)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "null"
         org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport.getConnection(UpdateTagSupport.java:234)
         org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport.doStartTag(UpdateTagSupport.java:115)
         org.apache.jsp.round_005fprocess_jsp._jspx_meth_sql_update_0(round_005fprocess_jsp.java:168)
         org.apache.jsp.round_005fprocess_jsp._jspService(round_005fprocess_jsp.java:71)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.

    Your problem is that you need to have a
    <sql:setDataSource
           var="myDataSource"
           dataSource="jdbc:mysql://localhost/user,com.mysql.jdbc.Driver,user,parul"
    />and your sql:query would now be
    <sql:query var="login" dataSource="${myDataSource}">
    SELECT * FROM login;
    </sql:query>You can use whatever name you want for the var in the setDataSource as long as it matches the dataSource in the query.

  • How can I write program in Labview for zbrain kit..??

    Hello everybody
    I need to write the program in Labview fro Zbrain kit. I need to write code for multiple analog input (through multiple channels) that results multiple digital output. I found one refrence code which has one analog input (one channel) and gives one digital output.
    I also need to save data for channels. I have no idea how can I save data for channels.
    I have attached here the base program. Please give me idea how can I understand this program so that I can complete following tasks:
    1. Save data for one channel and later for multiple channels
    2. Modify the number of channels from one channels to multiple channels.
    Actually I have gone through the videos and text based content(basics in labview) but I am unable to write the code.
    Attachments:
    Analog_3_InBlock.vi ‏131 KB

    Hi,
    Attached is an example snipped with some more comments on how to acquire multiple channels on a ZBrain platform that is based on an Analog Devices Blackfin processor. Just drag and drop it into your LabVIEW diagram. More examples can be found here: http://wiki.schmid-engineering.ch/zsystem/doku.php?id=example_zmc_adc-dma_continous. The idea behind dynamic data acquisition on a microprocessor is simple: you define the channels (up to 6x) , sampling frequency (up to 250kHz)  and block sizes (up to 65'000) and start the acquisition. The underlying driver model samples in the data in parallel and the LabVIEW program gets this data. While e.g. processing the data, the underlying driver model continues sampling new data.
    I hope this helped.
    Marco Schmid
    Schmid Engineering
    Attachments:
    snippet_zmc_adc-dma_continuous.png ‏107 KB

  • How can I Write a sine wave in an Access-fil​e?

    I measure a sine wave in LabView 6i. How can I write the datas automatically to an Acces-file, at the same time?
    In my program, I managed it with Execute SQL.vi, I change a number in a SQL statement(String) -> after this I push start and then it writes the statement in the Access-file.
    The problem is, it writes only one data per measurement in the file. How can I write all datas in the Access-file and measure the wave at the same time?
    Thanks for help!
    Attachments:
    getwave.vi ‏49 KB

    On the waveform palette, you will find a "to components" vi that you can break out the array of the waveform. You can then, using a for loop write all of the values from the waveform.
    Better yet, there are examples in the database toolkit manual on pages 3-13 to 3-15 that deal with reading arrays (and even has a waveform example).
    Good luck!

  • A gap between letters started to show in my indesgn files. tried to undo with tracking, the paragraph settings. nothing helped. it ruins the fluent view of the document. how can i restore the program so that doesn't happen?

    a gap between letters started to show in my indesign files. tried to undo with tracking, then with the paragraph settings. nothing helped. it ruins the fluent view of the document. how can i restore the program so that doesn't happen?
    for example: say i write a paragraph. then, in a weird some sort of way an involuntary gap suddenly appears between different letters of random words(i did not recognize any pattern to the gap appearing) throughout the entire paragraph. once i've double clicked on that paragraph, and made a minor change, lets say tapped a 'space' key, and then clicked ctrl+z to undo, it has aligned(or fixed) the entire paragraph and made it look ok again. i've tried numerous ways to undo the entire thing, but cannot find the reason. i've been working for a few years and there's no reason why this thing all of a sudden should happen right now.
    if anyone has stumbled on something like that and can advise, i would welcome it.
    MNS-KG
    Vadim

    yep...i'm typing with hebrew. i'll make a printscreen with the settings you've asked for@:
    if you look closely you'll see that almost every line has a single letter apart. in hebrew there is no usually a singe letter structured words.

  • How can I write mathematical formulas?

    How can I write mathematical formulas?
    I tried tu use the formula editor of ms word with paste and copy but it didnt work, because the formula
    was not in line with the text.

    I was able to use Word's equation editor; just type in the formula and copy it into the Pages document.
    I've heard you can do the same thing with the equation bar in Grapher utility, but I haven't tried that.
    Other options involve LaTeX, which is a typesetting program. I've looked at that but haven't really explored it.

  • How can i write the data to PIC16F819 using labview?

    how can i write the data to PIC16F819 using labview?
    Need help!
    im using labview in gathering the datas that i need to right to the PIC, then after getting all the datas i am using another program which is ICD2 in order to write it to the PIC. Is it possible to do this task through LV? coz we are spending a lot of time transferring the data from LV to ICD2 manually and its prone to mistake as well.
    any suggestion?
    thanks,
    Pedz

    LabVIEW does not currently have a built-in method to communicate with
    i2c, but there are other vendors that sell devices to communicate in
    this manner with LabVIEW development kits.  One that I know of is
    from MCC... here is a link:  http://www.mcc-us.com
    They sell a device called iPort, and then you can buy LabVIEW VIs to go with it.  I hope this is helpful to you!
    john m

  • How can we let the program run in backgroud automatically?

    normally,we need to find peak off time run big program
    that read pooled table and slowly.
    How can we let the program run in backgroud automatically?
    BTW:before that pop a window just give runner a notice.

    Here is an example, try this one.
    REPORT ztest.
    PARAMETERS: p_vbeln LIKE vbak-vbeln,
                p_bkrun NO-DISPLAY.
    DATA: ls_vbak LIKE vbak.
    DATA: v_answer,
          v_jobcount LIKE tbtcjob-jobcount.
      IF p_bkrun IS INITIAL.
    *-- not background processing
        CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
             EXPORTING
                  textline1      = 'This may time out.'
                  textline2      = 'Do you want to run in background?'
                  titel          = 'Warning!!!'
                  cancel_display = space
             IMPORTING
                  answer         = v_answer.
        IF v_answer = 'J'.
    *-- run in the background
          CALL FUNCTION 'JOB_OPEN'
               EXPORTING
                    jobname          = 'ZTEST'
               IMPORTING
                    jobcount         = v_jobcount
               EXCEPTIONS
                    cant_create_job  = 1
                    invalid_job_data = 2
                    jobname_missing  = 3
                    OTHERS           = 4.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            EXIT.
          ENDIF.
    *-- submit the program in the background
          SUBMIT ztest
            WITH p_bkrun = 'X'
            WITH p_vbeln = p_vbeln
            USER sy-uname
            VIA JOB 'ZTEST' NUMBER v_jobcount AND RETURN.
    *-- close the job
          CALL FUNCTION 'JOB_CLOSE'
               EXPORTING
                    jobcount             = v_jobcount
                    jobname              = 'ZTEST'
                    strtimmed            = 'X'
               EXCEPTIONS
                    cant_start_immediate = 1
                    invalid_startdate    = 2
                    jobname_missing      = 3
                    job_close_failed     = 4
                    job_nosteps          = 5
                    job_notex            = 6
                    lock_failed          = 7
                    OTHERS               = 8.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE 'W' NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
          EXIT.
        ELSE.
          CLEAR v_answer.
        ENDIF.
      ENDIF.
      CHECK v_answer IS INITIAL.
      SELECT SINGLE * FROM vbak
                      INTO ls_vbak
                     WHERE vbeln = p_vbeln.
      IF sy-subrc <> 0.
        WRITE:/ 'Invalid Order Id.'.
      ENDIF.
    END-OF-SELECTION.
      CHECK v_answer IS INITIAL.
      IF p_bkrun IS INITIAL.
        WRITE:/ 'Here is the result running the program in foreground.'.
      ELSE.
        WRITE:/ 'Here is the result running the program in background.'.
      ENDIF.
      WRITE:/ ls_vbak-vbeln,
              ls_vbak-vkorg.

  • How can I write from an Include?

    Hi to everybody!!
    I've a problem with my include...inside of this I've to write '2'. for make this I put...
    write: '2'.
    But when I execute the program... the number 2 doesn't appears, somebody told me that I need to put the End-OF-SELECTION, but when I can't see it.
    Does anybody know how can I write something from an include?
    Thanks a lot.
    Regards,
    Rebeca

    Try this way...
    I don't where you placed the include , you place under the event and see.
    REPORT ZTEST.
    END-OF-SELECTION.
    INCLUDE ZINCLUDE.

  • How can I make my program Run forever?

    I would like to know how can I make my program execute some method while the GUI still open. I have something like this.
      public static void main(String args[]) {
        System.out.println("****************************");
        System.out.println("    PACKET READER CONSOLE   ");
        System.out.println("****************************");
        IPDetector window = new IPDetector(); // IPDetector is the JFrame
        window.setTitle("IPDetector Analyzer");
        window.pack();
        window.show();
        PortListener pl = new PortListener();// Is my portlistener class
        PacketReader c = new PacketReader();
        while(JFrame still open){// I dont know how to put a statemente here
          pl.start();// this method reads from a port and returns a string
          String cc = pl.data;// gets the string from the port listener
          while(!cc.equals("")){
            c.portWriter(cc);// writes the string into a file
      }I want that my portlistener keeps reading all the time, and if is something in the socket information.
    Should I use a thread? Any ideas? thanks.
    Chris

    I still not understanding how to make it thread. My main class is this one IPDetector. and it looks like this.
    public class IPDetector extends JFrame {
      // Declaration of the instance variables
      private static ArrayofDisplay  ad = new ArrayofDisplay();
      private ArrayofCreators database = new ArrayofCreators();
      JLabel sourceLabel;//etc..
      public IPDetector() {
        IPDetectorLayout customLayout = new IPDetectorLayout();
        getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
        getContentPane().setLayout(customLayout);
        sourceLabel = new JLabel("Source IP Add.");
        getContentPane().add(sourceLabel); 
        addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
      // I get confused here...
      private boolean alive; // Do I need to declared here?
      public void setAlive(boolean val) { // This one also?
        alive = val;
      // IPDetector Methods...
      public void displayCaller(ArrayofDisplay aD){  }
      public void setAndReplace(String text)  {    }
      public void refresh(){ }
      public boolean action(Event evt, Object arg){ }
      //etc...
      public static void main(String args[]) {
        System.out.println("***********************************************");
        IPDetector window = new IPDetector();
        window.setTitle("IPDetector");
        window.pack();
        window.show();
        PortListener pl = new PortListener();
        PacketReader c = new PacketReader();
        while (alive) {// Is this correct here?
          pl.start();
          String cc = pl.data;
          while(!cc.equals("")){
            c.portWriter(cc);
            window.refresh();
            cc = "";
    class IPDetectorLayout implements LayoutManager {
      public IPDetectorLayout() {  }
      public void addLayoutComponent(String name, Component comp) {  }
      public void layoutContainer(Container parent) {  }
    }

  • How can I write a tree report?

    How can I write a tree report? If you have any document/ link can you please send that.
    Regards,
    Subhasish

    REPORT  zdemo_alv_tree.
    Demo program prepared for ****************
    CLASS cl_gui_column_tree DEFINITION LOAD.
    CLASS cl_gui_cfw DEFINITION LOAD.
    DATA tree1  TYPE REF TO cl_gui_alv_tree_simple.
    INCLUDE <icon>.
    INCLUDE bcalv_simple_event_receiver.
    DATA: gt_sflight      TYPE sflight OCCURS 0,   " Output-Table
          gt_fieldcatalog TYPE lvc_t_fcat,         " Field Catalog
          gt_sort         TYPE lvc_t_sort,         " Sorting Table
          ok_code         LIKE sy-ucomm.           " OK-Code
    END-OF-SELECTION.
      CALL SCREEN 100.
    *&      Form  BUILD_FIELDCATALOG
    This subroutine is used to build the field catalog for the ALV list
    FORM build_fieldcatalog.
    get fieldcatalog
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'SFLIGHT'
        CHANGING
          ct_fieldcat      = gt_fieldcatalog.
    change fieldcatalog
      DATA: ls_fieldcatalog TYPE lvc_s_fcat.
      LOOP AT gt_fieldcatalog INTO ls_fieldcatalog.
        CASE ls_fieldcatalog-fieldname.
          WHEN 'CARRID' OR 'CONNID' OR 'FLDATE'.
            ls_fieldcatalog-no_out = 'X'.
            ls_fieldcatalog-key    = ''.
          WHEN 'PRICE' OR 'SEATSOCC' OR 'SEATSMAX' OR 'PAYMENTSUM'.
            ls_fieldcatalog-do_sum = 'X'.
        ENDCASE.
        MODIFY gt_fieldcatalog FROM ls_fieldcatalog.
      ENDLOOP.
    ENDFORM.                               " BUILD_FIELDCATALOG
    *&      Form  BUILD_OUTTAB
    Retrieving the data from the table and filling it in the output table
    of the ALV list
    FORM build_outtab.
      SELECT * FROM sflight INTO TABLE gt_sflight.
    ENDFORM.                               " BUILD_OUTTAB
    *&      Form  BUILD_SORT_TABLE
    This subroutine is used to build the sort table or the sort criteria
    FORM build_sort_table.
      DATA ls_sort_wa TYPE lvc_s_sort.
    create sort-table
      ls_sort_wa-spos = 1.
      ls_sort_wa-fieldname = 'CARRID'.
      ls_sort_wa-up = 'X'.
      ls_sort_wa-subtot = 'X'.
      APPEND ls_sort_wa TO gt_sort.
      ls_sort_wa-spos = 2.
      ls_sort_wa-fieldname = 'CONNID'.
      ls_sort_wa-up = 'X'.
      ls_sort_wa-subtot = 'X'.
      APPEND ls_sort_wa TO gt_sort.
      ls_sort_wa-spos = 3.
      ls_sort_wa-fieldname = 'FLDATE'.
      ls_sort_wa-up = 'X'.
      APPEND ls_sort_wa TO gt_sort.
    ENDFORM.                               " BUILD_SORT_TABLE
    *&      Module  PBO  OUTPUT
    This subroutine is used to build the ALV Tree
    MODULE pbo OUTPUT.
      IF tree1 IS INITIAL.
        PERFORM init_tree.
      ENDIF.
      SET PF-STATUS 'ZSTATUS'.
    ENDMODULE.                             " PBO  OUTPUT
    *&      Module  PAI  INPUT
    This subroutine is used to handle the navigation on the screen
    MODULE pai INPUT.
      CASE ok_code.
        WHEN 'EXIT' OR 'BACK' OR 'CANC'.
          PERFORM exit_program.
        WHEN OTHERS.
          CALL METHOD cl_gui_cfw=>dispatch.
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.                             " PAI  INPUT
    *&      Form  exit_program
          free object and leave program
    FORM exit_program.
      CALL METHOD tree1->free.
      LEAVE PROGRAM.
    ENDFORM.                               " exit_program
    *&      Form  register_events
    Handling the events in the ALV Tree control in backend
    FORM register_events.
    define the events which will be passed to the backend
      DATA: lt_events TYPE cntl_simple_events,
            l_event TYPE cntl_simple_event.
    define the events which will be passed to the backend
      l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_click.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
      APPEND l_event TO lt_events.
      CALL METHOD tree1->set_registered_events
        EXPORTING
          events                    = lt_events
        EXCEPTIONS
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
    set Handler
      DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.
      CREATE OBJECT l_event_receiver.
      SET HANDLER l_event_receiver->on_add_hierarchy_node
                                                            FOR tree1.
    ENDFORM.                               " register_events
    *&      Form  build_header
          build table for header
    FORM build_comment USING
          pt_list_commentary TYPE slis_t_listheader
          p_logo             TYPE sdydo_value.
      DATA: ls_line TYPE slis_listheader.
    LIST HEADING LINE: TYPE H
      CLEAR ls_line.
      ls_line-typ  = 'H'.
    LS_LINE-KEY:  NOT USED FOR THIS TYPE
      ls_line-info = 'ALV TREE DEMO for ****************'.
      APPEND ls_line TO pt_list_commentary.
      p_logo = 'ENJOYSAP_LOGO'.
    ENDFORM.                    "build_comment
    *&      Form  init_tree
    Building the ALV-Tree for the first time display
    FORM init_tree.
      PERFORM build_fieldcatalog.
      PERFORM build_outtab.
      PERFORM build_sort_table.
    create container for alv-tree
      DATA: l_tree_container_name(30) TYPE c,
            l_custom_container TYPE REF TO cl_gui_custom_container.
      l_tree_container_name = 'TREE1'.
      CREATE OBJECT l_custom_container
          EXPORTING
                container_name = l_tree_container_name
          EXCEPTIONS
                cntl_error                  = 1
                cntl_system_error           = 2
                create_error                = 3
                lifetime_error              = 4
                lifetime_dynpro_dynpro_link = 5.
    create tree control
      CREATE OBJECT tree1
        EXPORTING
            i_parent              = l_custom_container
            i_node_selection_mode =
                                  cl_gui_column_tree=>node_sel_mode_multiple
            i_item_selection      = 'X'
            i_no_html_header      = ''
            i_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.
    create info-table for html-header
      DATA: lt_list_commentary TYPE slis_t_listheader,
            l_logo             TYPE sdydo_value.
      PERFORM build_comment USING
                     lt_list_commentary
                     l_logo.
    repid for saving variants
      DATA: ls_variant TYPE disvariant.
      ls_variant-report = sy-repid.
    register events
      PERFORM register_events.
    create hierarchy
      CALL METHOD tree1->set_table_for_first_display
        EXPORTING
          it_list_commentary = lt_list_commentary
          i_logo             = l_logo
          i_background_id    = 'ALV_BACKGROUND'
          i_save             = 'A'
          is_variant         = ls_variant
        CHANGING
          it_sort            = gt_sort
          it_outtab          = gt_sflight
          it_fieldcatalog    = gt_fieldcatalog.
    expand first level
      CALL METHOD tree1->expand_tree
        EXPORTING
          i_level = 1.
    optimize column-width
      CALL METHOD tree1->column_optimize
        EXPORTING
          i_start_column = tree1->c_hierarchy_column_name
          i_end_column   = tree1->c_hierarchy_column_name.
    ENDFORM.                    " init_tree

  • In Lion, running on an i MAC (late 2006), how can I stop certain programs from automatically starting up when I start my MAC?

    In Lion, running on an I MAC, (late 2006), how can I stop certain programs (iTunes, Word) from automatically starting up when I start the computer?

    Any application that is open when you shut down will re-open when you restart unless you deselect this when shutting down/restarting:
    Also check System Preferences>Users & Groups>Login items tab and make sure there's nothing listed there that you don't want launched.

Maybe you are looking for

  • Clarification on how to use Xserve Raid and Fibre Channel without xsan.

    First let me apologize for not responding earlier to your response, I tend to get busy and then forget to check back here. Tod, the answer to your question is No, only one computer is accessing the xserve raid files at any one time and that is via Fi

  • Extremely slow file copy from USB 3 external Seagate on MacBook

    I copied my iPhoto file of 20GB onto a new Seagate USB external drive from my 2011 MacBook in about 20 minutes over USB 2.0. I am copying up the same file from the same drive on my newer 2012 MacBook pro and it is taking 7 hours. The newer MacBook ha

  • How can I change the Safari toolbar for easier reading?

    Just about everything on iMac can be adjusted for us old timers, except the Safari tool bar. The favorites bar has print which cannot be read without a magnifying glass. Placing grey type on a grey background compounds the problem. I am helping my ol

  • Javascript in adobe air question...

    I have a VERY simple javascript password script that just takes the password from a form and compares it... if password is correct is redirects to correct html file. I know the script is poorly written, but it does what I need for the time being. if

  • Disk space not found

    tried to partition using bootcamp while installing win 7...in between the process, power went off.......now i lost 250 gb space coz it is not showing it anywhere