<?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 Problem in select endselect in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-endselect/m-p/5010090#M1166266</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this requirement is : recursivley call the select statement based on the parent value .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  lv_tmp_node = '419957600'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; based on the value 419957600 the parent id is retreived. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then next time parent id is passed to the data base table . until the value becomes 1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the parent id is 1. i have to get the value .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the first time the parent id value is 00000017&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;example : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      for 17 the parent value is again 16 ... for 16 the parent id is 15 ... it goes on  until the parent id equals. one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;problem here is the select endselect statment is not working as expected. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second time select endselect is not picking the correct parent value . Still it shows the value of the previous parent id &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest wat might be the problem or any othe best option to do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT SINGLE parentid nodename nodeid INTO (lv_parentid , lv_nodename&lt;/P&gt;&lt;P&gt;  ,lv_nodeid)&lt;/P&gt;&lt;P&gt;      FROM /bi0/hdbduns_num&lt;/P&gt;&lt;P&gt;             WHERE nodename = lv_tmp_node. "" comm_structure-dbduns_num.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF lv_parentid = 1.&lt;/P&gt;&lt;P&gt;    RESULT = lv_nodename.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       EXIT.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT  parentid nodename INTO (lv_parentid1 , lv_nodename)&lt;/P&gt;&lt;P&gt;       FROM /bi0/hdbduns_num WHERE nodeid = lv_parentid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      IF lv_parentid1 EQ '00000001' ."".parentid.&lt;/P&gt;&lt;P&gt;        RESULT = lv_nodename.&lt;/P&gt;&lt;P&gt;        EXIT.&lt;/P&gt;&lt;P&gt;      ELSE.&lt;/P&gt;&lt;P&gt;        CLEAR lv_parentid.&lt;/P&gt;&lt;P&gt;        lv_parentid = lv_parentid1.&lt;/P&gt;&lt;P&gt;        CLEAR lv_parentid1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       CONTINUE.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDSELECT.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Jan 2009 13:38:08 GMT</pubDate>
    <dc:creator>UmaArjunan</dc:creator>
    <dc:date>2009-01-16T13:38:08Z</dc:date>
    <item>
      <title>Problem in select endselect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-endselect/m-p/5010090#M1166266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this requirement is : recursivley call the select statement based on the parent value .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  lv_tmp_node = '419957600'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; based on the value 419957600 the parent id is retreived. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then next time parent id is passed to the data base table . until the value becomes 1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the parent id is 1. i have to get the value .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the first time the parent id value is 00000017&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;example : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      for 17 the parent value is again 16 ... for 16 the parent id is 15 ... it goes on  until the parent id equals. one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;problem here is the select endselect statment is not working as expected. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second time select endselect is not picking the correct parent value . Still it shows the value of the previous parent id &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest wat might be the problem or any othe best option to do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT SINGLE parentid nodename nodeid INTO (lv_parentid , lv_nodename&lt;/P&gt;&lt;P&gt;  ,lv_nodeid)&lt;/P&gt;&lt;P&gt;      FROM /bi0/hdbduns_num&lt;/P&gt;&lt;P&gt;             WHERE nodename = lv_tmp_node. "" comm_structure-dbduns_num.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF lv_parentid = 1.&lt;/P&gt;&lt;P&gt;    RESULT = lv_nodename.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       EXIT.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT  parentid nodename INTO (lv_parentid1 , lv_nodename)&lt;/P&gt;&lt;P&gt;       FROM /bi0/hdbduns_num WHERE nodeid = lv_parentid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      IF lv_parentid1 EQ '00000001' ."".parentid.&lt;/P&gt;&lt;P&gt;        RESULT = lv_nodename.&lt;/P&gt;&lt;P&gt;        EXIT.&lt;/P&gt;&lt;P&gt;      ELSE.&lt;/P&gt;&lt;P&gt;        CLEAR lv_parentid.&lt;/P&gt;&lt;P&gt;        lv_parentid = lv_parentid1.&lt;/P&gt;&lt;P&gt;        CLEAR lv_parentid1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       CONTINUE.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDSELECT.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Jan 2009 13:38:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-endselect/m-p/5010090#M1166266</guid>
      <dc:creator>UmaArjunan</dc:creator>
      <dc:date>2009-01-16T13:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in select endselect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-endselect/m-p/5010091#M1166267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My guess is you should put your selection in a separate routine and do a recursive call to that routine. Basically, the routine will keep calling itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make sure to insert an escape or it might run for ever and ever and ever...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To give you an idea:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FORM recursive_select using p_child_id
		      changing p_stop.


  if p_stop ne space.
    exit.
  endif.

  select parent_id
    from table
   where child_id eq p_child_id.
  endselect.
  if sy-subrc ne 0.
    p_stop = 'X'.
    exit.
  else.

*   Store found id in an internal table?
*   and continue to find the next parent
    perform recursive_select using parent_id
                             changing p_stop.

  endif.



ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Jan 2009 13:55:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-endselect/m-p/5010091#M1166267</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-16T13:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in select endselect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-endselect/m-p/5010092#M1166268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You want to imply that value of lv_parentid changes second time in select/endselect loop but the SELECT statement returns the same values ???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise your code seems to be ok.. revert.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Jan 2009 14:01:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-endselect/m-p/5010092#M1166268</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-16T14:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in select endselect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-endselect/m-p/5010093#M1166269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ankesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you are absolutely correct. the second time the select statement fetches the same value. How to solve this ? if you could  provide your suggestion, it will be helpful .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Jan 2009 17:04:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-endselect/m-p/5010093#M1166269</guid>
      <dc:creator>UmaArjunan</dc:creator>
      <dc:date>2009-01-16T17:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in select endselect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-endselect/m-p/5010094#M1166270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Maen Anachronos ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The idea works fine for my problem in  select endselect. When i  call the subroutine recursively, &lt;/P&gt;&lt;P&gt;it fetches the correct parent id and there by i can get the correct node name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually this code i am using it in the BI start routines. Now i have a problem in creating subroutine from a subroutine .. If you have any suggestions / idea plz.......  let me know&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Jan 2009 06:59:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-endselect/m-p/5010094#M1166270</guid>
      <dc:creator>UmaArjunan</dc:creator>
      <dc:date>2009-01-19T06:59:15Z</dc:date>
    </item>
  </channel>
</rss>

