08-29-2007 6:09 AM
Dear All,
I'm doing one Customer Invoice upload program.
In the selection screen, I have one parameter to get File path from the users.
It executes first time without any error.
I dont change any parameter in the selection screen. I execute this program again. But it shows an information message stating "WRONG PARAMETER: FILE_NAME" and after OK, it shows an error message stating "File is not available". This error is coming from the FM "GUI_UPLOAD".
I set breakpoint after GUI_UPLOAD. SY-SUBRC = 1. It means "file_open_error = 1".
Can anyone tell the reason and solution for this problem?
Points will be rewarded.
Thanks & Regards,
Neeraj
08-29-2007 6:15 AM
possibility could be the parameter at selection screen could be rlgrap-filename or of type C.
but the FM accepts file name type string.
so before executing the fm move the file name to a local string.
parameter : p_ifnam(50) type C.
or
parameter : p_ifnam type rlgrap-filename.
data : l_fname type str.
>> before calling GUI_UPLOAD move the filename to a local string.
l_fname = p_ifnam.
call function 'GUI_UPLOAD'.....
Hope this helps
Regards
Gopi
08-29-2007 6:15 AM
possibility could be the parameter at selection screen could be rlgrap-filename or of type C.
but the FM accepts file name type string.
so before executing the fm move the file name to a local string.
parameter : p_ifnam(50) type C.
or
parameter : p_ifnam type rlgrap-filename.
data : l_fname type str.
>> before calling GUI_UPLOAD move the filename to a local string.
l_fname = p_ifnam.
call function 'GUI_UPLOAD'.....
Hope this helps
Regards
Gopi
08-29-2007 8:02 AM
Dear Gopi and Raam,
I have already moved to the value to String field.
Then only I passed this value to the parameter in the FM "GUI_UPLOAD".
Can you please tell me any other alternative?
Thanks & Regards,
Neeraj
08-29-2007 8:08 AM
Hi Neeraj, that could just be a possibiltiy, but we can correct if you can please paste your code.
Regards
Gopi
08-29-2007 8:22 AM
This is my code....
data : w_file type string. "pass the file path to FM GUI_UPLOAD
parameters : p_file type ibipparms-path obligatory. "rlgrap-filename
*----
at selection-screen on value-request for p_file .
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'P_FILE'
importing
file_name = p_file.
move p_file to w_file .
*----
start-of-selection.
call function 'GUI_UPLOAD'
exporting
filename = w_file
filetype = 'ASC'
has_field_separator = '#'
tables
data_tab = it_upload
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.
_________________
Please help me to solve this problem.
Thanks & Regards,
Neeraj
08-29-2007 8:27 AM
Hii..Neeraj..
I got the Error now..
Check the Code correction below..
You must place the statement
<b>move p_file to w_file .</b>
Under the Event Start-of-selection.
But currently it is under AT SELECTION-SCREEN ON VALUE-REQUEST..
that is why it is called only for the first time (When u press F4)...
data : w_file type string. "pass the file path to FM GUI_UPLOAD
parameters : p_file type ibipparms-path obligatory. "rlgrap-filename
*----
at selection-screen on value-request for p_file .
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'P_FILE'
importing
file_name = p_file.
*----
start-of-selection.
<b>move p_file to w_file .</b> "Earlier this is under another event
call function 'GUI_UPLOAD'
exporting
filename = w_file
filetype = 'ASC'
has_field_separator = '#'
tables
data_tab = it_upload
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.
<b>Reward points if Helpful</b>
08-29-2007 8:56 AM
05-13-2015 8:15 AM
Hi Varma,
I have used the move statement in start-of-selection itself, but i am getting the error as file not available.and wrong parameter .can you please help.
Thanks.
08-29-2007 6:45 AM
yes u need to assign file name type string ......see the sample code ...........here i have used class 'frontend services' to fetch the file......
DATA: FILENAME TYPE STRING, "Default File Name
FILETABLE TYPE FILETABLE, "Table Holding Selected Files
V_RC TYPE I, "Return Code, Number of Files or -1 If Error Occurred
V_FILE TYPE STRING. "
FILENAME = 'C:\Documents and Settings\ramyav\Desktop\raam.txt'..
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE =
DEFAULT_EXTENSION =
DEFAULT_FILENAME = FILENAME
FILE_FILTER =
WITH_ENCODING =
INITIAL_DIRECTORY =
MULTISELECTION =
CHANGING
FILE_TABLE = FILETABLE
RC = V_RC
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
OTHERS = 5
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF SY-SUBRC = 0.
READ TABLE FILETABLE INDEX 1 INTO V_FILE.
ENDIF.
IF V_RC = 1.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = V_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE = VIRUS_SCAN_PROFILE
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH = FILELENGTH
HEADER = HEADER
TABLES
DATA_TAB = IT_TABLE
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.
ENDIF.
reward points if helpful
08-29-2007 7:58 AM
Hi Neeraj..
In GUI_DOWNLOAD FM we have to pass the FILENAME type STRING only.
But since it is working for the First time the error may be different.
If u paste ur code it Will help..
Regards...
Varma
08-29-2007 8:36 AM
hey u need to pass move statement in start of selection.....
reward points if helpful.