<?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: Convertion Problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638046#M1442966</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SORT lt_machine_sales4 BY ktgrm_d.
  CLEAR: lwa_out5.
  LOOP AT lt_machine_sales4 INTO lwa_out5.
      AT end of  ktgrm_d.
      SUM.
      lwa_out5-act_gross_p  = lwa_out5-act_sales_p - lwa_out5-act_cos_p.
      IF lwa_out5-act_sales_p IS NOT INITIAL.
        lwa_out5-act_gross_perc_p = ( lwa_out5-act_gross_p / lwa_out5-act_sales_p ) * 100.
      ENDIF.
      WRITE  lwa_out5-act_gross_perc_p TO lwa_out5-act_gross_perc NO-SIGN LEFT-JUSTIFIED DECIMALS 1.
      IF lwa_out5-act_gross_p &amp;lt; 0.
        CONCATENATE lwa_out5-act_gross_perc '%-' INTO lwa_out5-act_gross_perc.
      ELSE.
        CONCATENATE lwa_out5-act_gross_perc '%' INTO lwa_out5-act_gross_perc.
      ENDIF.
**************BUDGET CALCULATION FOR GROSS PROFIT &amp;amp; GROSS PROFIT PERCENTAGE.
      lv_bud_gross_p  = lwa_out5-bud_sales_p - lwa_out5-bud_cos_p.
      IF lwa_out5-bud_sales_p IS NOT INITIAL.
        lwa_out5-bud_gross_perc_p = ( lv_bud_gross_p / lwa_out5-bud_sales_p * 100 ).
      ENDIF.

      IF lwa_out5-bud_gross_perc_p NE 0.
        WRITE lwa_out5-bud_gross_perc_p TO lwa_out5-bud_gross_perc LEFT-JUSTIFIED.
        CONCATENATE lwa_out5-bud_gross_perc '%' INTO lwa_out5-bud_gross_perc SEPARATED BY space.
      ENDIF.
*****************************************************************************
      CLEAR:lwa_out5-matkl_d,
            lwa_out5-matnr.
      APPEND lwa_out5 TO lt_machine_sales5.
      CLEAR:lwa_out5.
    ENDAT.
  ENDLOOP.

Still itsnot working
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Feb 2010 09:05:18 GMT</pubDate>
    <dc:creator>former_member251546</dc:creator>
    <dc:date>2010-02-17T09:05:18Z</dc:date>
    <item>
      <title>Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638030#M1442950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;good day guys&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am getting a problem when iam doing the summing the values. Actually my itab got  -ve values.  Plz see my code, tell me is it wrong?&lt;/P&gt;&lt;P&gt;like:&lt;/P&gt;&lt;P&gt;&amp;gt;QTY     Actsales    Act cost&lt;/P&gt;&lt;P&gt;&amp;gt; -&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt; -    -&lt;/P&gt;&lt;HR originaltext="---------" /&gt;&lt;P&gt;      -&lt;/P&gt;&lt;HR originaltext="-----------" /&gt;&lt;P&gt;&amp;gt;1-          1000-          1000&lt;/P&gt;&lt;P&gt;&amp;gt;9             900                30-&lt;/P&gt;&lt;P&gt;&amp;gt;3-            300-            200&lt;/P&gt;&lt;P&gt;&amp;gt;8             100              200-&lt;/P&gt;&lt;P&gt; &amp;gt;Sort lt_machine_sales4 by ktgrm_d ascending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at lt_machine_sales4 into lwa_out5.
  at new ktgrm_d.
    SUM.
   if lwa_out5-sales_qty &amp;lt; 0.
  lwa_out5-sales_qty = lwa_out5-sales_qty * -1.            "qty values
  endif.
  if lwa_out5-act_sales_p &amp;lt; 0.
  lwa_out5-act_sales_p = lwa_out5-act_sales_p * -1.      "act sales
  endif.
  if  lwa_out5-act_cos_p &amp;lt; 0 .
  lwa_out5-act_cos_p = lwa_out5-act_cos_p * -1.          "act costs
  endif.
    lwa_out5-ACT_GROSS_P  = lwa_out5-act_sales_p - lwa_out5-act_cos_p.
    lwa_out5-act_gross_perc_p = ( lwa_out5-act_gross_p / lwa_out5-act_sales_p ) * 100.

    append lwa_out5 to lt_machine_sales5.
    clear:lwa_out5.
  endat.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on Feb 16, 2010 2:26 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Feb 2010 06:50:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638030#M1442950</guid>
      <dc:creator>former_member251546</dc:creator>
      <dc:date>2010-02-16T06:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638031#M1442951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Balaji,&lt;/P&gt;&lt;P&gt;First you are doing sum and then checking if it is negative or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 at new ktgrm_d.
   if lwa_out5-sales_qty &amp;lt; 0.
  lwa_out5-sales_qty = lwa_out5-sales_qty * -1.            "qty values
  endif.
  if lwa_out5-act_sales_p &amp;lt; 0.
  lwa_out5-act_sales_p = lwa_out5-act_sales_p * -1.      "act sales
  endif.
  if  lwa_out5-act_cos_p &amp;lt; 0 .
  lwa_out5-act_cos_p = lwa_out5-act_cos_p * -1.          "act costs
  endif.

 SUM.  " Keep it here
    lwa_out5-ACT_GROSS_P  = lwa_out5-act_sales_p - lwa_out5-act_cos_p.
    lwa_out5-act_gross_perc_p = ( lwa_out5-act_gross_p / lwa_out5-act_sales_p ) * 100.
    append lwa_out5 to lt_machine_sales5.
    clear:lwa_out5.


endat.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Swarna Munukoti&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Swarna Munukoti on Feb 16, 2010 7:58 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Feb 2010 06:58:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638031#M1442951</guid>
      <dc:creator>former_member217544</dc:creator>
      <dc:date>2010-02-16T06:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638032#M1442952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;good Morning Swarna&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Its not working...Plz advice me
Sort lt_machine_sales4 by ktgrm_d ascending.

loop at lt_machine_sales4 into lwa_out5.
  AT new ktgrm_d.
   if lwa_out5-sales_qty &amp;lt; 0.
   lwa_out5-sales_qty = lwa_out5-sales_qty * -1.
  ENDIF.
  SUM.
    lwa_out5-ACT_GROSS_P  = lwa_out5-act_sales_p - lwa_out5-act_cos_p.
    lwa_out5-act_gross_perc_p = ( lwa_out5-act_gross_p / lwa_out5-act_sales_p ) * 100.

    append lwa_out5 to lt_machine_sales5.
    clear:lwa_out5.
  endat.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Feb 2010 07:01:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638032#M1442952</guid>
      <dc:creator>former_member251546</dc:creator>
      <dc:date>2010-02-16T07:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638033#M1442953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Whats the problem you are facing ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Feb 2010 19:09:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638033#M1442953</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-02-16T19:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638034#M1442954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thank you for reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 
My itab got data like as below as 

QTY     sales         cost
----      -------        --------
10        2000-         2000
20-       3000          1000-
20-       1000-         800-
10        2000         1000

iam using AT New when iam doing the subtot ,  at that time its gives the prob due to -ve values
so ive used the  lwa_out5-sales_qty = lwa_out5-sales_qty * -1. but its doesnt work out. so ive removed the code. Pls see the code. and plz let me know how to overcome the prob

SORT lt_machine_sales4 BY ktgrm_d.

  LOOP AT lt_machine_sales4 INTO lwa_out5.
    AT NEW ktgrm_d.
      SUM.
      lwa_out5-act_gross_p  = lwa_out5-act_sales_p - lwa_out5-act_cos_p.
      lwa_out5-act_gross_perc_p = ( lwa_out5-act_gross_p / lwa_out5-act_sales_p ) * 100.
      WRITE  lwa_out5-act_gross_perc_p TO lwa_out5-act_gross_perc NO-SIGN LEFT-JUSTIFIED DECIMALS 1.
      IF lwa_out5-act_gross_p &amp;lt; 0.
        CONCATENATE lwa_out5-act_gross_perc '%-' INTO lwa_out5-act_gross_perc.
      ELSE.
        CONCATENATE lwa_out5-act_gross_perc '%' INTO lwa_out5-act_gross_perc.
      ENDIF.
**************BUDGET CALCULATION FOR GROSS PROFIT &amp;amp; GROSS PROFIT PERCENTAGE.
      lv_bud_gross_p  = lwa_out5-bud_sales_p - lwa_out5-bud_cos_p.
      lwa_out5-bud_gross_perc_p = ( lv_bud_gross_p / lwa_out5-bud_sales_p * 100 ).

      IF lwa_out5-bud_gross_perc_p NE 0.
        WRITE lwa_out5-bud_gross_perc_p TO lwa_out5-bud_gross_perc LEFT-JUSTIFIED.
        CONCATENATE lwa_out5-bud_gross_perc '%' INTO lwa_out5-bud_gross_perc SEPARATED BY space.
      ENDIF.
*****************************************************************************
      clear:lwa_out5-matkl_d,
            lwa_out5-matnr.
      APPEND lwa_out5 TO lt_machine_sales5.
      CLEAR:lwa_out5.
    ENDAT.
  ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2010 06:05:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638034#M1442954</guid>
      <dc:creator>former_member251546</dc:creator>
      <dc:date>2010-02-17T06:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638035#M1442955</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;while using AT NEW control stmt, you should remember that, all the right side values of that field will be getting " ** ". So it is better to move the work area data into another workare before writting AT NEW stmt.&lt;/P&gt;&lt;P&gt;It will solve ur pb.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Srinivas K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2010 06:24:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638035#M1442955</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-17T06:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638036#M1442956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;thank you for reply.&lt;/P&gt;&lt;P&gt;Plz check my code. is it right?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at lt_machine_sales into lwa_out5.
lwa_out1 = lwa_out5.
At new ktgrm_d.
 sum.
append lwa_out1 to lt_machine_sales1.
endat.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2010 06:31:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638036#M1442956</guid>
      <dc:creator>former_member251546</dc:creator>
      <dc:date>2010-02-17T06:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638037#M1442957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, Processed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Srinivas K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2010 06:34:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638037#M1442957</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-17T06:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638038#M1442958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;good day&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Still it snot working. plz see once in my code..any prob&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SORT lt_machine_sales4 BY ktgrm_d.
  CLEAR: lwa_out5,
         lwa_out1.

  LOOP AT lt_machine_sales4 INTO lwa_out5.
    lwa_out1 = lwa_out5.
    AT NEW ktgrm_d.
      if lwa_out1-sales_qty &amp;lt; 0.
        lwa_out1-sales_qty = lwa_out1-sales_qty * -1.
      endif.
      SUM.
      lwa_out1-act_gross_p  = lwa_out1-act_sales_p - lwa_out1-act_cos_p.
      IF lwa_out1-act_sales_p IS NOT INITIAL.
        lwa_out1-act_gross_perc_p = ( lwa_out1-act_gross_p / lwa_out1-act_sales_p ) * 100.
      ENDIF.
      WRITE  lwa_out1-act_gross_perc_p TO lwa_out1-act_gross_perc NO-SIGN LEFT-JUSTIFIED DECIMALS 1.
      IF lwa_out1-act_gross_p &amp;lt; 0.
        CONCATENATE lwa_out1-act_gross_perc '%-' INTO lwa_out1-act_gross_perc.
      ELSE.
        CONCATENATE lwa_out1-act_gross_perc '%' INTO lwa_out1-act_gross_perc.
      ENDIF.
**************BUDGET CALCULATION FOR GROSS PROFIT &amp;amp; GROSS PROFIT PERCENTAGE.
      lv_bud_gross_p  = lwa_out1-bud_sales_p - lwa_out1-bud_cos_p.
      IF lwa_out1-bud_sales_p IS NOT INITIAL.
        lwa_out1-bud_gross_perc_p = ( lv_bud_gross_p / lwa_out1-bud_sales_p * 100 ).
      ENDIF.

      IF lwa_out1-bud_gross_perc_p NE 0.
        WRITE lwa_out1-bud_gross_perc_p TO lwa_out1-bud_gross_perc LEFT-JUSTIFIED.
        CONCATENATE lwa_out1-bud_gross_perc '%' INTO lwa_out1-bud_gross_perc SEPARATED BY space.
      ENDIF.
*****************************************************************************
      CLEAR:lwa_out1-matkl_d,
            lwa_out1-matnr.
      APPEND lwa_out1 TO lt_machine_sales5.
      CLEAR:lwa_out1.
    ENDAT.
  ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2010 07:17:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638038#M1442958</guid>
      <dc:creator>former_member251546</dc:creator>
      <dc:date>2010-02-17T07:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638039#M1442959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Balaji,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To the best of my knowledge, SUM is only considered within AT END OF control structure. I think you need to modify your SUM statement. Do an F1 on SUM we got a good example there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pranaam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2010 07:28:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638039#M1442959</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-17T07:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638040#M1442960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Balaji,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SUM stmt will not work in AT NEW contrl stmt. It can only be used in AT END or AT LAST only. Kindly look into help by pressing F1.&lt;/P&gt;&lt;P&gt;The statement SUM can only be specified within a loop starting with LOOP, and is only considered within a AT- ENDAT control structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Change the control stmt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Srinivas K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2010 07:30:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638040#M1442960</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-17T07:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638041#M1442961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Kaudri - Are you sure that SUM will not work in At new and At end. ???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@OP-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; AT NEW ktgrm_d.&lt;/P&gt;&lt;P&gt;      SUM.&lt;/P&gt;&lt;P&gt;      lwa_out5-act_gross_p  = lwa_out5-act_sales_p - lwa_out5-act_cos_p.&lt;/P&gt;&lt;P&gt;      lwa_out5-act_gross_perc_p = ( lwa_out5-act_gross_p / lwa_out5-act_sales_p ) * 100.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here when a new ktgrm_d is found it will consider both the -ve and +ve values for SUM.&lt;/P&gt;&lt;P&gt;After that there is no use of multiplying with -1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A	B&lt;/P&gt;&lt;P&gt;a	1&lt;/P&gt;&lt;P&gt;a	1-&lt;/P&gt;&lt;P&gt;a	2&lt;/P&gt;&lt;P&gt;a	3-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab&lt;/P&gt;&lt;P&gt;at new A.&lt;/P&gt;&lt;P&gt;sum = the value here is -1.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;Here if you multiply the negative value with -1 the result will not be same.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you please explain what you exactly want then it will be easy to help you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2010 08:36:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638041#M1442961</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-02-17T08:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638042#M1442962</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;SUM statement wont work with AT NEW control Stament but it works with AT END control stmt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Desktop\untitled.bmp]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Srinivas K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2010 08:47:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638042#M1442962</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-17T08:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638043#M1442963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Iam getting the report for Gross profit  and GP % for sales.

In my report first iam displaying  the Iteams wise.. as well every item displays the subtotal also.

Like:

Agency            Categegory     Machine      sales       cost       GrossProfit          GP %    QTY
------------------------------------------------------------------------------------------------------

XYZ                   ABC               Bajaj           100         80                20                      80%    10
 
Subtot                                                           100        80               20                       80%   10

ABC                    Mot1              Indica          100          50                50                    50%     50-
                                                 Maruthi        100          50                50                     50%    50


Subtot                                                           200          100              100                    50%   100    "PROBLE IS HERE ITSNOT GETTING
------------------------------------------------------------------------------------------------------------

For the subtotal  iam using the AT new based on agency. 

hope uve understand my senario.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2010 08:52:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638043#M1442963</guid>
      <dc:creator>former_member251546</dc:creator>
      <dc:date>2010-02-17T08:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638044#M1442964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Balaji,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand your scenario. For the subtotals it is better to you if use AT END OF statement. First try with this and let me know if you have any problem with that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Srinivas K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2010 09:02:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638044#M1442964</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-17T09:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638045#M1442965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;sorry for the before i didnt type very well.&lt;/P&gt;&lt;P&gt;I have used the at end of statement also . but stil its same the problem&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2010 09:02:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638045#M1442965</guid>
      <dc:creator>former_member251546</dc:creator>
      <dc:date>2010-02-17T09:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638046#M1442966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SORT lt_machine_sales4 BY ktgrm_d.
  CLEAR: lwa_out5.
  LOOP AT lt_machine_sales4 INTO lwa_out5.
      AT end of  ktgrm_d.
      SUM.
      lwa_out5-act_gross_p  = lwa_out5-act_sales_p - lwa_out5-act_cos_p.
      IF lwa_out5-act_sales_p IS NOT INITIAL.
        lwa_out5-act_gross_perc_p = ( lwa_out5-act_gross_p / lwa_out5-act_sales_p ) * 100.
      ENDIF.
      WRITE  lwa_out5-act_gross_perc_p TO lwa_out5-act_gross_perc NO-SIGN LEFT-JUSTIFIED DECIMALS 1.
      IF lwa_out5-act_gross_p &amp;lt; 0.
        CONCATENATE lwa_out5-act_gross_perc '%-' INTO lwa_out5-act_gross_perc.
      ELSE.
        CONCATENATE lwa_out5-act_gross_perc '%' INTO lwa_out5-act_gross_perc.
      ENDIF.
**************BUDGET CALCULATION FOR GROSS PROFIT &amp;amp; GROSS PROFIT PERCENTAGE.
      lv_bud_gross_p  = lwa_out5-bud_sales_p - lwa_out5-bud_cos_p.
      IF lwa_out5-bud_sales_p IS NOT INITIAL.
        lwa_out5-bud_gross_perc_p = ( lv_bud_gross_p / lwa_out5-bud_sales_p * 100 ).
      ENDIF.

      IF lwa_out5-bud_gross_perc_p NE 0.
        WRITE lwa_out5-bud_gross_perc_p TO lwa_out5-bud_gross_perc LEFT-JUSTIFIED.
        CONCATENATE lwa_out5-bud_gross_perc '%' INTO lwa_out5-bud_gross_perc SEPARATED BY space.
      ENDIF.
*****************************************************************************
      CLEAR:lwa_out5-matkl_d,
            lwa_out5-matnr.
      APPEND lwa_out5 TO lt_machine_sales5.
      CLEAR:lwa_out5.
    ENDAT.
  ENDLOOP.

Still itsnot working
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2010 09:05:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638046#M1442966</guid>
      <dc:creator>former_member251546</dc:creator>
      <dc:date>2010-02-17T09:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638047#M1442967</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 missed again moving the workarea data into another workarea. If it is still unresolved reply me how is the ouput or error what you are getting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Srinivas K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2010 09:12:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638047#M1442967</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-17T09:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638048#M1442968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;sorry its not working if ive moved to another work area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subtotal is getting the last record of final itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2010 09:22:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638048#M1442968</guid>
      <dc:creator>former_member251546</dc:creator>
      <dc:date>2010-02-17T09:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Convertion Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638049#M1442969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It will work in any control break statements.&lt;/P&gt;&lt;P&gt;Have you tried.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types:begin of ty,&lt;/P&gt;&lt;P&gt;field1 type c,&lt;/P&gt;&lt;P&gt;field2 type i,&lt;/P&gt;&lt;P&gt;end of ty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:it type table of ty.&lt;/P&gt;&lt;P&gt;data:wa type ty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa-field1 = 'A'.&lt;/P&gt;&lt;P&gt;wa-field2 = '1'.&lt;/P&gt;&lt;P&gt;append wa to it.&lt;/P&gt;&lt;P&gt;wa-field1 = 'A'.&lt;/P&gt;&lt;P&gt;wa-field2 = '2'.&lt;/P&gt;&lt;P&gt;append wa to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it into wa.&lt;/P&gt;&lt;P&gt;at new field1.&lt;/P&gt;&lt;P&gt;sum.&lt;/P&gt;&lt;P&gt;write wa-field2.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2010 09:27:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convertion-problem/m-p/6638049#M1442969</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-02-17T09:27:13Z</dc:date>
    </item>
  </channel>
</rss>

