cancel
Showing results for 
Search instead for 
Did you mean: 

Errors during insert in Z* table from tab delimited file

ricky_shaw
Contributor
0 Kudos
206

Hi Experts,
I have a bigtab delimited file (*.txt) with some 30 fields separated by tabs in a record.
These fields are spilling over to next row.

Issue 1 ) When i am reading this file using GUI_UPLOAD, its only taking 26 fields & ignoring other 4 fields.
I delared my itab like this:

types: begin of ty_filedata,
lv_data type string,
end of ty_filedata.

data: gt_filedata type standard table of ty_filedata.

I tried declaring lv_data with 3000 chars like below also:
lv_data(3000) type c.

Issue 2): I am looping at above gt_filedata & splitting at tabs'(using cl_abap_char_utilities=>horizontal_tab)
but i cannot see that all fields are getting updated into gt_data.

loop at gt_filedata into data(ls_filedata).
split ls_filedata-lv_data at cl_abap_char_utilities=>horizontal_tab into wa_data-field1 wa_data-field2
....... .....
..... ........
wa_data-field30.
append wa_data to gt_data.
endloop.

Sandra_Rossi
Active Contributor
0 Kudos
Please use the buttons "..." and "</>" to make the code easy to read. See here the detailed steps: https://community.sap.com/t5/questions-about-sap-websites/how-to-post-code-in-sap-community-gt-2024/...
Sandra_Rossi
Active Contributor
0 Kudos

If your issue is about missing fields, although your code is using LV_DATA of type STRING (endless number of characters), it's non-sense to truncate even more, down to 3000 characters !!!??? Your issue is somewhere else, so just debug and revert back and tell us the actual issue.

View Entire Topic
MBartsch71
Participant
0 Kudos

Hi Ricky,

 

i would recommend, that you declare the structure of your z-table according to the data in the text file.

This means you should declare a structure with 30 fields in SAP. If you are not sure which data types then use something like char100 or so till you find out the right data types.

After that the gui upload should populate the fields correctly.

Greeting Matt