<?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: A Binary Tree Implementation in ABAP in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-binary-tree-implementation-in-abap/m-p/3299071#M789624</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This sample code uses dynamic objects to create a binary tree of random numbers. It stores numbers on the left node or right node depending on the value comparison with the current value. There are two recursive subrotines used for the building of the tree and printing  through the tree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For comparison purpose, the same random numbers are stored and sorted in an internal table and printed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report YBINTREE - Build/Print Binary Tree of numbers *&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report ybintree .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types: begin of stree,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;value type i,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left type ref to data,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;right type ref to data,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end of stree. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: tree type stree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: int type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of rnd occurs 0,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;num type i,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end of rnd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do 100 times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;generate random number between 0 and 100&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'RANDOM_I4'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rnd_min = 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rnd_max = 100&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rnd_value = int.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;store numbers&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rnd-num = int.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append rnd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;build binary tree of random numbers&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform add_value using tree int.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;stored numbers are sorted for comparison&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort rnd by num.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;print sorted random numbers&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / 'Sorted Numbers'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / '=============='.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at rnd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: rnd-num.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;print binary tree. This should give the same result&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;as the one listed from the internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / 'Binary Tree List'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / '================'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform print_value using tree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form add_value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;text - Build tree with value provided&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;--&amp;gt;TREE text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;--&amp;gt;VAL text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form add_value using tree type stree val type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;ltree&amp;gt; type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: work type stree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if tree is initial. "When node has no values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tree-value = val. " assign value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: tree-left, tree-right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create data tree-left type stree. "Create an empty node for left&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create data tree-right type stree. "create an empty node for right&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if val le tree-value. "if number is less than or equal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign tree-left-&amp;gt;* to &amp;lt;ltree&amp;gt;. "assign the left node to fs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;call add_value recursively with left node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform add_value using &amp;lt;ltree&amp;gt; val.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else. "if number is greater&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign tree-right-&amp;gt;* to &amp;lt;ltree&amp;gt;. "assign the right node to fs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;call add_value recursively with right node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform add_value using &amp;lt;ltree&amp;gt; val.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "add_value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form print_value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;text - traverse tree from left-mid-right order&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;automatically this will be sorted list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;--&amp;gt;TREE text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form print_value using tree type stree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;ltree&amp;gt; type any.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if tree is initial. "node is empty&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else. "non-empty node&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign tree-left-&amp;gt;* to &amp;lt;ltree&amp;gt;. "left node&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform print_value using &amp;lt;ltree&amp;gt;. "print left&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: tree-value. "print the current value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign tree-right-&amp;gt;* to &amp;lt;ltree&amp;gt;. "right node&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform print_value using &amp;lt;ltree&amp;gt;. "print right&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "print_value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reward Points if found helpfull..&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cheers,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Chandra Sekhar.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 02 Feb 2008 09:14:20 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-02T09:14:20Z</dc:date>
    <item>
      <title>A Binary Tree Implementation in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-binary-tree-implementation-in-abap/m-p/3299069#M789622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can any one explaine me how to create a binary tree of random numbers with dynamic objects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Manjula.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Feb 2008 06:21:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/a-binary-tree-implementation-in-abap/m-p/3299069#M789622</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-02T06:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: A Binary Tree Implementation in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-binary-tree-implementation-in-abap/m-p/3299070#M789623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi manjula,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This sample code uses dynamic objects to create a binary tree of random numbers as per your requirement ...pls go through It.  &lt;/P&gt;&lt;P&gt;It stores numbers on the left node or right node depending on the value comparison with the current value. There are two recursive subrotines used for the building of the tree and printing  through the tree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For comparison purpose, the same random numbers are stored and sorted in an internal table and printed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report YBINTREE - Build/Print Binary Tree of numbers *&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report ybintree .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;types: begin of stree,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;value type i,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left type ref to data,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;right type ref to data,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end of stree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: tree type stree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: int type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of rnd occurs 0,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;num type i,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end of rnd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;do 100 times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;generate random number between 0 and 100&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'RANDOM_I4'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rnd_min = 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rnd_max = 100&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rnd_value = int.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;store numbers&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rnd-num = int.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append rnd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;build binary tree of random numbers&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform add_value using tree int.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;stored numbers are sorted for comparison&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort rnd by num.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;print sorted random numbers&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / 'Sorted Numbers'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / '=============='.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at rnd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: rnd-num.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;print binary tree. This should give the same result&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;as the one listed from the internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / 'Binary Tree List'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / '================'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform print_value using tree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form add_value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;text - Build tree with value provided&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;--&amp;gt;TREE text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;--&amp;gt;VAL text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form add_value using tree type stree val type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;ltree&amp;gt; type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: work type stree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if tree is initial. "When node has no values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tree-value = val. " assign value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: tree-left, tree-right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create data tree-left type stree. "Create an empty node for left&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create data tree-right type stree. "create an empty node for right&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if val le tree-value. "if number is less than or equal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign tree-left-&amp;gt;* to &amp;lt;ltree&amp;gt;. "assign the left node to fs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;call add_value recursively with left node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform add_value using &amp;lt;ltree&amp;gt; val.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else. "if number is greater&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign tree-right-&amp;gt;* to &amp;lt;ltree&amp;gt;. "assign the right node to fs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;call add_value recursively with right node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform add_value using &amp;lt;ltree&amp;gt; val.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "add_value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form print_value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;text - traverse tree from left-mid-right order&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;automatically this will be sorted list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;--&amp;gt;TREE text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form print_value using tree type stree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;ltree&amp;gt; type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if tree is initial. "node is empty&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else. "non-empty node&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign tree-left-&amp;gt;* to &amp;lt;ltree&amp;gt;. "left node&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform print_value using &amp;lt;ltree&amp;gt;. "print left&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: tree-value. "print the current value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign tree-right-&amp;gt;* to &amp;lt;ltree&amp;gt;. "right node&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform print_value using &amp;lt;ltree&amp;gt;. "print right&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "print_value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pls reward if helps,&lt;/P&gt;&lt;P&gt;regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Feb 2008 06:50:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/a-binary-tree-implementation-in-abap/m-p/3299070#M789623</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-02T06:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: A Binary Tree Implementation in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-binary-tree-implementation-in-abap/m-p/3299071#M789624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This sample code uses dynamic objects to create a binary tree of random numbers. It stores numbers on the left node or right node depending on the value comparison with the current value. There are two recursive subrotines used for the building of the tree and printing  through the tree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For comparison purpose, the same random numbers are stored and sorted in an internal table and printed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report YBINTREE - Build/Print Binary Tree of numbers *&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report ybintree .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types: begin of stree,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;value type i,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left type ref to data,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;right type ref to data,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end of stree. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: tree type stree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: int type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of rnd occurs 0,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;num type i,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end of rnd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do 100 times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;generate random number between 0 and 100&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'RANDOM_I4'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rnd_min = 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rnd_max = 100&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rnd_value = int.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;store numbers&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rnd-num = int.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append rnd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;build binary tree of random numbers&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform add_value using tree int.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;stored numbers are sorted for comparison&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort rnd by num.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;print sorted random numbers&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / 'Sorted Numbers'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / '=============='.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at rnd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: rnd-num.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;print binary tree. This should give the same result&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;as the one listed from the internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / 'Binary Tree List'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / '================'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform print_value using tree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form add_value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;text - Build tree with value provided&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;--&amp;gt;TREE text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;--&amp;gt;VAL text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form add_value using tree type stree val type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;ltree&amp;gt; type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: work type stree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if tree is initial. "When node has no values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tree-value = val. " assign value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: tree-left, tree-right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create data tree-left type stree. "Create an empty node for left&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create data tree-right type stree. "create an empty node for right&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if val le tree-value. "if number is less than or equal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign tree-left-&amp;gt;* to &amp;lt;ltree&amp;gt;. "assign the left node to fs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;call add_value recursively with left node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform add_value using &amp;lt;ltree&amp;gt; val.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else. "if number is greater&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign tree-right-&amp;gt;* to &amp;lt;ltree&amp;gt;. "assign the right node to fs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;call add_value recursively with right node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform add_value using &amp;lt;ltree&amp;gt; val.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "add_value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form print_value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;text - traverse tree from left-mid-right order&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;automatically this will be sorted list&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;--&amp;gt;TREE text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form print_value using tree type stree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;ltree&amp;gt; type any.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if tree is initial. "node is empty&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else. "non-empty node&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign tree-left-&amp;gt;* to &amp;lt;ltree&amp;gt;. "left node&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform print_value using &amp;lt;ltree&amp;gt;. "print left&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: tree-value. "print the current value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign tree-right-&amp;gt;* to &amp;lt;ltree&amp;gt;. "right node&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform print_value using &amp;lt;ltree&amp;gt;. "print right&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "print_value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reward Points if found helpfull..&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cheers,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Chandra Sekhar.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Feb 2008 09:14:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/a-binary-tree-implementation-in-abap/m-p/3299071#M789624</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-02T09:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: A Binary Tree Implementation in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-binary-tree-implementation-in-abap/m-p/3299072#M789625</link>
      <description>&lt;P&gt;Please find this link .&lt;/P&gt;&lt;P&gt;&lt;A href="https://mysapnuts.blogspot.com/2021/07/binary-tree-using-sap-abap.html" target="test_blank"&gt;https://mysapnuts.blogspot.com/2021/07/binary-tree-using-sap-abap.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jul 2021 05:30:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/a-binary-tree-implementation-in-abap/m-p/3299072#M789625</guid>
      <dc:creator>former_member327594</dc:creator>
      <dc:date>2021-07-17T05:30:41Z</dc:date>
    </item>
  </channel>
</rss>

