<?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: File Upload in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-upload/m-p/2652156#M611431</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You mean from your PC to your program internal 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,
       fld4(10) type c,
       fld5(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
                               idat-fld4
                               idat-fld5.
    append idat.

  endloop.


  loop at idat.
    write:/ idat-fld1, idat-fld2, idat-fld3, idat-fld4, idat-fld5.
  endloop.

&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 Aug 2007 18:51:10 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2007-08-13T18:51:10Z</dc:date>
    <item>
      <title>File Upload</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-upload/m-p/2652155#M611430</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;I am trying to upload a file from the application server&lt;/P&gt;&lt;P&gt;the location of the file is C:\Documents and Settings\rajeevgupta\My Document and the file is in the following format :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A | 100 | 00 | 12 | 08/01/2007 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please help me out how to upload this file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;P&gt;Rajeev Gupta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2007 18:46:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-upload/m-p/2652155#M611430</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-13T18:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: File Upload</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-upload/m-p/2652156#M611431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You mean from your PC to your program internal 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,
       fld4(10) type c,
       fld5(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
                               idat-fld4
                               idat-fld5.
    append idat.

  endloop.


  loop at idat.
    write:/ idat-fld1, idat-fld2, idat-fld3, idat-fld4, idat-fld5.
  endloop.

&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 Aug 2007 18:51:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-upload/m-p/2652156#M611431</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-08-13T18:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: File Upload</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-upload/m-p/2652157#M611432</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;&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;          Internal Table Types                                      *&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;data  : BEGIN OF i_FILE occurs 0 ,&lt;/P&gt;&lt;P&gt;         LINE(1000) TYPE C,&lt;/P&gt;&lt;P&gt;        END OF i_FILE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : BEGIN OF itab,&lt;/P&gt;&lt;P&gt;        VCODE(2) TYPE C,     &lt;/P&gt;&lt;P&gt;        CURR(10) TYPE C,      &lt;/P&gt;&lt;P&gt;        ODLEVEL(10) TYPE C,  &lt;/P&gt;&lt;P&gt;        DLEVEL(20) TYPE C,    &lt;/P&gt;&lt;P&gt;        EDATE(11) TYPE C,     &lt;/P&gt;&lt;P&gt;           &lt;/P&gt;&lt;P&gt;     end of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : LV_DATE TYPE D.&lt;/P&gt;&lt;P&gt;  MOVE: P_FN_IMP TO V_FILENAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-- Read the File From PC&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'GUI_UPLOAD'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      FILENAME = V_FILENAME&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      DATA_TAB = I_FILE&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      OTHERS   = 17.&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;  ELSE.&lt;/P&gt;&lt;P&gt;    LOOP AT I_FILE INTO X_FILE.&lt;/P&gt;&lt;P&gt;    split x_file at '|' into itab- VCODE,     &lt;/P&gt;&lt;P&gt;        itab-CURR      &lt;/P&gt;&lt;P&gt;        ODLEVEL  &lt;/P&gt;&lt;P&gt;        DLEVEL    &lt;/P&gt;&lt;P&gt;        EDATE.&lt;/P&gt;&lt;P&gt;append itab.&lt;/P&gt;&lt;P&gt;    endloop.&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;Mahesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2007 18:51:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-upload/m-p/2652157#M611432</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-13T18:51:56Z</dc:date>
    </item>
  </channel>
</rss>

