03-16-2007 5:50 AM
Hi Friends,
I am creating a ZUPLOAD program to uplaod data from a file...
Please try to answer few of my queries:
1. Can i use GUI_UPLOAD or WS_UPLOAD for uploading anykind of file.
2. I have defined lv_file TYPE rlgrap-filename, which is a passing parameter to FILENAME in GUI_UPLAOD/WS_UPLOAD. But i see that lv_file is accepted in WS_UPLOAD and not in GUI_UPLOAD. Is it true?
3. I have a notepad file with the data in it separated by manual tabs. So, is manually tabbed file different from tab delimited notepad file?
Thanks and regards,
Vishwa
03-16-2007 5:56 AM
hi
u can use any method for uploading data.gui_upload is the enhanced one
-->u should give the type of lv_file same as it is in the function modules import parameters.
-
>yea its the same whether u give tab explicitly or save it as tab delimited file.
but be sure u give extactly one tab space..other wise data fetched will be a mess
hope this helps u
03-16-2007 5:54 AM
Hi,
As GUI_UPLOAD is latest FM for newer versions..
So go for it to avoid the warnings and errors during upgradation..
2)In gui-upload it takes the file name as type string, not as rlgrap-filename in ws_upload.
30Both manual tabbed and tab delimited files are same..
but there will be abit confusion ni the tabbed file which is manually done ...
Tab delimited file takes the total size of the field and then it gives a tab where as u are doing it manually, if u give the tabs after taking ful field length into consideration.. it is fine..if not it will lead to errors in uplaoding..
Cheers,
Simha.
Mark all the helpful answers...
03-16-2007 5:56 AM
hi
u can use any method for uploading data.gui_upload is the enhanced one
-->u should give the type of lv_file same as it is in the function modules import parameters.
-
>yea its the same whether u give tab explicitly or save it as tab delimited file.
but be sure u give extactly one tab space..other wise data fetched will be a mess
hope this helps u
03-16-2007 5:57 AM
Hi,
1. Can i use GUI_UPLOAD or WS_UPLOAD for uploading anykind of file.
yes, you can use anyone. GUI_UPLOAD is the latest one and WS_UPLOAD is the old one and Obsolete.
2. I have defined lv_file TYPE rlgrap-filename, which is a passing parameter to FILENAME in GUI_UPLAOD/WS_UPLOAD. But i see that lv_file is accepted in WS_UPLOAD and not in GUI_UPLOAD. Is it true?
it will take for both fun modules.lv_file will be accepted in GUI_UPLOAD also.
3. I have a notepad file with the data in it separated by manual tabs. So, is manually tabbed file different from tab delimited notepad file?
If you are 100% sure that the data is Tab delimted then OK, other wise put the same data in EXCEL and convert it to Tab delimited text file and use it to the fun module.
Regards,
Anji
03-16-2007 5:57 AM
03-16-2007 5:58 AM
1. Can i use GUI_UPLOAD or WS_UPLOAD for uploading anykind of file.
use GUI_UPLOAD
2. I have defined lv_file TYPE rlgrap-filename, which is a passing parameter to FILENAME in GUI_UPLAOD/WS_UPLOAD. But i see that lv_file is accepted in WS_UPLOAD and not in GUI_UPLOAD. Is it true?
use lv_file of type STRING.
3. 3. I have a notepad file with the data in it separated by manual tabs. So, is manually tabbed file different from tab delimited notepad file?
i guess both are same but in manuall added tabs u may forget sometime , it will show as # sometimes
03-16-2007 6:01 AM
Hi
Use this code for GUI_UPLOAD
CONSTANTS : lc_asc TYPE char10 VALUE 'ASC'. "function module filetype
DATA: lv_filenm TYPE string.
CLEAR lv_filenm.
MOVE v_flname TO lv_filenm.
*Call the function to get the file into an internal table.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_filenm
filetype = lc_asc
TABLES
data_tab = i_flatfile
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.
*Display Message File not found.
MESSAGE i010 WITH lv_filenm.
LEAVE LIST-PROCESSING.
ENDIF.
FOR SPLIT FILE c_pip means '|'
IF i_flatfile[] IS NOT INITIAL.
LOOP AT i_flatfile INTO wa_flatfile.
SPLIT wa_flatfile-fdata AT c_pip
INTO wa_flupload-ekorg
wa_flupload-ktokk
wa_flupload-anred
wa_flupload-name1
wa_flupload-sortl
wa_flupload-stras
wa_flupload-ort01
wa_flupload-regio
wa_flupload-pstlz
wa_flupload-land1
wa_flupload-spras
wa_flupload-telf1
wa_flupload-telfx
wa_flupload-telf2
wa_flupload-lfurl
wa_flupload-remark
wa_flupload-parvw
wa_flupload-lifn2
wa_flupload-defpa.
APPEND wa_flupload TO i_flupload.
CLEAR : wa_flupload , wa_flatfile.
ENDLOOP.
**Please reward suitable points***
With Regards
Navin Khedikar
03-19-2007 11:22 AM
Hi Navin,
What is 'l' as in c_pip?
thanks,
vishwanath
Message was edited by:
vishwanath vedula
03-19-2007 11:25 AM
| means tab delimiter which is used to identify the fields. say u ahve 10 fields. so now if u want to split the file u can use | which normally is tab delimiter.
05-07-2007 11:15 AM
1.yes
2.gui_upload is used from versions 4.6c where as ws_upload is used before versions 4.6c. now a days ws_upload is obselete.
3.there is no difference between manually tabbed flat files and tab delimited flat files.
regards,
suresh babu