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

FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' Problem

Former Member
0 Likes
864

Hi,

I am trying to upload an excel sheet using SAP standard function module ALSM_EXCEL_TO_INTERNAL_TABLE through an custom program. I am getting a strange error: "I must close the excel sheet" even though I my excel sheet is not open.

Below is my source code.

data: I_INTERN         LIKE ALSMEX_TABLINE occurs 0.
        FILENAME        LIKE  RLGRAP-FILENAME,
        I_BEGIN_COL  TYPE  I DEFAULT 1,
        I_BEGIN_ROW TYPE  I DEFAULT 1
        I_END_COL      TYPE  I DEFAULT 256
        I_END_ROW     TYPE  I DEFAULT 65536


call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    exporting
      FILENAME                = FILENAME
      I_BEGIN_COL             = I_BEGIN_COL
      I_BEGIN_ROW             = I_BEGIN_ROW
      I_END_COL               = I_END_COL
      I_END_ROW               = I_END_ROW
    tables
      INTERN                  = I_INTERN
    exceptions
      INCONSISTENT_PARAMETERS = 1
      UPLOAD_OLE              = 2
      others                  = 3.
  if SY-SUBRC <> 0.
    case SY-SUBRC.
      when 1.
        raise INCONSISTENT_PARAMETERS.
      when 2.
        raise UPLOAD_OLE.
      when 3.
        raise OTHERS.
    endcase.
  endif.

Please advice me some solution.

Thanks,

Chinmay

Hi,

I am trying to upload an excel sheet using SAP standard function module ALSM_EXCEL_TO_INTERNAL_TABLE through an custom program. I am getting a strange error: "I must close the excel sheet" even though I my excel sheet is not open.

Below is my source code.

data: I_INTERN         LIKE ALSMEX_TABLINE occurs 0.
        FILENAME        LIKE  RLGRAP-FILENAME,
        I_BEGIN_COL  TYPE  I DEFAULT 1,
        I_BEGIN_ROW TYPE  I DEFAULT 1
        I_END_COL      TYPE  I DEFAULT 256
        I_END_ROW     TYPE  I DEFAULT 65536


call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    exporting
      FILENAME                = FILENAME
      I_BEGIN_COL             = I_BEGIN_COL
      I_BEGIN_ROW             = I_BEGIN_ROW
      I_END_COL               = I_END_COL
      I_END_ROW               = I_END_ROW
    tables
      INTERN                  = I_INTERN
    exceptions
      INCONSISTENT_PARAMETERS = 1
      UPLOAD_OLE              = 2
      others                  = 3.
  if SY-SUBRC <> 0.
    case SY-SUBRC.
      when 1.
        raise INCONSISTENT_PARAMETERS.
      when 2.
        raise UPLOAD_OLE.
      when 3.
        raise OTHERS.
    endcase.
  endif.

Please advice me some solution.

Thanks,

Chinmay

1 REPLY 1
Read only

RaymondGiuseppi
Active Contributor
0 Likes
421

This FM use OLE to Copy/Paste data from Excel to clipboard and then to Abap. This problem can be related to the many threads on [OLE close excel process|http://www.sdn.sap.com/irj/scn/advancedsearch?query=olecloseexcel+process] take a look. (*)

Regards,

Raymond

(*) Especially if you have done a lot of tests without logging off your Windows. Look via Windows task manager ([ctrlaltdel|http://en.wikipedia.org/wiki/Control-Alt-Delete])