‎2006 Nov 21 10:30 AM
Hi all,
my flat file seperated by ','(comma).
How can i upload the data in internal table using <b>gui_upload.</b>
Kishore.
‎2006 Nov 21 10:32 AM
hi,
chk this sample code.
types: begin of tdat,
fld1(10) type c,
fld2(10) type c,
fld3(10) type c,
end of tdat.
data: itab type table of ttab with header line.
data: idat type table of tdat with header line.
data: file_str type string.
parameters: p_file type localfile.
at selection-screen on value-request for p_file.
call function 'KD_GET_FILENAME_ON_F4'
exporting
static = 'X'
changing
file_name = p_file.
start-of-selection.
file_str = p_file.
call function 'GUI_UPLOAD'
exporting
filename = file_str
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.
delete itab index 1.
loop at itab.
clear idat.
split itab-rec at cl_abap_char_utilities=>horizontal_tab
into idat-fld1
idat-fld2
idat-fld3.
append idat.
endloop.
loop at idat.
write:/ idat-fld1, idat-fld2, idat-fld3.
endloop.Rgds
Anver
‎2006 Nov 21 10:54 AM
I AM USING 4.6 C THIS IS cl_abap_char_utilities=>horizontal_tab
NOT AVAILABLE...
‎2006 Nov 21 10:56 AM
hi,
remove that part.
and check wheather all data is getting inside ur internal table by debugging.
Regards
Anver
‎2006 Nov 21 10:33 AM
Hi reddy,
use this instead of that
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_PFILE
I_BEGIN_COL = 1
I_BEGIN_ROW = 2
I_END_COL = 9
I_END_ROW = 6000
TABLES
INTERN = IT_EXCEL
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
‎2006 Nov 21 10:33 AM
Hi,
Just pass the File name and File type in the Export parameters and also pass the table parameter and execute the function.
Regards,
Ram
‎2006 Nov 21 10:34 AM
Hi,
U can try by passing the :
HAS_FIELD_SEPARATOR TYPE CHAR01 SPACE Split columns with TAB during ASCII upload.
It by default takes the TAB delimiter , am not sure about comma.
Thanks,
Sandeep
‎2006 Nov 21 10:37 AM
Hi
After creating flat file write a program in abap like this:
DATA : BEGIN OF <Internal Table name> OCCURS 0,
Give Field names here something like this.
Eg. LIfnr like lfa1-lifnr
END OF ITAB.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = Flatfile name with path and extension
FILETYPE = 'ASC'
TABLES
DATA_TAB = Internal table name.
Loop at <internal table name>.
write:/ <internal table name>.
endloop.
Hope this helps you.
Regards
Haritha.
‎2006 Nov 21 10:43 AM
Hi,
You can use the FM TEXT_CONVERT_CSV_TO_SAP or KCD_CSV_FILE_TO_INTERN_CONVERT to upload the CSV file to internal table.
Regards
Vijay