<?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: logic for the report in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456579#M1250364</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;1.  sort gt_bseg in descending value of zuonr.( so you will get the hightest values).&lt;/P&gt;&lt;P&gt;2. create another internal table and move the fields belnr, zuonr, wrbtr into it.&lt;/P&gt;&lt;P&gt;3. then pass the total value in dmbtr into the internal table.&lt;/P&gt;&lt;P&gt;4. modify it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Apr 2009 06:44:47 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-04-20T06:44:47Z</dc:date>
    <item>
      <title>logic for the report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456575#M1250360</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;&lt;/P&gt;&lt;P&gt;i need to fetch the data based on BELNR BUKRS and ZUONR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BELNR     BUKRS   ZUONR     DMBTR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1001            0005     TP004      5&lt;/P&gt;&lt;P&gt;1001            0005     TP006      4&lt;/P&gt;&lt;P&gt;1001            0005     PK458      10&lt;/P&gt;&lt;P&gt;1001            0005     PK876       2&lt;/P&gt;&lt;P&gt;1001            0005     PK999       50&lt;/P&gt;&lt;P&gt;&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    ZUONR    DMBTR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1001        0005        TP006         9&lt;/P&gt;&lt;P&gt;1001        0005        PK999        62&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If ZUONR field first 2 alphabets are same those DMBTR values should be added     and ZUONR output should be last value of the first 2 alphabets&lt;/P&gt;&lt;P&gt;suppose for above eg:&lt;/P&gt;&lt;P&gt;ZUONR  = TP004    =  5&lt;/P&gt;&lt;P&gt;                TP006    =  4&lt;/P&gt;&lt;P&gt;                            -&lt;/P&gt;&lt;HR originaltext="---------------" /&gt;&lt;P&gt;                                 9&lt;/P&gt;&lt;P&gt;                           -&lt;/P&gt;&lt;HR originaltext="--------------" /&gt;&lt;P&gt;ZUONR Should display the highest of first 2 alphabtes i.e., coming to TP, the highest is TP006&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THE output should be as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BELNR    BUKRS    ZUONR    DMBTR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1001        0005        TP006         9&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please see code below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have added the all DMBTR values ,if FIRST 2 alphabets of ZUONR ARE SAME but how to pass  zuonr highest value to output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now the output is coming as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BELNR    BUKRS    ZUONR                         DMBTR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1001        0005        TP-----(missing 006)              9&lt;/P&gt;&lt;P&gt;                               &lt;/P&gt;&lt;P&gt;only 2 fields of ZUONR is displaying, while adding DMBTR it should compare with first 2 alphabets of ZUONR But while displaying in the output the Zuonr should be highest value of the first 2 alphabets,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT gt_bseg.&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;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;please help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2009 06:12:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456575#M1250360</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-20T06:12:18Z</dc:date>
    </item>
    <item>
      <title>Re: logic for the report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456576#M1250361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try the following :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the Collect stmt inside the loop,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
MODIFY GT_OUTPUT.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mansi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2009 06:15:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456576#M1250361</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-20T06:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: logic for the report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456577#M1250362</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;First of all sort the internal table by field zuonr, than you can make use of the logic for addition of dmbtr.&lt;/P&gt;&lt;P&gt;To get the highest Zuonr you can use logic as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if gt_bseg-zuonr+0(2) eq lv_zuonr.&lt;/P&gt;&lt;P&gt;gt_output-zuonr = gt_bseg-zuonr.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;lv_zuonr = gt_bseg-zuonr+0(2).&lt;/P&gt;&lt;P&gt;gt_output-zuonr = gt_bseg-zuonr.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2009 06:23:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456577#M1250362</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-20T06:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: logic for the report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456578#M1250363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI KRITESH,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is my code where do i need to put your code.&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;COLLECT gt_output.&lt;/P&gt;&lt;P&gt;CLEAR gt_output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2009 06:33:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456578#M1250363</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-20T06:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: logic for the report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456579#M1250364</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;1.  sort gt_bseg in descending value of zuonr.( so you will get the hightest values).&lt;/P&gt;&lt;P&gt;2. create another internal table and move the fields belnr, zuonr, wrbtr into it.&lt;/P&gt;&lt;P&gt;3. then pass the total value in dmbtr into the internal table.&lt;/P&gt;&lt;P&gt;4. modify it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2009 06:44:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456579#M1250364</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-20T06:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: logic for the report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456580#M1250365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can i use control break statement to get the last value of the ZUONR which has FIRST 2 alphbets same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if so please help with code.&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>Mon, 20 Apr 2009 07:15:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456580#M1250365</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-20T07:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: logic for the report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456581#M1250366</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;You can try this logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. decalre a local variable lv_zuonr, lv_dmbtr and lv_count.&lt;/P&gt;&lt;P&gt; loop at gt_bseg into gs_bseg.&lt;/P&gt;&lt;P&gt;     lv_zuonr = gs_bseg-zuonr0(2).&lt;/P&gt;&lt;P&gt;     if lv_zuonr = gs_bseg-zuonr0(2).&lt;/P&gt;&lt;P&gt;       if lv_count = 1.&lt;/P&gt;&lt;P&gt;        lv_dmbtr = gs_bseg-dmbtr.&lt;/P&gt;&lt;P&gt;        lv_zuonr1 = gs_bseg-zounr.&lt;/P&gt;&lt;P&gt;       else.&lt;/P&gt;&lt;P&gt;         if lv_dmbtr &amp;gt; gs_besg-dmbtr.&lt;/P&gt;&lt;P&gt;            gs_bseg-zounr = lv_zuonr1.&lt;/P&gt;&lt;P&gt;            gs_bseg-dmbtr = lv_dmbtr + gs_bseg-dmbtr.&lt;/P&gt;&lt;P&gt;            modify gt_bseg from gs_bseg transporting zuonr dmbtr.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2009 09:53:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456581#M1250366</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-20T09:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: logic for the report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456582#M1250367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this.... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have another internal table say T_ITAB2 with same structure as of the internal table in which these fields are there...Let the original table be T_ITAB1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: l_index type sy-tabix.
          l_zuonr type... declare this.
LOOP at T_ITAB1 into WA_ITAB1.
l_index = sy-tabix.
do.
add 1 to l_index.
read table T_ITAB2 into WA_ITAB2 index l_index.
if sy-subrc = 0.
	l_zuonr = l_zuonr + wa_itab2-zuonr.
else.
	wa_itab2-zuonr = l_zuonr.
	append wa_itab2 to t_itab2.	
	exit.
endif.
enddo.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once this code is executed... T_ITAB2 will have the entries as you need &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are not gettin the correct output.. then sort the tables appropriately..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2009 10:13:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456582#M1250367</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-20T10:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: logic for the report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456583#M1250368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this ---&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF it1,&lt;/P&gt;&lt;P&gt;      BELNR(4),&lt;/P&gt;&lt;P&gt;       BUKRS(4),&lt;/P&gt;&lt;P&gt;       ZUONR(5),&lt;/P&gt;&lt;P&gt;       DMBTR TYPE i,&lt;/P&gt;&lt;P&gt;  END OF it1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: it_1 TYPE TABLE OF it1 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;      it_2 TYPE TABLE OF it1 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;data: v1(4), v2(4), v3(5), v4 TYPE i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM in_data USING:&lt;/P&gt;&lt;P&gt;'1001' '0005' 'PK458' 10,&lt;/P&gt;&lt;P&gt;'1001' '0005' 'PK876' 2,&lt;/P&gt;&lt;P&gt;'1001' '0005' 'PK999' 50,&lt;/P&gt;&lt;P&gt;'1001' '0005' 'TP004' 5,&lt;/P&gt;&lt;P&gt;'1001' '0005' 'TP006' 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_1.&lt;/P&gt;&lt;P&gt;    IF v3 IS INITIAL.&lt;/P&gt;&lt;P&gt;      v1 = it_1-BELNR.&lt;/P&gt;&lt;P&gt;      v2 = it_1-BUKRS.&lt;/P&gt;&lt;P&gt;      v3 = it_1-ZUONR.&lt;/P&gt;&lt;P&gt;      v4 = it_1-DMBTR.&lt;/P&gt;&lt;P&gt;    ELSEIF v3&lt;EM&gt;0(2) ne it_1-ZUONR&lt;/EM&gt;0(2).&lt;/P&gt;&lt;P&gt;      it_2-BELNR = v1.&lt;/P&gt;&lt;P&gt;      it_2-BUKRS = v2.&lt;/P&gt;&lt;P&gt;      it_2-ZUONR = v3.&lt;/P&gt;&lt;P&gt;      it_2-DMBTR = v4.&lt;/P&gt;&lt;P&gt;      APPEND it_2.&lt;/P&gt;&lt;P&gt;      v1 = it_1-BELNR.&lt;/P&gt;&lt;P&gt;      v2 = it_1-BUKRS.&lt;/P&gt;&lt;P&gt;      v3 = it_1-ZUONR.&lt;/P&gt;&lt;P&gt;      v4 = it_1-DMBTR.&lt;/P&gt;&lt;P&gt;    else.&lt;/P&gt;&lt;P&gt;      v3 = it_1-ZUONR.&lt;/P&gt;&lt;P&gt;      v4 = v4 + it_1-DMBTR.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;      it_2-BELNR = v1.&lt;/P&gt;&lt;P&gt;      it_2-BUKRS = v2.&lt;/P&gt;&lt;P&gt;      it_2-ZUONR = v3.&lt;/P&gt;&lt;P&gt;      it_2-DMBTR = v4.&lt;/P&gt;&lt;P&gt;      APPEND it_2.&lt;/P&gt;&lt;P&gt;LOOP AT it_2.&lt;/P&gt;&lt;P&gt;    WRITE: / it_2-BELNR, it_2-BUKRS, it_2-ZUONR, it_2-DMBTR.&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;FORM IN_DATA USING VALUE(a) VALUE(b) VALUE(c) VALUE(d) type i.&lt;/P&gt;&lt;P&gt;    it_1-BELNR = a.&lt;/P&gt;&lt;P&gt;    it_1-BUKRS = b.&lt;/P&gt;&lt;P&gt;    it_1-ZUONR = c.&lt;/P&gt;&lt;P&gt;    it_1-DMBTR = d.&lt;/P&gt;&lt;P&gt;    APPEND it_1.&lt;/P&gt;&lt;P&gt;    CLEAR it_1.&lt;/P&gt;&lt;P&gt;ENDFORM.                    " IN_DATA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this will help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: mayank jain on Apr 24, 2009 1:36 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2009 06:06:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-the-report/m-p/5456583#M1250368</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-23T06:06:12Z</dc:date>
    </item>
  </channel>
</rss>

