Sunday, December 19, 2010
Posted by Venkat.O at 12:20 AM
We can use the Function module TEXT_CONVERT_XLS_TO_SAP to read the Excel file into the internal table. From this internal table you can fill the target internal table.
REPORT ztest_notepad.
DATA: BEGIN OF it_data OCCURS 0,
bukrs TYPE t001-bukrs,
butxt TYPE t001-butxt,
ort01 TYPE t001-ort01,
END OF it_data.
TYPE-POOLS:truxs.
DATA:it_tab_raw_data TYPE  truxs_t_text_data.
"Call TEXT_CONVERT_XLS_TO_SAP fm
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_tab_raw_data       = it_tab_raw_data
i_filename           = 'C:\test.xls'
TABLES
i_tab_converted_data = it_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.
ELSE.
"Loop the data table  
LOOP AT it_data.
WRITE:/ it_data-bukrs,it_data-butxt, it_data-ort01.
ENDLOOP.
ENDIF.

0 comments:

Post a Comment

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.