ABAP – ALSM_EXCEL_TO_INTERNAL_TABLE

The Function Module  ALSM_EXCEL_TO_INTERNAL_TABLE is used for uploding data from the excel sheet to the internal table in the program.

Importing Parameters

filename                     –  Name of the excel filename.

i_begin_col              – Starting  column.

i_begin_row             –  Starting row

i_end_col                    – Ending Column

i_end_row                      – Ending Row

 

Exporting Parameter

 intern                        – Internal table to which data are uploaded.

After execution , the below FM upload the values from the excel to the internal table it_alsmex_tabline which is of type alsmex_tabline.  The values are stored in the following format:

Values

 

 

 

 

 

 

 

CALL FUNCTION ‘ALSM_EXCEL_TO_INTERNAL_TABLE
EXPORTING
filename                = p_file1
i_begin_col             = 1
i_begin_row             = 1
i_end_col               = 7
i_end_row               = 100
TABLES
intern                  = it_alsmex_tabline
EXCEPTIONS
inconsistent_parameters = 1
upload_ole              = 2
OTHERS                  = 3.
IF sy-subrc <> 0.
*    implement suitable error handling here
ENDIF.

 

 

We can extract the values by looping the internal table as follows:

 

LOOP AT it_alsmex_tabline INTO wa_alsmex_tabline.

CASE wa_alsmex_tabline-col.
WHEN ‘0001’.
work_area-field1 = wa_alsmex_tabline-value.

WHEN ‘0002’.
work_area-field2 = wa_alsmex_tabline-value.

………
ENDCASE.

 

0 Comments

Leave A Reply