03-17-2010 9:34 AM
Hi ,
I am uploading a file through function module 'WS_UPLOAD' but it does not uploads everything.
It just uploads first 7 fields .
The file which i am uploading is a tab delimited file .Here is my code .
data: pathname type rlgrap-filename,
filename type rlgrap-filename,
file_length type n.
data: tmp_filename type rlgrap-filename,
ftype type rlgrap-filetype.
* Get the file name
clear pathname.
* perform get_filename using filename 'O' changing pathname.
call function 'WS_FILENAME_GET'
exporting
def_filename = filename
def_path = pathname
mask = ',*.*,*.*.'
mode = 'O'
importing
filename = tmp_filename
exceptions
inv_winsys = 01
no_batch = 02
selection_cancel = 03
selection_error = 04.
if sy-subrc = 0.
pathname = tmp_filename.
endif.
ftype = 'DAT'.
* Upload the data from the mentioned file name
if not pathname is initial.
* perform upload using pathname ftype file_length.
call function 'WS_UPLOAD'
exporting
codepage = 'IBM'
filename = pathname
filetype = ftype
user_form = ' '
user_prog = ' '
dat_d_format = ' '
importing
filelength = file_length
tables
data_tab = user_temp_tab
exceptions
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
others = 10.
endif.
Can anyone tell me the reason for this because i am using this function in a BADI to upload the data.
03-17-2010 9:36 AM
WS_UPLOAD is an obsolete FM & should not be used. Instead use GUI_UPLOAD & pass the HAS_FIELD_SEPARATOR = 'X' while calling the FM.
BR,
Suhas
03-17-2010 9:39 AM
Even if its old & obsolete, it will NOT stop after the seventh column.
03-17-2010 9:43 AM
Hey Rainer,
I think the horizontal tabs in the file are the culprit. I am not sure if WS_UPLOAD has the importing param HAS_FIELD_SEPARATOR (currently i cannot login into my SAP server) so i suggested GUI_UPLOAD
BR,
Suhas
03-17-2010 9:46 AM
Hi,
Can u tell that if there is any other format which would work with this function module.
Thanks
03-17-2010 10:14 AM
Hi ,
It still does not work with gui_upload function module.Still first 7 fields are coming not the rest . I have a total of 19 fields.
After 7th field there are numbers which are not being loaded.
Thanks,
Amber
03-17-2010 10:17 AM
Is the internal table defined in a way so that it can handle all the 19 fields ?
Anyways can you paste the declaration of your internal table into which you are uploading the data & the call to GUI_UPLOAD ?
BR,
Suhas
03-17-2010 10:31 AM
yes the file format is right and it has 19 fields in same order as there are in the file which i am uploading and the table is already decleared in the standard program so it does not let me create one with the same name in my BADI .
Thanks ,
amber
03-17-2010 10:58 AM
If you are uploading a tab delimited file why are you using a codepage = 'IBM' & filetype = 'DAT' ?
03-17-2010 11:02 AM
Hi Amber,
can you post the type declaration for the internal table.
Thanks and Regards,
Gopal
03-17-2010 11:20 AM
Hi,
Please check value of file_length.
This might be creating problem.
03-17-2010 12:04 PM
Hi Amber Bhaita,
As per my knowledge, WS_FILENAME_GET is also Obsolete. So you have to replace it with appropriate one i.e. with using class CL_GUI_FRONTEND_SERVICES and method file_open_dialog. Then you try. I hope it would work.
As it is taking 7 fields only means it is making mistake in import of data NOT in the code.
Please give feedback whether it works or not.
Harish
03-17-2010 3:26 PM
DATA: BEGIN OF WA_MARA,
matnr type matnr,
END OF WA_MARA.
DATA: FF_PATH TYPE STRING.
FF_PATH = 'C:\Documents and Settings\Desktop\VIG.txt'.
DATA: IT_MARA LIKE TABLE OF WA_MARA WITH HEADER LINE .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = FF_PATH
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
TABLES
DATA_TAB = IT_MARA.
WRITE / 'the uploaded records in the internal table are'.
WRITE /.
LOOP AT IT_MARA.
WRITE: / IT_MARA.
ENDLOOP.
03-17-2010 3:39 PM
How do you see that it is only uploading the first seven fields? In debugging, what do you see if you enter say the eighth field at the beginning of the display?
Rob
03-17-2010 5:13 PM
Hi Rob,
I cannot put the 8th and any fields after that in the beginning as the fields from 8th till 19 are all of type CURR and the ones in the beginning are either CHAR or NUMC type . I tried putting some values in the first 4 fields still 8th(including 8th) field onwards it does not take any value ...
03-17-2010 5:27 PM
Can you try making ALL the fields in your internal table type CHAR instead of CURR. Then as you loop thru the table move the CHAR fields to you CURR fields. At lease give it a try. Seems pretty suspicious that the CHAR fields load fine but the CURR fields don't.
03-18-2010 8:23 AM
Hi All,
I tried uploading the file in another desktop and it is uploading fine in the development server with ws_upload but not in the quality and production server .
As someone told me above to check the file_lenght and it was 0.
Thanks,
Amber
03-18-2010 9:51 AM
Hi,
If the declaration of the internal table is from any table, then check whether the table has those many fields in both development systems and production system, as you are telling it is working fine in development system and not in quality and production system. there may be chances for some of the field addition changes not moved to other systems.
Thanks and Regards,
Gopal
04-21-2010 11:11 AM
Thanks All,
It's done . There was a problem with saving the file .
regards,
Amber