In the ABAP report program we have frequently used the TEXT_CONVERT_XLS_TO_SAP function module to convert excel file data to an internal table. Sometimes we face issues with this function module in case of background jobs. This function module works fine in foreground execution of a report but in background it will not work. so we need an alternate solution that will help for foreground as well as background execution.
ALSM_EXCEL_TO_INTERNAL_TABLE is a SAP's standard function module that will work in background and foreground also.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file "file name
i_begin_col = '0001'
i_begin_row = '0002'
i_end_col = '0007'
i_end_row = '9999'
TABLES
intern = it_excel "internal table name
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
IDE Used To Test This Code : SAP ABAP Editor.
Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us. We will reply you as soon as possible.
Post a Comment