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

Problem with GUI_UPLOAD FM

Former Member
0 Likes
1,980

Hi All,

I have trouble using the FM GUI_UPLOAD. I am using this FM to upload text-delimited file data into an ITAB of same structure. The problem is that it is reading only the 1st record and returning sy-subrc = 8. The no of columns in file is 89. When I am reducing the no of columns of this file, then it is reading the data. There is not data format conversion problem, I have check the same. Does any one know why this is happening? Thanks in advance.

Regards,

Prashant.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,445

data : begin of lt_d occurs 0,

data type string,

end of lt_d.

Use this for the upload function module

Gui_upload and u have the data in lt_d.

delete lt_d where data is initial.

loop at lt_d.

split : lt_d at separator into

wa_itab .....

append wa_itab to itab.

endloop.

use this ...

8 REPLIES 8
Read only

Former Member
0 Likes
1,445

Dear Prashant,

I think you need to check your Function parameters.

Check for Tab settings also.

It will sure work.

All the best.

-Maharshi

Read only

Former Member
0 Likes
1,445

Hi,

I don't see the problem there. Following are the parameters used by me in the FM:

EXPORTING

filename = l_file

filetype = 'ASC'

has_field_separator = 'X'

read_by_line = 'X'

TABLES

data_tab = it_conv_data.

FYI the FM is not working with or without the parameter read_by_line.

Reagards,

Prashant

Read only

Former Member
0 Likes
1,445

Hi Prashant,,,,,

The Function Parameters are good, Just remove READ_BY_LINE Parameter,,,,,,,,

The Possible exception could be "BAD_DATA_FORMAT" as the function module Cannot Interpret Data in File

Please Check your file as there is no other reason for this exception,,,,,,,

Try uploading with another file,,,,,

Thanks

Saurabh

Read only

Former Member
0 Likes
1,446

data : begin of lt_d occurs 0,

data type string,

end of lt_d.

Use this for the upload function module

Gui_upload and u have the data in lt_d.

delete lt_d where data is initial.

loop at lt_d.

split : lt_d at separator into

wa_itab .....

append wa_itab to itab.

endloop.

use this ...

Read only

Former Member
0 Likes
1,445

Hi Saurabh,

As mentioned earlier it is not working with or without read_by_line. Any other ideas. I have tested the program with multiple text files but no luck.

Reagards,

Prashant.

Read only

Former Member
0 Likes
1,445

hi prashant,

try this oops concept.

CALL METHOD cl_gui_frontend_services=>gui_upload

EXPORTING

filename = l_v_filepc

filetype = 'TXT'

has_field_separator = ' '

  • header_length = 0

  • read_by_line = 'X'

  • dat_mode = SPACE

  • codepage = SPACE

  • ignore_cerr = ABAP_TRUE

  • replacement = '#'

  • virus_scan_profile =

  • IMPORTING

  • filelength =

  • header =

CHANGING

data_tab = fp_it_pernr_infty "fp_it_pernr

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

not_supported_by_gui = 17

error_no_gui = 18

OTHERS = 19 .

IF sy-subrc <> 0.

...

ENDIF.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,445

Hi Prashant,

Save your records in an excel file as 'TEXT DELIMITED' file type and pass this text file.

In the GUI_UPLOAD function module, try using these parameters only.


  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
     FILENAME                     = 'c:\vendors.txt'
     FILETYPE                      = 'DAT'
    TABLES
      DATA_TAB                    = VENDOR_TAB.

Hope this solves your problem.

Thanks & Regards.

Tarun Gambhir.

Edited by: Tarun Gambhir on Dec 1, 2008 11:28 AM

Read only

Former Member
0 Likes
1,445

Thanks everybody for help.

Regards,

Prashant.