Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Abap-FM

Former Member
0 Likes
378

Hi,

How do i upload the large amount of data of EXCEL sheet to internal table, we can use FM i.e., ALSM_EXCEL_TO_INTERNAL_TABLEand how to loop this large amount of Data??

2 REPLIES 2
Read only

Former Member
0 Likes
354

Hi,

Check this link:

Regards

Adil

Edited by: Syed Abdul Adil on Jul 8, 2008 10:01 AM

Read only

Former Member
0 Likes
354

hiiii

if you want to upload data from excel file then you will have to use following code

*Upload data from Excel to internal table.
  CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
      filename                = p_pfile
      i_begin_col             = 1
      i_begin_row             = 2
      i_end_col               = 45
      i_end_row               = 8
    TABLES
      intern                  = it_excel
    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.                               " IF sy-subrc <> 0

*Populate data to internal tables and structructures
  SORT it_excel BY row col.

  LOOP AT it_excel INTO ls_excel.

    CASE ls_excel-col.
      WHEN 1.
        ls_data-doc_type = ls_excel-value.
      WHEN 2.
        ls_data-rec_no = ls_excel-value.
      WHEN 3.
        ls_data-doc_ver = ls_excel-value.
      WHEN 4.
        ls_data-doc_part = ls_excel-value.
      WHEN 5.
        ls_data-description = ls_excel-value.
      WHEN 6.
        ls_data-username = ls_excel-value.
      WHEN 7.
        ls_data-statusextern = ls_excel-value.
      WHEN 8.
        ls_data-statusintern = ls_excel-value.
      WHEN 9.
        ls_data-statuslog = ls_excel-value.
      WHEN 10.
        ls_data-laboratory = ls_excel-value.
      WHEN 11.
        ls_data-ecnumber = ls_excel-value.
      WHEN 12.
        ls_data-validfromdate = ls_excel-value.
      WHEN 13.
        ls_data-revlevel = ls_excel-value.
      WHEN 14.
        ls_data-deleteindicator = ls_excel-value.
      WHEN 15.
        ls_data-cadindicator = ls_excel-value.
      WHEN 16.
        ls_data-structureindicator = ls_excel-value.
      WHEN 17.
        ls_data-predocumentnumber = ls_excel-value.
      WHEN 18.
        ls_data-predocumentversion = ls_excel-value.
      WHEN 19.
        ls_data-predocumentpart = ls_excel-value.
      WHEN 20.
        ls_data-predocumenttype = ls_excel-value.
            ENDCASE.                           "      ENDLOOP.                             " LOOP AT it_excel

regards

twinkal