<?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 append problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-problem/m-p/2000552#M407150</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hallow &lt;/P&gt;&lt;P&gt;i have a problem with my table. I have I do read structure(CALL FUNCTION 'RHPH_STRUCTURE_READ' ) of org unit and I get it in order in the organization (the order I get is important) .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like that&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Org unit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;123&lt;/P&gt;&lt;P&gt;456&lt;/P&gt;&lt;P&gt;156&lt;/P&gt;&lt;P&gt;238&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; after that my program is running and If I find more data on the org.unit I doing append for more line in my table but the problem is that the line in the append come in the last line and I wont to append it in the after the line he belong to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex.&lt;/P&gt;&lt;P&gt;Org&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;123&lt;/P&gt;&lt;P&gt;123&lt;/P&gt;&lt;P&gt;456&lt;/P&gt;&lt;P&gt;456&lt;/P&gt;&lt;P&gt;156&lt;/P&gt;&lt;P&gt;238&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I now that I can do &amp;lt;b&amp;gt;sort&amp;lt;/b&amp;gt; after the append but I &amp;lt;b&amp;gt;don&amp;#146;t won&amp;lt;/b&amp;gt;t ,I wont to keep the order that I get in  structure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That i get from&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'RHPH_STRUCTURE_READ' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;their is option to do append in index or somting else&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, 14 Mar 2007 08:10:48 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-03-14T08:10:48Z</dc:date>
    <item>
      <title>append problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-problem/m-p/2000552#M407150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hallow &lt;/P&gt;&lt;P&gt;i have a problem with my table. I have I do read structure(CALL FUNCTION 'RHPH_STRUCTURE_READ' ) of org unit and I get it in order in the organization (the order I get is important) .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like that&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Org unit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;123&lt;/P&gt;&lt;P&gt;456&lt;/P&gt;&lt;P&gt;156&lt;/P&gt;&lt;P&gt;238&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; after that my program is running and If I find more data on the org.unit I doing append for more line in my table but the problem is that the line in the append come in the last line and I wont to append it in the after the line he belong to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex.&lt;/P&gt;&lt;P&gt;Org&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;123&lt;/P&gt;&lt;P&gt;123&lt;/P&gt;&lt;P&gt;456&lt;/P&gt;&lt;P&gt;456&lt;/P&gt;&lt;P&gt;156&lt;/P&gt;&lt;P&gt;238&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I now that I can do &amp;lt;b&amp;gt;sort&amp;lt;/b&amp;gt; after the append but I &amp;lt;b&amp;gt;don&amp;#146;t won&amp;lt;/b&amp;gt;t ,I wont to keep the order that I get in  structure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That i get from&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'RHPH_STRUCTURE_READ' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;their is option to do append in index or somting else&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, 14 Mar 2007 08:10:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-problem/m-p/2000552#M407150</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-14T08:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: append problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-problem/m-p/2000553#M407151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try to use&lt;/P&gt;&lt;P&gt;APPEND &amp;lt;wa&amp;gt; TO &amp;lt;itab&amp;gt; SORTED BY &amp;lt;f&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_erp2004/helpdata/en/fc/eb36c8358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_erp2004/helpdata/en/fc/eb36c8358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2007 08:14:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-problem/m-p/2000553#M407151</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-14T08:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: append problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-problem/m-p/2000554#M407152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Antonio,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use INSERT with index instead of APPEND.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;John.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2007 08:16:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-problem/m-p/2000554#M407152</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-14T08:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: append problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-problem/m-p/2000555#M407153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE ITAB1 WITH KEY ORG = ITAB-ORG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;INSERT ITAB1 INTO ITAB INDEX SY-TABIX.&amp;lt;OR YOU MAY ADD 1 TO SY-TABIX&amp;gt;.&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;REGARDS&lt;/P&gt;&lt;P&gt;SHIBA DUTTA&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2007 08:18:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-problem/m-p/2000555#M407153</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-14T08:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: append problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-problem/m-p/2000556#M407154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;lt;b&amp;gt;APPEND ... SORTED by   will not work here....&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND [wa TO] itab SORTED BY f. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;Inserts the new entry into table and re-sorts the table by the sub-field f in descending order. This only makes sense if the table was sorted beforehand. When the number of table entries reaches the OCCURS parameter value, the last entry is deleted if the value f of a new entry is greater (particularly suitable for ranked lists). You can only sort by one sub-field. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you specify wa TO , the new line is taken from the contents of the explicitly specified work area wa . Otherwise, it comes from the header line of the internal table itab . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF COMPANIES OCCURS 3,&lt;/P&gt;&lt;P&gt;        NAME(10), SALES TYPE I,&lt;/P&gt;&lt;P&gt;      END   OF COMPANIES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COMPANIES-NAME = 'big'.&lt;/P&gt;&lt;P&gt;COMPANIES-SALES = 90.&lt;/P&gt;&lt;P&gt;APPEND COMPANIES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COMPANIES-NAME = 'small'.&lt;/P&gt;&lt;P&gt;COMPANIES-SALES = 10.&lt;/P&gt;&lt;P&gt;APPEND COMPANIES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COMPANIES-NAME = 'too small'.&lt;/P&gt;&lt;P&gt;COMPANIES-SALES =  5.&lt;/P&gt;&lt;P&gt;APPEND COMPANIES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COMPANIES-NAME = 'middle'.&lt;/P&gt;&lt;P&gt;COMPANIES-SALES = 50.&lt;/P&gt;&lt;P&gt;APPEND COMPANIES SORTED BY SALES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table now has three (-&amp;gt; OCCURS 3 ) entries. The line with the contents 'too small' in the sub-field NAME is deleted from the table because the entry for 'middle' has a greater value in the sub-field SALES . This entry now appears in the second table line (after 'big' and before 'small' ). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes&lt;/P&gt;&lt;P&gt;Whenever an internal table is processed with APPEND SORTED BY , it should always be filled in this way. &lt;/P&gt;&lt;P&gt;If you specify APPEND with the parameter SORTED BY , the system always searches the entire table. Therefore, it is sometimes better to create the table with a simple APPEND and then use SORT to sort in descending ot ascending order afterwards. &lt;/P&gt;&lt;P&gt;You can also sort in ascending order by first determining the insert position with READ TABLE itab WITH KEY f = itab-f BINARY SEARCH and then by inserting the new entry into the table (perhaps read SY-SUBRC beforehand) with INSERT itab INDEX SY-TABIX . &lt;/P&gt;&lt;P&gt;However, you should be aware that, in such cases, the table may contain more entries than specified in the OCCURS parameter . &lt;/P&gt;&lt;P&gt;If several lines with an identical value f are added, lines added later are treated as smaller, i.e. they are inserted after existing lines with the same value f . &lt;/P&gt;&lt;P&gt;If you use APPEND ... SORTED BY f with an explicitly specified work area, this must be compatible with the line type of the internal table. &lt;/P&gt;&lt;P&gt;If the sort criterion f is not known until runtime, you can use SORTED BY (name) to specify it dynamically as the contents of the field name . If name is blank at runtime or contains an invalid component name, a runtime error occurs. &lt;/P&gt;&lt;P&gt;Regardless of whether you specify it statically or dynamically, you can restrict the sort criterion f further by defining an offset and/or length.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2007 08:18:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-problem/m-p/2000556#M407154</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-14T08:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: append problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-problem/m-p/2000557#M407155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi SHIBA DUTTA &lt;/P&gt;&lt;P&gt;i try like u say and i have runtime erorr&lt;/P&gt;&lt;P&gt;what can be the problem&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT emp_tab INTO wa_emp_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  READ TABLE t_itab INTO wa_t_itab&lt;/P&gt;&lt;P&gt;  WITH KEY jobid =  wa_emp_tab-stell.&lt;/P&gt;&lt;P&gt;  IF sy-subrc NE 0.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_t_itab-org_unit = wa_emp_tab-orgeh.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INSERT wa_t_itab INTO t_itab INDEX sy-tabix.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; ADD 1 TO sy-tabix.&lt;/P&gt;&lt;P&gt; CLEAR wa_t_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2007 08:50:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-problem/m-p/2000557#M407155</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-14T08:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: append problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-problem/m-p/2000558#M407156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;IF sy-subrc eq 0. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_t_itab-org_unit = wa_emp_tab-orgeh.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INSERT wa_t_itab INTO t_itab INDEX sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ADD 1 TO sy-tabix.&lt;/P&gt;&lt;P&gt;CLEAR wa_t_itab.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;wa_t_itab-org_unit = wa_emp_tab-orgeh.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append  wa_t_itab TO t_itab .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you are using ne 0 then you have to append else insert because when you are trying to insert with ne 0 the sy-tabix value is 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;shiba dutta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2007 08:56:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-problem/m-p/2000558#M407156</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-14T08:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: append problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-problem/m-p/2000559#M407157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Within a LOOP , on an internal table, you do not have to specify the insertion point with INDEX idx . The source table is then inserted before the current LOOP line in the target table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so use APPEND wa to itab.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2007 08:57:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-problem/m-p/2000559#M407157</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-14T08:57:01Z</dc:date>
    </item>
  </channel>
</rss>

