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

Problem with data upload from Excel to Int table

Former Member
0 Likes
1,022

Hi Friends,

I have gone thro the forum threads a lot , but could not find solution to my problem.

I have data in excel sheet and I have to get this into an internal table.

PLEASE NOTE THAT I AM USING ECC6.0 (syatem data: SAP EHP 1 for SAP NetWeaver 7.0).

Hence, options of using ALSM_EXCEL_TO_INTERNAL_TABLE and KCD_EXCEL_OLE_TO_INT_CONVERT are ruled out. I am getting error that these function modules do not exist. Also, type-pool TRUXS does not exist.

And, GUI_UPLOAD is giving me junk data into internal table.

So, please help me by giving any other function modules so that I can upload my data in excel file to internal table.

Thanks in Advance.

Regards,

Krish.

9 REPLIES 9
Read only

Former Member
0 Likes
904

Hi,

Try this

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = filename

FILETYPE = 'DBF' ----->use this type will work

Regards,

Anil

Edited by: M Srinivasa Anil Kumar on Oct 20, 2009 6:55 PM

Edited by: M Srinivasa Anil Kumar on Oct 20, 2009 6:56 PM

Read only

0 Likes
904

Hi Anil,

I have tried using filetype DBF, but I am getting error 'Wrong value of the parameter FILETYPE'.

So, i guess i cannot use this filetype.

Regards,

Krish.

Read only

0 Likes
904

null

Edited by: M Srinivasa Anil Kumar on Oct 21, 2009 12:24 PM

Edited by: M Srinivasa Anil Kumar on Oct 21, 2009 12:24 PM

Read only

Former Member
0 Likes
904

type-pools : truxs.

  • Internal table declaartion for excel file

data : it_raw type truxs_t_text_data.

call function 'TEXT_CONVERT_XLS_TO_SAP'

exporting

i_line_header = 'X'

i_tab_raw_data = it_raw

i_filename = p_fILE "" Excel file

tables

i_tab_converted_data = iN_FILE " our Internal table

exceptions

conversion_failed = 1

others = 2

Read only

0 Likes
904

hi PBS..

pls dont mind me saying this..

pls read the query completely and answer..

i have already mentioned in my request that , in the version which i am using, type-pool TRUXS is not available and hence i cannot use the FM..

regards,

krish

Read only

Former Member
0 Likes
904

Hi Krish,

please search .. you will find many options.

Read only

Former Member
0 Likes
904

Hi,

Save the excel file as tab delimited file and then refer to the given snippet:

DATA: lv_filetype(10) TYPE c,

lv_gui_sep TYPE c,

lv_file_name TYPE string.

lv_filetype = 'ASC'.

lv_gui_sep = 'X'.

lv_file_name = pa_dfile. >> file path

  • FM call to upload file

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = lv_file_name

filetype = lv_filetype

has_field_separator = lv_gui_sep

TABLES

data_tab = gi_zhralcon_file > internal table

Hope it helps.

Regards,

Rajesh Kumar

Read only

0 Likes
904

Hi Rajesh,

Yes!!!! i have saved the excel file as a tab delimited txt file and then used the FM..

it is working fine now.

thanks a lot!!!

regards,

krish

Read only

Former Member
0 Likes
904

HI,

Try doing like the sample code below:

DATA: it_raw TYPE truxs_t_text_data.

&----


*&Start-of-selection

&----


START-OF-SELECTION.

&----


*&Function module called to upload xls data into an internal table

&----


CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

i_field_seperator = 'X'

i_line_header = 'X'

i_tab_raw_data = it_raw

i_filename = p_file "file path browsed

TABLES

i_tab_converted_data = it_upload[] "int table populated

EXCEPTIONS

conversion_failed = 1 "browsed file's data

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.

Hope it helps

Regards

Mansi