Application Development 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: 

GUI_UPLOAD

Former Member
0 Kudos

Hi friends,

I would like to use GUI_UPLOAD to upload a flat file data into an internal table but I want to make sure that the flat file is not open before using GUI_UPLOAD. So how can i check whether a flat file is currently open or not??

Thanks in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Harshu,

I guess that will be taken care by the EXCEPTION FILE_OPEN_ERROR of that FM,

No need to write any separate code for that

I will checkout if there is any FM available to check if any file is open or not

6 REPLIES 6

Former Member
0 Kudos

can the i know the source of input file?

Former Member
0 Kudos

close the flat file when u run the application . wether it is excel file or text whatever it is

Former Member
0 Kudos

Hi Harshu,

I guess that will be taken care by the EXCEPTION FILE_OPEN_ERROR of that FM,

No need to write any separate code for that

I will checkout if there is any FM available to check if any file is open or not

Former Member
0 Kudos

Hi,

If flat file is .txt file then GUI_Upload won't give any Exception,

IF it .XL file the GUI_Upload throw an eror it it open.

Regards,

Srinivas M

0 Kudos

Hi,

If you want to use it online then you cna use the parameter CONFIRM_OVERWRITE in FM GUI_DOWNLOAD

Regards,

sasi

Former Member
0 Kudos

Hi,

Try to include this in your code and see if it helps.

Make necessary changes to names as applicable in your case.

CALL FUNCTION 'UPLOAD'

EXPORTING

FILENAME = 'D:\.TXT'

FILETYPE = 'DAT'

TABLES

DATA_TAB = I_FILE1

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TABLE_WIDTH = 4

INVALID_TYPE = 5

NO_BATCH = 6

UNKNOWN_ERROR = 7

OTHERS = 8.

IF SY-SUBRC NE 0.

CASE SY-SUBRC.

WHEN 1.

WRITE: / 'Conversion error. Data not read ....'.

WHEN 2.

WRITE: / 'file_open_error. Data not read ....'.

WHEN 3.

WRITE: / 'file_read_error. Data not read ....'.

WHEN 4.

WRITE: / 'invalid_table_width. Data not read ....'.

WHEN 5.

WRITE: / 'invalid_type. data not read ....'.

WHEN 6.

WRITE: / ' no_batch '.

WHEN 7.

WRITE: / 'unknown_error'.

WHEN OTHERS.

WRITE: / 'Error reading data. read data may not be good ...'

Reward points if useful

Regards,

Bhavin P Shah