<?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: Problem uploading data from an excel file using 'GUI_UPLOAD' in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-uploading-data-from-an-excel-file-using-gui-upload/m-p/4311939#M1027896</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;  As others have told you, use ALSM_EXCEL_TO_INTERNAL_TABLE function module, for reference &lt;/P&gt;&lt;P&gt;  Check out this sample code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  z_file3.

DATA: fname(40),
      w_line TYPE i VALUE 1,
      w_file TYPE rlgrap-filename.

DATA:
  t_tab LIKE
  TABLE OF ALSMEX_TABLINE
  WITH HEADER LINE.

DATA: fs_tab LIKE LINE OF t_tab.


w_file = 'C:\Documents and Settings\ABC\Desktop\Book1.xls'.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
  EXPORTING
    filename                      = w_file
    i_begin_col                   = 1
    i_begin_row                   = 1
    i_end_col                     = 10
    i_end_row                     = 100
  tables
    intern                        = t_tab
 EXCEPTIONS
   INCONSISTENT_PARAMETERS       = 1
   UPLOAD_OLE                    = 2
   OTHERS                        = 3
          .
IF sy-subrc NE 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
  WRITE: 'UPLOAD SUCCESSFUL'.
ENDIF.

fname = '.\z_file.xls'.
OPEN DATASET fname FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT t_tab INTO fs_tab.
  TRANSFER fs_tab TO fname.
ENDLOOP.

IF sy-subrc EQ 0.
  WRITE: / 'FILE OPENED ON APPS SERVER'.
ELSE.
  WRITE: / 'FILE COULD NOT BE OPENED'.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Abhijeet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Aug 2008 06:29:23 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-01T06:29:23Z</dc:date>
    <item>
      <title>Problem uploading data from an excel file using 'GUI_UPLOAD'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-uploading-data-from-an-excel-file-using-gui-upload/m-p/4311933#M1027890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi gurus, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am in a need to upload data from an excel file. &lt;/P&gt;&lt;P&gt;I tried using 'GUI_UPLOAD' function , but the file is not being opened. &lt;/P&gt;&lt;P&gt;I am getting an exception message that 'file open error'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am giving the file type as 'XLS' , I have tried using file types as 'BIN' and 'DAT' , but still not working. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what i am giving, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : it_lum TYPE TABLE OF  z0pm_u9_vm_lum, &lt;/P&gt;&lt;P&gt;           it_brkt TYPE TABLE OF z0pm_u9_vm_brkt, &lt;/P&gt;&lt;P&gt;           file_name TYPE string. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;file_name = 'E:\ZQRY_IPOWER_Z0PM_U9_VM_LUM'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'GUI_UPLOAD' &lt;/P&gt;&lt;P&gt;  EXPORTING &lt;/P&gt;&lt;P&gt;    filename                      = file_name &lt;/P&gt;&lt;P&gt;   filetype                      = 'XLS' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  TABLES &lt;/P&gt;&lt;P&gt;    data_tab                      = it_lum &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXCEPTIONS &lt;/P&gt;&lt;P&gt;   file_open_error               = 1 &lt;/P&gt;&lt;P&gt;   file_read_error               = 2 &lt;/P&gt;&lt;P&gt;   no_batch                      = 3 &lt;/P&gt;&lt;P&gt;   gui_refuse_filetransfer       = 4 &lt;/P&gt;&lt;P&gt;   invalid_type                  = 5 &lt;/P&gt;&lt;P&gt;   no_authority                  = 6 &lt;/P&gt;&lt;P&gt;   unknown_error                 = 7 &lt;/P&gt;&lt;P&gt;   bad_data_format               = 8 &lt;/P&gt;&lt;P&gt;   header_not_allowed            = 9 &lt;/P&gt;&lt;P&gt;   separator_not_allowed         = 10 &lt;/P&gt;&lt;P&gt;   header_too_long               = 11 &lt;/P&gt;&lt;P&gt;   unknown_dp_error              = 12 &lt;/P&gt;&lt;P&gt;   access_denied                 = 13 &lt;/P&gt;&lt;P&gt;   dp_out_of_memory              = 14 &lt;/P&gt;&lt;P&gt;   disk_full                     = 15 &lt;/P&gt;&lt;P&gt;   dp_timeout                    = 16 &lt;/P&gt;&lt;P&gt;   OTHERS                        = 17 &lt;/P&gt;&lt;P&gt;          . &lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0. &lt;/P&gt;&lt;P&gt;  MODIFY z0pm_u9_vm_lum FROM TABLE it_lum. &lt;/P&gt;&lt;P&gt;  WRITE : / ' UPLOAD SUCCESS ' . &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any pointers on this, will be really appreciated. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance. &lt;/P&gt;&lt;P&gt;Yatin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2008 06:03:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-uploading-data-from-an-excel-file-using-gui-upload/m-p/4311933#M1027890</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-01T06:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Problem uploading data from an excel file using 'GUI_UPLOAD'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-uploading-data-from-an-excel-file-using-gui-upload/m-p/4311934#M1027891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Use the FM  'alsm_excel_to_internal_table  '.This is a better approach becuase you can retrieve the data from the excel sheet row wise and column wise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Divya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2008 06:08:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-uploading-data-from-an-excel-file-using-gui-upload/m-p/4311934#M1027891</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-01T06:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: Problem uploading data from an excel file using 'GUI_UPLOAD'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-uploading-data-from-an-excel-file-using-gui-upload/m-p/4311935#M1027892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use trh FM &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ALSM_EXCEL_TO_INTERNAL_TABLE for uploading Excel file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2008 06:11:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-uploading-data-from-an-excel-file-using-gui-upload/m-p/4311935#M1027892</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-01T06:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problem uploading data from an excel file using 'GUI_UPLOAD'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-uploading-data-from-an-excel-file-using-gui-upload/m-p/4311936#M1027893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hiii&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for uploading excel file use below code..here gui_upload will not work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*Upload data from Excel sheet to internal table.
  CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
      filename                = p_pfile
      i_begin_col             = 1
      i_begin_row             = 2
      i_end_col               = 13
      i_end_row               = 8
    TABLES
      intern                  = it_excel
    EXCEPTIONS
      inconsistent_parameters = 1
      upload_ole              = 2
      OTHERS                  = 3.
  IF sy-subrc &amp;lt;&amp;gt; 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


*Populate data to internal tables and structures

  SORT it_excel BY row col.

  LOOP AT it_excel INTO ls_excel.

    CASE ls_excel-col.
      WHEN 1.
        ls_data-rec_no = ls_excel-value.
        IF ls_data-rec_no NE w_docno.
          WRITE:
            'You Have Entered wrong Document Number'.
        ELSE.
          WRITE:
            'Document Number Same'.
        ENDIF.                         " IF ls_data-rec_no NE w_docno.
      WHEN 2.
        ls_data-doc_type = ls_excel-value.
      WHEN 3.
        ls_data-doc_part = ls_excel-value.
      WHEN 4.
        ls_data-doc_ver = ls_excel-value.
      WHEN 5.
        ls_data-application = ls_excel-value.
      WHEN 6.
        ls_data-data_car = ls_excel-value.
      WHEN 7.
        ls_data-file_path = ls_excel-value.
      WHEN 8.
        ls_data-matnr = ls_excel-value.

    ENDCASE.                           " CASE ls_excel-col.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;twinkal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2008 06:12:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-uploading-data-from-an-excel-file-using-gui-upload/m-p/4311936#M1027893</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-01T06:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problem uploading data from an excel file using 'GUI_UPLOAD'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-uploading-data-from-an-excel-file-using-gui-upload/m-p/4311937#M1027894</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;you cannot specify filetype as XLS. It can be either BIN, DAT or ASC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try using ASC and set HAS_FIELD_SEPARATOR = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mohaiyuddin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Mohaiyuddin Soniwala on Aug 1, 2008 11:57 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2008 06:24:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-uploading-data-from-an-excel-file-using-gui-upload/m-p/4311937#M1027894</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-01T06:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problem uploading data from an excel file using 'GUI_UPLOAD'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-uploading-data-from-an-excel-file-using-gui-upload/m-p/4311938#M1027895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yatin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lcl_filename
filetype = 'ASC'"&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;check this
has_field_separator = 'X'"&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;also this
TABLES
data_tab = i_input
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.

You can also use this FM TEXT_CONVERT_XLS_TO_SAP
Chk this Link
&amp;lt;a class="jive_macro jive_macro_message" href="" __jive_macro_name="message" modifiedtitle="true" __default_attr="1298016"&amp;gt;&amp;lt;/a&amp;gt;

&amp;lt;a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="104327"&amp;gt;&amp;lt;/a&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2008 06:25:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-uploading-data-from-an-excel-file-using-gui-upload/m-p/4311938#M1027895</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-01T06:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem uploading data from an excel file using 'GUI_UPLOAD'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-uploading-data-from-an-excel-file-using-gui-upload/m-p/4311939#M1027896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;  As others have told you, use ALSM_EXCEL_TO_INTERNAL_TABLE function module, for reference &lt;/P&gt;&lt;P&gt;  Check out this sample code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  z_file3.

DATA: fname(40),
      w_line TYPE i VALUE 1,
      w_file TYPE rlgrap-filename.

DATA:
  t_tab LIKE
  TABLE OF ALSMEX_TABLINE
  WITH HEADER LINE.

DATA: fs_tab LIKE LINE OF t_tab.


w_file = 'C:\Documents and Settings\ABC\Desktop\Book1.xls'.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
  EXPORTING
    filename                      = w_file
    i_begin_col                   = 1
    i_begin_row                   = 1
    i_end_col                     = 10
    i_end_row                     = 100
  tables
    intern                        = t_tab
 EXCEPTIONS
   INCONSISTENT_PARAMETERS       = 1
   UPLOAD_OLE                    = 2
   OTHERS                        = 3
          .
IF sy-subrc NE 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
  WRITE: 'UPLOAD SUCCESSFUL'.
ENDIF.

fname = '.\z_file.xls'.
OPEN DATASET fname FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT t_tab INTO fs_tab.
  TRANSFER fs_tab TO fname.
ENDLOOP.

IF sy-subrc EQ 0.
  WRITE: / 'FILE OPENED ON APPS SERVER'.
ELSE.
  WRITE: / 'FILE COULD NOT BE OPENED'.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Abhijeet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2008 06:29:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-uploading-data-from-an-excel-file-using-gui-upload/m-p/4311939#M1027896</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-01T06:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problem uploading data from an excel file using 'GUI_UPLOAD'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-uploading-data-from-an-excel-file-using-gui-upload/m-p/4311940#M1027897</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;At the time of excuting program the file is opened  at that time it will gives file_open_error . Pls check that file is closed or not.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2008 06:40:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-uploading-data-from-an-excel-file-using-gui-upload/m-p/4311940#M1027897</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-01T06:40:36Z</dc:date>
    </item>
  </channel>
</rss>

