‎2009 May 11 6:07 AM
Hi Experts,
If the flat file is of tab delimited type, means is it excel or text file ? How to upload that file into Internal table. Because, if excel we have to use 'ALSM_excel_to_internal table'. If text file no need to use this FM. Please guide. It is just given that, flat file is of tab delimited.
Rgds,
khad.
‎2009 May 11 6:10 AM
Hi,
You can use the GUI_UPLOAD to upload the tab delimited file.
Filetype should be 'DAT' and HAS_FIELD_SEPARATOR should be 'X'.
‎2009 May 11 6:10 AM
Hi,
You can use the GUI_UPLOAD to upload the tab delimited file.
Filetype should be 'DAT' and HAS_FIELD_SEPARATOR should be 'X'.
‎2009 May 11 6:39 AM
Hi,
use gui_upload for upload the flat file it may be asc ,tab deliminated .
check below link for bdc
https://www.sdn.sap.com/irj/scn/wiki?path=/display/home/bdc&;
Regards,
Madhu
‎2009 May 11 6:44 AM
Hi,
Use the following code to upload file in excel format.
DATA: tb_file_data TYPE TABLE OF text4096,
tb_testfile TYPE TABLE OF ty_testfile,
tb_testfile_file TYPE TABLE OF ty_testfile_file.
DATA: lv_file_name TYPE rlgrap-filename.
lv_file_name = pa_filep.
* To upload file in excel format
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_line_header = ''
i_tab_raw_data = tb_file_data
i_filename = lv_file_name
TABLES
i_tab_converted_data = tb_testfile_file
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Use the below code to upload file in tab delimited format
DATA: tb_testfile TYPE TABLE OF ty_testfile,
tb_testfile_file TYPE TABLE OF ty_testfile_file.
DATA: lv_filetype(10) TYPE c,
lv_gui_sep TYPE c,
lv_file_name TYPE string.
lv_filetype = 'ASC'.
lv_gui_sep = 'X'.
lv_file_name = pa_filep.
* FM call to upload file
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_file_name
filetype = lv_filetype
has_field_separator = lv_gui_sep
TABLES
data_tab = tb_testfile_file
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
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.
Regards,
Manish