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 file upload.

Former Member
0 Likes
652

Hi,

i am reading a text file using GUI_UPLOAD.

but agter reading the file when i am looking into table its reading upto only position 256 of each line.

i need to read full line upto position 500 of the text file .. please guide me in this case.

thnx

vikash

1 ACCEPTED SOLUTION
Read only

umashankar_sahu
Active Participant
0 Likes
609

hi vikash

you have to increase the size of internal table.

like suppose you have internal table ITAB it contans 3 fields

data : begin of itab occurs 0,

text(500) type c, " here you downloading the text so check the length

line_num type i,

pname(30) type c,

end of itab

data : p_file type string.

p_file = 'c:\test'.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = p_file

FILETYPE = 'DAT' " check formt either DAT or ASC or DBF

HAS_FIELD_SEPARATOR = 'X '

tables

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

hope this will helpfull for you.

hi vikash

you have to increase the size of internal table.

like suppose you have internal table ITAB it contans 3 fields

data : begin of itab occurs 0,

text(500) type c, " here you downloading the text so check the length

line_num type i,

pname(30) type c,

end of itab

data : p_file type string.

p_file = 'c:\test'.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = p_file

FILETYPE = 'DAT' " check formt either DAT or ASC or DBF

HAS_FIELD_SEPARATOR = 'X '

tables

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

hope this will helpfull for you.

4 REPLIES 4
Read only

Former Member
0 Likes
609

Hello,

Dont take the internal table as fields, take it as char or string.

In the upload program u can split into the internal table.

BEGIN OF gi_text OCCURS 0,

champ(3000),

END OF gi_text.

Call upload FM

TABLES

data_tab = gi_text

You take string also instead of char and try

Edited by: Santosh Marupally on May 22, 2009 9:20 AM

Read only

Former Member
0 Likes
609

Hi,

check the following code......

types: begin of ty_load,

text type string,

end of ty_load.

data: i_load type table of ty_load ,

w_load type ty_load.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\Documents and Settings\rk56944\Desktop\test.txt'

FILETYPE = 'ASC'

TABLES

DATA_TAB = i_load

Rgds,

Raj.

Read only

Former Member
0 Likes
609

Hi,

while declaring the field declare it with type string.

eg: types: begin of t_text,

lines type string,

end of t_text.

data: it_text type table of t_text with header line.

call the FM GUI_UPLOAD.

in the table parameter you will get the complete data.

Regards,

Venu

Read only

umashankar_sahu
Active Participant
0 Likes
610

hi vikash

you have to increase the size of internal table.

like suppose you have internal table ITAB it contans 3 fields

data : begin of itab occurs 0,

text(500) type c, " here you downloading the text so check the length

line_num type i,

pname(30) type c,

end of itab

data : p_file type string.

p_file = 'c:\test'.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = p_file

FILETYPE = 'DAT' " check formt either DAT or ASC or DBF

HAS_FIELD_SEPARATOR = 'X '

tables

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

hope this will helpfull for you.