<?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: modifying one table from two internal tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/modifying-one-table-from-two-internal-tables/m-p/8024659#M1609216</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mrinmoy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No Key field has been changed . &lt;/P&gt;&lt;P&gt;System has to create a new records with status 10  by incrementing the countno by 1 and update the table  and update the original record with status 14 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bharat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jul 2011 05:29:29 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-07-14T05:29:29Z</dc:date>
    <item>
      <title>modifying one table from two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modifying-one-table-from-two-internal-tables/m-p/8024657#M1609214</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 a having a basic alv list records with check boxes . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Example in the Basic list  : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WH         Rectyp     Count List No         Docmnt no       Count No.        Status No  Blocking Reason Code&lt;/P&gt;&lt;P&gt;012        CC             0001                      0000000001          001                   13              A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I select the check box for the above record and click on a push button "Recount'.&lt;/P&gt;&lt;P&gt;system has to  create a new record in the database table (ex:/tdit/sc_workltu) with the same record details but by incrementing  Count No by 1  and it has to change the status to 10 .After creating a new record it has to update the original record with the status 14 instead of 13 . as shown below &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;             WH         Rectyp     Count List No         Docmnt no       Count No.        Status No  Blocking Reason Code&lt;/P&gt;&lt;P&gt;Orig       012        CC             0001                      0000000001          001                   13              A&lt;/P&gt;&lt;P&gt;New      012        CC             0001                      0000000001          002                   10              A&lt;/P&gt;&lt;P&gt;Updorg  012        CC             0001                      0000000001          001                   14              A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had written the code but I am unable to create a new with all  field data it is only updating the status with 10 and remainig fields are getting empty .&lt;/P&gt;&lt;P&gt;like &lt;/P&gt;&lt;P&gt;             WH         Rectyp     Count List No         Docmnt no       Count No.        Status No  Blocking Reason Code&lt;/P&gt;&lt;P&gt;New                                                                                10              &lt;/P&gt;&lt;P&gt;Updorg  012        CC             0001                      0000000001          001                   14              A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Code : &lt;/P&gt;&lt;P&gt;DATA: lt_tasks TYPE STANDARD TABLE OF zrf2_tasks,&lt;/P&gt;&lt;P&gt;        ls_tasks LIKE LINE OF lt_tasks,&lt;/P&gt;&lt;P&gt;        lt_new   TYPE STANDARD TABLE OF /tdit/sc_workltu,&lt;/P&gt;&lt;P&gt;        ls_new   LIKE LINE OF lt_new,&lt;/P&gt;&lt;P&gt;        lt_orig   TYPE STANDARD TABLE OF /tdit/sc_workltu,&lt;/P&gt;&lt;P&gt;        ls_orig   LIKE LINE OF lt_orig.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT gt_final INTO ls_final WHERE check_box EQ 'X' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF ls_final-status EQ '13' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Increase the count number by 1&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      ls_new = ls_final.&lt;/P&gt;&lt;P&gt;      ls_new-counum = ls_final-counum  + 1.&lt;/P&gt;&lt;P&gt;      ls_new-status = '10'.&lt;/P&gt;&lt;P&gt;      APPEND ls_new TO lt_new.&lt;/P&gt;&lt;P&gt;      CLEAR ls_new.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; MODIFY /tdit/sc_workltu FROM table lt_new.&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;update original task to status 14&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      ls_orig = ls_new = ls_final.&lt;/P&gt;&lt;P&gt;      ls_orig-belnum = ls_final-belnum.&lt;/P&gt;&lt;P&gt;      ls_orig-status = '14'.&lt;/P&gt;&lt;P&gt;      APPEND ls_orig TO lt_orig.&lt;/P&gt;&lt;P&gt;      CLEAR ls_orig.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Determine input parameters for walksequence&lt;/P&gt;&lt;P&gt;      ls_tasks-belnum = ls_final-belnum.&lt;/P&gt;&lt;P&gt;      ls_tasks-wzone = ls_final-wzone.&lt;/P&gt;&lt;P&gt;      ls_tasks-lgnum = ls_final-lgnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      SELECT SINGLE reihf&lt;/P&gt;&lt;P&gt;            FROM lagp&lt;/P&gt;&lt;P&gt;            INTO ls_tasks-reihf&lt;/P&gt;&lt;P&gt;            WHERE lgnum = ls_final-lgnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      APPEND ls_tasks TO lt_tasks.&lt;/P&gt;&lt;P&gt;      CLEAR ls_tasks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;      IF ls_final-status = '10' OR&lt;/P&gt;&lt;P&gt;         ls_final-status = '11' OR&lt;/P&gt;&lt;P&gt;         ls_final-status = '12' OR&lt;/P&gt;&lt;P&gt;         ls_final-status = '16' OR&lt;/P&gt;&lt;P&gt;         ls_final-status = '17'.&lt;/P&gt;&lt;P&gt;         ls_tasks-belnum = ls_final-belnum.&lt;/P&gt;&lt;P&gt;         ls_tasks-wzone  = ls_final-wzone.&lt;/P&gt;&lt;P&gt;         ls_tasks-lgnum  = ls_final-lgnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        SELECT SINGLE reihf&lt;/P&gt;&lt;P&gt;               FROM lagp&lt;/P&gt;&lt;P&gt;               INTO ls_tasks-reihf&lt;/P&gt;&lt;P&gt;               WHERE lgnum = ls_final-lgnum.&lt;/P&gt;&lt;P&gt;        APPEND ls_tasks TO lt_tasks.&lt;/P&gt;&lt;P&gt;        CLEAR ls_tasks.&lt;/P&gt;&lt;P&gt;&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;P&gt;&lt;/P&gt;&lt;P&gt;  MODIFY /tdit/sc_workltu FROM table lt_orig.&lt;/P&gt;&lt;P&gt;  MODIFY /tdit/sc_workltu FROM table lt_new.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please verify the code and provide me the solution &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;&amp;lt;&amp;lt; Moderator message - Everyone's problem is important. But the answers in the forum are provided by volunteers. Please do not ask for help quickly. &amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bharat Kumar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on Jul 14, 2011 10:44 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2011 05:05:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modifying-one-table-from-two-internal-tables/m-p/8024657#M1609214</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-07-14T05:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: modifying one table from two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modifying-one-table-from-two-internal-tables/m-p/8024658#M1609215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bharat,&lt;/P&gt;&lt;P&gt;     Though I am not sure if your table key field got changed or not. If not then it should not create a new entry. Also you can out commit work after modifying the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Mrinmoy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2011 05:12:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modifying-one-table-from-two-internal-tables/m-p/8024658#M1609215</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-07-14T05:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: modifying one table from two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modifying-one-table-from-two-internal-tables/m-p/8024659#M1609216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mrinmoy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No Key field has been changed . &lt;/P&gt;&lt;P&gt;System has to create a new records with status 10  by incrementing the countno by 1 and update the table  and update the original record with status 14 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bharat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2011 05:29:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modifying-one-table-from-two-internal-tables/m-p/8024659#M1609216</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-07-14T05:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: modifying one table from two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modifying-one-table-from-two-internal-tables/m-p/8024660#M1609217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bharath,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When u modify the standard table check for sy-subrc if its 0, then use insert statement to add a new record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Shafiq.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2011 07:03:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modifying-one-table-from-two-internal-tables/m-p/8024660#M1609217</guid>
      <dc:creator>shafiqahmed_khan</dc:creator>
      <dc:date>2011-07-14T07:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: modifying one table from two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modifying-one-table-from-two-internal-tables/m-p/8024661#M1609218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;if i understand the problem correctly, try&lt;/P&gt;&lt;P&gt;loop at lt_orig .&lt;/P&gt;&lt;P&gt;  read table lt_new with &amp;lt;key_fields&amp;gt; .&lt;/P&gt;&lt;P&gt;  move-corresponding lt_orig to &amp;lt;db_table&amp;gt; .&lt;/P&gt;&lt;P&gt;  move-corresponding lt_new to &amp;lt;db_table&amp;gt;.&lt;/P&gt;&lt;P&gt;  modify &amp;lt;db_table&amp;gt; .&lt;/P&gt;&lt;P&gt;endloop .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Burak&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2011 11:26:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modifying-one-table-from-two-internal-tables/m-p/8024661#M1609218</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-07-14T11:26:25Z</dc:date>
    </item>
  </channel>
</rss>

