<?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: highest value in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/highest-value/m-p/5505587#M1259249</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;write as : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY gt_ouput INDEX l_index from l_output transporting zuonr  .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Apr 2009 14:00:42 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-04-17T14:00:42Z</dc:date>
    <item>
      <title>highest value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/highest-value/m-p/5505582#M1259244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the report i need to fetch the data based on BELNR BUKRS HKONT and ZUONR &lt;/P&gt;&lt;P&gt;For eg: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for a particular belnr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BELNR BUKRS GJAHR HKONT ZUONR DMBTR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5004 0005 2008 3421 TM0000 54&lt;/P&gt;&lt;P&gt;5004 0005 2008 3421 TM3421 60&lt;/P&gt;&lt;P&gt;5004 0005 2008 3421 TM3426 20&lt;/P&gt;&lt;P&gt;5004 0005 2008 3421 WK4537 10&lt;/P&gt;&lt;P&gt;5004 0005 2008 3421 WK7444 30 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output should display as only one line item with highest ZUONR of first 2 alphabets and sum of the DMBTR as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ZUONR   =  TM0000  TM3421  TM3426&lt;/P&gt;&lt;P&gt;ZUONR   =  WK4537   WK7444.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whereas coming to ZUONR TM THE HIGHEST IS TM3426&lt;/P&gt;&lt;P&gt;Whereas coming to ZUONR WK THE HIGHEST IS WK7444&lt;/P&gt;&lt;P&gt; need to compare with first 2 alphabets and add all the dmbtr values&lt;/P&gt;&lt;P&gt;the output should be as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BELNR BUKRS GJAHR HKONT ZUONR DMBTR&lt;/P&gt;&lt;P&gt;5004 0005 2008 3421 TM3426 134&lt;/P&gt;&lt;P&gt;5004 0005 2008 3421 WK7444 40 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please help me how to WRITE CODE get the highest ZUONR field in output &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please see my code below&lt;/P&gt;&lt;P&gt;if first 2 alphabets are same i am adding the DMBTR, how to get the highest ZUONR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT gt_bseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  gt_output-belnr = gt_bseg-belnr.&lt;/P&gt;&lt;P&gt;  gt_output-zuonr+0(2) = gt_bseg-zuonr.&lt;/P&gt;&lt;P&gt;  gt_output-dmbtr = gt_bseg-dmbtr.&lt;/P&gt;&lt;P&gt;  gt_output-wrbtr = gt_bseg-wrbtr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; COLLECT gt_output.&lt;/P&gt;&lt;P&gt;  CLEAR gt_output.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now i am getting as THE followinG Missing the ZUONR value after the alphabets&lt;/P&gt;&lt;P&gt;BELNR BUKRS GJAHR HKONT ZUONR DMBTR&lt;/P&gt;&lt;P&gt;5004    0005      2008     3421        TM-------     134&lt;/P&gt;&lt;P&gt;5004    0005      2008     3421        WK -&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt;     40&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2009 12:03:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/highest-value/m-p/5505582#M1259244</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-17T12:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: highest value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/highest-value/m-p/5505583#M1259245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT gt_bseg.

gt_output-belnr = gt_bseg-belnr.
gt_output-zuonr+0(2) = gt_bseg-zuonr.
gt_output-dmbtr = gt_bseg-dmbtr.
gt_output-wrbtr = gt_bseg-wrbtr.



COLLECT gt_output.
CLEAR gt_output.
ENDLOOP.

SORT gt_bseg by belnr zuonr descending.

loop at gt_output into gs_output.

read table gt_bseg into gs_bseg with key belnr = gs_output-belnr .

if sy-subrc = 0.

gs_output-zuonr = gs_bseg-zuonr.
modify gt_output from gs_output transporting zuonr.

endif.

endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2009 12:13:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/highest-value/m-p/5505583#M1259245</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-17T12:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: highest value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/highest-value/m-p/5505584#M1259246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add one more field in gt_output to update complete value of ZUONR as DUMMY and another to put only first 2 characters of ZUONR.&lt;/P&gt;&lt;P&gt;Instead of collect do the SUM if  ZUONR+0(2) exists in internal table gt_output  else APPEND gt_output &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT gt_bseg.&lt;/P&gt;&lt;P&gt;v_dummy = gt_bseg-zuonr+(2).&lt;/P&gt;&lt;P&gt;read table gt_output with key  dummy = v_dummy.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  gt_output-dmbtr = gt_output-dmbtr + gt_bseg-dmbtr.&lt;/P&gt;&lt;P&gt;  gt_output-wrbtr = gt_bseg-wrbtr.&lt;/P&gt;&lt;P&gt; else&lt;/P&gt;&lt;P&gt;   append the required field to gt_output.&lt;/P&gt;&lt;P&gt;  append gt_output.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT gt_output  on DUMMY DESCENDING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from gt_output  comparing DUMMY.&lt;/P&gt;&lt;P&gt;See if this works for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sunil Sawaikar on Apr 17, 2009 2:19 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2009 12:15:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/highest-value/m-p/5505584#M1259246</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-17T12:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: highest value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/highest-value/m-p/5505585#M1259247</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;PRE&gt;&lt;CODE&gt;DATA l_char TYPE bseg-zuonr.
DATA l_index type sy-tabix.

LOOP AT gt_bseg.

gt_output-belnr = gt_bseg-belnr.
gt_output-dmbtr = gt_bseg-dmbtr.
gt_output-wrbtr = gt_bseg-wrbtr.

* gt_output-zuonr = gt_bseg-zuonr.

IF l_char(2) NE  gt_bseg-zuonr(2) AND NOT l_char is initial.
  l_index = sy-tabix.

  READ TABLE gt_ouput INTO l_output index l_index.
  l_output-zuonr = l_char 
  MODIFY gt_ouput from l_output transporting zuonr index l_index 
ENDIF.

COLLECT gt_output.
CLEAR gt_output.
l_char = gt_bseg-zuonr.

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2009 12:19:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/highest-value/m-p/5505585#M1259247</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-17T12:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: highest value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/highest-value/m-p/5505586#M1259248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi avinash,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY gt_ouput from l_output transporting zuonr index l_index .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am getting an error as No component exists with name INDEX,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COULD you please suggest does it requires any changes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2009 13:57:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/highest-value/m-p/5505586#M1259248</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-17T13:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: highest value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/highest-value/m-p/5505587#M1259249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;write as : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY gt_ouput INDEX l_index from l_output transporting zuonr  .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2009 14:00:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/highest-value/m-p/5505587#M1259249</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-17T14:00:42Z</dc:date>
    </item>
  </channel>
</rss>

