<?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 put a file into a table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/put-a-file-into-a-table/m-p/1146359#M116277</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello i would like to know how can i put a file into a db table.&lt;/P&gt;&lt;P&gt;the file is an excel file and the first step that iam doing is to create an internal table and then i sent the file in the GUI_UPLOAD and the the internal table receice the file information , and the last step i make a loop to the internal table and i need to insert the information into the db table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please if have some examples please sent me thanks a lot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Dec 2005 23:40:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-12-30T23:40:03Z</dc:date>
    <item>
      <title>put a file into a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/put-a-file-into-a-table/m-p/1146359#M116277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello i would like to know how can i put a file into a db table.&lt;/P&gt;&lt;P&gt;the file is an excel file and the first step that iam doing is to create an internal table and then i sent the file in the GUI_UPLOAD and the the internal table receice the file information , and the last step i make a loop to the internal table and i need to insert the information into the db table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please if have some examples please sent me thanks a lot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Dec 2005 23:40:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/put-a-file-into-a-table/m-p/1146359#M116277</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-30T23:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: put a file into a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/put-a-file-into-a-table/m-p/1146360#M116278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First, I would suggest converting your excel file to a comma delimited text file.  Then you can use the following code to upload and update your custom table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001.

types: begin of ttab,
       rec(1000) type c,
       end of ttab.

types: begin of tdat,
       fld1(10) type c,
       fld2(10) type c,
       fld3(10) type c,
       end of tdat.

data: itab type table of ttab with header line.
data: idat type table of tdat with header line.

data: file_str type string.

parameters: p_file type localfile.

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.

  file_str = p_file.

  call function 'GUI_UPLOAD'
    exporting
      filename                = file_str
    tables
      data_tab                = itab
    exceptions
      file_open_error         = 1
      file_read_error         = 2
      no_batch                = 3
      gui_refuse_filetransfer = 4
      invalid_type            = 5
      no_authority            = 6
      unknown_error           = 7
      bad_data_format         = 8
      header_not_allowed      = 9
      separator_not_allowed   = 10
      header_too_long         = 11
      unknown_dp_error        = 12
      access_denied           = 13
      dp_out_of_memory        = 14
      disk_full               = 15
      dp_timeout              = 16
      others                  = 17.


  loop at itab.
    clear idat.
    split itab-rec at ',' into idat-fld1
                               idat-fld2
                               idat-fld3.
    append idat.
  endloop.

* now you have your data in specific fields of an internal table.
* you can now update your database table.

  loop at idat.
   insert zdata from idat.
  endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&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>Fri, 30 Dec 2005 23:51:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/put-a-file-into-a-table/m-p/1146360#M116278</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-12-30T23:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: put a file into a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/put-a-file-into-a-table/m-p/1146361#M116279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gilos,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is another option.. for this, you will have to save the excel file as a tab delimited .txt file..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
report zp_testbdc1.
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; TYPES
*&amp;amp;---------------------------------------------------------------------*
types:
* structure for inbound file
  begin of typ_in_file,
   field1(4),
   field2(4),
   field3(4),
  end of typ_in_file.
data:
        t_file        type typ_in_file occurs 0,
        rec_file      like line of t_file.
t_filetable type filetable,
w_filetable like file_table-filename,
w_subrc     type i.
parameters:
          p_file  like rlgrap-filename.  "file name

* get local file
at selection-screen on value-request for p_file.
  call method cl_gui_frontend_services=&amp;gt;file_open_dialog
    exporting
      window_title            = 'Choose File'
    changing
      file_table              = t_filetable
      rc                      = w_subrc
    exceptions
      file_open_dialog_failed = 1
      cntl_error              = 2
      error_no_gui            = 3
      not_supported_by_gui    = 4
      others                  = 5.

  case sy-subrc.
    when 0.
      read table t_filetable index 1 into w_filetable.
      move w_filetable to p_file.
  endcase.

* upload the file

  call method cl_gui_frontend_services=&amp;gt;gui_upload
    exporting
      filename                = p_file
      filetype                = 'ASC'
      has_field_separator     = 'X'
    changing
      data_tab                = t_file
    exceptions
      file_open_error         = 1
      file_read_error         = 2
      no_batch                = 3
      gui_refuse_filetransfer = 4
      invalid_type            = 5
      no_authority            = 6
      unknown_error           = 7
      bad_data_format         = 8
      header_not_allowed      = 9
      separator_not_allowed   = 10
      header_too_long         = 11
      unknown_dp_error        = 12
      access_denied           = 13
      dp_out_of_memory        = 14
      disk_full               = 15
      dp_timeout              = 16
      not_supported_by_gui    = 17
      error_no_gui            = 18
      others                  = 19.
  if sy-subrc eq 0.
    loop at t_file into rec_file.
* update your dbtable.
      modify ztab from rec_file.
    endloop.
  endif.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suresh Datti&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Suresh Datti&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 31 Dec 2005 00:46:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/put-a-file-into-a-table/m-p/1146361#M116279</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2005-12-31T00:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: put a file into a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/put-a-file-into-a-table/m-p/1146362#M116280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is a way to import your Excel file without changing it to a text file.  We've used the following code with great success.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM excel_import TABLES   p_tab&lt;/P&gt;&lt;P&gt;                  USING    p_filename LIKE rlgrap-filename&lt;/P&gt;&lt;P&gt;                           p_rc        LIKE sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA : t_table TYPE  alsmex_tabline OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;  DATA : gv_index TYPE i.&lt;/P&gt;&lt;P&gt;  DATA : gv_start_col TYPE i VALUE '1',&lt;/P&gt;&lt;P&gt;         gv_start_row TYPE i VALUE '1',&lt;/P&gt;&lt;P&gt;         gv_end_col   TYPE i VALUE '256',&lt;/P&gt;&lt;P&gt;         gv_end_row   TYPE i VALUE '65536'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  FIELD-SYMBOLS : &amp;lt;$fs&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            filename                = p_filename&lt;/P&gt;&lt;P&gt;            i_begin_col             = gv_start_col&lt;/P&gt;&lt;P&gt;            i_begin_row             = gv_start_row&lt;/P&gt;&lt;P&gt;            i_end_col               = gv_end_col&lt;/P&gt;&lt;P&gt;            i_end_row               = gv_end_row&lt;/P&gt;&lt;P&gt;       TABLES&lt;/P&gt;&lt;P&gt;            intern                  = t_table&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            inconsistent_parameters = 1&lt;/P&gt;&lt;P&gt;            upload_ole              = 2&lt;/P&gt;&lt;P&gt;            OTHERS                  = 3.&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;&lt;P&gt;            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  MOVE : sy-subrc TO p_rc.&lt;/P&gt;&lt;P&gt;  CHECK NOT t_table[] IS INITIAL.&lt;/P&gt;&lt;P&gt;  SORT t_table BY row col.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT t_table.&lt;/P&gt;&lt;P&gt;    MOVE : t_table-col TO gv_index.&lt;/P&gt;&lt;P&gt;    ASSIGN COMPONENT gv_index OF STRUCTURE p_tab TO &amp;lt;$fs&amp;gt;.&lt;/P&gt;&lt;P&gt;    MOVE : t_table-value TO &amp;lt;$fs&amp;gt;.&lt;/P&gt;&lt;P&gt;    AT END OF row.&lt;/P&gt;&lt;P&gt;      APPEND p_tab.&lt;/P&gt;&lt;P&gt;      CLEAR p_tab.&lt;/P&gt;&lt;P&gt;    ENDAT.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best of luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Jan 2006 21:09:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/put-a-file-into-a-table/m-p/1146362#M116280</guid>
      <dc:creator>tamra_walstrom</dc:creator>
      <dc:date>2006-01-02T21:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: put a file into a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/put-a-file-into-a-table/m-p/1146363#M116281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what if I would have to upload like 1 million records ata time from a excel file to a custom table . Is there a program that can load that many records from excel file to a custom table directly.&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;Aarav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 21:29:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/put-a-file-into-a-table/m-p/1146363#M116281</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T21:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: put a file into a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/put-a-file-into-a-table/m-p/1146364#M116282</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;   Use table mant Gen to play with millions of data....&lt;/P&gt;&lt;P&gt;just copy &amp;amp; paste, no other go...&lt;/P&gt;&lt;P&gt;I did the same way, else do the way my friends have said through code..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Krishna..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2008 04:18:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/put-a-file-into-a-table/m-p/1146364#M116282</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-04T04:18:51Z</dc:date>
    </item>
  </channel>
</rss>

