Control problem in trees using class

Hi all i am creating tree structure using class method in that when i am creating only one node it is working properly but when i try to crate multiple nodes it is giving me dump my program is as follow.
I search these on sdn and try the things but it still giving me same error.
*& Report  ZIRPT_HR_TEST_SPLITTER_01
report  zirpt_hr_test_splitter_01.
tables : pa0001,t582s.
select-options : p_pernr for pa0001-pernr no intervals.
*       CLASS screen_init DEFINITION
class screen_init definition create private.
  public section.
    class-methods init_screen.
    methods constructor.
  private section.
    data: splitter_h type ref to cl_gui_splitter_container,
    splitter_v type ref to cl_gui_splitter_container,
    picture type ref to cl_gui_picture,
    tree type ref to cl_gui_simple_tree,
     it_pa0001 type table of pa0001,
     it_pa0000 type table of pa0000.
    methods: fill_tree,
    fill_picture.
endclass.                    "screen_init DEFINITION
*       CLASS screen_handler DEFINITION
class screen_handler definition.
  public section.
    methods: constructor importing container
    type ref to cl_gui_container,
    handle_node_double_click
    for event node_double_click
    of cl_gui_simple_tree
    importing node_key.
  private section.
    data: html_viewer type ref to cl_gui_html_viewer,
           it_pa0001 type table of pa0001,
           it_pa0000 type table of pa0000,
    list_viewer type ref to cl_gui_alv_grid.
    methods:
    fill_list importing pernr type pa0001-pernr
                       infty type t582s-infty.
endclass.                    "screen_handler DEFINITION
*       CLASS screen_init IMPLEMENTATION
class screen_init implementation.
  method init_screen.
    data screen type ref to screen_init.
    create object screen.
  endmethod.                    "init_screen
  method constructor.
    data: events type cntl_simple_events,
    event like line of events,
    event_handler type ref to screen_handler,
    container_left type ref to cl_gui_container,
    container_right type ref to cl_gui_container,
    container_top type ref to cl_gui_container,
    container_bottom type ref to cl_gui_container.
    create object splitter_h
    exporting
    parent = cl_gui_container=>screen0
    rows = 1
    columns = 2.
    call method splitter_h->set_border
      exporting
        border = cl_gui_cfw=>false.
    call method splitter_h->set_column_mode
      exporting
        mode = splitter_h->mode_absolute.
    call method splitter_h->set_column_width
      exporting
        id    = 1
        width = 110.
    container_left = splitter_h->get_container( row = 1 column = 1 ).
    container_right = splitter_h->get_container( row = 1 column = 2 ).
    create object splitter_v
    exporting
    parent = container_left
    rows = 2
    columns = 1.
    call method splitter_v->set_border
      exporting
        border = cl_gui_cfw=>false.
    call method splitter_v->set_row_mode
      exporting
        mode = splitter_v->mode_absolute.
    call method splitter_v->set_row_height
      exporting
        id     = 1
        height = 160.
    container_top = splitter_v->get_container( row = 1 column = 1 ).
    container_bottom = splitter_v->get_container( row = 2 column = 1 ).
    create object picture
    exporting parent = container_top.
    create object tree
    exporting parent = container_bottom
    node_selection_mode =
    cl_gui_simple_tree=>node_sel_mode_single.
    create object event_handler
    exporting container = container_right.
    event-eventid = cl_gui_simple_tree=>eventid_node_double_click.
    event-appl_event = ' '.
    append event to events.
    call method tree->set_registered_events
      exporting
        events = events.
    set handler event_handler->handle_node_double_click for tree.
    call method: me->fill_tree,
                 me->fill_picture.
     call method cl_gui_cfw=>flush.
  endmethod.                    "constructor
  method fill_picture.
    types pict_line(256) type c.
    data pict_tab type table of pict_line.
    data url(255) type c.
    data : file type rlgrap-filename value 'C:\Documents and Settings\sapgroup.NITCOWRL\My Documents\nitco.gif'.
    translate file to upper case.
*CALL FUNCTION 'WS_UPLOAD'
*EXPORTING
*filename = file
*filetype = 'BIN'
*TABLES
*data_tab = pict_tab.
    data query_table_wa type w3query.
    data query_table type table of w3query." OF like w3query occurs 1 with header line.
    data html_table type table of w3html."  like w3html occurs 1.
    data return_code type  w3param-ret_code.
    data content_type type  w3param-cont_type.
    data content_length type  w3param-cont_len.
    data pic_data type table of w3mime."  like w3mime occurs 0.
    data pic_size type i.
    refresh query_table.
    query_table_wa-name = '_OBJECT_ID'.
    query_table_wa-value = 'ENJOYSAP_LOGO'.
    append query_table_wa to query_table.
    call function 'WWW_GET_MIME_OBJECT'
      tables
        query_string        = query_table
        html                = html_table
        mime                = pic_data
      changing
        return_code         = return_code
        content_type        = content_type
        content_length      = content_length
      exceptions
        object_not_found    = 1
        parameter_not_found = 2
        others              = 3.
    if sy-subrc = 0.
      pic_size = content_length.
    endif.
    call function 'DP_CREATE_URL'
      exporting
        type     = 'image'
        subtype  = cndp_sap_tab_unknown
        size     = pic_size
        lifetime = cndp_lifetime_transaction
      tables
        data     = pic_data
      changing
        url      = url
      exceptions
        others   = 1.
*IMPORT pict_tab = pict_tab FROM DATABASE abtree(pi) ID 'FLIGHTS'.
*CALL FUNCTION 'DP_CREATE_URL'
*EXPORTING
*type = 'IMAGE'
*subtype = 'GIF'
*TABLES
*data = pict_tab
*CHANGING
*url = url.
    call method picture->load_picture_from_url
      exporting
        url = url.
    call method picture->set_display_mode
      exporting
        display_mode = picture->display_mode_fit_center.
*     CALL METHOD cl_gui_cfw=>flush.
  endmethod.                    "fill_picture
  method fill_tree.
    data: node_table type table of abdemonode,
    node type abdemonode.
*data : it_pa0001 TYPE TABLE OF p0001,
    data :wa_pa0001 type pa0001,
          wa_pa0000 type pa0000,
          it_t582s type table of t582s,
          wa_t582s type t582s.
    types : begin of ttab,
             itext type t582s-itext,
             infty type t582s-infty,
             pernr type p0001-pernr,
             end of ttab.
    data : itab type table of ttab,
           wa_tab type ttab.
      field-symbols : <fs> like p_pernr.
      data : text1 type c.
    node-hidden = ' '.
    node-disabled = ' '.
    node-isfolder = 'X'.
    node-expander = ' '.
    select * from t582s
             into corresponding fields of table it_t582s
             where sprsl = sy-langu
               and infty in ('0001','0000')."'0002','0006',
*                         '0008','0015','0019').
    loop at it_t582s into wa_t582s .
      move-corresponding wa_t582s to wa_tab.
      node-node_key = wa_t582s-infty.
      clear node-relatkey.
      clear node-relatship.
      node-text = wa_t582s-itext.
      node-n_image = ' '.
      node-exp_image = ' '.
      append node to node_table.
      loop at p_pernr assigning <fs>.
        wa_tab-pernr = <fs>-low.
        append wa_tab to itab.
        clear p_pernr-low.
        node-node_key = <fs>-low.
        node-relatkey = wa_tab-infty.
        node-relatship = cl_gui_simple_tree=>relat_last_child.
        node-text = <fs>-low.
        node-n_image = '@AV@'.
        append node to node_table.
      endloop.
*        SELECT SINGLE * FROM pa0001 INTO wa_pa0001 WHERE pernr in p_pernr.
*     WHEN '0000'.
*        SELECT SINGLE * FROM pa0000 INTO wa_pa0000 WHERE pernr = p_pernr.
*    wa_tab-pernr = wa_pa0000-pernr.
*    endcase.
      clear : wa_tab,wa_pa0001,wa_pa0000.
    endloop.
*node-hidden = ' '.
*node-disabled = ' '.
*node-isfolder = 'X'.
*node-expander = ' '.
*LOOP AT itab INTO wa_tab.
*AT NEW infty.
*node-node_key = wa_tab-infty.
*CLEAR node-relatkey.
*CLEAR node-relatship.
*node-text = wa_tab-itext.
*node-n_image = ' '.
*node-exp_image = ' '.
*APPEND node TO node_table.
*ENDAT.
*AT NEW pernr.
* node-node_key = wa_tab-pernr.
*node-relatkey = wa_tab-infty.
*node-relatship = cl_gui_simple_tree=>relat_last_child.
*node-text = wa_tab-pernr.
*node-n_image = '@AV@'.
*node-exp_image = '@AV@'.
*ENDAT.
*APPEND node TO node_table.
*ENDLOOP.
    call method tree->add_nodes
      exporting
        table_structure_name = 'ABDEMONODE'
        node_table           = node_table.
*    CALL METHOD cl_gui_cfw=>flush.
  endmethod.                    "fill_tree
endclass.                    "screen_init IMPLEMENTATION
*       CLASS screen_handler IMPLEMENTATION
class screen_handler implementation.
  method constructor.
    create object: html_viewer exporting parent = container,
    list_viewer exporting i_parent = container.
  endmethod.                    "constructor
  method handle_node_double_click.
    data: infty type t582s-infty,
          pernr type pa0001-pernr.
    infty = node_key(4).
    pernr = node_key+4(8).
*IF pernr IS INITIAL.
*CALL METHOD: fill_html EXPORTING infty = infty,
*html_viewer->set_visible EXPORTING visible = 'X',
*list_viewer->set_visible EXPORTING visible = ' '.
*ELSE.
    call method: fill_list exporting infty = infty
                                     pernr = pernr,
    list_viewer->set_visible exporting visible = 'X',
    html_viewer->set_visible exporting visible = ' '.
*ENDIF.
*    CALL METHOD cl_gui_cfw=>flush.
  endmethod.                    "handle_node_double_click
*METHOD fill_html.
*DATA url TYPE scarr-url.
*SELECT SINGLE url
*FROM scarr
*INTO url
*WHERE infty = infty.
*CALL METHOD html_viewer->show_url EXPORTING url = url.
*ENDMETHOD.
  method fill_list.
    data: flight_tab type table of demofli,
    begin of flight_title,
    carrname type scarr-carrname,
    cityfrom type spfli-cityfrom,
    cityto type spfli-cityto,
    end of flight_title,
    list_layout type lvc_s_layo.
*DATA : it_pa0001 TYPE TABLE OF p0001.
    if infty = '0001'.
      select * from pa0001 into table it_pa0001 where pernr = pernr.
    elseif infty = '0000'.
      select * from pa0001 into table it_pa0001 where pernr = pernr.
    endif.
*SELECT SINGLE c~carrname p~cityfrom p~cityto
*INTO CORRESPONDING FIELDS OF flight_title
*FROM ( scarr AS c
*INNER JOIN spfli AS p ON c~carrid = p~carrid )
*WHERE p~carrid = carrid AND
*p~connid = connid.
*SELECT fldate seatsmax seatsocc
*INTO CORRESPONDING FIELDS OF TABLE flight_tab
*FROM sflight
*WHERE carrid = carrid AND connid = connid
*  ORDER BY fldate.
*CONCATENATE flight_title-carrname
*connid
*flight_title-cityfrom
*flight_title-cityto
    list_layout-grid_title = 'TEST'.
    list_layout-smalltitle = 'X'.
    list_layout-cwidth_opt = 'X'.
    list_layout-no_toolbar = 'X'.
*if infty = '0001'.
    call method list_viewer->set_table_for_first_display
      exporting
        i_structure_name = 'PA0001'
        is_layout        = list_layout
      changing
        it_outtab        = it_pa0001.
* CALL METHOD cl_gui_cfw=>flush.
*ELSEIF infty = '0001'.
*CALL METHOD list_viewer->set_table_for_first_display
*EXPORTING i_structure_name = 'PA0000'
*is_layout = list_layout
*CHANGING it_outtab = it_pa0000.
*endif.
  endmethod.                    "fill_list
endclass.                    "screen_handler IMPLEMENTATION
start-of-selection.
  data : it_pa0001 type table of p0001.
  call screen 100.
*  MODULE status_0100 OUTPUT
module status_0100 output.
  set pf-status 'SCREEN_100'.
  set titlebar 'TIT_100'.
  call method screen_init=>init_screen.
*   CALL METHOD cl_gui_cfw=>flush.
endmodule.                    "status_0100 OUTPUT
*  MODULE cancel INPUT
module cancel input.
  set screen 0.
  leave program.
endmodule.                    "cancel INPUT
Plz Suggest ,
Regards ,
Paresh G.

METHOD fill_tree.
    DATA: node_table TYPE TABLE OF abdemonode,
    node TYPE abdemonode.
*data : it_pa0001 TYPE TABLE OF p0001,
    DATA :wa_pa0001 TYPE pa0001,
          wa_pa0000 TYPE pa0000,
          it_t582s TYPE TABLE OF t582s,
          wa_t582s TYPE t582s.
    TYPES : BEGIN OF ttab,
             itext TYPE t582s-itext,
             infty TYPE t582s-infty,
             pernr TYPE p0001-pernr,
             END OF ttab.
    DATA : itab TYPE TABLE OF ttab,
           wa_tab TYPE ttab.
      FIELD-SYMBOLS : <fs> LIKE p_pernr.
      DATA : text1 TYPE c.
    node-hidden = ' '.
    node-disabled = ' '.
    node-isfolder = 'X'.
    node-expander = ' '.
    SELECT * FROM t582s
             INTO CORRESPONDING FIELDS OF TABLE it_t582s
             WHERE sprsl = sy-langu
               AND infty IN ('0001','0000')."'0002','0006',
                        '0008','0015','0019').
    LOOP AT it_t582s INTO wa_t582s .
      MOVE-CORRESPONDING wa_t582s TO wa_tab.
      node-node_key = wa_t582s-infty.
      CLEAR node-relatkey.
      CLEAR node-relatship.
      node-text = wa_t582s-itext.
      node-n_image = ' '.
      node-exp_image = ' '.
      APPEND node TO node_table.
      LOOP AT p_pernr ASSIGNING <fs>.
        wa_tab-pernr = <fs>-low.
        APPEND wa_tab TO itab.
        CLEAR p_pernr-low.
        node-node_key = <fs>-low.
        node-relatkey = wa_tab-infty.
        node-relatship = cl_gui_simple_tree=>relat_last_child.
        node-text = <fs>-low.
        node-n_image = '@AV@'.
        APPEND node TO node_table.
      ENDLOOP.
CLEAR : wa_tab,wa_pa0001,wa_pa0000.
    ENDLOOP.
CALL METHOD tree->add_nodes
      EXPORTING
        table_structure_name = 'ABDEMONODE'
        node_table           = node_table.
   CALL METHOD cl_gui_cfw=>flush.
  ENDMETHOD.                    "fill_tree

Similar Messages

  • ALV grid using classes(displaying subtotals groupwise in ALV grid control)

    Hello ,
      please can any body help me its urgent tome.
    displaying subtotals groupwise ..say for ex..
    cost group  costelement         amount     
    10          101         100.00
    10                            102          200.00
    10                            103          300.00
    20                            104          400.00
    20                            105          500.00
    20                            106          600.00
                    101         100.00
                    102         200.00
                    103         300.00
    10                          600.00
              104         400.00
              105         500.00
              106         600.00
    20                         1500.00
    In ALV grid control using classes.
    Thanks in Advance

    Hi alson,
    MODULE pbo OUTPUT.
    SET PF-STATUS 'MAIN100'.
    IF g_custom_container IS INITIAL.
    CREATE OBJECT g_custom_container
    EXPORTING container_name = g_container.
    CREATE OBJECT grid1
    EXPORTING i_parent = g_custom_container.
    <b>CALL METHOD grid1->set_table_for_first_display
    EXPORTING IS_LAYOUT = it_LAY
    CHANGING it_fieldcatalog = fieldcat
    it_sort = it_sort
    it_outtab = itab[].</b>
    ENDIF.
    ENDMODULE. " PBO OUTPUT
    keep the below code
    <b>CALL METHOD grid1->set_table_for_first_display
    EXPORTING IS_LAYOUT = it_LAY
    CHANGING it_fieldcatalog = fieldcat
    it_sort = it_sort
    it_outtab = itab[].</b>
    here
    IF pdel = 'X'.
    *BEGIN OF CHANGES BY VINAY DASARI
    PERFORM get_data.
    <b>CALL METHOD grid1->set_table_for_first_display
    EXPORTING IS_LAYOUT = it_LAY
    CHANGING it_fieldcatalog = fieldcat
    it_sort = it_sort
    it_outtab = itab[].</b>
    ENDIF.

  • F4 help in ALV Grid Control (using classes)

    Hi All,
        I have created a report using ALV Grid control (using classes). I need to provide F4 help for some of the fields in the Grid control.  I couldn't understand the standard demo program BCALV_GRID_F4_HELP. So Can anyone please provide me sample code for the same.
    Regards
    Jaker.

    hi check this..programs also
    BCALV_GRID_EDIT_DELTA
    BCALV_TEST_GRID_F4_HELP
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/how%2bto%2bimplement%2bf4%2bsearch%2bhelp%2bin%2boo%2balv%2bgrid
    Struggling with f4 handling in ALV grid - Minisap 46D
    regards,
    venkat

  • How to use classes of packages in flex mx:Script/ or mxml/

    Hi.I am just learning Flex using Flex Builder 3 facing one problem,
    Suppose I declare one package with name alert.as
    package
    import mx.controls.Alert;
    public class alert
    public function alertBtn()
    Alert("Hello btn 1");
    Now in want to use the function in mxml that I declared in a package.
    <mx:Button label="btn1" click="alertBtn();"  />
    I have few questions
    1)How to Import the class alert.as in <mx:Script> and where should i store the file alert.as in the directory folder of flex?
    2)How to call the function alertBtn() when btn1 is clicked.
    Thanks so much!
    Regards
    Ankur

    Hi Greg.I think I was not able to clear my problem properly.Let me try this time again.
    What I wanted to do was that in the below written code I have the full access of the id=panel1 in the  script tag .This works properly.
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script><![CDATA[
    import flash.display.Sprite;
    import mx.core.UIComponent;
    private function addChildToPanel():void {
    var circle:Sprite = new Sprite();
    circle.graphics.beginFill(0xFFCC00);
    circle.graphics.drawCircle(0, 0, 20);
    var c:UIComponent = new UIComponent();
    c.addChild(circle);
    panel1.addChild(c);
    ]]></mx:Script>
    <mx:Panel id="panel1" height="100" width="100"/>
    <mx:Button id="myButton" label="Click Me" click="addChildToPanel();"/>
    </mx:Application>
    This above functionality when I tried to do using class Outside the code ,its not working !
    Here is with the package:-
    But suppose I make One package 
    package
    import flash.display.Sprite;
    import mx.core.UIComponent;
    class getPanel extends Sprite
    public function addChildToPanel():void {
    var circle:Sprite = new Sprite();
    circle.graphics.beginFill(0xFFCC00);
    circle.graphics.drawCircle(0, 0, 20);
    var c:UIComponent = new UIComponent();
    c.addChild(circle);
    panel1.addChild(c);
              }//class
                        }//package
    Now in MXML
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script><![CDATA[
    import getPanel;
    ]]></mx:Script>
    <mx:Panel id="panel1" height="100" width="100"/>
    <mx:Button id="myButton" label="Click Me" click="getPanel.addChildToPanel();"/>
    </mx:Application>
    So My problem is that this code doesnt do anything.
    Neither the addChild function is working in it ,Nor the Panel1 is accessible here.
    Can u pls help me here.
    Thanks
    Ankur

  • ALV Tree using ABAP Objects

    Can anyone tell me how to Copy a node on an ALV Tree using context menu ?

    Hello Vidya
    The sample report ZUS_SDN_ALVTREE_CTXMENU demonstrates how to copy nodes on an ALV tree.
    Before showing the entire coding I would like to point out a few crucial parts of the coding:
    (1) Defintion of OUTTAB list
    TYPES: BEGIN OF ty_s_outtab.
    INCLUDE  TYPE vbak.
    TYPES: nkey     TYPE lvc_nkey.
    TYPES: ntype    TYPE lvc_value.  " 'VKORG' / 'VTWEG' / 'SPART' / leaf
    TYPES: END OF ty_s_outtab.
    TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                          WITH DEFAULT KEY.
    The OUTTAB list contains two additional fields holding the tree key (LVC_NKEY) and the node type.
    (2) The main logic of the report is implemented in event handler method handle_node_ctxmenu_sel.
          WHEN 'COPY_SUBTREE'.
            CALL METHOD go_alvtree->get_subtree
              EXPORTING
                i_node_key       = node_key
              IMPORTING
                et_subtree_nodes = lt_subtree.
            CALL METHOD go_alvtree->get_parent
              EXPORTING
                i_node_key        = node_key
              IMPORTING
                e_parent_node_key = ld_parent_key.
            LOOP AT lt_subtree INTO ld_node_key.
              READ TABLE gt_outtab INTO ls_outtab
                   WITH KEY nkey = ld_node_key.
              APPEND ls_outtab TO lt_outtab.
            ENDLOOP.
            READ TABLE lt_outtab INTO ls_outtab INDEX 1.
            ld_ntype = ls_outtab-ntype.
            DELETE lt_outtab WHERE ( vbeln IS INITIAL ).  " hierarchy nodes
            CASE ld_ntype.
              WHEN 'VKORG'.
                ld_top_key = ld_parent_key.
              WHEN 'VTWEG'.
                ld_vkorg_key = ld_parent_key.
              WHEN 'SPART'.
                ld_vtweg_key = ld_parent_key.
              WHEN 'LEAF'.
                ld_spart_key = ld_parent_key.
            ENDCASE.
    "       Note: similar logic like in routine CREATE_HIERARCHY
            SORT lt_outtab BY vkorg vtweg spart kunnr audat.
            LOOP AT lt_outtab INTO ls_outtab.
    *& Report  ZUS_SDN_ALVTREE_CTXMENU
    *& Based on: BCALV_TREE_03
    REPORT  zus_sdn_alvtree_ctxmenu.
    TYPES: BEGIN OF ty_s_outtab.
    INCLUDE  TYPE vbak.
    TYPES: nkey     TYPE lvc_nkey.
    TYPES: ntype    TYPE lvc_value.  " 'VKORG' / 'VTWEG' / 'SPART' / leaf
    TYPES: END OF ty_s_outtab.
    TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                          WITH DEFAULT KEY.
    DATA:
      gd_repid      TYPE syst-repid,
      gd_okcode     TYPE ui_func,
      go_docking    TYPE REF TO cl_gui_docking_container,
      go_alvtree    TYPE REF TO cl_gui_alv_tree.
    DATA:
      gt_outtab     TYPE ty_t_outtab,  " Sales Document
      gt_fcat       TYPE lvc_t_fcat.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
    * §2. Define an event handler method to build up a context menu
    *     (postfix of event name: _CONTEXT_MENU_REQUEST).
    * This event is fired each time the user klick with the right
    * mouse button on a node.
        CLASS-METHODS:
          handle_node_ctxmenu_req
          FOR EVENT node_context_menu_request OF cl_gui_alv_tree
            IMPORTING
              node_key
              menu,
    * §3. Define an event handler method to respond to a function code
    *     triggered by your menu (postfix: _CONTEXT_MENU_SELECTED).
    * This event is fired when the user selects an entry of the
    * build up context menu.
          handle_node_ctxmenu_sel
          FOR EVENT node_context_menu_selected OF cl_gui_alv_tree
            IMPORTING
              node_key
              fcode
              sender.
    * 'sender' is an implicit event parameter that is provided by
    * ABAP Objects runtime system. It contains a reference to the
    * object that fired the event. You may directly use it to
    * call methods of this instance.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
    * §4. Implement your event handler methods.
      METHOD handle_node_ctxmenu_req.
    * Event parameter 'menu' holds a reference to the standard context
    * menu of ALV Tree (functions 'Expand'/'Collapse' on nodes).
    * You may either append your own functions (separated by a line)
    * or clear the menu if you do not want to allow standard functions.
    * In this case the standard menu is cleared.
        CALL METHOD menu->clear.
    * The next line defines one line of the context menu.
        CALL METHOD menu->add_function
          EXPORTING
            fcode = 'DEL_SUBTREE'
            text  = 'Delete Subtree'(901).        "Delete Subtree
        CALL METHOD menu->add_function
          EXPORTING
            fcode = 'COPY_SUBTREE'
            text  = 'Copy Subtree'(902).        "Copy Subtree
      ENDMETHOD.                    "handle_node_ctxmenu_req
      METHOD handle_node_ctxmenu_sel.
    * At this point of execution, the user selected a menu entry of the
    * menu build up in event handler method handle_node_cm_req.
    * Query your own function codes and react accordingly.
        DATA:
          l_rc TYPE c,
          ld_ntype      TYPE lvc_value,
          ld_parent_key TYPE lvc_nkey,
          ld_node_key   TYPE lvc_nkey,
          lt_subtree    TYPE lvc_t_nkey,
          ls_outtab     TYPE ty_s_outtab,
          ls_last       TYPE ty_s_outtab,
          lt_outtab     TYPE ty_t_outtab.
        DATA:
          ld_vkorg_key   TYPE lvc_nkey,
          ld_vtweg_key   TYPE lvc_nkey,
          ld_spart_key   TYPE lvc_nkey,
          ld_last_key    TYPE lvc_nkey,
          ld_top_key     TYPE lvc_nkey.
        CASE fcode.
          WHEN 'DEL_SUBTREE'.
            CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
                 EXPORTING
                      textline1      = 'Do you really want to delete'(902)
                    textline2      = 'this node and all its subnodes?'(903)
                      titel          = 'Confirmation'(904)
                      cancel_display = ' '
                 IMPORTING
                      answer         = l_rc.
            IF l_rc EQ 'J'.
              CALL METHOD sender->delete_subtree
                EXPORTING
                  i_node_key = node_key.
    * Do not forget to refresh the display when you change the contents
    * of your list.
              CALL METHOD sender->frontend_update.
            ENDIF.
          WHEN 'COPY_SUBTREE'.
            CALL METHOD go_alvtree->get_subtree
              EXPORTING
                i_node_key       = node_key
              IMPORTING
                et_subtree_nodes = lt_subtree.
            CALL METHOD go_alvtree->get_parent
              EXPORTING
                i_node_key        = node_key
              IMPORTING
                e_parent_node_key = ld_parent_key.
            LOOP AT lt_subtree INTO ld_node_key.
              READ TABLE gt_outtab INTO ls_outtab
                   WITH KEY nkey = ld_node_key.
              APPEND ls_outtab TO lt_outtab.
            ENDLOOP.
            READ TABLE lt_outtab INTO ls_outtab INDEX 1.
            ld_ntype = ls_outtab-ntype.
            DELETE lt_outtab WHERE ( vbeln IS INITIAL ).  " hierarchy nodes
            CASE ld_ntype.
              WHEN 'VKORG'.
                ld_top_key = ld_parent_key.
              WHEN 'VTWEG'.
                ld_vkorg_key = ld_parent_key.
              WHEN 'SPART'.
                ld_vtweg_key = ld_parent_key.
              WHEN 'LEAF'.
                ld_spart_key = ld_parent_key.
            ENDCASE.
            SORT lt_outtab BY vkorg vtweg spart kunnr audat.
            LOOP AT lt_outtab INTO ls_outtab.
              IF ( ld_ntype = 'VKORG' ).
                "   new sales organisation
                IF ( ls_outtab-vkorg = ls_last-vkorg ).
                ELSE.
                  PERFORM add_sales_org
                                    USING
                                       ls_outtab
                                       ld_top_key
                                 CHANGING
                                       ld_vkorg_key.
                  ls_outtab-nkey   = ld_vkorg_key.
                  ls_outtab-ntype = 'VKORG'.
                  DESCRIBE TABLE gt_outtab.  " fill sy-tfill
                  MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
                    TRANSPORTING nkey ntype.
                ENDIF.
              ENDIF.
              IF ( ld_ntype = 'VKORG'  OR
                   ld_ntype = 'VTWEG' ).
                "   new distribution channel
                IF ( ls_outtab-vkorg = ls_last-vkorg  AND
                     ls_outtab-vtweg = ls_last-vtweg ).
                ELSE.
                  PERFORM add_distrib_chan
                                    USING
                                       ls_outtab
                                       ld_vkorg_key
                                 CHANGING
                                       ld_vtweg_key.
                  ls_outtab-nkey = ld_vtweg_key.
                  ls_outtab-ntype = 'VTWEG'.
                  DESCRIBE TABLE gt_outtab.  " fill sy-tfill
                  MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
                    TRANSPORTING nkey ntype.
                ENDIF.
              ENDIF.
              IF ( ld_ntype = 'VKORG'  OR
                   ld_ntype = 'VTWEG'  OR
                   ld_ntype = 'SPART' ).
                "   new channel
                IF ( ls_outtab-vkorg = ls_last-vkorg  AND
                     ls_outtab-vtweg = ls_last-vtweg  AND
                     ls_outtab-spart = ls_last-spart ).
                ELSE.
                  PERFORM add_division
                                    USING
                                       ls_outtab
                                       ld_vtweg_key
                                 CHANGING
                                       ld_spart_key.
                  ls_outtab-nkey = ld_spart_key.
                  ls_outtab-ntype = 'SPART'.
                  DESCRIBE TABLE gt_outtab.  " fill sy-tfill
                  MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
                    TRANSPORTING nkey ntype.
                ENDIF.
              ENDIF.
    * Leaf:
              PERFORM add_complete_line
                                USING
                                   ls_outtab
                                   ld_spart_key
                             CHANGING
                                   ld_last_key.
              ls_outtab-nkey = ld_last_key.
              ls_outtab-ntype = 'LEAF'.
              DESCRIBE TABLE gt_outtab.  " fill sy-tfill
              MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
                  TRANSPORTING nkey ntype.
              ls_last = ls_outtab.
            ENDLOOP.
            CALL METHOD cl_gui_cfw=>set_new_ok_code
              EXPORTING
                new_code = 'REFRESH_TREE'
    *          IMPORTING
    *            RC       =
        ENDCASE.
      ENDMETHOD.                    "handle_node_ctxmenu_sel
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      PERFORM init_controls.
    * Link the docking container to the target dynpro
      gd_repid = syst-repid.
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = gd_repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      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 SCREEN '0100'.
    * NOTE: no screen elements, ok_code -> gd_okcode
    **    PROCESS BEFORE OUTPUT.
    **      MODULE STATUS_0100.
    **    PROCESS AFTER INPUT.
    **      MODULE USER_COMMAND_0100.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      TRANSLATE gd_okcode TO UPPER CASE.  " facilitate manual entries
      CASE gd_okcode.
        WHEN 'BACK' OR
             'EXIT'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
      when 'REFRESH_TREE'.
        CALL METHOD go_alvtree->update_calculations
    *      EXPORTING
    *        NO_FRONTEND_UPDATE =
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  INIT_CONTROLS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM init_controls .
      DATA:
        ls_hierarchy_header TYPE treev_hhdr.
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          OTHERS                      = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL METHOD go_docking->set_extension
        EXPORTING
          extension  = 99999 " full-size screen
        EXCEPTIONS
          cntl_error = 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.
    * create tree control
      CREATE OBJECT go_alvtree
        EXPORTING
            parent              = go_docking
            node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
            item_selection      = ' '
            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.
      PERFORM build_hierarchy_header CHANGING ls_hierarchy_header.
    * Hide columns and sum up values initially using the fieldcatalog
      PERFORM build_fieldcatalog.
    * 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 go_alvtree->set_table_for_first_display
        EXPORTING
          is_hierarchy_header = ls_hierarchy_header
        CHANGING
          it_fieldcatalog     = gt_fcat
          it_outtab           = gt_outtab. "table must be empty !
      PERFORM init_tree.
    ENDFORM.                    " INIT_CONTROLS
    *&      Form  INIT_TREE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM init_tree .
      PERFORM create_hierarchy.
      PERFORM register_events.
    * Update calculations which were initially defined by field DO_SUM
    * of the fieldcatalog. (see build_fieldcatalog).
      CALL METHOD go_alvtree->update_calculations.
    * Send data to frontend.
      CALL METHOD go_alvtree->frontend_update.
    ENDFORM.                    " INIT_TREE
    *&      Form  build_hierarchy_header
    *       text
    *      <--P_LS_HIERARCHY_HEADER  text
    FORM build_hierarchy_header
         CHANGING
               cs_hierarchy_header TYPE treev_hhdr.
      cs_hierarchy_header-heading =
            'SalesOrg/DistChannel/Division'(300).
      cs_hierarchy_header-tooltip = 'Customer: Master Sales Data'(400).
      cs_hierarchy_header-width = 45.
      cs_hierarchy_header-width_pix = ''.
    ENDFORM.                    " build_hierarchy_header
    *&      Form  build_fieldcatalog
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog .
    * define local data
      DATA:
        ls_fcat    TYPE lvc_s_fcat.
      REFRESH: gt_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
         i_structure_name             = 'VBAK'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 2
          OTHERS                       = 3.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      LOOP AT gt_fcat INTO ls_fcat.
        CASE ls_fcat-fieldname.
          WHEN 'VBELN'  OR
               'AUDAT'  OR
               'AUART'  OR
               'WAERK'  OR
               'VKORG'  OR
               'VTWEG'  OR
               'SPART'  OR
               'BSTNK'  OR
               'KUNNR'.
          WHEN 'NETWR'.
            ls_fcat-do_sum = 'X'.
            ls_fcat-h_ftype = 'SUM'.  " or: 'MAX' / 'AVG'
          WHEN OTHERS.
            ls_fcat-tech = 'X'.
        ENDCASE.
        MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
      ENDLOOP.
    ENDFORM.                    " build_fieldcatalog
    *&      Form  create_hierarchy
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM create_hierarchy .
    * define local data
      DATA:
        ls_outtab    TYPE ty_s_outtab,
        ls_last      TYPE ty_s_outtab,
        lt_outtab    TYPE ty_t_outtab.
      DATA:
        ld_vkorg_key   TYPE lvc_nkey,
        ld_vtweg_key   TYPE lvc_nkey,
        ld_spart_key   TYPE lvc_nkey,
        ld_last_key    TYPE lvc_nkey,
        ld_top_key     TYPE lvc_nkey.
      " Select data
      SELECT * FROM  vbak INTO CORRESPONDING FIELDS OF TABLE lt_outtab
        UP TO 1550 ROWS.
      " sort table according to conceived hierarchy
      SORT lt_outtab BY vkorg vtweg spart kunnr audat.
    * Define one top node. In this way it is possible to calculate
    * values for the whole hierarchy.
      CALL METHOD go_alvtree->add_node
        EXPORTING
          i_relat_node_key = ''
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = 'Sales Documents'
        IMPORTING
          e_new_node_key   = ld_top_key.
      CLEAR: ls_outtab.
      ls_outtab-nkey  = ld_top_key.
      ls_outtab-ntype = 'ROOT'.
      MODIFY gt_outtab FROM ls_outtab INDEX 1
            TRANSPORTING nkey ntype.
      LOOP AT lt_outtab INTO ls_outtab.
        "   new sales organisation
        IF ( ls_outtab-vkorg = ls_last-vkorg ).
        ELSE.
          PERFORM add_sales_org
                            USING
                               ls_outtab
                               ld_top_key
                         CHANGING
                               ld_vkorg_key.
          ls_outtab-nkey   = ld_vkorg_key.
          ls_outtab-ntype = 'VKORG'.
          DESCRIBE TABLE gt_outtab.  " fill sy-tfill
          MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
            TRANSPORTING nkey ntype.
        ENDIF.
        "   new distribution channel
        IF ( ls_outtab-vkorg = ls_last-vkorg  AND
             ls_outtab-vtweg = ls_last-vtweg ).
        ELSE.
          PERFORM add_distrib_chan
                            USING
                               ls_outtab
                               ld_vkorg_key
                         CHANGING
                               ld_vtweg_key.
          ls_outtab-nkey = ld_vtweg_key.
          ls_outtab-ntype = 'VTWEG'.
          DESCRIBE TABLE gt_outtab.  " fill sy-tfill
          MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
            TRANSPORTING nkey ntype.
        ENDIF.
        "   new channel
        IF ( ls_outtab-vkorg = ls_last-vkorg  AND
             ls_outtab-vtweg = ls_last-vtweg  AND
             ls_outtab-spart = ls_last-spart ).
        ELSE.
          PERFORM add_division
                            USING
                               ls_outtab
                               ld_vtweg_key
                         CHANGING
                               ld_spart_key.
          ls_outtab-nkey = ld_spart_key.
          ls_outtab-ntype = 'SPART'.
          DESCRIBE TABLE gt_outtab.  " fill sy-tfill
          MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
            TRANSPORTING nkey ntype.
        ENDIF.
    * Leaf:
        PERFORM add_complete_line
                          USING
                             ls_outtab
                             ld_spart_key
                       CHANGING
                             ld_last_key.
        ls_outtab-nkey = ld_last_key.
        ls_outtab-ntype = 'LEAF'.
        DESCRIBE TABLE gt_outtab.  " fill sy-tfill
        MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
            TRANSPORTING nkey ntype.
        ls_last = ls_outtab.
      ENDLOOP.
    ENDFORM.                    " create_hierarchy
    *&      Form  ADD_SALES_ORG
    *       text
    *      -->P_LS_OUTTAB  text
    *      -->P_LD_TOP_KEY  text
    *      <--P_LD_VKORG_KEY  text
    FORM add_sales_org
                   USING
                      value(us_outtab)     TYPE ty_s_outtab
                      value(ud_relat_key)  TYPE lvc_nkey
                CHANGING
                      cd_node_key          TYPE lvc_nkey.
    * define local data
      DATA:
       ld_nodetext    TYPE lvc_value,
       ls_outtab      TYPE ty_s_outtab.
      ld_nodetext = us_outtab-vkorg.
      " add node
      CALL METHOD go_alvtree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = ld_nodetext
          is_outtab_line   = ls_outtab
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                    " ADD_SALES_ORG
    *&      Form  add_DISTRIB_CHAN
    *       text
    *      -->P_LS_OUTTAB  text
    *      -->P_LD_VKORG_KEY  text
    *      <--P_LD_VTWEG_KEY  text
    FORM add_distrib_chan
                   USING
                      value(us_outtab)     TYPE ty_s_outtab
                      value(ud_relat_key)  TYPE lvc_nkey
                CHANGING
                      cd_node_key          TYPE lvc_nkey.
    * define local data
      DATA:
       ld_nodetext    TYPE lvc_value,
       ls_outtab      TYPE ty_s_outtab.
      ld_nodetext = us_outtab-vtweg.
      " add node
      CALL METHOD go_alvtree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = ld_nodetext
          is_outtab_line   = ls_outtab
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                    " add_DISTRIB_CHAN
    *&      Form  add_division
    *       text
    *      -->P_LS_OUTTAB  text
    *      -->P_LD_VTWEG_KEY  text
    *      <--P_LD_SPART_KEY  text
    FORM add_division
                   USING
                      value(us_outtab)     TYPE ty_s_outtab
                      value(ud_relat_key)  TYPE lvc_nkey
                CHANGING
                      cd_node_key          TYPE lvc_nkey.
    * define local data
      DATA:
       ld_nodetext    TYPE lvc_value,
       ls_outtab      TYPE ty_s_outtab.
      ld_nodetext = us_outtab-spart.
      " add node
      CALL METHOD go_alvtree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = ld_nodetext
          is_outtab_line   = ls_outtab
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                    " add_division
    *&      Form  add_complete_line
    *       text
    *      -->P_LS_OUTTAB  text
    *      -->P_LD_SPART_KEY  text
    *      <--P_LD_LAST_KEY  text
    FORM add_complete_line
                   USING
                      value(us_outtab)     TYPE ty_s_outtab
                      value(ud_relat_key)  TYPE lvc_nkey
                CHANGING
                      cd_node_key          TYPE lvc_nkey.
    * define local data
      DATA:
       ld_nodetext    TYPE lvc_value,
       ls_outtab      TYPE ty_s_outtab.
      WRITE us_outtab-kunnr TO ld_nodetext+0  NO-ZERO.
      WRITE us_outtab-audat TO ld_nodetext+20 DD/MM/YYYY.
      CONDENSE ld_nodetext.
      " add node
      CALL METHOD go_alvtree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = ld_nodetext
          is_outtab_line   = us_outtab    " !!!
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                    " add_complete_line
    *&      Form  register_events
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM register_events .
      DATA:
        lt_events TYPE cntl_simple_events,
        ls_event TYPE cntl_simple_event.
    * The following four tree events registers ALV Tree in the constructor
    * method itself.
    *    - cl_gui_column_tree=>eventid_expand_no_children
    * (needed to load data to frontend when a user expands a node)
    *    - cl_gui_column_tree=>eventid_header_context_men_req
    * (needed for header context menu)
    *    - cl_gui_column_tree=>eventid_header_click
    * (allows selection of columns (only when item selection activated))
    *   - cl_gui_column_tree=>eventid_item_keypress
    * (needed for F1-Help (only when item selection activated))
    * Nevertheless you have to provide their IDs again if you register
    * additional events with SET_REGISTERED_EVENTS (see below).
    * To do so, call first method  GET_REGISTERED_EVENTS (this way,
    * all already registered events remain registered, even your own):
      CALL METHOD go_alvtree->get_registered_events
        IMPORTING
          events = lt_events.
    * (If you do not these events will be deregistered!!!).
    * You do not have to register events of the toolbar again.
    * Register additional events for your own purposes:
    * §5. Register first context menu event on frontend (with postfix
    *     (_REQUEST). The second is registered automatically.
      ls_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
      APPEND ls_event TO lt_events.
    * register events on frontend
      CALL METHOD go_alvtree->set_registered_events
        EXPORTING
          events                    = lt_events
        EXCEPTIONS
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
      ENDIF.
    * §6. Register both context menu events on backend (ABAP Objects
    *    event handling).
      SET HANDLER:
        lcl_eventhandler=>handle_node_ctxmenu_req  FOR go_alvtree,
        lcl_eventhandler=>handle_node_ctxmenu_sel  FOR go_alvtree.
    ENDFORM.                    " register_events
    Regards,
      Uwe

  • ALV Tree using Function Modules

    Hi,
    I want a simple example of ALV Tree using Function Modules which can display multiple Columns in the Hierarchically arranged fashion along with nodes & icons.
    Also should be able to handle the events.
    Thanks in Advance..

    Hi Ramesh,
    Here is a example of alv tree
    *& Report  BCALV_TREE_DEMO                                             *
    report  bcalv_tree_demo.
    class cl_gui_column_tree definition load.
    class cl_gui_cfw definition load.
    data tree1  type ref to cl_gui_alv_tree.
    data mr_toolbar type ref to cl_gui_toolbar.
    include <icon>.
    include bcalv_toolbar_event_receiver.
    include bcalv_tree_event_receiver.
    data: toolbar_event_receiver type ref to lcl_toolbar_event_receiver.
    data: gt_sflight      type sflight occurs 0,      "Output-Table
          gt_fieldcatalog type lvc_t_fcat, "Fieldcatalog
          ok_code like sy-ucomm.           "OK-Code
    start-of-selection.
    end-of-selection.
      call screen 100.
    *&      Module  PBO  OUTPUT
    *       process before output
    module pbo output.
      set pf-status 'MAIN100'.
      if tree1 is initial.
        perform init_tree.
      endif.
      call method cl_gui_cfw=>flush.
    endmodule.                             " PBO  OUTPUT
    *&      Module  PAI  INPUT
    *       process after input
    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.
      call method cl_gui_cfw=>flush.
    endmodule.                             " PAI  INPUT
    *&      Form  build_fieldcatalog
    *       build fieldcatalog for structure sflight
    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_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 = 'Hierarchy Header'.         "#EC NOTEXT
      p_hierarchy_header-tooltip =
                             'This is the Hierarchy Header !'. "#EC NOTEXT
      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 tree1->free.
      leave program.
    endform.                               " exit_program
    *&      Form  build_header
    *       build table for html_header
    *  -->  p1        text
    *  <--  p2        text
    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: flight-overview'.       "#EC NOTEXT
      append ls_line to pt_list_commentary.
    * STATUS LINE: TYPE S
      clear ls_line.
      ls_line-typ  = 'S'.
      ls_line-key  = 'valid until'.                          "#EC NOTEXT
      ls_line-info = 'January 29 1999'.                      "#EC NOTEXT
      append ls_line to pt_list_commentary.
      ls_line-key  = 'time'.
      ls_line-info = '2.00 pm'.                              "#EC NOTEXT
      append ls_line to pt_list_commentary.
    * ACTION LINE: TYPE A
      clear ls_line.
      ls_line-typ  = 'A'.
    * LS_LINE-KEY:  NOT USED FOR THIS TYPE
      ls_line-info = 'actual data'.                          "#EC NOTEXT
      append ls_line to pt_list_commentary.
      p_logo = 'ENJOYSAP_LOGO'.
    endform.
    *&      Form  create_hierarchy
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form create_hierarchy.
      data: ls_sflight type sflight,
            lt_sflight type sflight occurs 0.
    * get data
      select * from sflight into table lt_sflight
                            UP TO 200 ROWS .
      sort lt_sflight by carrid connid fldate.
    * add data to tree
      data: l_carrid_key type lvc_nkey,
            l_connid_key type lvc_nkey,
            l_last_key type lvc_nkey.
      loop at lt_sflight into ls_sflight.
        on change of ls_sflight-carrid.
          perform add_carrid_line using    ls_sflight
                                  changing l_carrid_key.
        endon.
        on change of ls_sflight-connid.
          perform add_connid_line using    ls_sflight
                                           l_carrid_key
                                  changing l_connid_key.
        endon.
        perform add_complete_line using  ls_sflight
                                         l_connid_key
                                changing l_last_key.
      endloop.
    * calculate totals
      call method tree1->update_calculations.
    * this method must be called to send the data to the frontend
      call method tree1->frontend_update.
    endform.                               " create_hierarchy
    *&      Form  add_carrid_line
    *       add hierarchy-level 1 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    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.
    * set item-layout
      data: lt_item_layout type lvc_t_layi,
            ls_item_layout type lvc_s_layi.
      ls_item_layout-t_image = '@3P@'.
      ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
      ls_item_layout-style   =
                            cl_gui_column_tree=>style_intensifd_critical.
      append ls_item_layout to lt_item_layout.
    * add node
      l_node_text =  ps_sflight-carrid.
      call method tree1->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
              it_item_layout   = lt_item_layout
           importing
              e_new_node_key = p_node_key.
    endform.                               " add_carrid_line
    *&      Form  add_connid_line
    *       add hierarchy-level 2 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    form add_connid_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.
    * set item-layout
      data: lt_item_layout type lvc_t_layi,
            ls_item_layout type lvc_s_layi.
      ls_item_layout-t_image = '@3Y@'.
      ls_item_layout-style   =
                            cl_gui_column_tree=>style_intensified.
      ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
      append ls_item_layout to lt_item_layout.
    * add node
      l_node_text =  ps_sflight-connid.
      call method tree1->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
              it_item_layout   = lt_item_layout
           importing
              e_new_node_key = p_node_key.
    endform.                               " add_connid_line
    *&      Form  add_cmplete_line
    *       add hierarchy-level 3 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    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.
    * set item-layout
      data: lt_item_layout type lvc_t_layi,
            ls_item_layout type lvc_s_layi.
      ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
      ls_item_layout-class   = cl_gui_column_tree=>item_class_checkbox.
      ls_item_layout-editable = 'X'.
      append ls_item_layout to lt_item_layout.
      l_node_text =  ps_sflight-fldate.
      call method tree1->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
              it_item_layout   = lt_item_layout
           importing
              e_new_node_key = p_node_key.
    endform.                               " add_complete_line
    *&      Form  register_events
    *       text
    *  -->  p1        text
    *  <--  p2        text
    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_expand_no_children.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
      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_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_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.
      if sy-subrc <> 0.
        message x208(00) with 'ERROR'.                       "#EC NOTEXT
      endif.
    * set Handler
      data: l_event_receiver type ref to lcl_tree_event_receiver.
      create object l_event_receiver.
      set handler l_event_receiver->handle_node_ctmenu_request
                                                            for tree1.
      set handler l_event_receiver->handle_node_ctmenu_selected
                                                            for tree1.
      set handler l_event_receiver->handle_item_ctmenu_request
                                                            for tree1.
      set handler l_event_receiver->handle_item_ctmenu_selected
                                                            for tree1.
    endform.                               " register_events
    *&      Form  change_toolbar
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form change_toolbar.
    * get toolbar control
      call method tree1->get_toolbar_object
              importing
                  er_toolbar = mr_toolbar.
      check not mr_toolbar is initial.
    * add seperator to toolbar
      call method mr_toolbar->add_button
              exporting
                  fcode     = ''
                  icon      = ''
                  butn_type = cntb_btype_sep
                  text      = ''
                  quickinfo = 'This is a Seperator'.         "#EC NOTEXT
    * add Standard Button to toolbar (for Delete Subtree)
      call method mr_toolbar->add_button
              exporting
                  fcode     = 'DELETE'
                  icon      = '@18@'
                  butn_type = cntb_btype_button
                  text      = ''
                  quickinfo = 'Delete subtree'.              "#EC NOTEXT
    * add Dropdown Button to toolbar (for Insert Line)
      call method mr_toolbar->add_button
              exporting
                  fcode     = 'INSERT_LC'
                  icon      = '@17@'
                  butn_type = cntb_btype_dropdown
                  text      = ''
                  quickinfo = 'Insert Line'.           "#EC NOTEXT
    * set event-handler for toolbar-control
      create object toolbar_event_receiver.
      set handler toolbar_event_receiver->on_function_selected
                                                          for mr_toolbar.
      set handler toolbar_event_receiver->on_toolbar_dropdown
                                                          for mr_toolbar.
    endform.                               " change_toolbar
    *&      Form  init_tree
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM init_tree.
    * create fieldcatalog for structure sflight
      perform build_fieldcatalog.
    * 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'.
      if sy-batch is initial.
        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.
        if sy-subrc <> 0.
          message x208(00) with 'ERROR'.                       "#EC NOTEXT
        endif.
      endif.
    * create tree control
      create object tree1
        exporting
            parent              = l_custom_container
            node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
            item_selection      = 'X'
            no_html_header      = ''
            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.
    * create Hierarchy-header
      data l_hierarchy_header type treev_hhdr.
      perform build_hierarchy_header changing l_hierarchy_header.
    * 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.
    * create emty tree-control
      call method tree1->set_table_for_first_display
         exporting
                   is_hierarchy_header  = l_hierarchy_header
                   it_list_commentary   = lt_list_commentary
                   i_logo               = l_logo
                   i_background_id      = 'ALV_BACKGROUND'
                   i_save               = 'A'
                   is_variant            = ls_variant
         changing
                   it_outtab            = gt_sflight "table must be emty !!
                   it_fieldcatalog      = gt_fieldcatalog.
    * create hierarchy
      perform create_hierarchy.
    * add own functioncodes to the toolbar
      perform change_toolbar.
    * register events
      perform register_events.
    * adjust column_width
      call method tree1->COLUMN_OPTIMIZE.
    ENDFORM.                    " init_tree
    regards,
    venu.

  • NI-FGEN Problems in TestStand using IVI Calls

    Hello:
    I have a problem. When using a 5411 under TesStand, making IVI calls the 5411 O/P is distorted when I configure it to O/P a simple Waveform ( 1.544 MHz, 5Vp-p 0V DC Offset). The same setup using either a CVI application utilizing the function panel or the soft front panel yields a fantastic O/P. If I can not make IVI calls from TestStand then what is the use?
    Help.... Very fruntrared and on a deadline
    cheers...

    Hello Craig -
    I've quickly looked over the CVI IVIclass demos including the quick bit of Fgen code, if you run this project and monitor the output in MAX you are seeing good results? If so, yes I'd check the settings in your IVI steps in TestStand. (If you haven't seen it yet try \CVI\samples\iviclass\fgen.prj)
    CVI also ships with function-by-function class help files which on my machine are located at C:\vxipnp\winnt\niivi\Help, I point this out since the demo sequence for IVI in TestStand makes a direct DLL call to set up the soft front panel as a non-interactive window... there are a few other cases where features of the driver are not accessible just by editing the step properties, but that is across the board, so again if it worked in CVI it should work here.
    I'm going to attach a quick little TestStand sequence (written for TS 2.0.1f1 the current release) to this project as a way of you just loosely troubleshooting, all it will do is launch the soft front panel and use the controls to try and set up your waveform... Try it once with the simulated instrument, or just go straight to altering the FileGlobal variable to point to your logical name and tell me if you get better or worse response?
    To alter the internals of the call to hardware right-click on the second step and choose 'edit Fgen'... you may want to examine your clock, the channel settings and extensions to make sure anything you configured in your code is configured here... The only thing I am still unsure of is whether you were using the default sine waves or if you were definining something arbritrary, the 5411 does have the ability to set sample counts/ waveform size /sampling rate. You may want to try setting your Arb SampleRate higher, or fall back on a quick DLL call to set some attributes manually if you can't access them any other way.
    You can use the IVI operation "get Information" on a particular logical name to aquire the current/default settings of your instrument.
    Below is some text I extracted from a LabVIEW example (I don't know how useful the actual code will be, but perhaps this is the cause of your undersampled data?) Jitter can also be a symptom of undersampling. I will try and check with the hardware team for you and post if I have any other ideas...
    -Regards
    Elaine R.
    National Instruments
    http://www.ni.com/ask
    --Extracted from an example "Generating Segments of Larger Waveforms with the NI 5411" --
    >>To set up sample counts, pass the array of sample counts you want to use to create a new arbitrary sequence. The array must have at least as many elements as the value you specify in the Sequence Length parameter. Each Sample Counts array element corresponds to a Waveform Handles array element and indicates how many samples of the given waveform to generate. Each element of the Sample Count array must be larger then the minimum waveform size and a multiple of the waveform quantum. You can obtain these values by calling niFgenQueryArbWfmCapabilities.
    For the NI 5411, you can use a minimum of 256 Sample Counts, with a quantum of 8, which is the same as creating a waveform for the NI 5411. The other restriction is that you cannot use a number greater than the number of samples in the waveform.
    In terms of use, the NI 5411 only generates the number of samples that are indicated by the Sample Count number regardless of how many actual samples are in the waveform array downloaded to the NI 5411.
    Attachments:
    fgen.seq ‏50 KB

  • ALV tree using Objects

    Hi,
    I am making an ALV tree using objects and the code is crashing due to an error in the Screen 100 ( which I am using ). I tried to implement the example provided at http://www.sapdevelopment.co.uk/reporting/alv/alvtree.htm but that is not working.
    Can anyone please tell me a working example or a brief tutorial so that I can correct the logical errors in my code.
    Thanks,
    Gaurav

    Hi,
    Check whether u have uncommented the PAI and PBO modules.
    Try this one.
    REPORT ZZZTEST_3
           NO STANDARD PAGE HEADING
           MESSAGE-ID zcs_cs_001.
    1/ Report Name: ZZZ_ALV_TREE_DEMO
    The definition and implementation of the event reciever class
    include <icon>.
    Predefine a local class for event handling to allow the
    declaration of a reference variable before the class is defined.
    class lcl_event_receiver definition deferred.
    data :
         Alv Containers
         tree definition
           o_tree type ref to cl_gui_simple_tree,
         Event Handler
           o_eventreceiver     type ref to lcl_event_receiver,
           o_dockingcontainer TYPE REF TO cl_gui_docking_container.
    data :
        node structures for tree building
          i_nodes type table of abdemonode, " node table def create bespoke
          w_nodes like line of i_nodes,     " work area
          i_tree_event type cntl_simple_events, " Itab for Tree Events
          w_tree_event type cntl_simple_event.   " Work area for Tree Events
    data:
           v_ratio1            type i,     "docking container screen area
    container screen area
           v_action(12)        type c.
    Internal Tables Used for Object ALV Display.
    data:
          i_toolbar           type table of stb_button,  "Tool bar for Grid1
          i_exclude1          type ui_functions,
          i_exclude2          type ui_functions,
          i_groups            type lvc_t_sgrp,  " Group Definitions
          i_selected_rows     type lvc_t_row.   " Select row type
    constants: c_x(1)    type c value 'X',             "Checked
               c_a(1)    type c value 'A'.             "All Layouts
          CLASS lcl_event_receiver DEFINITION
    class lcl_event_receiver definition.
      event receiver definitions for ALV actions
      public section.
        class-methods:
    Status bar
           handle_user_command
            for event user_command of cl_gui_alv_grid
                importing e_ucomm,
    Tree Actions
          handle_node_double_click
            for event node_double_click of cl_gui_simple_tree
            importing node_key,
    Row Double click for dirll down.
           handle_double_click
             for event double_click of cl_gui_alv_grid
                importing e_row
                          e_column
                          es_row_no.
    endclass.
    Implementation
    Every event handler that is specified below should also be set after
    the object has been created.  This is done in the PBO processing.
    with the following command
    SET HANDLER oEventreceiver->handle_toolbar FOR o_Alvgrid.
    class lcl_event_receiver implementation.
      method handle_user_command.
    In event handler method for event USER_COMMAND: Query your
      function codes defined in step 2 and react accordingly.
      endmethod.
    *&      Method handle_double_click
    This method is called when the user double clicks on a line to drill
    down.
    The following are exported from the ALV
    LVC_S_ROW
    LVC_S_COL
    LVC_S_ROID
      method handle_double_click.
    The double click drill down processing should be
    coded in the form below.
      endmethod.
    *&      Method handle_node_double_click
    This method handles the node double click event of the tree
    LVC_S_ROW
    LVC_S_COL
    LVC_S_ROID
      method handle_node_double_click.
       perform f9903_handle_node_double_click using node_key.
      endmethod.
    endclass.
    INITIALIZATION
    INITIALIZATION.
    PERFORM f050_initialize_values.
    FORM f050_initialize_values.
      v_ratio1 = 30.  "tree size
    ENDFORM.                    "  f050_initialize_values
    START-OF-SELECTION
    START-OF-SELECTION.
    END-OF-SELECTION
    END-OF-SELECTION.
      CALL SCREEN 9001.
    *Data Selection
    FORM f9000_objects_create USING    value(pobject)
                                 pparent
                                 value(pratio)
                                 value(prows)
                                 value(pcolumns).
      CASE pobject.
        WHEN  'o_dockingcontainer'.
          IF o_dockingcontainer IS INITIAL.
            CREATE OBJECT o_dockingcontainer
              EXPORTING
               side                        = v_dock_side1
                ratio                       = pratio  "amount of screen
              EXCEPTIONS
                cntl_error                  = 1
                cntl_system_error           = 2
                create_error                = 3
                lifetime_error              = 4
                lifetime_dynpro_dynpro_link = 5
                others                      = 6.
            PERFORM f9800_error_handle USING text-e06.
          ENDIF.
          WHEN 'o_tree'.
          IF o_tree IS INITIAL.
            CREATE OBJECT o_tree
             EXPORTING
            LIFETIME                    =
               parent                      = pparent
            SHELLSTYLE                  =
               node_selection_mode         = o_tree->node_sel_mode_single
            HIDE_SELECTION              =
              name                        = 'Transactions'
             EXCEPTIONS
               lifetime_error              = 1
               cntl_system_error           = 2
               create_error                = 3
                failed                     = 4
               illegal_node_selection_mode = 5
               others                      = 6.
            PERFORM f9800_error_handle USING text-e06.
          ENDIF.
        WHEN 'o_eventreceiver'.
          IF o_eventreceiver IS INITIAL.
            CREATE OBJECT o_eventreceiver.
            PERFORM f9800_error_handle USING text-e08.
          ENDIF.
        WHEN OTHERS.
       do nothing
      ENDCASE.
    ENDFORM.                    " f9000_objects_create
    *&      Form  f9100_create_tree
          Create the Tree
         -->P_O_TREE  tree data
    FORM f9100_create_tree USING p_o_tree TYPE REF TO cl_gui_simple_tree.
      REFRESH: i_nodes.
      CLEAR: w_nodes.
    Header Tree Folder
      w_nodes-node_key = 'ROOT'.
      w_nodes-isfolder = c_x.
      w_nodes-expander = c_x.
      w_nodes-text = 'Transactions'.
      APPEND w_nodes TO i_nodes.
    Adding Root Nodes for the tree.
    Key:
    NODE_KEY, RELATKEY, RELATSHIP, HIDDEN, DISABLED, ISFOLDER, N_IMAGE,
    EXP_IMAGE, STYLE, LAST_HITEM, NO_BRANCH, EXPANDER, DRAGDROPID, TEXT
      PERFORM f9101_node_list USING: '1' 'ROOT' '' '' '' c_x '' '' '' '' ''
                              c_x '' 'Sales Orders'.
    Adding subitems for the root node.
      PERFORM f9101_node_list USING:
                            Material Details
                              'VA01' '1' '' '' '' '' '@15@' '' '' '' '' ''
                              '' 'Create Sales Orders',
                            Document Details
                              'VA02' '1' '' '' '' '' '@15@' '' '' '' '' ''
                               '' 'Change Sales Orders'.
      PERFORM f9101_node_list USING: '2' 'ROOT' '' '' '' c_x '' '' '' '' ''
                              c_x '' 'Deliveries'.
    Adding subitems for the root node.
      PERFORM f9101_node_list USING:
                            Material Details
                              'VL01' '2' '' '' '' '' '@15@' '' '' '' '' ''
                              '' 'Create Outbound Delivery',
                            Document Details
                              'VL02' '2' '' '' '' '' '@15@' '' '' '' '' ''
                              '' 'Change Outbound Delivery'.
    add the nodes to the tree object,
      PERFORM f9102_add_treenodes TABLES i_nodes
                                 USING 'ABDEMONODE'  "node definition
                                        p_o_tree.       "tree declaration
    enabling event handlers for the tree
      PERFORM f9103_tree_event_handle USING p_o_tree.
    ENDFORM.                    " f9100_create_tree
    *&      Form  f9101_node_list
          Adding Nodes in a TREE
    FORM f9101_node_list USING    value(pnodekey)
                                 value(prelatkey)
                                 value(prelatship)
                                 value(phidden)
                                 value(pdisabled)
                                 value(pisfolder)
                                 value(pimage)
                                 value(pexpimage)
                                 value(pstyle)
                                 value(plastitem)
                                 value(pnobranch)
                                 value(pexpander)
                                 value(pdragdropid)
                                 value(ptext).
      w_nodes-node_key   = pnodekey.
      w_nodes-relatkey   = prelatkey.
      w_nodes-relatship  = prelatship. "Natural number
      w_nodes-hidden     = phidden.
      w_nodes-disabled   = pdisabled.
      w_nodes-isfolder   = pisfolder.
      w_nodes-n_image    =  pimage.  "Icons / embedded bitmap
      w_nodes-exp_image  = pexpimage. "Icons / embedded bitmap
      w_nodes-style      = pstyle.
      w_nodes-last_hitem = plastitem. "Tree Control: Column Name / Item
      "Name
      w_nodes-no_branch  = pnobranch.
      w_nodes-expander   = pexpander.
      w_nodes-dragdropid = pdragdropid.
      w_nodes-text       = ptext.
      APPEND w_nodes TO i_nodes.
    ENDFORM.                    " f9101_node_list
    *&      Form  f9102_add_treenodes
          Adding the Nodes to the Tree
         -->PI_NODES  Table containg the Nodes
         -->PTABLE    Name of the Table structure name
         -->PO_TREE   tree object
    FORM f9102_add_treenodes TABLES pi_nodes TYPE STANDARD TABLE
                            USING  value(ptable)
                                   po_tree TYPE REF TO cl_gui_simple_tree.
      CALL METHOD po_tree->add_nodes
        EXPORTING
          table_structure_name           = ptable    "may need to change
          node_table                     = pi_nodes[]
        EXCEPTIONS
          error_in_node_table            = 1
          failed                         = 2
          dp_error                       = 3
          table_structure_name_not_found = 4
          OTHERS                         = 5
      PERFORM f9800_error_handle USING text-e10.
    ENDFORM.                    " f9102_add_treenodes
    *&      Form  f9103_tree_event_handle
          Event Handling for Tree.
         -->P_P_O_TREE  text
    FORM f9103_tree_event_handle USING
                                p_o_tree TYPE REF TO cl_gui_simple_tree.
      w_tree_event-eventid = cl_gui_simple_tree=>eventid_node_double_click.
      w_tree_event-appl_event = ' '. " process PAI if event occurs
      APPEND w_tree_event TO i_tree_event.
      CALL METHOD p_o_tree->set_registered_events
          EXPORTING
            events = i_tree_event
          EXCEPTIONS
            cntl_error                = 1
            cntl_system_error         = 2
            illegal_event_combination = 3.
      IF sy-subrc <> 0.
       MESSAGE A000.
      ENDIF.
      IF o_eventreceiver IS INITIAL.
        CREATE OBJECT o_eventreceiver.
      ENDIF.
      SET HANDLER o_eventreceiver->handle_node_double_click FOR p_o_tree.
    ENDFORM.                    " f9103_tree_event_handle
         -->P_IEXCLUDE  text
         -->P_1150   text
    FORM f9200_exclude_functions USING   pexclude LIKE i_exclude1
                                   value(pfunction).
      DATA: l_exclude TYPE ui_func.
      l_exclude = pfunction.
      APPEND l_exclude TO pexclude.
    ENDFORM.                    " f9200_exclude_functions
    *&      Form  f9903_handle_node_double_click
          This form is used to handle the double click event for the tree
         -->P_NODE_KEY  Node clicked.
    FORM f9903_handle_node_double_click USING  p_node_key.
      CASE p_node_key.
        WHEN 'VA01'.
         SUBMIT ZZZ_TEST AND RETURN.
         CALL TRANSACTION 'VA01'. " and skip first screen.
        WHEN 'VA02'.
          CALL TRANSACTION 'VA02'. " and skip first screen.
        WHEN 'VL01'.
          CALL TRANSACTION 'VL01'. " and skip first screen.
        WHEN 'VL02'.
          CALL TRANSACTION 'VL02'. " and skip first screen.
        WHEN OTHERS.
        do nothning.
      ENDCASE.
    ENDFORM.                    " f9903_handle_node_double_click
    *&      Form  f9700_free_objects
    This form handles the freeing of the following objects
    ALV
    Docking Container
         -->P_O_ALVGRID  text
         -->P_0020   text
         -->P_0021   text
    FORM f9700_free_objects USING pobject
                        value(ptype)
                        value(ptext).
    Need to type the field symbol or it does not work
      CASE ptype.
        WHEN 'DOCKING'.
          DATA: l_odock TYPE REF TO cl_gui_docking_container.
          l_odock = pobject.
          IF NOT ( l_odock IS INITIAL ).
            CALL METHOD l_odock->free
              EXCEPTIONS
                cntl_error        = 1
               cntl_system_error = 2
                OTHERS            = 3.
            CLEAR: pobject, l_odock.
            PERFORM f9800_error_handle USING ptext.
          ENDIF.
        WHEN 'TREE'.
          DATA: l_otree TYPE REF TO cl_gui_simple_tree.
          l_otree = pobject.
          IF NOT ( l_otree IS INITIAL ).
            CALL METHOD l_otree->free
              EXCEPTIONS
                cntl_error        = 1
               cntl_system_error  = 2
                OTHERS            = 3.
            CLEAR: pobject, l_otree.
            PERFORM f9800_error_handle USING ptext.
          ENDIF.
        WHEN OTHERS.
       do something.
      ENDCASE.
    ENDFORM.                    " f9700_free_objects
    *&      Form  f9800_error_handle
          Handles Errors
         -->P_PTEXT  text
    FORM f9800_error_handle USING    value(ptext).
      IF sy-subrc NE 0.
    add your handling, for example
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  titel = text-e01
                  txt2  = sy-subrc
                  txt1  = ptext.
      ENDIF.
    ENDFORM.                    " f9800_error_handle
    *PBO & PAI Modules
    *&      Module  STATUS_9001  OUTPUT
          text
    module status_9001 output.
    Set the Status Bar
      set pf-status 'Z_STATUS'.
    Set the Title
      set titlebar 'Z_TITLE'.
      perform f9000_objects_create using:
                create docking container
                  'o_dockingcontainer' '' v_ratio1 '' '',
                create a tree
                  'o_tree' o_dockingcontainer '' '' '',
                Create the event reciever
                  'o_eventreceiver' '' '' '' ''.
    Create the Tree View.
      perform f9100_create_tree using o_tree.
    endmodule.                 " STATUS_9001  OUTPUT
    *&      Module  USER_COMMAND_9001  INPUT
          text
    module user_command_9001 input.
      case sy-ucomm.
        when 'EXIT' or  'CANC'.
          perform f9700_free_objects using:
                        o_tree 'TREE' text-E03,
                        o_dockingcontainer 'DOCKING' text-E05,
                        o_eventreceiver 'EVENT' text-e09.
    leave program.
          leave.    " to SCREEN 0.
        when 'BACK'.
          perform f9700_free_objects using:
                        o_tree 'TREE' text-E03,
                        o_dockingcontainer 'DOCKING' text-e05,
                        o_eventreceiver 'EVENT' text-E09.
          set screen '0'.
          leave screen.
        when others.
      endcase.
    endmodule.                 " USER_COMMAND_9001  INPUT
    Get back to me if u have any queries. Give me ur mail id, i will send one more sample code for ALV tree. This sample program will display only Tree not grid u can add ALV grid too.
    Thanks & Regards,
    Judith.

  • Using Class Timer  in a client/server app

    In my program i d like the server execute draws every 5 min choosing numbers randomly from1 to 10.
    Clients, when connected will inform server about the number they chose. (This works correctly)
    Next, the clients will wait until notified by the server about the number drawn in the last draw and
    about if they won or not.
    i ve found that i have to use classes Timer and TimerTask but API does not help me enough
    about how to use them. Could anyone help me?
    Here is the piece of code i think it need to be changed.
      // control thread's execution
          public void run()
             int message=0;
             int rnum=randGen.nextInt(10);
             display.append( "\n"+ "THE MAGIC NUMBER IS: " + rnum );
    // process connection
             try {
                // read message from client
                do {
                   try {
                      message =  input.readInt();
                      if (message==rnum){output.writeUTF("SERVER>>> YOU WON: MAGIC NUMBER IS: " +rnum);}
                       else {output.writeUTF("SERVER>>> YOU LOSE: MAGIC NUMBER IS: " +rnum);}
                      display.append( "\n\n" +"PLAYER " + clientNumber + " SELECTED NUMBER " + message );
                      display.setCaretPosition( display.getText().length() );
                   // process problems reading from client
                   catch ( IOException ioException ) {
                      display.append( "\nUnknown object type received" );
                } while ( message!=-1 );
                display.append( "\nClient terminated connection" );
                display = null;
             // close streams and socket
             finally {
                try {
                   output.close();
                   input.close();
                   connection.close();
                // process problems with I/O
                catch ( IOException ioException ) {
                   ioException.printStackTrace();
                clients.remove( this );
          }  // end method run
        

    I just implemented something like this so I know what you are trying to do.
    Basically TimerTask is an Abstract class, which means you can't make an instance of it. So TimeTask t = new TimeTask() won't work. Instead what you need to do is make your own class that extends TimerTask. You then need to implement the run() method which is abstract in TimerTask.
    This sounds complicated at first, but it is very easy.
    This is my DelayTimerTask:
    import java.util.TimerTask;
    *Author: Jon Parise
    *email: [email protected]
    public class DelayTimerTask extends TimerTask{
        private boolean timeExpired = false;
        /** Creates a new instance of DelayTimerTask */
        public DelayTimerTask() {
            timeExpired =false;
        public void run(){
            timeExpired =true;
        public boolean isExpired(){
            return this.timeExpired;
    }All this class does is set a flag when it is run.
    The Timer class schedules a TimerTask, in this case a DelayTimer. When the scheduled time comes, everything in run is executed, which in this case sets the flag.
    To schedule the task do this:
    Timer delayTimer = new Timer();
    DelayTimerTask delayTimerTask = new DelayTimerTask();
    delayTimer.schedule(delayTimerTask,5000);
    while(!delayTimerTask.isExpired()){
         //DoSomething Here
    }This will create a new delayTimer, and then schedule it to go off in 5 seconds(5000 millaseconds). When it goes off isExpired will become true and break you out of the loop.
    Hope this helps,
    Jon

  • Creating Tree using programmed ViewObject

    Hi,
    I'm currently trying to create a Tree in a JSF page using a programmatic ViewObject, wich means that I don't have any entity objects, only one ViewObject that is recursive through itself using a ViewLink to connect it.
    Structure:
    ViewObject name: GroupsView
    Atributes:
    -Name: String; PK
    -Owner: String;
    ViewLink name: GroupsLink
    Connects like this:
    -Cardinality: 1 to *
    -Source: GroupsView.Name
    -Destination: GroupsView.Owner
    and then I drag the link to the page and generate a tree from it, using GroupsView(<NameGroupsview>) level rules, but it seem to give me all the levels inside each level to the infinity, so it doesn't seem to verify the content groups inside each other.
    is there any problem with the structure I've used?
    thanks

    Yes thanks, I've already seen that link before and it worked when using an entity based View Object, my problem is when using a programmatic ViewObject, the link doesn't seem to recognize the structure.
    this is what I have in the GroupViewImpl.java:
    protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet rs) {
    // Create and populate a new row
    ViewRowImpl r = createNewRowForCollection(qc);
    int pos = getFetchPos(qc);
    try {
    int a = 0;
    RoleProfile Group = rowData.get(pos).getRoleProfile();
    populateAttributeForRow(r, a++, new Number(pos));
    populateAttributeForRow(r, a++, Group.getName());
    populateAttributeForRow(r, a++, null);
    //populateAttributeForRow(r, 2, Group.getName());
    } catch (IMException e) {
    e.printStackTrace();
    setFetchPos(qc, pos + 1);
    return r;
    and this is my selectionlistener from the Bean class:
    public void groupSelectionListener(SelectionEvent selectionEvent) {
    JSFUtils.invokeMethodExpression("#{bindings.GroupsView1.treeModel.makeCurrent}", Object.class, SelectionEvent.class, selectionEvent);
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("setroleNameVar");
    operationBinding.execute();
    CurrentUser = getSelectedUser();
    CurrentGroup = getSelectedGroup();
    try {
    System.out.println(CurrentGroup.getName());
    } catch (IMException e) {
    but I still get the entire collection repeated inside each item of the tree, I wasn't suposed
    This is irritating me, because I've searched much for this and still nothing
    Thanks again

  • Timer control problem

    Hi all. I'm a newbie in j2ee and Weblogic platform. Currently I'm using Weblogic Platform 8.1.
    I have a problem with web service and timer. When I have a running timer control, and then I restart the server, the timer control continue running the suspended tasks after the server up. I think this is the Weblogic features for availability, but I didn't need it. I need to stop the timer when the server stop.
    Could someone tell me how to stop the timer (or asynchronous conversation) when the server stop so it will not continue the task when the server start?
    And another question, is it possible to call Java control method within ordinary Java class in Weblogic Workshop?
    Thx..

    Hi all. I'm a newbie in j2ee and Weblogic platform. Currently I'm using Weblogic Platform 8.1.
    I have a problem with web service and timer. When I have a running timer control, and then I restart the server, the timer control continue running the suspended tasks after the server up. I think this is the Weblogic features for availability, but I didn't need it. I need to stop the timer when the server stop.
    Could someone tell me how to stop the timer (or asynchronous conversation) when the server stop so it will not continue the task when the server start?
    And another question, is it possible to call Java control method within ordinary Java class in Weblogic Workshop?
    Thx..

  • Load tree using renderer

    Hi,
    My current application contains a <mx:tree>
    his dataprovider is an xml file loaded from a httpservice
    this tree have a renderer extends TreeItemRenderer that allow me to add checkbox when node doesn't have childs.
    When user check or uncheck a node, i put some information in a datagrid.
    This datagrid is finally export to a file.
    Now the question is how can i initialize the tree using the two file (the original and this saved) ?
    See below my renderer code :
    package manageCheckBox
    import flash.events.Event;
    import flash.events.MouseEvent;
    import mx.collections.IViewCursor;
    import mx.controls.Alert;
    import mx.controls.CheckBox;
    import mx.controls.DataGrid;
    import mx.controls.treeClasses.*;
    import mx.controls.treeClasses.TreeItemRenderer;
    public class DisplayCheckBox extends TreeItemRenderer{
    public var chk:CheckBox;
    public var itemXml:XML; // original xml file
    public var dg:DataGrid; // datagrid to put information on
    public var myFields:XML; // saving file
    public function DisplayCheckBox(){
    super();
    mouseEnabled = false;
    override public function set data(value:Object):void{
    if(value != null){
    super.data = value;
    this.itemXml = XML(value);
    if(this.itemXml.@checked == "1"){
    this.chk.selected = true;
    }else{
    this.chk.selected = false;
    override protected function createChildren():void{
    super.createChildren();
    chk = new CheckBox();
    chk.addEventListener(MouseEvent.CLICK, handleChkClick);
    addChild(chk);
    override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{
    super.updateDisplayList(unscaledWidth,unscaledHeight);
    if(super.data){
    var tld:TreeListData = TreeListData(super.listData);
    if(tld.hasChildren){
    this.chk.visible = false;
    }else{
    this.chk.visible = true;
    if(chk.visible){
    this.chk.x = super.label.x
    super.label.x = this.chk.x + 17;
    this.chk.y = super.label.y+8;
    private function handleChkClick(evt:MouseEvent):void{
    if(this.chk.selected){
    this.itemXml.@checked = "1";
    // put information on the datagrid
    dg.dataProvider.addItem(
    "col1": this.itemXml.@label,
    "col2": this.itemXml.@label,
    "col3": this.itemXml.@resourceId
    }else{
    //this.checked = false;
    this.itemXml.@checked = "0";
    var vObject:Object = dg.dataProvider ;
    var cursor:IViewCursor=vObject.createCursor();
    while( !cursor.afterLast )
    if(cursor.current.col1 == this.itemXml.@label) {
    cursor.remove() ;
    cursor.moveNext();
    Thanks in advanc for your reply,
    Regards,
    HadanMarv

    A) The tree region is not refresh-enabled. If you want it to act on any change in session state the page will always have to be submitted/reloaded to reflect those changes.
    B) Providing a where-clause to the tree query is not done. There is nothing to achieve by doing so because of the nature of the query: the connect by occurs before the where clause filtering. You will break any and all metadata for the whole tree construct to use.
    Consider nodes which are from a different department than the one you filter on: how would the tree have to be constructed? What if a parent node misses because of that? How would it's child nodes match up? Worse: what if you select a dept which does not belong to the root node? The root node would not be displayed and subsequently no child nodes would be shown. Simply because the generated meta-data does not match up.
    Eg if "BLAKE" would be "SALES" and "JAMES" would be "ACCOUNTING", and you filter on dept = "ACCOUNTING", then "BLAKE" would be gone... But "JAMES" too. Just to illustrate how the represented data would be wrong.
    There is a reason the tree query requires the addition of the LEVEL pseudo-column, as this is used to iterate over the data to provide to the tree. You can see how horribly a where clause breaks that mechanism by simply running the query in sql developer or the sql workshop.
    tldr; Don't.

  • Provide me Helpful Links/Documents on ALV using Classes

    Dear all,
    Could you guys provide me with some Helpful Links/Documents on ALV using Classes.
    Thanks in Advance,
    Joseph Reddy

    Hi,
    Check these out:
    Check this for basic concepts of OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap code samples/abap objects/abap code sample to learn basic concept of object-oriented programming.doc
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap code samples/alv grid/abap code sample to display data in alv grid using object oriented programming.doc
    Tabstrip
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap code samples/alv grid/abap code sample for tab strip in alv.pdf
    Editable ALV
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap code samples/alv grid/abap code sample to edit alv grid.doc
    Tree
    http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
    General Tutorial for OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an easy reference for alv grid control.pdf
    http://www.geocities.com/mpioud/Abap_programs.html
    Best Regards,
    Anjali

  • Could not lookup PortalManagerHome in the JNDI tree using EJB reference java:comp/env/ejb/PortalManager

    Hi
    I am just a starter on WLPortal.
    I have created a barebone Application from scratch. I have synchronized it properly
    from EBCC to WLP. But When I am trying to access the home page of my application,
    I am getting from stack trace -
    <Nov 6, 2002 5:37:59 PM IST> <Error> <PortalAppflow> <Could not lookup PortalManagerHome
    in the JNDI tree using EJB reference java:comp/env/ejb/PortalManager.
    javax.naming.NameNotFoundException: Unable to resolve comp/env/ejb/PortalManager
    Resolved: 'comp/env' Unresolved:'ejb' ; remaining name 'PortalManager'
    at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:802)
    at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:209)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:173)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:181)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:181)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:323)
    at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:36)
    at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:124)
    at javax.naming.InitialContext.lookup(InitialContext.java:350)
    at com.bea.p13n.util.JndiHelper.lookupNarrow(JndiHelper.java:96)
    at com.bea.portal.appflow.PortalAppflowHelper.<clinit>(PortalAppflowHelper.java:64)
    at com.bea.portal.appflow.servlets.internal.PortalWebflowServlet.init(PortalWebflowServlet.java:78)
    at javax.servlet.GenericServlet.init(GenericServlet.java:258)
    at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:700)
    at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:643)
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:588)
    at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:368)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
    at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:215)
    at weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:112)
    at jsp_servlet.__index._jspService(__index.java:92)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:304)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2459)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2039)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    >
    <Nov 6, 2002 5:37:59 PM IST> <Error> <HTTP> <[WebAppServletContext(19695286,FirstWebApp,/FirstWebApp)]
    Servlet failed with Exception
    java.lang.NullPointerException:
    at com.bea.portal.appflow.PortalAppflowHelper.createPortalManager(PortalAppflowHelper.java:82)
    at com.bea.portal.appflow.servlets.internal.PortalWebflowServlet.setupPortalRequest(PortalWebflowServlet.java:187)
    at com.bea.portal.appflow.servlets.internal.PortalWebflowServlet.doGet(PortalWebflowServlet.java:99)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
    at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:215)
    at weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:112)
    at jsp_servlet.__index._jspService(__index.java:92)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:304)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2459)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2039)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    When I decompiled the class PortalAppflowHelper, I found a static block in it,
    which was as under-
    static
    debug = Debug.getInstance(com.bea.portal.appflow.PortalAppflowHelper.class);
    try
    if(debug.ON)
    debug.out("Looking up PortalManagerHome using EJB reference java:comp/env/ejb/PortalManager");
    portalManagerHome = (PortalManagerHome)JndiHelper.lookupNarrow("java:comp/env/ejb/PortalManager",
    com.bea.portal.manager.ejb.PortalManagerHome.class);
    if(debug.ON)
    debug.out("Successfully retrieved PortalManagerHome " + portalManagerHome);
    catch(Exception e)
    PortalAppflowLogger.errorFindingPortalManagerHome("java:comp/env/ejb/PortalManager",
    e);
    I have checked the PortalManager's JNDI name on WLConsole. Its ${APPNAME}.BEA_portal.PortalManager.
    Should I change it?
    When I tried to change it, I started getting other weird errors.
    Thanks
    Neeraj Hans

    Neeraj -
    The Portal framework code (including PortalAppflowHelper) uses ejb
    references to find the PortalManager (and other EJBs) from servlets and
    taglibs; that is what is signified by the java:comp/env/... name.
    Since you built your webapp from scratch (instead of using the portal
    wizard), you will need to make sure the you have the appropriate
    <ejb-ref> entries in your web.xml, and the corresponding
    <ejb-reference-description> entries in your weblogic.xml. By default,
    you will need at least mappings for:
    - ejb/PortalManager
    - ejb/UserManager
    - ejb/GroupManager
    - ejb/PipelineExecutor
    - ejb/EventService
    See either the resulting webapp from using the portal wizard or
    BEA_HOME/weblogic700/samples/portal/sampleportalDomain/beaApps/sampleportal/sampleportal/WEB-INF
    for example syntax.
    Greg
    Neeraj Hans wrote:
    Hi
    I am just a starter on WLPortal.
    I have created a barebone Application from scratch. I have
    synchronized it properly
    from EBCC to WLP. But When I am trying to access the home page of my
    application,
    I am getting from stack trace -
    <Nov 6, 2002 5:37:59 PM IST> <Error> <PortalAppflow> <Could not lookup
    PortalManagerHome
    in the JNDI tree using EJB reference java:comp/env/ejb/PortalManager.
    javax.naming.NameNotFoundException: Unable to resolve
    comp/env/ejb/PortalManager
    Resolved: 'comp/env' Unresolved:'ejb' ; remaining name 'PortalManager'
    at <stack trace lines snipped>
    When I decompiled the class PortalAppflowHelper, I found a static
    block in it,
    which was as under-
    static
    debug =
    Debug.getInstance(com.bea.portal.appflow.PortalAppflowHelper.class);
    try
    if(debug.ON)
    debug.out("Looking up PortalManagerHome using EJB
    reference java:comp/env/ejb/PortalManager");
    portalManagerHome =
    (PortalManagerHome)JndiHelper.lookupNarrow("java:comp/env/ejb/PortalManager",
    com.bea.portal.manager.ejb.PortalManagerHome.class);
    if(debug.ON)
    debug.out("Successfully retrieved PortalManagerHome "
    + portalManagerHome);
    catch(Exception e)
    PortalAppflowLogger.errorFindingPortalManagerHome("java:comp/env/ejb/PortalManager",
    e);
    I have checked the PortalManager's JNDI name on WLConsole. Its
    ${APPNAME}.BEA_portal.PortalManager.
    Should I change it?
    When I tried to change it, I started getting other weird errors.
    Thanks
    Neeraj Hans

  • Error  while  calling badi using class cl_exithandler with getInstance

    hi experts...we are using SAP ECC 6.0  version
    I have created  BADI Def   and  Implementation using  se18   and se19 with some interface methods..
    Problem:
    I'm writing  a report to call  that using  class CL_EXITHANDLER but it shows an  Exception..
    " Exception condition "DATA_INCONS_IN_EXIT_MANAGEM" raised."
    Report example:
    DATA: CL_EXIT  TYPE REF TO CL_EXITHANDLER,
          IF_USER_INSTANCE TYPE REF TO ZIF_EX_USER_MAILID1.
    CALL METHOD cl_exithandler=>get_instance
      EXPORTING
       EXIT_NAME                       = 'ZBADI_USERMAIL_DEF'
    *    NULL_INSTANCE_ACCEPTED        = SEEX_FALSE
    *  IMPORTING
    *    ACT_IMP_EXISTING              =
      CHANGING
        instance                       = IF_USER_INSTANCE
    *  EXCEPTIONS
    *    NO_REFERENCE                  = 1
    *    NO_INTERFACE_REFERENCE        = 2
    *    NO_EXIT_INTERFACE             = 3
    *    CLASS_NOT_IMPLEMENT_INTERFACE = 4
    *    SINGLE_EXIT_MULTIPLY_ACTIVE   = 5
    *    CAST_ERROR                    = 6
    *    EXIT_NOT_EXISTING             = 7
    *    DATA_INCONS_IN_EXIT_MANAGEM   = 8
    *    others                        = 9
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    so i found that all  EXITs  are in the Table " SXS_ATTR" 
    but  what i have created BADI  has not exist  in that Table so that  it gets  an  Exception(while i'm debugging found this)
    so kindly tel me whats problem my BADI "ZBADI_USERMAIL_DEF"  not maintained that  Database table
    but  in Implentation class  its working fine..

    yes i have created  badi  in  Enhancement spot so  regarding what u told i'm using  GET BADI  and CALL BADI
    DATA:W_HANDLE TYPE REF TO ZBADI_USERMAIL_DEF.
    GET BADI W_HANDLE.
    CALL BADI w_handle->get_user_mailid
      EXPORTING
        uname  = UNAME
      changing
        mailid = W_EMAIL
    WRITE: / 'UNAME:',UNAME.
    WRITE: / 'EMAIL ID',W_EMAIL.
    CALL BADI w_handle->get_user_address_data
      EXPORTING
        uname    = UNAME
      changing
        addrdata = W_ADDRDATA
    IF W_ADDRDATA IS NOT INITIAL.
      WRITE: / W_ADDRDATA-BNAME,W_ADDRDATA-NAME1,W_ADDRDATA-NAME2,W_ADDRDATA-TELPR,W_ADDRDATA-TELNR,W_ADDRDATA-TEL01.
    ENDIF.
    but  here  BADI  are not  called 
    Interface implementation class methods  not  executed  so kindly tel me whats problem here.
    Thanks in Advance
    sivakumar

Maybe you are looking for

  • Blocked Sales Order History Report

    Dear Friends, Is there any standard report available in SD to list who removed blocks in sales order and similarly in credit management for credit limits. Thanks & Regards,

  • Need flash player 9 for mac os 10.5

    i am unable to download flash 10, so it recommended that for my system, which is mac os 10.5.8 with safari 4.0.2 i need flash player 9....but when i download the zip files from the archives i can't open it. am i missing something here or is the link

  • I cannot delete my previously synced folders of photos off my iPhone 4s-

    HELP!!!!! I have followed all the instructions you have sent on Google- I went to itunes and made sure that I have no synced folders checked and have restarted and rebooted my computer and iPhone several times. My problem started when-- I made an iPh

  • Issue with Report refresh of the data

    Hi All, we have recently upgraded from 11.1.1.5 to 11.1.1.7 version of OBIEE and since then we are facing few issue with the data refresh. whenever the data gets loaded in the back end the report don't seem to get updated. Neither the Reload Metadata

  • Sub-contracting charges to be capitalised

    Dear All, Kindly give your input on the following, One of my client who is manufacturing Circuit Board, this activity is done both in-house production as well as sub-contracting. i. they are producing circuit board in In-house, as per the BOM compone