<?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: Internal table Sorting in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-sorting/m-p/438283#M12829</link>
    <description>&lt;P&gt;Move (iTab1) to other table just like itab2&lt;BR /&gt;now sort itab2 posnr hireitem&lt;/P&gt;&lt;P&gt;now delete adjecent duplicated from itab2 comparing posnr hireitme.&lt;/P&gt;&lt;P&gt;data:No_of_times type i.&lt;/P&gt;&lt;P&gt;Now &lt;/P&gt;&lt;P&gt;loop at itab2&lt;BR /&gt;loop at itab1 where psonr =  itab2-posnr and  hireitem = itab2-hiritem.&lt;BR /&gt;No_of_times = No_of_times + 1.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;write:itab2-posnr itab2-hireitem  No_of_times.&lt;BR /&gt;clear:no_of_times. &lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;</description>
    <pubDate>Thu, 04 May 2017 12:14:28 GMT</pubDate>
    <dc:creator>former_member196331</dc:creator>
    <dc:date>2017-05-04T12:14:28Z</dc:date>
    <item>
      <title>Internal table Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-sorting/m-p/438281#M12827</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have Internal Table (iTab1) like below.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/32942-itab1.jpg" /&gt;&lt;/P&gt;&lt;P&gt;I am expecting output Internal table like below (Itab2).&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/32943-itab2.jpg" /&gt;&lt;/P&gt;&lt;P&gt;1. If there is only one Line Item with single batch count should be 1.&lt;/P&gt;&lt;P&gt;2. mutliple batch items then ignore 00000 HIERARITME then count.&lt;/P&gt;&lt;P&gt;Please suggest me how to get the output.&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2017 10:03:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-sorting/m-p/438281#M12827</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-05-04T10:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-sorting/m-p/438282#M12828</link>
      <description>&lt;P&gt;This can be solved with a little programming...&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2017 11:44:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-sorting/m-p/438282#M12828</guid>
      <dc:creator>raghug</dc:creator>
      <dc:date>2017-05-04T11:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-sorting/m-p/438283#M12829</link>
      <description>&lt;P&gt;Move (iTab1) to other table just like itab2&lt;BR /&gt;now sort itab2 posnr hireitem&lt;/P&gt;&lt;P&gt;now delete adjecent duplicated from itab2 comparing posnr hireitme.&lt;/P&gt;&lt;P&gt;data:No_of_times type i.&lt;/P&gt;&lt;P&gt;Now &lt;/P&gt;&lt;P&gt;loop at itab2&lt;BR /&gt;loop at itab1 where psonr =  itab2-posnr and  hireitem = itab2-hiritem.&lt;BR /&gt;No_of_times = No_of_times + 1.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;write:itab2-posnr itab2-hireitem  No_of_times.&lt;BR /&gt;clear:no_of_times. &lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2017 12:14:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-sorting/m-p/438283#M12829</guid>
      <dc:creator>former_member196331</dc:creator>
      <dc:date>2017-05-04T12:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-sorting/m-p/438284#M12830</link>
      <description>&lt;P&gt;Hi Charan,&lt;/P&gt;&lt;P&gt;Thanks for the reply, I did exactly same but that doesn't solved by issue.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/33061-tab3.jpg" /&gt;&lt;/P&gt;&lt;P&gt;I am expecting output like below.&lt;/P&gt;&lt;P&gt;0010    00000   1&lt;/P&gt;&lt;P&gt;0020    00000   1&lt;/P&gt;&lt;P&gt;0030    0030      2&lt;/P&gt;&lt;P&gt;0040    0000     1&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2017 18:07:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-sorting/m-p/438284#M12830</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-05-04T18:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-sorting/m-p/438285#M12831</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try.&lt;/P&gt;&lt;P&gt;SORT  itab  POSNR HIERAITEM.&lt;/P&gt;&lt;P&gt;
loop at  itab  into  wa. &lt;/P&gt;&lt;P&gt;wa-count   =  '1'. &lt;/P&gt;&lt;P&gt;collect  wa  into   itab1. &lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt; delete  the   itab1 according   to  your   requirement.&lt;/P&gt;&lt;P&gt;Hope  it helpful,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Venkat.&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2017 05:42:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-sorting/m-p/438285#M12831</guid>
      <dc:creator>VenkatRamesh_V</dc:creator>
      <dc:date>2017-05-05T05:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-sorting/m-p/438286#M12832</link>
      <description>&lt;P&gt;The aim is to get and count the subnodes of a parent node of a tree like structure in an internal table.&lt;/P&gt;&lt;P&gt;There are many ways to do so. &lt;/P&gt;&lt;P&gt;A modern way of handling tree structures in internal tables are reflexive mesh path expressions. (In fact the only use case for which I have used meshes productively up to now).&lt;/P&gt;&lt;P&gt;Check the &lt;A href="https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abenmesh_for_reflex_sngl_abexa.htm"&gt;example&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2017 05:47:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-sorting/m-p/438286#M12832</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2017-05-05T05:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-sorting/m-p/438287#M12833</link>
      <description>&lt;P&gt;&amp;lt;keels over with a glazed look&amp;gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2017 07:08:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-sorting/m-p/438287#M12833</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-05-05T07:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table Sorting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-sorting/m-p/438288#M12834</link>
      <description>&lt;P&gt;As intended &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;A "real life" example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA parent TYPE abapdocu_tree-node_key VALUE 'ABENABAP'.
cl_demo_input=&amp;gt;request( CHANGING field = parent ).

TYPES:
  BEGIN OF line,
    id        TYPE abapdocu_tree-node_key,
    parent_id TYPE abapdocu_tree-relatkey,
  END OF line,
  t_itab TYPE STANDARD TABLE OF line WITH NON-UNIQUE KEY id
         WITH NON-UNIQUE SORTED KEY by_parent COMPONENTS parent_id,
  BEGIN OF MESH t_mesh,
    node TYPE t_itab
       ASSOCIATION to_node TO node ON parent_id = id
         USING KEY by_parent,
  END OF MESH t_mesh.
DATA mesh TYPE t_mesh.

SELECT * FROM abapdocu_tree
         WHERE tab_index &amp;gt; 0
         INTO TABLE @DATA(abap_docu_tree).

TRY.
    mesh-node = VALUE #( FOR node IN abap_docu_tree
                        ( id = node-node_key parent_id = node-relatkey ) ).
    DATA(subtree) = VALUE t_itab(
      FOR &amp;lt;node&amp;gt; IN mesh-node\to_node[ mesh-node[ id = parent ] ] ( &amp;lt;node&amp;gt; )  ).

    cl_demo_output=&amp;gt;new(
      )-&amp;gt;write( subtree
      )-&amp;gt;write( lines( subtree ) )-&amp;gt;display( ).
  CATCH cx_sy_itab_line_not_found.
    RETURN.
ENDTRY.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Using \to_node+ would also retrieve subnodes of the subnodes.&lt;/P&gt;&lt;P&gt;This might serve as a pattern for similar tasks.&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2017 07:13:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-sorting/m-p/438288#M12834</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2017-05-05T07:13:35Z</dc:date>
    </item>
  </channel>
</rss>

