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

i chaned the function from upload to gui upload

Former Member
0 Likes
1,107

hi all,

i would like to change the function for uploading a flat file for BDC

i was using CALL FUNCTION ' GUI UPLOAD'

  • EXPORTING

  • filename = 'C:\data\'

  • filetype = 'DAT'

  • TABLES

  • data_tab = it_data

  • EXCEPTIONS

  • conversion_error = 1

  • invalid_table_width = 2

  • invalid_type = 3

  • no_batch = 4

  • unknown_error = 5

  • OTHERS = 6.

  • IF sy-subrc <> 0.

  • WRITE:/ 'Unable to read the input file'.

  • STOP.

  • ENDIF.

  • MESSAGE s090 WITH 'Completed Uploading. Processing Data.....'.

but now i wana to use CALL FUNCTION 'GUI_UPLOAD'

i used but but its giving in "<i><b>wrong file format</b></i>" type as error message!

please help me out!!!

hi all,

i would like to change the function for uploading a flat file for BDC

i was using CALL FUNCTION ' GUI UPLOAD'

  • EXPORTING

  • filename = 'C:\data\'

  • filetype = 'DAT'

  • TABLES

  • data_tab = it_data

  • EXCEPTIONS

  • conversion_error = 1

  • invalid_table_width = 2

  • invalid_type = 3

  • no_batch = 4

  • unknown_error = 5

  • OTHERS = 6.

  • IF sy-subrc <> 0.

  • WRITE:/ 'Unable to read the input file'.

  • STOP.

  • ENDIF.

  • MESSAGE s090 WITH 'Completed Uploading. Processing Data.....'.

but now i wana to use CALL FUNCTION 'GUI_UPLOAD'

i used but but its giving in "<i><b>wrong file format</b></i>" type as error message!

please help me out!!!

6 REPLIES 6
Read only

Former Member
0 Likes
830

Hi Sivaram ,

The parameter filename in the FM GUI_UPLOAD is of type string , so you need to define a varaible of type string , store the file name to it and then pass this variable to the FM.

Regadrs

Arun

  • Assign points for helpful answers

Read only

Former Member
0 Likes
830

hi,

if u want to upload excel file the fm which u r using wont work go for this fm

ALSM_EXCEL_TO_INTERNAL_TABLE

for note pad file i.e txt file u can use gui_upload

Read only

0 Likes
830

hi,

change that file format to 'ASC' instead of 'DAT' and check

Read only

Former Member
0 Likes
830

Hi Sivaram,

The problem occurs from the file Format.

Check this notes,

'BIN'

A binary representation of the internal table is read from the file.

No conversion or interpretation is carried out. Usually, this produces

meaningful results only if the internal table consists of a single

column of type 'X'.

'DAT'

The components of the internal table are filled from the file. If the

table contains more than one column, the entries in the file must be

separated by tabs. Conversion exits are not carried out.

For the different data types, the following applies:

I or N or P or F

The numbers must be formatted according to the decimal representation

defined in the user settings.

D

The date must be formatted according to the date format defined in the

user settings.

T

The time must have format hh:mm:ss.

'ASC'.

The components of the internal table are filled from the file. Only data

types of fixed length are allowed. The data must be contained on the

file in its entire length.

Thanks,

Reward If Helpful.

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
830

Hi,

This is from FM documentation.This will help you.

Short text

Upload for data provider

Functionality

File transfer from frontend PC to an internal backend table.

A format conversion is possible. The functions are similar to the module WS_UPLOAD, however the data provider is used for the upload and not GMUX.

Example

CALL FUNCTION 'GUI_UPLOAD'

exporting

filetype = 'BIN'

filename = 'C:\DOWNLOAD.BIN'

tables

data_tab = itab.

loads the contents of the file 'C:\DOWNLOAD.BIN' on the frontend PC into the internal backend table itab. The transferred data is not converted.

CALL FUNCTION 'GUI_UPLOAD'

exporting

filetype = 'ASC'

filename = 'C:\DOWNLOAD.TXT'

tables

data_tab = itab.

loads the contents of the file 'C:\DOWNLOAD.TXT' on the frontend PC line by line into the internal backend table itab. The transferred data is converted.

Read only

uwe_schieferstein
Active Contributor
0 Likes
830

Hello Sivaram

Do not use function module GUI_UPLOAD since it is marked as <i>obsolete </i>with respect to Unicode. Instead use the static methods

- GUI_UPLOAD
- GUI_DOWNLOAD

of class <b>CL_GUI_FRONTEND_SERVICES</b> which are already Unicode-compatible.

Regards

Uwe