cancel
Showing results for 
Search instead for 
Did you mean: 

problem with ALV tree

Former Member
0 Kudos

I am facing a problem with ALV tree.

I have two ALV trees and one ALV grid in my program.

So it looks like this

Alv_tree1->when double click one leaf node

It open ALV_TREE2->->when double click one leaf node, some data will be dispalyed in alv grid.

The problem is when i select some Leaf nodes in ALV tree2 and push some button on toolbar(which i have created) it should be displayed in ALV grid. first time when i run the report it's working fine but

when i go backk from ALV Grid to ALV tree2, if i change selections i am not getting the selected values in my internal table.

i am calling the method


        CALL METHOD lcl_gui_alv_tree2->get_selected_nodes
          CHANGING
            ct_selected_nodes = lt_selected_nodes.

From sencod time onwards the internal table lt_selected_nodes is always empty.

How can i solve my problem.

Regards,

Lisa

Edited by: Lisa Roy on Apr 18, 2008 8:08 AM

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I have used flush and dispatch many times in my program this makes the problem

Former Member
0 Kudos

I think you have in PBO of screen 300 somethig similar like


if any_container is initial.
.
.
.
call method grid->set_table_for_first_display
             changing  it_outtab        = ct1_data[]
                       it_fieldcatalog  = fcat_ct1[].
.
.
.
endif.

if yes put after 'ENDIF'


call method grid->refresh_table_display( ).

if not put there the code from PBO of screen 300.

JS

Former Member
0 Kudos

Hi Lisa

I think you must correct progrm flow in PBO module of scrren with ALV grid and/or in double click event.

Could you put there the two parts of your program, pls?

JS

Former Member
0 Kudos

There is no code in PBO.

I have the code in my Local class.

Here is the code in local class.



  METHOD on_function_selected.
    DATA: lt_selected_nodes TYPE lvc_t_nkey,
          l_selected_node   TYPE lvc_nkey,
*          l_rc              TYPE c,
*          ls_s509           TYPE zvhf_s509,
          ls_material       TYPE zvhf_material,
          ls_merkpl         TYPE zvhf_merkpl.

    FIELD-SYMBOLS: <ls_fieldcatlog> TYPE LINE OF lvc_t_fcat.

    CASE fcode.
      WHEN 'PLAN'.
        CALL METHOD cl_gui_cfw=>dispatch.
* Determine which lines are selected
        CALL METHOD lcl_gui_alv_tree2->get_selected_nodes
          CHANGING
            ct_selected_nodes = lt_selected_nodes.

* When lines are selected MATNR field should be displayed
        READ TABLE gt_fieldcatlog3 ASSIGNING <ls_fieldcatlog>
                WITH KEY fieldname = 'MATNR'.
        IF sy-subrc = 0.

          IF <ls_fieldcatlog>-no_out = 'X'.
            <ls_fieldcatlog>-no_out = space.
          ENDIF.

        ENDIF.


        LOOP AT lt_selected_nodes INTO l_selected_node.
          l_selected_node = l_selected_node - 1.
          READ TABLE gt_material INTO ls_material INDEX l_selected_node.
          IF sy-subrc = 0.

            MOVE-CORRESPONDING ls_material TO ls_merkpl.
* Move corresponding material quantities to materials
            READ TABLE gt_s509 INTO gs_s509
                    WITH KEY dvkbur = ls_material-vkbur
                             matnr  = ls_material-matnr.
            IF sy-subrc = 0.
              MOVE-CORRESPONDING gs_s509 TO ls_merkpl.

            ENDIF.
            IF ls_merkpl IS NOT INITIAL.
* This append is required in order to fill ALV grid
              APPEND ls_merkpl TO gt_merkpl.
            ENDIF.
          ENDIF.
        ENDLOOP.

        CALL SCREEN 300 STARTING AT 10 5 ENDING AT 100 20.
        CLEAR lt_selected_nodes.
        CALL METHOD cl_gui_cfw=>flush.
    ENDCASE.

  ENDMETHOD.                    "on_function_selected


Regards,
Lisa