09-26-2008 11:59 AM
Hello,
I have to upload data from excel sheet to Internal Table.
The excel sheet is having 2 worksheets.
These worksheets are to be uploaded in two Internal tables.
Is there any Function module for this?
Your help wud be appretiated.
~pranu
09-26-2008 12:18 PM
You need 2 excel for loading two internal tables. You can't splitting a excel file in two internal tables.
I give you an example
**&----
**
*& Form LEER_EXCEL
**&----
**
FORM leer_excel .
DATA: it_raw TYPE truxs_t_text_data, "Variable necesaria para la función
p_fichero LIKE rlgrap-filename."Tipo de fichero necesario
Tipo de ruta necesaria*
CONCATENATE p_file1 gt_files INTO p_fichero.
REPLACE '.xls' WITH '.fan' INTO p_fichero.*
Función que carga un ficher excel en una tabla interna*
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =*
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = p_fichero
TABLES
i_tab_converted_data = gt_fichero1[]
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i000(su)
WITH 'Error al leer el archivo Excel.'
'Compruebe que el archivo no esta abierto'
'y revise que la estructura'
'es la adecuada'.
STOP.
ENDIF.
ENDFORM. " LEER_EXCEL
09-26-2008 12:18 PM
You need 2 excel for loading two internal tables. You can't splitting a excel file in two internal tables.
I give you an example
**&----
**
*& Form LEER_EXCEL
**&----
**
FORM leer_excel .
DATA: it_raw TYPE truxs_t_text_data, "Variable necesaria para la función
p_fichero LIKE rlgrap-filename."Tipo de fichero necesario
Tipo de ruta necesaria*
CONCATENATE p_file1 gt_files INTO p_fichero.
REPLACE '.xls' WITH '.fan' INTO p_fichero.*
Función que carga un ficher excel en una tabla interna*
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =*
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = p_fichero
TABLES
i_tab_converted_data = gt_fichero1[]
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i000(su)
WITH 'Error al leer el archivo Excel.'
'Compruebe que el archivo no esta abierto'
'y revise que la estructura'
'es la adecuada'.
STOP.
ENDIF.
ENDFORM. " LEER_EXCEL
09-26-2008 12:21 PM
Hello,
The excel that I am getting is having 5 Worksheets.
Sheet1, sheet2, sheet3, sheet4 and sheet5.
From this excel sheet, I have to read the data from worksheet1 and worksheet 3.
I will nto be getting two excel sheets. It would have been easier otherwise .
Any Idea?
Thanks
09-26-2008 12:25 PM
Hello,
Take a look on this: [ABAP - Upload data from Excel to Sap using OO|https://wiki.sdn.sap.com/wiki/x/xOw/]. It's a program to upload data and as you can see in this, it shows how to navigate between spreadsheets and cells.
Regards.