Application Development 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: 

Excel sheet upload to SAP internal table (SCM 5.0)

rudy_schmitz
Active Participant
0 Kudos

Hello everybody,

I am trying to find out a function which can load an excel sheet to a SAP internal table.

Having a look in the forum, I have already found interesting answers but on our SAP platform (SCM), the following function modules don't exist:

- ALSM_EXCEL_TO_INTERNAL_TABLE

- KCD_EXCEL_OLE_TO_INT_CONVERT

- TEXT_CONVERT_XLS_TO_SAP

I also tried to use function module GUI_UPLOAD, but it does not seem to work with a *.xls file.

It seems to be ok only with a *.csv file, but I would prefer a solution for a *.xls file.

But maybe I don't use it properly???

Do you have any (other) idea?

Regards,

Rudy

3 REPLIES 3

Former Member
0 Kudos

Hi Rudy,

Use the following program as a reference which helps you to transfer excel file data to internal table. I used function module TEXT_CONVERT_XLS_TO_SAP for this.

REPORT ZEXCEL_UPLOAD.

TYPE-POOLS truxs.

TABLES : zscarr.

  • Selection screen

PARAMETER p_file TYPE rlgrap-filename DEFAULT 'C:\TEST.xls'.

TYPES:

BEGIN OF t_tab,

carrid TYPE zscarr-carrid,

seats TYPE zscarr-total_seats,

END OF t_tab.DATA :

t_upload TYPE STANDARD TABLE OF t_tab,

wa_upload TYPE t_tab,

it_type TYPE truxs_t_text_data.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

  • PROGRAM_NAME = SYST-CPROG

  • DYNPRO_NUMBER = SYST-DYNNR

field_name = 'P_FILE'

IMPORTING

file_name = p_file.

START-OF-SELECTION.

  • Uploading the data in the file into internal table

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

  • I_FIELD_SEPERATOR =

  • I_LINE_HEADER = 'X'

i_tab_raw_data = it_type

i_filename = p_file

TABLES

i_tab_converted_data = t_upload[]

EXCEPTIONS

conversion_failed = 1

OTHERS = 2.

IF sy-subrc NE 0.

MESSAGE ID sy-msgid

TYPE sy-msgty

NUMBER sy-msgno

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

ENDIF.

Thanks,

Naveen Kumar.

Former Member
0 Kudos

Sorry

Edited by: bala virupaksha on Sep 15, 2008 2:49 PM

rudy_schmitz
Active Participant
0 Kudos

The version is mySAP SCM 5.0