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

Issue related to 'UPLOAD' function module

Former Member
0 Likes
741

Hi folks,

I am using 'UPLOAD' FM to upload a text file into the internal table from the presentation server. I have two text files that exactly identical. The file layouts, strucutre are the same only the data is different. The interesting thing is the first file is getting uploaded into the internal table, while the second no data is coming through. I have thoroughly checked the two files, there is no difference in the two.TXT files.

Here is the code...

CALL FUNCTION 'UPLOAD'

Exporting

filename = 'C:\HOA_ABC.txt

filetype = 'DAT'

Tables

data_tab = itab

.....

What can be the reason for this? Is there a problem with 'UPLOAD" FM ?

I have used this FM quite often and works fine, I am unable to discover what might be wrong in the second file?

Let me know,

Thanks,

VG

6 REPLIES 6
Read only

Former Member
0 Likes
714

hi,

r U trying to upload the 2 files in the same prog?

If so, I suggest check clearing/ refreshing internal tables/ variables before the FM is used 2nd time.

Rgds,

Raghu.

Read only

Former Member
0 Likes
714

hi,

Refresh itab data before you upload the second file ...

i.e,


REFRESH ITAB. 

Regards,

Santosh

Read only

Former Member
0 Likes
714

Hi Vinu,

Try using the FM "GUI_UPLOAD".


call function 'GUI_UPLOAD'
  exporting
    filename                      = filename
    filetype                      = filetype
    has_field_separator           = has_field_separator
    header_length                 = header_length
    read_by_line                  = read_by_line
    dat_mode                      = dat_mode
    codepage                      = codepage
    ignore_cerr                   = ignore_cerr
    replacement                   = replacement
    virus_scan_profile            = virus_scan_profile
  importing
    filelength                    = filelength
    header                        = header
  tables
    data_tab                      = data_tab
  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.
    case sy-subrc.
      when 1.
        raise file_open_error.
      when 2.
        raise file_read_error.
      when 3.
        raise no_batch.
      when 4.
        raise gui_refuse_filetransfer.
      when 5.
        raise invalid_type.
      when 6.
        raise no_authority.
      when 7.
        raise unknown_error.
      when 8.
        raise bad_data_format.
      when 9.
        raise header_not_allowed.
      when 10.
        raise separator_not_allowed.
      when 11.
        raise header_too_long.
      when 12.
        raise unknown_dp_error.
      when 13.
        raise access_denied.
      when 14.
        raise dp_out_of_memory.
      when 15.
        raise disk_full.
      when 16.
        raise dp_timeout.
      when others.
        raise unknown_error.
    endcase.
  endif.

&***************<removed_by_moderator>*******************&

PS: I will start removing points from now onward...

Edited by: Julius Bussche on Jun 23, 2008 11:01 PM

Read only

0 Likes
714

No. I am uploading them one by one. Is the FM not very consistent one? I upload the first file that goes fine The second one comes up with this wierd stuff. Anyway going forward I believe should use GUI_UPLOAD that can take different formats.

I shall take a look inot it. Thanks for the reply.

VG

Read only

0 Likes
714

check this sample code for gui_upload, you can have ASC.. BIN.. modes...


CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_filename_string
filetype = 'ASC'
has_field_separator = 'X'

    * HEADER_LENGTH = 0
    * READ_BY_LINE = 'X'

dat_mode = ''

    * IMPORTING
    * FILELENGTH =
    * HEADER =

TABLES
data_tab = i_text_data
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.

Read only

0 Likes
714

Thanks for the repsonse. I figured out the issue.

VG