Skip to Content
0
Former Member
Aug 02, 2006 at 06:30 PM

uploading excel issue

86 Views

Hi all,

Iam uploading an excel sheet to a table.

i moved all the rows and colums using FM into i_tab_sheet.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = p_file

I_BEGIN_COL = 1

I_BEGIN_ROW = 1

I_END_COL = 5

I_END_ROW = 20

TABLES

INTERN = i_itab_sheet

EXCEPTIONS

INCONSISTENT_PARAMETERS = 1

UPLOAD_OLE = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

loop at i_itab_sheet.

If i_itab_sheet-col = 1.

t_upload-erdat = i_itab_sheet-value.

elseIF i_itab_sheet-col = 2.

t_upload-matnr = i_itab_sheet-value.

<b>elseIF i_itab_sheet-col = 5.</b>

t_upload-kostl = i_itab_sheet-value.

append t_upload.

clear t_upload.

endif.

endloop.

The problem is that for 1 record say 2 record i.e 2 row my column 5 is empty.

Infact there is no record in i_tab_sheet with row 2 and column 5.

so when i loop it at i_tab_sheet.

The statement elseIF i_itab_sheet-col = 5.

t_upload-kostl = i_itab_sheet-value.

is never triggered and since i have append statement after this this particular record i.e record 2 of excel sheet is not moved in to internal table.

Can anyone suggest me how to overcome this.I want to move this one in to internal table