<?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 in adding field values? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-adding-field-values/m-p/5808113#M1312813</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Create ITAB as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fetch all the data from all the columns SME001 to SME016 in the respective columns in internal table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make use of field-symbol to add the value of the corresponding columns as follows:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;FS1&amp;gt; as line type of ITAB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;fs2&amp;gt; type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assume period selected is 007&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT ITAB ASSIGNING &amp;lt;FS1&amp;gt;

DO.
IF PERIOD = 000.
exit.
ENDIF.

Concatenate 'SME' period into LV_VARIABLE.

Assign component LV_VARIABLE of structure &amp;lt;FS1&amp;gt;
to &amp;lt;FS2&amp;gt;.

if &amp;lt;FS2&amp;gt; is assigned.
sum = sum + &amp;lt;FS2&amp;gt;
endif.

period = period - 1.

ENDDO.


ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So now sum will contain the sum of the values of SME001 to SME007.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it is clear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ankur Parab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Jun 2009 16:00:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-06-18T16:00:28Z</dc:date>
    <item>
      <title>problem in adding field values?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-adding-field-values/m-p/5808111#M1312811</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;I am using table COSP in my program. The requirement is i need to add the field values(SMEXXX) of this table structure  until the period entered in seletion-screen. &lt;/P&gt;&lt;P&gt;i.e if the period is 005. &lt;/P&gt;&lt;P&gt;i need to add &lt;/P&gt;&lt;P&gt;SME001 UNTIL SME005 TO a variable. &lt;/P&gt;&lt;P&gt;if the period is 007 then &lt;/P&gt;&lt;P&gt;SME001 UNTIL SME007.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need the logic to choose the no of  field values dynamically? please help me. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, &lt;/P&gt;&lt;P&gt;aravind.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2009 02:02:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-adding-field-values/m-p/5808111#M1312811</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-18T02:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: problem in adding field values?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-adding-field-values/m-p/5808112#M1312812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Aravind,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a Sample code. Just look after It.!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA : I(3) TYPE N VALUE '001'.
DATA : TEST(15).

LOOP AT PERIOD.

  IF I IN PERIOD.
  CLEAR TEST.
  CONCATENATE 'SME' I INTO TEST.
  I = I + 1.
  SELECT (TEST) FORM COSP INTO SME_VALUE....
  FINAL_SMEVALUE = FINAL_SMEVALUE +  SME_VALUE.

  CLEAR : SME_VALUE
  ENDSELECT.

ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards,&lt;/P&gt;&lt;P&gt;Dileep .C&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2009 02:33:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-adding-field-values/m-p/5808112#M1312812</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-18T02:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: problem in adding field values?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-adding-field-values/m-p/5808113#M1312813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Create ITAB as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fetch all the data from all the columns SME001 to SME016 in the respective columns in internal table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make use of field-symbol to add the value of the corresponding columns as follows:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;FS1&amp;gt; as line type of ITAB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;fs2&amp;gt; type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assume period selected is 007&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT ITAB ASSIGNING &amp;lt;FS1&amp;gt;

DO.
IF PERIOD = 000.
exit.
ENDIF.

Concatenate 'SME' period into LV_VARIABLE.

Assign component LV_VARIABLE of structure &amp;lt;FS1&amp;gt;
to &amp;lt;FS2&amp;gt;.

if &amp;lt;FS2&amp;gt; is assigned.
sum = sum + &amp;lt;FS2&amp;gt;
endif.

period = period - 1.

ENDDO.


ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So now sum will contain the sum of the values of SME001 to SME007.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it is clear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ankur Parab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2009 16:00:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-adding-field-values/m-p/5808113#M1312813</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-18T16:00:28Z</dc:date>
    </item>
  </channel>
</rss>

