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

upload excel into a internal table

Former Member
0 Likes
1,067

Hi all,

i am using this function CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP' but it takes a lot of time when I upload the excel file into internal table, some body how can i reduce or another function that i can use to upload mi excel file into internal table? Ples help me.

mi code is

*Carga archivo excel a tabla interna

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

  • I_FIELD_SEPERATOR =

i_line_header = 'X'

i_tab_raw_data = it_raw " Work table

i_filename = p_file "Ruta archivo

TABLES

i_tab_converted_data = p_tabfile[] "Tabla archivo

EXCEPTIONS

conversion_failed = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

thanks in advamce.

Mariso,l.

I am trying upload a excel file into internal table but Take a lot of time with the function 'TEXT_CONVERT_XLS_TO_SAP', I need reduce the time.

7 REPLIES 7
Read only

Former Member
0 Likes
1,026

Try with ALSM_EXCEL_TO_INTERNAL_TABLE

Is the excel file delimited with tabulators?

Edited by: Ramiro Escamilla on Apr 4, 2008 11:12 PM

Read only

Former Member
0 Likes
1,026

Hi,

Try with the FM KCD_EXCEL_OLE_TO_INT_CONVERT

Hope it is helpful..

Regards,

Chithra

Read only

rahul2000
Contributor
0 Likes
1,026

Hi Marisol..

Its suprising that it is taking a lot of time....

What are you passing exactly then?

Read only

Former Member
0 Likes
1,026

I am trying upload a excel file into internal table but Take a lot of time with the function 'TEXT_CONVERT_XLS_TO_SAP', I need reduce the time.

Read only

Former Member
0 Likes
1,026

Hi Marisol,

The Following FM's might help u out.

KCD_EXCEL_OLE_TO_INT_CONVERT

ALSM_EXCEL_TO_INTERNAL_TABLE

Also the below links might help you out.

http://www.sap-img.com/abap/upload-direct-excel.htm

<REMOVED BY MODERATOR>

Thanks,

Sirisha.

Edited by: Alvaro Tejada Galindo on Apr 7, 2008 12:43 PM

Read only

Former Member
0 Likes
1,026

hi,

REPORT ZTESTPROG002.

tables: mara.

PARAMETERS: p_file LIKE rlgrap-filename default 'C:\Documents and Settings\venkatapp\Desktop\venkat.xls'.

data:begin of it_mara occurs 0,

matnr like mara-matnr,

meins like mara-meins,

mtart like mara-mtart,

mbrsh like mara-mbrsh,

end of it_mara.

SELECT matnr

meins

mtart

mbrsh

FROM mara

INTO corresponding fields of TABLE it_mara.

CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'

EXPORTING

i_filename = p_file

TABLES

i_tab_sap_data = it_mara.

regards,

venkat.

Edited by: venkat appikonda on Apr 5, 2008 10:25 AM

Read only

Former Member
0 Likes
1,026

could be something like this:

PARAMETERS: p_infile LIKE rlgrap-filename OBLIGATORY.

DATA: BEGIN OF t_excel OCCURS 0.

INCLUDE STRUCTURE alsmex_tabline.

DATA: END OF t_excel.

DATA: w_filenm LIKE rlgrap-filename.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_infile.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

def_filename = p_infile

mask = ',*.xls.'

mode = 'O'

title = 'Upload File'(i03)

IMPORTING

filename = p_infile

EXCEPTIONS

inv_winsys = 1

no_batch = 2

selection_cancel = 3

selection_error = 4

OTHERS = 5.

IF sy-subrc <> 0.

CASE sy-subrc.

WHEN '1'.

PERFORM popup_to_inform USING text-e01.

WHEN '2'.

PERFORM popup_to_inform USING text-e02.

WHEN '3'.

PERFORM popup_to_inform USING text-e03.

WHEN '4'.

PERFORM popup_to_inform USING text-e04.

WHEN '5'.

PERFORM popup_to_inform USING text-e05.

ENDCASE.

ENDIF.

START-OF-SELECTION.

WRITE p_infile TO w_filenm.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = w_filenm

i_begin_col = 1

i_begin_row = 1

i_end_col = 10 "max number of columns

i_end_row = 300 "max number of rows

TABLES

intern = t_excel[].

IF t_excel[] IS INITIAL.

MESSAGE text-e02 TYPE 'E'.

ENDIF.

"For example:

LOOP AT t_excel.

IF t_excel-col = '0002'. "second column

" l_var = t_excel-value.

ENDIF.

ENDLOOP.