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

convert .csv file into internal table based on fieldnames?

Former Member
0 Likes
976

Hi Experts,

I would like to convert the csv file data into internal table based on the fieldnames. not with actual data.

Because some of the cells have data with commas. but this is not the field separated comma. So, we need to build internal table with column names. not with actual data.

Note: Any cell may have text with comm. like below..

col1 | col2 | col3 | col4

123 | test,abcd | sdkl,efheb | egjhfj,dfgeh

234,345 | dfue,ghf | fdhfdjfd | dfjkgfm,ede

I tried with the below fms but no use.

TEXT_CONVERT_CSV_TO_SAP

TEXT_CONVERT_XLS_TO_SAP

ALSM_EXCEL_TO_INTERNAL_TABLE

GUI_UPLOAD.

I know normally ... if CSV file will do like SPLIT record by separator.

But here ... the data may contains commas. So, it is not working with my case.

Pls help me .

Any FM to convert the csv file data to internal table with fieldnames not with data.

Thanks in advance.

Raghu

Hi Experts,

I would like to convert the csv file data into internal table based on the fieldnames. not with actual data.

Because some of the cells have data with commas. but this is not the field separated comma. So, we need to build internal table with column names. not with actual data.

Note: Any cell may have text with comm. like below..

col1 | col2 | col3 | col4

123 | test,abcd | sdkl,efheb | egjhfj,dfgeh

234,345 | dfue,ghf | fdhfdjfd | dfjkgfm,ede

I tried with the below fms but no use.

TEXT_CONVERT_CSV_TO_SAP

TEXT_CONVERT_XLS_TO_SAP

ALSM_EXCEL_TO_INTERNAL_TABLE

GUI_UPLOAD.

I know normally ... if CSV file will do like SPLIT record by separator.

But here ... the data may contains commas. So, it is not working with my case.

Pls help me .

Any FM to convert the csv file data to internal table with fieldnames not with data.

Thanks in advance.

Raghu

2 REPLIES 2
Read only

Former Member
0 Likes
558

Hi,

It is difficult to read the data from the file it field data contains the comma in CSV file. If the length data in each field is fixed then you use the position and offset to read the data.

1,000 Test File 11-11-2009

200 Test Fun 12-11-2009

Field1 = itab(6).

Field2 = itab+6(9).

Field3 = itab+15(10).

If the value in the field is not fixed then you need to change the delimiter of the file.

Read only

Former Member
0 Likes
558

This message was moderated.