‎2009 Jun 03 10:40 AM
Hi,
In BDC report i am getting one runtime error while using Gui_ipload FM saying that filename is not specified but no error if i use the obsolete FM: UPLOAD.
Please tell me how do rectify this error.
Thanks,
Ahmed
‎2009 Jun 03 10:42 AM
‎2009 Jun 03 10:44 AM
can u please send the sample code for GUI_DOWNLOAD.
for notepad
‎2009 Jun 03 10:48 AM
Hi,
Have a look at this and see if this helps
DATA: gv_fname TYPE string.
PARAMETERS: p_fname TYPE RLGRAP-FILENAME OBLIGATORY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SY-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FNAME'
IMPORTING
FILE_NAME = P_FNAME
.
GV_FNAME2 = P_FNAME.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = GV_FNAME
filetype = 'ASC'
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.
‎2009 Jun 03 10:43 AM
hi
check ur file name data type
gui_upload accept string data type not 'c'.
check out this code
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.
DATA: Y_V_FILE TYPE STRING.
MOVE P_FILE TO Y_V_FILE.
CALL FUNCTION 'GUI_UPLOAD' "gui_upload accept only the string thats
"why we create y_v_file and assign p_file to it
EXPORTING
FILENAME = Y_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 =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = Y_I_FILE
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
Edited by: mayank jain on Jun 3, 2009 12:02 PM
‎2009 Jun 03 10:43 AM
Check the type of variable u r passing to FM....lv_file_name...
And debug to see whether ur variable contain value while passing to FM!
‎2009 Jun 03 10:45 AM
I am not passing any filename .
In execution it asks for file uploading then i ll select the file.
‎2009 Jun 03 10:48 AM
To FM u have to pass the path...
check the variable before passing to FM...whether it contains path...
p_file TYPE rlgrap-filename . --- >> declare like this to get the path
‎2009 Jun 03 10:54 AM
Hi
Once you have selected the file name, that has to be passed to the Fumction Module Gui_Upload in the export parameter filename.
If you are first storing the selected filename in a local variable then check the data type of the variable. It should be of type C.
If you are directly passing that filename to FM, try passing it in between inverted comas(' ').
Regards
Gaurav.
‎2009 Jun 03 10:45 AM
hi,
try to use this for F4 help
FORM get_F4_help CHANGING e_file TYPE RLGRAP-FILENAME.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_PATH = 'C:\ '
MASK = ',,.,..'
MODE = 'O'
IMPORTING
FILENAME = e_file
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 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.
‎2009 Jun 03 10:48 AM
Dear Ahmed,
Check your file type. It should be of type string. But when you select file path from f4 functinality for that file type should RLgrap-filename. In this case you can transfer date to string type file.
or else if your path is fix. try with hard coded path in FM.
Regards,
Vijay
‎2009 Jun 03 10:48 AM
Hi,
UPLOAD fm expects an input file name which is of type rlgrap-filename which is of character128 datatype.But the file name length may exceed 128.
Whereas in GUI_UPLOAD the type of the filename is string.
Hence declare the filename as string type.
Regards,
Lakshman