<?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 uploading excel spread sheet using gui_upload in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-excel-spread-sheet-using-gui-upload/m-p/2549152#M580239</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can any one guide me for how to upload excel spread sheet using function gui_upload.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Jul 2007 07:02:00 GMT</pubDate>
    <dc:creator>MohitSingh</dc:creator>
    <dc:date>2007-07-17T07:02:00Z</dc:date>
    <item>
      <title>uploading excel spread sheet using gui_upload</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-excel-spread-sheet-using-gui-upload/m-p/2549152#M580239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can any one guide me for how to upload excel spread sheet using function gui_upload.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2007 07:02:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-excel-spread-sheet-using-gui-upload/m-p/2549152#M580239</guid>
      <dc:creator>MohitSingh</dc:creator>
      <dc:date>2007-07-17T07:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: uploading excel spread sheet using gui_upload</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-excel-spread-sheet-using-gui-upload/m-p/2549153#M580240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Try this way and reward if found helpfull.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rakesh.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
parameters: pa_fname type rlgrap-filename.

move pa_fname to dataset.

CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    filename                      = dataset
   FILETYPE                      = 'ASC'
   HAS_FIELD_SEPARATOR           = 'X'
*   HEADER_LENGTH                 = 0
   READ_BY_LINE                  = 'X'
*   DAT_MODE                      = ' '
*   CODEPAGE                      = ' '
*   IGNORE_CERR                   = ABAP_TRUE
*   REPLACEMENT                   = '#'
*   CHECK_BOM                     = ' '
*   VIRUS_SCAN_PROFILE            =
* IMPORTING
*   FILELENGTH                    =
*   HEADER                        =
  tables
    data_tab                      = it_record
 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
          .
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.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        RAKESH S R&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2007 07:06:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-excel-spread-sheet-using-gui-upload/m-p/2549153#M580240</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-17T07:06:46Z</dc:date>
    </item>
    <item>
      <title>Re: uploading excel spread sheet using gui_upload</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-excel-spread-sheet-using-gui-upload/m-p/2549154#M580241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the FM gui_upload.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF tp_data,&lt;/P&gt;&lt;P&gt;          line(4096),&lt;/P&gt;&lt;P&gt;        END   OF tp_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: l_filename_ip TYPE string,&lt;/P&gt;&lt;P&gt;        tl_data       TYPE STANDARD TABLE OF tp_data WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  l_filename_ip = p_input.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--Upload Data&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'GUI_UPLOAD'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            filename                = l_filename_ip&lt;/P&gt;&lt;P&gt;            filetype                = 'ASC'&lt;/P&gt;&lt;P&gt;            has_field_separator     = ''&lt;/P&gt;&lt;P&gt;       TABLES&lt;/P&gt;&lt;P&gt;            data_tab                = tl_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;File name is string type so convert it into string as shown above. Now give the path of the required file and give the required extension. Extension is necessary. Give EXL fr excel sheet and TXT for notepad file etc. Call the FM and u will get all the data in the internal table tl_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now once u get all the data in tl_data u can split it into ure required internal table as shown below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Write the below logic after calling the above FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT tl_data .&lt;/P&gt;&lt;P&gt;*--Taking the contents of the input file leaving the header part&lt;/P&gt;&lt;P&gt;      PERFORM split_and_save USING tl_data-line.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " gui_upload&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  split_and_save&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Splitting the contents from the input file and saving them into&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      an internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     --&amp;gt;P_TL_DATA_LINE  text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM split_and_save USING fp_data.&lt;/P&gt;&lt;P&gt;*--Local data declaration&lt;/P&gt;&lt;P&gt;  DATA : tl_data TYPE STANDARD TABLE OF tp_data WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;         l_type  TYPE c,&lt;/P&gt;&lt;P&gt;         c_comma(1) TYPE c VALUE ','.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--Split at the Comma&lt;/P&gt;&lt;P&gt;  SPLIT fp_data AT c_comma INTO TABLE tl_data.&lt;/P&gt;&lt;P&gt;  CLEAR inputtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--Move it to the target fields&lt;/P&gt;&lt;P&gt;  DO.&lt;/P&gt;&lt;P&gt;    ASSIGN COMPONENT sy-index OF STRUCTURE inputtab TO &amp;lt;fs_field&amp;gt;.&lt;/P&gt;&lt;P&gt;    IF NOT sy-subrc IS INITIAL.&lt;/P&gt;&lt;P&gt;      EXIT.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;*--Extract source data&lt;/P&gt;&lt;P&gt;    CLEAR tl_data.&lt;/P&gt;&lt;P&gt;    READ TABLE tl_data INDEX sy-index.&lt;/P&gt;&lt;P&gt;*--Populate the target&lt;/P&gt;&lt;P&gt;    &amp;lt;fs_field&amp;gt; = tl_data-line.&lt;/P&gt;&lt;P&gt;  ENDDO.&lt;/P&gt;&lt;P&gt;*--Append this record&lt;/P&gt;&lt;P&gt;  APPEND inputtab.&lt;/P&gt;&lt;P&gt;ENDFORM.                    " split_and_save&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above code will give u the required internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Sharadendu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2007 07:10:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-excel-spread-sheet-using-gui-upload/m-p/2549154#M580241</guid>
      <dc:creator>sharadendu_agrawal</dc:creator>
      <dc:date>2007-07-17T07:10:14Z</dc:date>
    </item>
  </channel>
</rss>

