<?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 format data in internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-format-data-in-internal-table/m-p/1130732#M111629</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rich,&lt;/P&gt;&lt;P&gt;thanks very much.&lt;/P&gt;&lt;P&gt;I'll follow this method in my program.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Feb 2006 19:06:58 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-02-13T19:06:58Z</dc:date>
    <item>
      <title>how to format data in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-format-data-in-internal-table/m-p/1130729#M111626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friendz...&lt;/P&gt;&lt;P&gt;In a program i have transferred the data from a Excel Spread sheet (.xls file) to an internal table using FM &amp;lt;b&amp;gt;"ALSM_EXCEL_TO_INTERNAL_TABLE"&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The internal table is like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;begin of xl_data occurs 0,&lt;/P&gt;&lt;P&gt;     vendor name&lt;/P&gt;&lt;P&gt;     street&lt;/P&gt;&lt;P&gt;     address&lt;/P&gt;&lt;P&gt;     vat reg no&lt;/P&gt;&lt;P&gt;     bank no&lt;/P&gt;&lt;P&gt;     ........&lt;/P&gt;&lt;P&gt;     .........&lt;/P&gt;&lt;P&gt;     ........&lt;/P&gt;&lt;P&gt;end of xl_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now i have to include some more fields to this internal table and then i have to download this data to a &amp;lt;b&amp;gt;.txt&amp;lt;/b&amp;gt; file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;could you please tell me how should i do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2006 18:36:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-format-data-in-internal-table/m-p/1130729#M111626</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-13T18:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to format data in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-format-data-in-internal-table/m-p/1130730#M111627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please see this sample program.  It will upload from excel into internal table,  move data to another itab with other fields and download to C:\ drive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0002.

types: begin of ttab ,
      fld1(30) type c,
      fld2(30) type c,
      fld3(30) type c,
      fld4(30) type c,
      fld5(30) type c,
      end of ttab.

types: begin of ttab2 ,
      fld1(30) type c,
      fld2(30) type c,
      fld3(30) type c,
      fld4(30) type c,
      fld5(30) type c,
      fld6(30) type c,
      fld7(30) type c,
      end of ttab2.

data: itab type table of ttab with header line.
data: itab2 type table of ttab2 with header line.

selection-screen skip 1.
parameters: p_file type localfile default
            'C:test.txt'.
selection-screen skip 1.

at selection-screen on value-request for p_file.
  call function 'KD_GET_FILENAME_ON_F4'
       exporting
            static    = 'X'
       changing
            file_name = p_file.

start-of-selection.

  clear itab. refresh itab.
  perform upload_data.

  loop at itab.
    clear itab2.
    move-corresponding itab to itab2.
    itab2-fld6 = 'Another Field'.
    itab2-fld7 = 'No, really last one'.
    append itab2.
  endloop.


  call function 'GUI_DOWNLOAD'
       exporting
            filename = 'C:itab2.txt'
       tables
            data_tab = itab2
       exceptions
            others   = 22.


************************************************************************
* Upload_Data
************************************************************************

form upload_data.

  data: file type  rlgrap-filename.
  data: xcel type table of alsmex_tabline with header line.

  file = p_file.

  call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
       exporting
            filename                = file
            i_begin_col             = '1'
            i_begin_row             = '1'
            i_end_col               = '200'
            i_end_row               = '5000'
       tables
            intern                  = xcel
       exceptions
            inconsistent_parameters = 1
            upload_ole              = 2
            others                  = 3.

  loop at xcel.

    case xcel-col.
      when '0001'.
        itab-fld1 = xcel-value.
      when '0002'.
        itab-fld2 = xcel-value.
      when '0003'.
        itab-fld3 = xcel-value.
      when '0004'.
        itab-fld4 = xcel-value.
      when '0005'.
        itab-fld5 = xcel-value.
    endcase.

    at end of row.
      append itab.
      clear itab.
    endat.

  endloop.

endform.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2006 18:44:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-format-data-in-internal-table/m-p/1130730#M111627</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-02-13T18:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to format data in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-format-data-in-internal-table/m-p/1130731#M111628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create a new internal table with all fields in your uploaded table in same sequence &amp;amp; at last additional fields you require. Equate table as -&lt;/P&gt;&lt;P&gt;New table[] = Uploaded table[]&lt;/P&gt;&lt;P&gt;Populate data in required fields &amp;amp; download it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2006 18:47:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-format-data-in-internal-table/m-p/1130731#M111628</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-13T18:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to format data in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-format-data-in-internal-table/m-p/1130732#M111629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rich,&lt;/P&gt;&lt;P&gt;thanks very much.&lt;/P&gt;&lt;P&gt;I'll follow this method in my program.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2006 19:06:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-format-data-in-internal-table/m-p/1130732#M111629</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-13T19:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to format data in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-format-data-in-internal-table/m-p/1130733#M111630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please make sure to award points for helpful answers ans mark you post as solved when solved completely. Thanks and welcome to SDN!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2006 19:09:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-format-data-in-internal-table/m-p/1130733#M111630</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-02-13T19:09:16Z</dc:date>
    </item>
  </channel>
</rss>

