<?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: Problem with logic in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-logic/m-p/3522287#M847207</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also if no. of records are only 5 and if they will not change in no.&lt;/P&gt;&lt;P&gt;then simply take 5 string variables, get the value of text in each varaible and compare them laterwords as per the required sequence and get the final text printed. then it will be a case of simple if ...elseif...endif statemenst.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Feb 2008 17:45:35 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-28T17:45:35Z</dc:date>
    <item>
      <title>Problem with logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-logic/m-p/3522285#M847205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Experts.&lt;/P&gt;&lt;P&gt;i have 5 items in a table itab1.&lt;/P&gt;&lt;P&gt;item delivery num&lt;/P&gt;&lt;P&gt;10   2100000000&lt;/P&gt;&lt;P&gt;20   2100000030&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;... my query is like this&lt;/P&gt;&lt;P&gt;Loop at itab1.&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;    SELECT SINGLE a~vtext INTO (tvkggt-text)&lt;/P&gt;&lt;P&gt;     FROM vbkd AS a&lt;/P&gt;&lt;P&gt;        INNER JOIN tvkggt AS b&lt;/P&gt;&lt;P&gt;        ON a&lt;SUB&gt;kdkg1 = b&lt;/SUB&gt;kdkgr&lt;/P&gt;&lt;P&gt;     WHERE a~vbeln EQ itab1-vbeln_vauf&lt;/P&gt;&lt;P&gt;     AND a~posnr EQ itab1-posnr_vauf.&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;this tvkggt-text is used in printing the text in the layout.tvkggt table will have the text .according to the above query the last line item text will be picked and that will be&lt;/P&gt;&lt;P&gt;printed .&lt;/P&gt;&lt;P&gt;ex : 10   2100000000       sap&lt;/P&gt;&lt;P&gt;     20   2100000030       oracle&lt;/P&gt;&lt;P&gt;     30   2200000021       myapps&lt;/P&gt;&lt;P&gt;     40   2300030000       java&lt;/P&gt;&lt;P&gt;     50   2399990000       cobal  &lt;/P&gt;&lt;P&gt;in the above case according to our query the text cobal   will be taken into tvkggt-text and that will be printed. My requirement is that if text java is there for any line item it may be 1st one or 3rd one etc , then hjave to be printed not  the last item text . if oracle is there but not java then oracle should be given preference. if both java and cobal is there then &lt;/P&gt;&lt;P&gt;java should be given preference. If both are not there at that time the last line&lt;/P&gt;&lt;P&gt;item text should be printed. I made some changes to above query but not completed.&lt;/P&gt;&lt;P&gt;so please help me to achieve it. we should not write outside the loop of itab1 because there are some more statements to it.now i declared another internal table itab2 with field text. my new Modified query is like this&lt;/P&gt;&lt;P&gt;Loop at itab1.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;    SELECT  single b~vtext INTO   ltab2&lt;/P&gt;&lt;P&gt;     FROM vbkd AS a&lt;/P&gt;&lt;P&gt;        INNER JOIN tvkggt AS b&lt;/P&gt;&lt;P&gt;        ON a&lt;SUB&gt;kdkg1 = b&lt;/SUB&gt;kdkgr&lt;/P&gt;&lt;P&gt;     WHERE a~vbeln EQ itab1-vbeln_vauf&lt;/P&gt;&lt;P&gt;     AND a~posnr EQ itab2-posnr_vauf.&lt;/P&gt;&lt;P&gt;append itab2.&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;so please tell me how to achieve this.&lt;/P&gt;&lt;P&gt;thank you all for the valuable replies&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 28, 2008 12:43 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2008 17:30:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-logic/m-p/3522285#M847205</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-28T17:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-logic/m-p/3522286#M847206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Madan,&lt;/P&gt;&lt;P&gt;This seems to be simple but the way oyu have explained is making difficult to understand.&lt;/P&gt;&lt;P&gt;i am trying to give you certian steps if you follow them i guess you can write the logic for your own.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. first thing avoid selct in side loop(that to avaoid join )&lt;/P&gt;&lt;P&gt;2. you can use for all entries clause an dfetch all the text values in one data base read.&lt;/P&gt;&lt;P&gt;3. use loop and read combination for further processin and fetch all the texts in one internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1 into wa_itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table itab2 into wa_itab2 with key ......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move itab2-text to itab3-text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append itab3.&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;now loop on itab3 and &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;process further as per your requirement..&lt;/P&gt;&lt;P&gt;like...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab3 into wa_itab3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if wa_itab3 = 'JAVA...&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;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2008 17:42:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-logic/m-p/3522286#M847206</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-28T17:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-logic/m-p/3522287#M847207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also if no. of records are only 5 and if they will not change in no.&lt;/P&gt;&lt;P&gt;then simply take 5 string variables, get the value of text in each varaible and compare them laterwords as per the required sequence and get the final text printed. then it will be a case of simple if ...elseif...endif statemenst.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2008 17:45:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-logic/m-p/3522287#M847207</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-28T17:45:35Z</dc:date>
    </item>
  </channel>
</rss>

