<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: alv tree get selected items in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-get-selected-items/m-p/4415181#M1048948</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/a9/e6eb40c4f8712ae10000000a155106/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/a9/e6eb40c4f8712ae10000000a155106/content.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Sep 2008 18:15:30 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-09-08T18:15:30Z</dc:date>
    <item>
      <title>alv tree get selected items</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-get-selected-items/m-p/4415180#M1048947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi gusrus i would like to know how can i get the user selected items from an alvtree oo. &lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 18:07:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-get-selected-items/m-p/4415180#M1048947</guid>
      <dc:creator>alejandro_romero2</dc:creator>
      <dc:date>2008-09-08T18:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: alv tree get selected items</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-get-selected-items/m-p/4415181#M1048948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/a9/e6eb40c4f8712ae10000000a155106/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/a9/e6eb40c4f8712ae10000000a155106/content.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 18:15:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-get-selected-items/m-p/4415181#M1048948</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-08T18:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: alv tree get selected items</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-get-selected-items/m-p/4415182#M1048949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks a lot but im really new in abap object so i dont know how to implment it&lt;/P&gt;&lt;P&gt;i am using this portion of code, what should i do next to get the selected rows?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT g_custom_container&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;      container_name = l_tree_container_name&lt;/P&gt;&lt;P&gt;  EXCEPTIONS&lt;/P&gt;&lt;P&gt;      cntl_error = 1&lt;/P&gt;&lt;P&gt;      cntl_system_error = 2&lt;/P&gt;&lt;P&gt;      create_error = 3&lt;/P&gt;&lt;P&gt;      lifetime_error = 4&lt;/P&gt;&lt;P&gt;      lifetime_dynpro_dynpro_link = 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CREATE OBJECT g_alv_tree&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;      parent = g_custom_container&lt;/P&gt;&lt;P&gt;      node_selection_mode = cl_gui_column_tree=&amp;gt;node_sel_mode_multiple&lt;/P&gt;&lt;P&gt;      item_selection = ''&lt;/P&gt;&lt;P&gt;      no_html_header = 'X'&lt;/P&gt;&lt;P&gt;      no_toolbar = ''&lt;/P&gt;&lt;P&gt;  EXCEPTIONS&lt;/P&gt;&lt;P&gt;      cntl_error = 1&lt;/P&gt;&lt;P&gt;      cntl_system_error = 2&lt;/P&gt;&lt;P&gt;      create_error = 3&lt;/P&gt;&lt;P&gt;      lifetime_error = 4&lt;/P&gt;&lt;P&gt;      illegal_node_selection_mode = 5&lt;/P&gt;&lt;P&gt;      failed = 6&lt;/P&gt;&lt;P&gt;      illegal_column_name = 7.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alejandro Romero on Sep 8, 2008 8:26 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 18:22:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-get-selected-items/m-p/4415182#M1048949</guid>
      <dc:creator>alejandro_romero2</dc:creator>
      <dc:date>2008-09-08T18:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: alv tree get selected items</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-get-selected-items/m-p/4415183#M1048950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alejandro,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code you have provided is far not enought to create an alv tree control. I assume this is only part of your program.&lt;/P&gt;&lt;P&gt;Providing you have tree already displayed and you can select nodes, now you may use below to get selected nodes (keys of rows) from the tree:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: it_nodes type TREEMNOTAB.

call method g_alv_tree-&amp;gt;GET_SELECTED_NODES
	importing
		NODE_KEY_TABLE = it_nodes.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it will help you&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 21:05:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-get-selected-items/m-p/4415183#M1048950</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2008-09-08T21:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: alv tree get selected items</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-get-selected-items/m-p/4415184#M1048951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Alejandro&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Copy report BCALV_TREE_DEMO to a z-report and make the following changes in the PAI module.&lt;/P&gt;&lt;P&gt;Please note than you can select multiple nodes but only single items.&lt;/P&gt;&lt;P&gt;In addition, to allow item selection you have to change the instantiation of your tree:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CREATE OBJECT g_alv_tree
EXPORTING
parent = g_custom_container
node_selection_mode = cl_gui_column_tree=&amp;gt;node_sel_mode_multiple
item_selection = 'X'   " if space then no item selection is possible
no_html_header = 'X'
...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  PAI  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       process after input
*----------------------------------------------------------------------*
module pai input.

  translate ok_code to UPPER CASE.

  case ok_code.
    when 'EXIT' or 'BACK' or 'CANC'.
      perform exit_program.


    when 'GET_SELECTED_ITEM'.
      perform GET_SELECTED_ITEM.

    when others.
      call method cl_gui_cfw=&amp;gt;dispatch.
  endcase.
  clear ok_code.
  call method cl_gui_cfw=&amp;gt;flush.

endmodule.                             " PAI  INPUT

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  GET_SELECTED_ITEM
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form GET_SELECTED_ITEM .
  data: ld_nkey         type lvc_nkey,
        ld_fieldname    type lvc_fname,
        ld_msg          type bapi_msg.

  CALL METHOD tree1-&amp;gt;get_selected_item
    IMPORTING
      e_selected_node   = ld_nkey
      e_fieldname       = ld_fieldname
    EXCEPTIONS
      no_item_selection = 1
      cntl_system_error = 2
      failed            = 3
      others            = 4.
  IF sy-subrc &amp;lt;&amp;gt; 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  concatenate 'NKey=' ld_nkey
              'Fieldname=' ld_fieldname
              into ld_msg.
  message ld_msg type 'I'.

endform.                    " GET_SELECTED_ITEM
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may want to have a look at thread &lt;SPAN __jive_macro_name="thread" id="1036602"&gt;&lt;/SPAN&gt; to get some more details about this sample report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Sep 2008 21:12:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-get-selected-items/m-p/4415184#M1048951</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2008-09-08T21:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: alv tree get selected items</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-get-selected-items/m-p/4415185#M1048952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks guys i solve the problem thanks again&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2008 16:30:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-get-selected-items/m-p/4415185#M1048952</guid>
      <dc:creator>alejandro_romero2</dc:creator>
      <dc:date>2008-09-10T16:30:13Z</dc:date>
    </item>
  </channel>
</rss>

