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

Error in upload excel

Former Member
5,139

Hi Experts,

I'm receiving an error when i use fm ALSM_EXCEL_TO_INTERNAL_TABLE to upload excel, the system return UPLOAD_OLE = 2 error.

Pls help me.....

My Ms Office Version is 2016 ; and SAP GUI version is SAP GUI 750 ,Patch 7.

11 REPLIES 11
Read only

prad_k
Explorer
0 Likes
3,865
Read only

Former Member
0 Likes
3,865

I have checked this link, it's not this issue, thanks.

Read only

TMSingh_SAP
Participant
0 Likes
3,865

Hi,

can you share the code how it is written.

Thanks,

Mohan

Read only

Former Member
0 Likes
3,865

Hi Mohan,

When I use SAP GUI 740 , It's OK. so.. t think the code is not relevant , thanks. the code as below.



SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S32 {
color: #3399FF;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}

      PERFORM FRM_UPLOAD_DATA_FROM_EXCEL

        TABLES GT_LIST

        USING P_FNAME 1 1 50000 16

        CHANGING GS_UPLOAD

        .


SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S31 {
font-style: italic;
color: #808080;
}
.L0S32 {
color: #3399FF;
}
.L0S33 {
color: #4DA619;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}
.L0S70 {
color: #808080;
}

FORM FRM_UPLOAD_DATA_FROM_EXCEL

   TABLES PT_UPLOAD

   USING PV_IP_FNAME PV_IP_BEGIN_ROW PV_IP_BEGIN_COL PV_IP_END_ROW

   PV_IP_END_COL

   CHANGING CV_PS_UPLOAD  "LIKE GS_UPLOAD

   .



  CONSTANTS:

    C_BEGIN_ROW TYPE I VALUE 2 ,

    C_END_ROW TYPE I VALUE 50000 ,

    C_BEGIN_COL TYPE I VALUE 1 ,      "起始列

    C_END_COL TYPE I VALUE 18.        "结束列



  DATA: LT_EXCEL TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.

  FIELD-SYMBOLS: <LV_F> TYPE ANY.



  CLEAR: PT_UPLOAD.

  REFRESH:PT_UPLOAD.



  CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

    EXPORTING

      FILENAME                = PV_IP_FNAME

      I_BEGIN_COL             = PV_IP_BEGIN_COL

      I_BEGIN_ROW             = PV_IP_BEGIN_ROW

      I_END_COL               = PV_IP_END_COL

      I_END_ROW               = PV_IP_END_ROW

    TABLES

      INTERN                  = LT_EXCEL

    EXCEPTIONS

      INCONSISTENT_PARAMETERS = 1

      UPLOAD_OLE              = 2

      OTHERS                  = 3.

  IF SY-SUBRC <> 0.

*IF NOT ( SY-MSGTY IS INITIAL OR SY-MSGID IS INITIAL OR SY-MSGNO IS

*INITIAL ).

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

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

*    ENDIF.

    MESSAGE E001(00) WITH TEXT-029 '' '' ''.

  ENDIF.





  LOOP AT LT_EXCEL.

    CONDENSE LT_EXCEL-VALUE.

* TRANSLATE LT_EXCEL-VALUE TO UPPER CASE.

    ASSIGN COMPONENT LT_EXCEL-COL OF STRUCTURE CV_PS_UPLOAD TO <LV_F>.

    IF SY-SUBRC = 0.

      <LV_F> = LT_EXCEL-VALUE.

      UNASSIGN <LV_F>.

    ENDIF.

    AT END OF ROW.

      MOVE-CORRESPONDING CV_PS_UPLOAD TO PT_UPLOAD.

      APPEND PT_UPLOAD.

      CLEAR: PT_UPLOAD ,

             CV_PS_UPLOAD .

    ENDAT.

  ENDLOOP.



ENDFORM.

Read only

Lakshmipathi
SAP Champion
SAP Champion
3,865

Have a look at OSS note 933420

Read only

0 Likes
3,865
Thanks, but may be is not this issue, i debug into this function module, change the rows and cols ,the system error in row "

CREATE OBJECT application 'Excel.Application'. "as below.

Read only

0 Likes
3,865

In GUI 740, anything is OK.

Read only

jayaraj2018
Product and Topic Expert
Product and Topic Expert
0 Likes
3,865

Hi Ming,

Did you manage to resolve your problem. I am also facing the same error with the FM ALSM_EXCEL_TO_INTERNAL_TABLE while the program runs fine in others' PC.

I even tried reinstalling MS office and SAP GUI still no luck.
Appreciate your valuable feedback.

Regards,

Jay

Read only

Sandra_Rossi
Active Contributor
0 Likes
3,865

Can you mention inside your question that you debugged and that the error is triggered at that line:

CREATE OBJECT application 'Excel.Application'.

(otherwise people may ask you the solution although they have unrelated issues)

Read only

Nawanandana
Active Contributor
0 Likes
3,865

Hi,

Can you check error message ? sy-msgv1,sy-msgv2,sy-msgv3. or debug it, you will find the issue.

Read only

Nawanandana
Active Contributor
0 Likes
3,865

If its not work, try to use FM TEXT_CONVERT_XLS_TO_SAP