<?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: Internal table into database table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-into-database-table/m-p/3872824#M930900</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Ankit...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ur qstn is a very tricky one.... u want to populate from the same row ....... this wil be trouble.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i dont think this is possible. but if u have different rows for the three values, then it is possible.&lt;/P&gt;&lt;P&gt;use two workareas and use nested loops. &lt;/P&gt;&lt;P&gt;like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop itab into wa1.&lt;/P&gt;&lt;P&gt;loop itab into wa2.&lt;/P&gt;&lt;P&gt;insert into DBTAB values wa2-val1 wa2-val2.....&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will help but in the case that i hav mentioned above.&lt;/P&gt;&lt;P&gt;otherwise.... m not sure...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 May 2008 11:19:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-05-26T11:19:03Z</dc:date>
    <item>
      <title>Internal table into database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-into-database-table/m-p/3872821#M930897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have an internal table having a structure like below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Account Entity Category period1value pd2value&lt;/P&gt;&lt;P&gt;10 A C 100 200.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where account corresponds to 10&lt;/P&gt;&lt;P&gt;entity A&lt;/P&gt;&lt;P&gt;category C&lt;/P&gt;&lt;P&gt;period1 value = 100&lt;/P&gt;&lt;P&gt;period2 value = 200.&lt;/P&gt;&lt;P&gt;period3 value =300&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I need to populate it into a database table having structure like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Account Entity Category period Value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;10 A C 1 100&lt;/P&gt;&lt;P&gt;10 A C 2 200.&lt;/P&gt;&lt;P&gt;10 A C 3 300&lt;/P&gt;&lt;P&gt;If u see this carefully a new column, period is added in the database table and thus for each row there will be only 1value.&lt;/P&gt;&lt;P&gt;Instead of period1 value and period2 value being in the same row they will come in different rows.One row will be like the value for period1 and next for value like period2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pleadse help&lt;/P&gt;&lt;P&gt;Ankit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2008 11:07:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-into-database-table/m-p/3872821#M930897</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-26T11:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table into database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-into-database-table/m-p/3872822#M930898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at itab.
ztable-Account = itab-Account.  
ztable-Entity = itab-Entity.
ztable-Category = itab-Category.
ztable-period_Value = itab-period_Value1.
insert ztable.
if itab-period_Value2 is not initial.
ztable-period_Value = itab-period_Value2.
insert ztable.
endif.
if itab-period_Value3 is not initial.
ztable-period_Value = itab-period_Value3.
insert ztable.
endif.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds,&lt;/P&gt;&lt;P&gt;bharat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2008 11:16:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-into-database-table/m-p/3872822#M930898</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-26T11:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table into database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-into-database-table/m-p/3872823#M930899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per your requirement, in the table first three fields are to be primary key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While looping the internal table INSERT the records by giving period value using counter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;counter = 1.
loop at itab into wa_itab.

counter = counter + 1.
wa_itab1-Account = wa_itab-Account.
wa_itab1-Entity = wa_itab-Entity.
wa_itab1-Category = wa_itab-Category.
wa_itab1-period = counter.
wa_itab1-Value = wa_itab-period1.

INSERT &amp;lt;your table name&amp;gt; from wa_itab1.

if wa_itab-period2 is not initial.
counter = counter + 1.
clear wa_itab1.

wa_itab1-Account = wa_itab-Account.
wa_itab1-Entity = wa_itab-Entity.
wa_itab1-Category = wa_itab-Category.
wa_itab1-period = counter.
wa_itab1-Value = wa_itab-period2.

INSERT &amp;lt;your table name&amp;gt; from wa_itab1.

endif.

clear : wa_itab, wa_itab1.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raghu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2008 11:17:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-into-database-table/m-p/3872823#M930899</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-26T11:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table into database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-into-database-table/m-p/3872824#M930900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Ankit...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ur qstn is a very tricky one.... u want to populate from the same row ....... this wil be trouble.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i dont think this is possible. but if u have different rows for the three values, then it is possible.&lt;/P&gt;&lt;P&gt;use two workareas and use nested loops. &lt;/P&gt;&lt;P&gt;like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop itab into wa1.&lt;/P&gt;&lt;P&gt;loop itab into wa2.&lt;/P&gt;&lt;P&gt;insert into DBTAB values wa2-val1 wa2-val2.....&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will help but in the case that i hav mentioned above.&lt;/P&gt;&lt;P&gt;otherwise.... m not sure...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2008 11:19:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-into-database-table/m-p/3872824#M930900</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-26T11:19:03Z</dc:date>
    </item>
  </channel>
</rss>

