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

gui_upload for uploading binary file

Former Member
0 Likes
8,874

Hello All,

I am trying to upload '.jpg' files using gui_upload function.

But something goes wrong and it dumps.

I am new to ABAP.

following is the code i used.

DATA: xline TYPE xstring.

DATA : t_file LIKE TABLE OF xline WITH HEADER LINE.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filetype = 'BIN'

filename = 'C:\Documents and Settings\I046674\Desktop\RawTest\images\Image_1000.jpg'

TABLES

data_tab = t_file.

It dumps in the 'GUI_UPLOAD' function itself.

Saying follownig,

==========================================

Error analysis

The error occurred at a statement in the form

ASSIGN f TO <fs> TYPE t

One of these two cases occurred:

1) Field f is a string, a data reference, an object reference, an

internal table or a structure that contains such a field. With the

TYPE addition, this is not possible.

2) Field f is of type x and field symbol <fs> has a character-type type.

When executing the statement, the length of f is not a multiple of

the length (in bytes) of a Unicode character.

===============================================

Can someone help me on this?

Thanks & Regards,

Abhijit

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,902

Delcare xline of type X instead of string.

DATA: xline TYPE X.
DATA : t_file LIKE TABLE OF xline WITH HEADER LINE.

CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filetype = 'BIN'
filename = 'C:\Documents and Settings\I046674\Desktop\RawTest\images\Image_1000.jpg'
TABLES
data_tab = t_file.

4 REPLIES 4
Read only

Former Member
0 Likes
3,902

use simple txt file for upload

Read only

Former Member
0 Likes
3,902

hi,

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'c:\temp\text.txt'

filetype = ' '

IMPORTING

filelength = fleng

TABLES

data_tab = text_tab

EXCEPTIONS

file_write_error = 1

invalid_type = 2

no_authority = 3

unknown_error = 4

OTHERS = 10.

thanks

Read only

Former Member
0 Likes
3,903

Delcare xline of type X instead of string.

DATA: xline TYPE X.
DATA : t_file LIKE TABLE OF xline WITH HEADER LINE.

CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filetype = 'BIN'
filename = 'C:\Documents and Settings\I046674\Desktop\RawTest\images\Image_1000.jpg'
TABLES
data_tab = t_file.

Read only

0 Likes
3,902

Hello Karan,

I want to store complete image as one database table row.

How can i achieve that?

Thanks & Regards,

Abhijit