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 Upload

Former Member
0 Kudos

I have an Excel Sheet. I want to upload the records into the internal table. How ?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

use this Function Module - "TEXT_CONVERT_XLS_TO_SAP"

Try this code

TYPE-POOLS truxs.

types: begin of t_tab,
col1(5) type c,
col2(5) type c,
col3(5) type c,
end of t_tab.
data : itab type standard table of t_tab,
wa type t_tab.

data it_type type truxs_t_text_data.

parameter p_file type rlgrap-filename.
data ttab type tabname.

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.

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 = itab[]
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.

end-of-selection.

loop at itab into wa.
write : wa-col1.
write : wa-col2.
write : wa-col3.
endloop.

Thanks

\Vikranth

Edited by: Khimavath Vikranth on Jun 12, 2008 10:37 AM

9 REPLIES 9

Former Member
0 Kudos

Hi,

FUBA

WS_UPLOAD

with filetype = DAT

Regards

Nicole

Former Member
0 Kudos

Hi,

use this Function Module - "TEXT_CONVERT_XLS_TO_SAP"

Try this code

TYPE-POOLS truxs.

types: begin of t_tab,
col1(5) type c,
col2(5) type c,
col3(5) type c,
end of t_tab.
data : itab type standard table of t_tab,
wa type t_tab.

data it_type type truxs_t_text_data.

parameter p_file type rlgrap-filename.
data ttab type tabname.

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.

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 = itab[]
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.

end-of-selection.

loop at itab into wa.
write : wa-col1.
write : wa-col2.
write : wa-col3.
endloop.

Thanks

\Vikranth

Edited by: Khimavath Vikranth on Jun 12, 2008 10:37 AM

Former Member
0 Kudos

HI

Try this Function Module ALSM_EXCEL_TO_INTERNAL_TABLE

0 Kudos

I have used in teh following way. But i have not got any records into the table.

CALL FUNCTION 'FAA_FILE_UPLOAD_EXCEL'

EXPORTING

i_filename = p_file

TABLES

et_filecontent = i_extab

EXCEPTIONS

error_accessing_file = 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.

Former Member
0 Kudos

hi manju arun ni ping me plzzzzzzzzzz

Former Member
0 Kudos

hey thr,

for that u have to use the following fm.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

  • I_FIELD_SEPERATOR =

  • I_LINE_HEADER =

i_tab_raw_data =

i_filename =

tables

i_tab_converted_data =

  • 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.

just fill the relevant parameters according to ur requirements.

<REMOVED BY MODERATOR>

take care

Edited by: Alvaro Tejada Galindo on Jun 12, 2008 7:08 PM

Former Member
0 Kudos

Hello All,

I do find both the function modules that you specify. Is this being used by a specific application area ?

Any other suggestions on how to upload excel data into the SAP system?

Cheers

Kiran

0 Kudos

Sorry I mean to say that - I am not finding the above mentioned FMs in any of my SAP systems. I checked Basis, BI and SRM systems.

Can you pls tell me where I can find this ?

Cheers

Kiran

0 Kudos

Hi Kiran,

These FMs are from SAP ECC system.

Cheers,

Birwa