Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

File Upload

Former Member
0 Likes
624

Dear All,

I want to upload local file. I am using Function Module 'GUI_UPLOAD' for this. My file on PC is a Text file with semicolon as a field seperater. So, could u please give the solution for what parameters are required to pass to Function Module 'GUI_UPLOAD' for this?

Please do ASAP.

Thanks in advance,

Prasad.

5 REPLIES 5
Read only

Former Member
0 Likes
605

hi,

use <b>ws_upload.</b>

Regards,

Read only

Former Member
0 Likes
605

Prasad,

use this way. Hope this meets ur requirement

types : begin of tp_tab,

line1(2000) type c,

end of tp_tab.

data : filepath type rlgrap-filename,

table1 type standard table of tp_tab.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = filepath

filetype = 'ASC'

TABLES

data_tab = Table1

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.

Read only

Former Member
0 Likes
605

Hi Prashad,

please refer the following code hope this may help you.

types: begin of ty_itab,
        line(200)  TYPE c,   "size can varry
       end of ty_itab.

types: begin of ty_final_tab,
        name(4)  TYPE c,
        age(3)   TYPE c,
        loc(7)   TYPE c,
       end of ty_final_tab.


types: tt_itab  TYPE standard table of ty_itab,
       tt_final_tab  TYPE standard table of ty_final_tab.

data: lt_itab  TYPE tt_itab,
      ls_itab  TYPE ty_itab,

      lt_final_tab  TYPE tt_final_tab,
      ls_final_tab  TYPE ty_final_tab.

CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
   FILENAME                      = 'C:Documents and Settingsguptaram.PATNIDesktoptest.txt'
   FILETYPE                      = 'ASC'

  TABLES
    DATA_TAB                      = lt_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
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

loop at lt_itab into ls_itab.

  split ls_itab-line at ';' into ls_final_tab-name
                                 ls_final_tab-age
                                 ls_final_tab-loc.

  append ls_final_tab to lt_final_tab.

endloop.

Read only

Former Member
0 Likes
605

Hi,

Use the sampe function module with

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

filename = 'C:/Output.xls'

  • FILETYPE = 'ASC'

  • APPEND = ' '

<b> write_field_separator = 'X'</b>

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • WRITE_EOL = ABAP_TRUE

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = itab2

  • FIELDNAMES =

  • EXCEPTIONS

  • FILE_WRITE_ERROR = 1

  • NO_BATCH = 2

  • GUI_REFUSE_FILETRANSFER = 3

  • INVALID_TYPE = 4

  • NO_AUTHORITY = 5

  • UNKNOWN_ERROR = 6

  • HEADER_NOT_ALLOWED = 7

  • SEPARATOR_NOT_ALLOWED = 8

  • FILESIZE_NOT_ALLOWED = 9

  • HEADER_TOO_LONG = 10

  • DP_ERROR_CREATE = 11

  • DP_ERROR_SEND = 12

  • DP_ERROR_WRITE = 13

  • UNKNOWN_DP_ERROR = 14

  • ACCESS_DENIED = 15

  • DP_OUT_OF_MEMORY = 16

  • DISK_FULL = 17

  • DP_TIMEOUT = 18

  • FILE_NOT_FOUND = 19

  • DATAPROVIDER_EXCEPTION = 20

  • CONTROL_FLUSH_ERROR = 21

  • OTHERS = 22

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

You cant do that in the down load but before passing the data to the internal table you can just include the semi colon in your text file and make upload.

Thanks

Yogesh

Read only

Former Member
0 Likes
605

Dear All,

Thanks for your kind help!!!!!!!!!!!!!!!!!!

I am closing the tread as my question is answered.

Thank you again,

Best Regards,

Prasad.