<?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 Adding fields to database table and copying data from other fields in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-database-table-and-copying-data-from-other-fields/m-p/3646706#M878201</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;I am having a database table where in I am having a column 'FIELD1'.&lt;/P&gt;&lt;P&gt;My requirement is that I want to add two more fields in the table 'FIELD2' and 'FIELD3'.&lt;/P&gt;&lt;P&gt;I then want to copy all the data in field1 to field2 and field3. then I want to delete the original field1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for Ex.&lt;/P&gt;&lt;P&gt;lets say FIELD1 = 100.&lt;/P&gt;&lt;P&gt;now I want to add FIELD2 and FIELD3 in the table and make FIELD2 = 100 AND FIELD3 = 100. The FIELD1 will be deleted from table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest the methods to do so. &lt;/P&gt;&lt;P&gt;It is urgent.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Apr 2008 11:31:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-04-10T11:31:55Z</dc:date>
    <item>
      <title>Adding fields to database table and copying data from other fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-database-table-and-copying-data-from-other-fields/m-p/3646706#M878201</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;I am having a database table where in I am having a column 'FIELD1'.&lt;/P&gt;&lt;P&gt;My requirement is that I want to add two more fields in the table 'FIELD2' and 'FIELD3'.&lt;/P&gt;&lt;P&gt;I then want to copy all the data in field1 to field2 and field3. then I want to delete the original field1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for Ex.&lt;/P&gt;&lt;P&gt;lets say FIELD1 = 100.&lt;/P&gt;&lt;P&gt;now I want to add FIELD2 and FIELD3 in the table and make FIELD2 = 100 AND FIELD3 = 100. The FIELD1 will be deleted from table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest the methods to do so. &lt;/P&gt;&lt;P&gt;It is urgent.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Apr 2008 11:31:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-database-table-and-copying-data-from-other-fields/m-p/3646706#M878201</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-10T11:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Adding fields to database table and copying data from other fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-database-table-and-copying-data-from-other-fields/m-p/3646707#M878202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gaurav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do this way ...&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data : begin of it_ztab occurs 0 with header line,
          fld1 like ztab-fld1,
          fld2 like ztab-fld2,
          fld3 like ztab-fld3,
        end of it_ztab. 

data : wa_ztab like it_ztab.

it_ztab-fld1 = '100'.
append it_ztab. 
clear    it_ztab.

loop at it_ztab.
  wa_ztab-fld2 = it_ztab-fld1.
  wa_ztab-fld3 = it_ztab-fld1.
  wa_ztab-fld1 = ' '.
* Make sure that the structure of internal table/ workarea and database table shoud be same
  modify ztab from wa_ztab.
endloop.
 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Apr 2008 11:42:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-database-table-and-copying-data-from-other-fields/m-p/3646707#M878202</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-10T11:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Adding fields to database table and copying data from other fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-database-table-and-copying-data-from-other-fields/m-p/3646708#M878203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;for ex: if your table name is  ZTABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt; it_tab type table of ZTABLE with headerline.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from ZTABLE &lt;/P&gt;&lt;P&gt;           into table it_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_itab.&lt;/P&gt;&lt;P&gt;  it_itab-field2 = it_itab-field1.&lt;/P&gt;&lt;P&gt;  it_itab-field3 = it_itab-field1.&lt;/P&gt;&lt;P&gt;  clear it_itab-field1.&lt;/P&gt;&lt;P&gt;  modify it_itab.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;modify ZTABLE  from table IT_ITAB.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Apr 2008 06:29:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-database-table-and-copying-data-from-other-fields/m-p/3646708#M878203</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-12T06:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: Adding fields to database table and copying data from other fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-database-table-and-copying-data-from-other-fields/m-p/3646709#M878204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can add fields into table using Append structure or you can use include to add the structure or fields to current table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Than write a loop to table and copy the value of the field1 to field2 and field3 and make field1 is initial than update the database table ( its compulsory otherwise this changes wont get reflected to Database.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you have to go to SE11 and select change after writing the table name and need to remove the field from the Database table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Apr 2008 12:13:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-database-table-and-copying-data-from-other-fields/m-p/3646709#M878204</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-14T12:13:39Z</dc:date>
    </item>
  </channel>
</rss>

