Skip to Content
0
Former Member
Jun 30, 2009 at 11:40 AM

How to upload data from excel using 'ALSM_EXCEL_TO_INTERNAL_TABLE'

29 Views

Hi ,

i am uploading excel using 'ALSM_EXCEL_TO_INTERNAL_TABLE' FM.

my code is:

call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'

exporting

filename = p_file

i_begin_col = 1

i_begin_row = 1

i_end_col = 26

i_end_row = 4

tables

intern = gt_itab

exceptions

inconsistent_parameters = 1

upload_ole = 2

others = 3.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

But when pass the value that i got in gt_itab to gt_bom, instead of 1 row , 26 rows are getting added to the internal table.

I am appending the values in the following way.

loop at gt_itab into gs_itab.

case gs_itab-col.

when 1.

move gs_itab-value to gs_bom-material.

when 2.

move gs_itab-value to gs_bom-plant.

when 3.

move gs_itab-value to gs_bom-bom_usage.

when 4.

move gs_itab-value to gs_bom-alt_bom.

when 5.

move gs_itab-value to gs_bom-from_lot_size.

when 6.

move gs_itab-value to gs_bom-to_lot_size.

when 7.

move gs_itab-value to gs_bom-base_qty.

when 8.

move gs_itab-value to gs_bom-valid_from.

when 9.

move gs_itab-value to gs_bom-alt_bom_text.

when 10.

move gs_itab-value to gs_bom-bom_text.

when 11.

move gs_itab-value to gs_bom-bom_status.

when 12.

move gs_itab-value to gs_bom-lab_r_office.

when 13.

move gs_itab-value to gs_bom-item_cat.

when 14.

move gs_itab-value to gs_bom-component.

when 15.

move gs_itab-value to gs_bom-quantity.

when 16.

move gs_itab-value to gs_bom-comp_unit.

when 17.

move gs_itab-value to gs_bom-comp_scrap.

when 18.

move gs_itab-value to gs_bom-operation_scrap.

when 19.

move gs_itab-value to gs_bom-net_id.

when 20.

move gs_itab-value to gs_bom-item_text_line_1.

when 21.

move gs_itab-value to gs_bom-item_text_line_2.

when 22.

move gs_itab-value to gs_bom-usage_prob.

when 23.

move gs_itab-value to gs_bom-altitem_group.

when 24.

move gs_itab-value to gs_bom-strategy.

when 25.

move gs_itab-value to gs_bom-priority.

when 26.

move gs_itab-value to gs_bom-sort_string.

append gs_bom to gt_bom .

clear gs_bom.

endcase.

endcase.

Kindly help in fixing this issue.

Thanks a lot.