<?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: How to insert record inside the internal table in below code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-insert-record-inside-the-internal-table-in-below-code/m-p/5859721#M1321214</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  YTEST_MODIFY.

data: begin of itab occurs 1,
TOT TYPE C,
f1 type c,
f2 type c,
f3 type i ,
end of itab.

data: begin of Jtab occurs 1,
f1 type c,
f2 type c,
f3 type i ,
end of Jtab.
START-OF-SELECTION.
ITAB-f1 = 'A'.ITAB-F2 =  1.ITAB-F3 =  1.
APPEND ITAB.
ITAB-f1 = 'B'.ITAB-F2 =  1.ITAB-F3 =  1.
APPEND ITAB.
ITAB-f1 = 'C'.ITAB-F2 =  5.ITAB-F3 =  1.
APPEND ITAB.
ITAB-f1 = 'D'.ITAB-F2 =  3.ITAB-F3 =  1.
APPEND ITAB.
ITAB-f1 = 'E'.ITAB-F2 =  4.ITAB-F3 =  1.
APPEND ITAB.
ITAB-f1 = 'F'.ITAB-F2 =  2.ITAB-F3 =  1.
APPEND ITAB.
SORT ITAB BY F2.

LOOP AT ITAB.
WRITE:/ ITAB-F1 ,8 ITAB-F2 , ITAB-F3.
ENDLOOP.

LOOP AT ITAB.
IF ITAB-F2 = 1 OR ITAB-F2 = 2.
ITAB-TOT = 1.
MODIFY ITAB.
ELSEIF ITAB-F2 = 3.
ITAB-TOT = 3.
MODIFY ITAB.
ELSEIF ITAB-F3 = 4 OR ITAB-F3 = 5.
ITAB-TOT = 4.
MODIFY ITAB.
ENDIF.
ENDLOOP.

DATA: A TYPE I , B .

LOOP AT ITAB.
IF B = 0.
A = A + ITAB-F3.
ENDIF.
AT END OF TOT.
MOVE SPACE TO ITAB-F1.
MOVE SPACE TO ITAB-F2.
MOVE A TO ITAB-F3.
MODIFY ITAB .
CLEAR A.
B = 1.
ENDAT.

B = 0.
ENDLOOP.



LOOP AT ITAB.
MOVE-CORRESPONDING ITAB TO JTAB.
APPEND JTAB.
ENDLOOP.

ULINE.
LOOP AT JTAB.
WRITE: / JTAB-F1 , JTAB-F2 , JTAB-F3.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jul 2009 05:35:06 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-07-15T05:35:06Z</dc:date>
    <item>
      <title>How to insert record inside the internal table in below code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-insert-record-inside-the-internal-table-in-below-code/m-p/5859720#M1321213</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;My requirement is to find the sub-total and need to insert in between the internal table. &lt;/P&gt;&lt;P&gt;You can see the output ....where I want the sub-total F2 when 1 &amp;amp; 2 combindely , 3 , 4&amp;amp; 5 combindely .Please check it and let me know is it possible &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;when i am using modification  it is not creating extra row inside the table instead it is modifying one row and putting the total there. &lt;/P&gt;&lt;P&gt;For ex: the origianl output is &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;F1   F2       F3&lt;/P&gt;&lt;P&gt;A      1          1&lt;/P&gt;&lt;P&gt;B      1          1&lt;/P&gt;&lt;P&gt;F      2          1&lt;/P&gt;&lt;P&gt;D      3          1&lt;/P&gt;&lt;P&gt;E      4          1&lt;/P&gt;&lt;P&gt;C      5          1&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;We want to display all the total of f2 of 1-2 , 3 , 4-5 &lt;/P&gt;&lt;P&gt;so expcected output is &lt;/P&gt;&lt;P&gt;F1   F2       F3&lt;/P&gt;&lt;P&gt;A      1          1&lt;/P&gt;&lt;P&gt;B      1          1&lt;/P&gt;&lt;P&gt;F      2          1&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     *              3  -&amp;gt;This is the sub-total of 1&amp;amp; 2 of f2 &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;D      3          1&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        *           1 -&amp;gt;this is the sub-total of 3 &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;E      4          1&lt;/P&gt;&lt;P&gt;C      5          1&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      *             2 -&amp;gt; this is the sub-total of 4 &amp;amp; 5 &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;= space&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;But coming output is &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;A 1          1&lt;/P&gt;&lt;P&gt;B 1          1&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; *             3 -&amp;gt; it is modifying the F row and inserting the total .Total is comong correct but is shoule insert  instead of modifying the record!! &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  *           1&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;E  4          1&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; *             2&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Please help how to insert the row total at the end of the chage of field &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find the below code ..Due to space problem i am attaching below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jul 2009 05:33:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-insert-record-inside-the-internal-table-in-below-code/m-p/5859720#M1321213</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-15T05:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert record inside the internal table in below code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-insert-record-inside-the-internal-table-in-below-code/m-p/5859721#M1321214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  YTEST_MODIFY.

data: begin of itab occurs 1,
TOT TYPE C,
f1 type c,
f2 type c,
f3 type i ,
end of itab.

data: begin of Jtab occurs 1,
f1 type c,
f2 type c,
f3 type i ,
end of Jtab.
START-OF-SELECTION.
ITAB-f1 = 'A'.ITAB-F2 =  1.ITAB-F3 =  1.
APPEND ITAB.
ITAB-f1 = 'B'.ITAB-F2 =  1.ITAB-F3 =  1.
APPEND ITAB.
ITAB-f1 = 'C'.ITAB-F2 =  5.ITAB-F3 =  1.
APPEND ITAB.
ITAB-f1 = 'D'.ITAB-F2 =  3.ITAB-F3 =  1.
APPEND ITAB.
ITAB-f1 = 'E'.ITAB-F2 =  4.ITAB-F3 =  1.
APPEND ITAB.
ITAB-f1 = 'F'.ITAB-F2 =  2.ITAB-F3 =  1.
APPEND ITAB.
SORT ITAB BY F2.

LOOP AT ITAB.
WRITE:/ ITAB-F1 ,8 ITAB-F2 , ITAB-F3.
ENDLOOP.

LOOP AT ITAB.
IF ITAB-F2 = 1 OR ITAB-F2 = 2.
ITAB-TOT = 1.
MODIFY ITAB.
ELSEIF ITAB-F2 = 3.
ITAB-TOT = 3.
MODIFY ITAB.
ELSEIF ITAB-F3 = 4 OR ITAB-F3 = 5.
ITAB-TOT = 4.
MODIFY ITAB.
ENDIF.
ENDLOOP.

DATA: A TYPE I , B .

LOOP AT ITAB.
IF B = 0.
A = A + ITAB-F3.
ENDIF.
AT END OF TOT.
MOVE SPACE TO ITAB-F1.
MOVE SPACE TO ITAB-F2.
MOVE A TO ITAB-F3.
MODIFY ITAB .
CLEAR A.
B = 1.
ENDAT.

B = 0.
ENDLOOP.



LOOP AT ITAB.
MOVE-CORRESPONDING ITAB TO JTAB.
APPEND JTAB.
ENDLOOP.

ULINE.
LOOP AT JTAB.
WRITE: / JTAB-F1 , JTAB-F2 , JTAB-F3.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jul 2009 05:35:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-insert-record-inside-the-internal-table-in-below-code/m-p/5859721#M1321214</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-15T05:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert record inside the internal table in below code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-insert-record-inside-the-internal-table-in-below-code/m-p/5859722#M1321215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;by which field you are grouping&lt;/P&gt;&lt;P&gt; 1and 2 &lt;/P&gt;&lt;P&gt; 3 &lt;/P&gt;&lt;P&gt; 4 and 5&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jul 2009 05:39:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-insert-record-inside-the-internal-table-in-below-code/m-p/5859722#M1321215</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2009-07-15T05:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert record inside the internal table in below code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-insert-record-inside-the-internal-table-in-below-code/m-p/5859723#M1321216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SaS,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You might have to do something [similer|&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1158692"&gt;&lt;/A&gt;; where i was intended to do so for Sub-total text.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jul 2009 05:46:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-insert-record-inside-the-internal-table-in-below-code/m-p/5859723#M1321216</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-15T05:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert record inside the internal table in below code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-insert-record-inside-the-internal-table-in-below-code/m-p/5859724#M1321217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;You can see the output ....where I want the sub-total F2 when 1 &amp;amp; 2 combindely , 3 , 4&amp;amp; 5 combindely .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi Sas,&lt;/P&gt;&lt;P&gt;On what basis do you decide for which fields of F2 you have to sum F3? as in how have you decided 1-2,3,4-5...?&lt;/P&gt;&lt;P&gt;whats is the sequence?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sumit Nene&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jul 2009 05:50:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-insert-record-inside-the-internal-table-in-below-code/m-p/5859724#M1321217</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-15T05:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert record inside the internal table in below code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-insert-record-inside-the-internal-table-in-below-code/m-p/5859725#M1321218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Kulesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Consider F2 as Emp group where we HR need to identify the totals of emp gorup 1&amp;amp; 2 and 3 and 4&amp;amp;5 how many people are there.,....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So this is my requirement and F3 is the Total field which need to be inserted in between of the internal table...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So i hope you understand my requirement.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Amit that thread is TOO vast &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt; and too complicated i guess...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually a small change i need to put in my previous code...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;instead of modify i need to put insert is working but it is inserting above the end of Field...&lt;/P&gt;&lt;P&gt;But to insert in the appropraite line how ???will copy paste the code in next thread&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jul 2009 06:12:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-insert-record-inside-the-internal-table-in-below-code/m-p/5859725#M1321218</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-15T06:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert record inside the internal table in below code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-insert-record-inside-the-internal-table-in-below-code/m-p/5859726#M1321219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the solution ....i Got the answer &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; Thanks for your helping hands friends &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  YTEST_MODIFY.

DATA: BEGIN OF ITAB OCCURS 1,
TOT TYPE C,
F1 TYPE C,
F2 TYPE C,
F3 TYPE I ,
END OF ITAB.

DATA: BEGIN OF JTAB OCCURS 1,
F1 TYPE C,
F2 TYPE C,
F3 TYPE I ,
END OF JTAB.



START-OF-SELECTION.


  ITAB-F1 = 'A'.
  ITAB-F2 =  1.
  ITAB-F3 =  1.
  APPEND ITAB.

  ITAB-F1 = 'B'.
  ITAB-F2 =  1.
  ITAB-F3 =  1.
  APPEND ITAB.

  ITAB-F1 = 'C'.
  ITAB-F2 =  5.
  ITAB-F3 =  1.
  APPEND ITAB.

  ITAB-F1 = 'D'.
  ITAB-F2 =  3.
  ITAB-F3 =  1.
  APPEND ITAB.

  ITAB-F1 = 'E'.
  ITAB-F2 =  4.
  ITAB-F3 =  1.
  APPEND ITAB.

  ITAB-F1 = 'F'.
  ITAB-F2 =  2.
  ITAB-F3 =  1.
  APPEND ITAB.

  SORT ITAB BY F2.

  LOOP AT ITAB.
    WRITE:/1 ITAB-F1 ,
          8 ITAB-F2 ,
          10 ITAB-F3 .
  ENDLOOP.

  LOOP AT ITAB.
    IF ITAB-F2 = 1 OR ITAB-F2 = 2.
      ITAB-TOT = 1.
      MODIFY ITAB.
    ELSEIF ITAB-F2 = 3.
      ITAB-TOT = 3.
      MODIFY ITAB.
    ELSEIF ITAB-F2 = 4 OR ITAB-F2 = 5.
      ITAB-TOT = 4.
      MODIFY ITAB.
    ENDIF.
  ENDLOOP.


  SKIP 2.

  SORT ITAB BY TOT.

  DATA : L_SUM(2) TYPE C,
         L_ROW(2) TYPE C.

  LOOP AT ITAB.
    MOVE-CORRESPONDING ITAB TO JTAB.
    APPEND JTAB.
    L_SUM = L_SUM + ITAB-F3 .

    AT END OF TOT.
      CLEAR JTAB.
      JTAB-F3 = L_SUM .
      APPEND JTAB.
      CLEAR L_SUM.
    ENDAT.

  ENDLOOP.

  LOOP AT JTAB.
    WRITE:/1 JTAB-F1 ,
          8 JTAB-F2 ,
          10 JTAB-F3 .
  ENDLOOP.

*  DATA: a TYPE i , b .
*
*  LOOP AT itab.
*    IF b = 0.
*      a = a + itab-f3.
*    ENDIF.
*    AT END OF tot.
*      MOVE space TO itab-f1.
*      MOVE space TO itab-f2.
*      MOVE a TO itab-f3.
*      MODIFY itab .
*      CLEAR a.
*      b = 1.
*    ENDAT.
*
*    b = 0.
*  ENDLOOP.
*
*
*
*  LOOP AT itab.
*    MOVE-CORRESPONDING itab TO jtab.
*    APPEND jtab.
*  ENDLOOP.
*
*  ULINE.
*  LOOP AT jtab.
*    WRITE: / jtab-f1 , jtab-f2 , jtab-f3.
*  ENDLOOP.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jul 2009 06:25:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-insert-record-inside-the-internal-table-in-below-code/m-p/5859726#M1321219</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-15T06:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert record inside the internal table in below code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-insert-record-inside-the-internal-table-in-below-code/m-p/5859727#M1321220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hii ssaplove,&lt;/P&gt;&lt;P&gt;check the following code, its working in my system..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZTEST09
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

REPORT  ZTEST09.

data total type i.
data n type sy-tabix.
data m type sy-tabix.
data p type sy-tabix.

data: begin of itab occurs 1,
TOT TYPE C,
f1 type c,
f2 type c,
f3 type i ,
end of itab.

data: begin of Jtab occurs 1,
f1 type c,
f2 type c,
f3 type i ,
end of Jtab.
START-OF-SELECTION.
ITAB-f1 = 'A'.ITAB-F2 =  1.ITAB-F3 =  1.
APPEND ITAB.
ITAB-f1 = 'B'.ITAB-F2 =  1.ITAB-F3 =  1.
APPEND ITAB.
ITAB-f1 = 'C'.ITAB-F2 =  5.ITAB-F3 =  1.
APPEND ITAB.
ITAB-f1 = 'D'.ITAB-F2 =  3.ITAB-F3 =  1.
APPEND ITAB.
ITAB-f1 = 'E'.ITAB-F2 =  4.ITAB-F3 =  1.
APPEND ITAB.
ITAB-f1 = 'F'.ITAB-F2 =  2.ITAB-F3 =  1.
APPEND ITAB.
SORT ITAB BY F2.

loop at itab where f2 = 1 or f2 = 2.
n = sy-tabix.
total = total + itab-f3.
endloop.

n = n + 1.
CLEAR itab.
itab-tot = total.
 insert itab index n.
 clear total.
clear itab.
loop at itab from n where f2 = 3.
  m = sy-tabix.
  total = total + itab-f3.
endloop.


m = m + 1.
CLEAR itab.
itab-tot = total.
 insert itab index m.
 clear total.
clear itab.

loop at itab from m where f2 = 4 or f2 = 5.
  p = sy-tabix.
  total = total + itab-f3.
endloop.

p = p + 1.
CLEAR itab.
itab-tot = total.
 insert itab index p.
 clear total.
clear itab.

 LOOP AT itab.
 write:/ itab-f1 , itab-f2, itab-f3,itab-tot..
 endloop.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  Sub_total
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jul 2009 06:47:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-insert-record-inside-the-internal-table-in-below-code/m-p/5859727#M1321220</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-15T06:47:19Z</dc:date>
    </item>
  </channel>
</rss>

