‎2006 Nov 17 1:22 PM
Hi,
My problem is to upload from a .csv file whose structure is unknown.
But the clue here is the first row of the file would be of the technical fields names..
I mean
USR01-BNAME,USR01-LANGU
What could be the best approach??
I read the first row and splitted it and stored in an I_tab...is that of any use?
‎2006 Nov 17 1:34 PM
Hello,
I believe, that you may use the column names to create some kind of dynamic table.
At first, generate a fieldcatalog for your future table.
Then, try to do something like the following:
*
DATA: new_line TYPE REF TO data.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = p_it_fieldcatalog
IMPORTING
ep_table = lt_data
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc <> 0.
********
ENDIF.
ASSIGN lt_data->* TO <fs_table>.
IF sy-subrc <> 0.
*****
ENDIF.
CREATE DATA new_line LIKE LINE OF <fs_table>.
*****
ASSIGN new_line->* TO <fs2>.
IF sy-subrc <> 0.
***
ENDIF.
‎2006 Nov 17 1:49 PM
You can try ALSM_EXCEL_TO_INTERNAL_TABLE function module.
this FM will read all the columns n rows of your excel sheet to a internal table.
this internal table contains data in form of
row no col no data.
now as you mentioned first row contains field names, using these you can create a dynamic table. then populate the data acoordingly.
hope this helps.
award Forum points to useful answers
‎2006 Nov 17 2:13 PM
hi
Welcome to SDN first of all !!!
Please do go through the Craig's post in the ABAP General Forum
I think that your requirement has been discussed before
Please check this thread
https://forums.sdn.sap.com/click.jspa?searchID=93720&messageID=1364406
Do award points if helpful