06-12-2008 9:29 AM
I have an Excel Sheet. I want to upload the records into the internal table. How ?
06-12-2008 9:36 AM
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
06-12-2008 9:32 AM
06-12-2008 9:36 AM
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
06-12-2008 9:37 AM
06-12-2008 9:52 AM
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.
06-12-2008 9:37 AM
06-12-2008 10:18 AM
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
09-05-2008 5:33 AM
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
09-05-2008 8:00 AM
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
07-10-2013 6:12 AM