2017 Jan 13 6:11 AM
Hi All,
I am using class cl_gui_frontend_services=>gui_upload, to upload an excel file for ASCII as well as for CSV format.
There gives no any errors.
Even the file is opening on excel by other someone.
Can anyone please help me,
how to get a error return code.
I am using
GUI:740 LEVEL:8
SAPBASIS:701 LEVEL:12
Excel2010
2017 Jan 13 7:36 AM
I never heard of such a problem, so I think you misinterpret the issue, but you didn't say what you did before getting to the conclusion "there's no error return code". Please give more details.
2017 Jan 13 7:40 AM
Maybe your system has several application servers, and the target directory is not seen from all application servers (missing symbolic link, for instance)
2017 Jan 13 9:39 AM
thank you for your reply
I am sorry for the inconvenience.
I only do 2 steps
1.open the file 'test.csv' on excel
2.action SM37: GUI_UPLOAD
then the file was uploaded into the exporting parameter.
what I expeced result is
file was cloud not upload
because the file is using by the others.
2017 Jan 13 4:34 PM
I still don't understand what your problem is. You now use SE37 (SM37 you said?) to execute function module GUI_UPLOAD? (you don't use anymore the class?) I guess you should get a non-null return code (SY-SUBRC) if the file is locked. That's the normal behavior.
2017 Jan 16 6:37 AM
I am sorry It is my misstake.
function code is SE37.
Next is my logic source.
*************************************************************************************************
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
EXPORTING
FILENAME = L_FILENAME
FILETYPE = 'ASC'
CHANGING
DATA_TAB = L_OTAB_CSV
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.
MESSAGE E201 WITH 'THE FILE IS USING'.
ENDIF.
*************************************************************************************************
When the file L_FILENAME is still opening on excel.
I think
The logic's should be return sy-subrc <> 0.
and output the error message.
But I recived sy-subrc is '0'.
I would like to know
If my source have any mistake or
the function 'GUI_UPLOAD' is depend on GUI version and BASIS LEVEL
2017 Jan 16 9:08 PM
You have to look for a corrective SAP note if any, or open a message at SAP support.
2017 Jan 17 8:45 AM
Thank you so much.
I could not find any SAP note to solve the problem.
So I have questioned to SAP support
But nothing be answered still now.
2017 Jan 17 10:37 AM
at least I can confirm that my system does not work different from yours, I just tried the same from LSMW and was also able to read the data without any problem. I actually see this as an advantage as I can stay in my Excel and can compare it directly with my Display read-file in LSMW, earlier I had to close Excel and needed to reopen the file after the import was done.
2017 Jan 23 3:17 AM
Thank you.
I was relieved that there was the same result.
At least it seems that there is no problem with my program.
However, I wanted to issue an error message as a specification.
2017 Jan 16 9:46 PM
do a second test case: create a standard Excel file, save it as CSV but do not leave Excel. Now try your program. Is the result different than in the test where you opened an existing CSV file with Excel?
2017 Jan 17 3:45 AM
Thank you for your idea.
I did just like you said.
But, There is a same result be return. SY-SUBRC = 0.
I try my program on the other PC
SAP GUI710 here is worked,the return code SY-SUBRC = 12
2017 Jan 23 5:24 AM
Instead of that Use CALL FUNCTION 'GUI_UPLOAD'.
************************************************************************
************************************************************************
START-OF-SELECTION.
IF p_ppath IS NOT INITIAL.
l_filenm = p_ppath.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_filenm
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = itab_item
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.
ENDIF.
2017 Jan 23 8:24 AM
Thank you for your advice.
But, nothing be changed.
There is a same result be returned ~SY-SUBRC = 0.
2017 Jan 25 7:51 AM
I recived an answer from sap surport.
Explaning is
[This is an improvement for higher GUI version]
Check note 2419199