Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Read *.tab file into internal table

salilvaidya
Explorer
0 Likes
1,446

Hi all,

I am using the Class method

CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_file
filetype = c_filetype (ASC)
has_field_separator = c_checked (X)
read_by_line = c_checked (X)
CHANGING
data_tab = i_input_table

The file I have has columns tab delimited and the file is also stored as *.tab on presentation server. When executing this program i keep getting the error bad_data_format. Kindly help.

Regards,

Salil

Hi all,

I am using the Class method

CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_file
filetype = c_filetype (ASC)
has_field_separator = c_checked (X)
read_by_line = c_checked (X)
CHANGING
data_tab = i_input_table

The file I have has columns tab delimited and the file is also stored as *.tab on presentation server. When executing this program i keep getting the error bad_data_format. Kindly help.

Regards,

Salil

4 REPLIES 4
Read only

Sandra_Rossi
Active Contributor
1,358

The question has been already asked and answered a lot in the forum:

"gui_upload" "bad_data_format" site:sap.com
Read only

salilvaidya
Explorer
0 Likes
1,358

yes i understand that similar question has already been asked but this is specific to file with extension *.tab and tab delimited

Read only

matt
Active Contributor
1,358

On the left of the "Your Answer" text box, there's the text

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details.

You should leave a comment to your question, not answer it.

Read only

Jeansy
Active Contributor
0 Likes
1,358

Hi,
i created a small demo report in my system and it was working finde.

See the following code-snippet:

REPORT zjz_tab.

TYPES: BEGIN OF ts_data,
matnr TYPE matnr,
maktx TYPE maktx,
matkl TYPE matkl,
brgew TYPE brgew,
ntgew TYPE ntgew,
gewei TYPE gewei,
END OF ts_data.

DATA: lt_data TYPE TABLE OF ts_data.

CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = 'C:\temp\data.tab'
filetype = 'ASC'
has_field_separator = abap_true
CHANGING
data_tab = lt_data
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
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.

This is my test file for the given report (separated by tabulators):

MATNR	MAKTX	MATKL	12	13	KG

I also had first the same issue with Return-Code 8 (BAD_DATA_FORMAT). This comes up when the content of a column does not fit to the data type of the column. Maybe you check this again in detail?

I hope this helps 🙂

Kind regards
Jens