<?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: Flat file upload in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-upload/m-p/1908504#M378427</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 can use the FM GUI_UPLOAD by passing the parameter HAS_FIELD_SEPARATOR = 'X'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the FM &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TEXT_CONVERT_XLS_TO_SAP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Feb 2007 16:50:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-02-23T16:50:37Z</dc:date>
    <item>
      <title>Flat file upload</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-upload/m-p/1908503#M378426</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;&lt;/P&gt;&lt;P&gt;     I have flat file in Excel format (***.xls) . Now i need to read .xls file into my internal table. so which procedure is best one. is it GUI_UPLOAD function with ASC format or any other best procedure for better efficiency. Plz help me out on this regard...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanking you...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2007 16:49:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-upload/m-p/1908503#M378426</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-23T16:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: Flat file upload</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-upload/m-p/1908504#M378427</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 can use the FM GUI_UPLOAD by passing the parameter HAS_FIELD_SEPARATOR = 'X'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the FM &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TEXT_CONVERT_XLS_TO_SAP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2007 16:50:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-upload/m-p/1908504#M378427</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-23T16:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: Flat file upload</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-upload/m-p/1908505#M378428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chinna,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use GUI_UPLOAD with FILETYPE as 'ASC' and HAS_FIELD_SEPARATOR as 'X' and specify FILENAME as string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the efficent way of uploading excel into internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data lv_filename type string value 'C:\MATERIALS.XLS'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF lv_filename IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'GUI_UPLOAD'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        filename                = lv_filename&lt;/P&gt;&lt;P&gt;        filetype                = 'ASC'&lt;/P&gt;&lt;P&gt;        has_field_separator     = 'X'&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;        data_tab                = it_data&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;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2007 16:55:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-upload/m-p/1908505#M378428</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-23T16:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Flat file upload</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-upload/m-p/1908506#M378429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chinna&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use any one of the below 2 Function modules&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ALSM_EXCEL_TO_INTERNAL_TABLE
GUI_UPLOAD&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;lt;/b&amp;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;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report Z_UPLOAD_EXAMPLE
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

report z_upload_example.
parameters: exl_file type rlgrap-filename.
* exl_file = p_file.

data: begin of itab occurs 0,
matnr like mara-matnr,
mtart like mara-mtart,
matkl like mara-matkl,
wrkst like mara-wrkst,
end of itab.
data: begin of itab1 occurs 0.
include structure alsmex_tabline.
data: end of itab1.

*----------------------------------------------------------------------*
* AT S E L E C T I O N S C R E E N ON VALUE REQUEST
*----------------------------------------------------------------------*
at selection-screen on value-request for exl_file.

* To get the F4 help for file
perform get_filename.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Form GET_FILENAME
*&amp;amp;---------------------------------------------------------------------*
* This routine allows user to select the input file path
*----------------------------------------------------------------------*

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Form get_filename
*&amp;amp;---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --&amp;gt; p1 text
* &amp;lt;-- p2 text
*----------------------------------------------------------------------*
form get_filename .
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
* FIELD_NAME = ' '
importing
file_name = exl_file.
.

endform. " get_filename




start-of-selection.

perform upload_data.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Form upload_data
*&amp;amp;---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --&amp;gt; p1 text
* &amp;lt;-- p2 text
*----------------------------------------------------------------------*
form upload_data .
data: v_file type string.
v_file = exl_file.

call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = exl_file
i_begin_col = 1
i_begin_row = 1
i_end_col = 4
i_end_row = 4
tables
intern = itab1
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.




endform. " upload_data



end-of-selection.

sort itab1 by row.
loop at itab1.
case itab1-col.
when '0001'.
itab-matnr = itab1-value.
when '0002'.
itab-mtart = itab1-value.
when '0003'.
itab-matkl = itab1-value.
when '0004'.
itab-wrkst = itab1-value.
endcase.

at end of row.
append itab.
clear itab.
endat.
endloop.

loop at itab.
write :/ itab.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Naresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2007 17:04:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-upload/m-p/1908506#M378429</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-23T17:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: Flat file upload</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-upload/m-p/1908507#M378430</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;&lt;/P&gt;&lt;P&gt;     Thanking you all giving me your valueable time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chinna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2007 19:10:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-upload/m-p/1908507#M378430</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-23T19:10:22Z</dc:date>
    </item>
  </channel>
</rss>

