Skip to Content
0
Former Member
Aug 09, 2006 at 09:16 AM

Uploading Excel file to SAP

127 Views

Hi Friends,

Iam trying to Upload Excel file into SAP using the FM

ALSM_EXCEL_TO_INTERNAL_TABLE. But it is going to dump n the error is

The call to the function module "ALSM_EXCEL_TO_INTERNAL_TABLE" is incorrect:

In the function module interface, you can specify only

fields of a specific type and length under "INTERN".

Although the currently specified field

"ITAB" is the correct type, its length is incorrect.

I have attached the code also.

Please let me know where iam getting the error.

Code :

Tables : mara,

ztable.

parameters : p_infile like rlgrap-filename.

data : begin of itab occurs 0,

matnr like mara-matnr,

mbrsh like mara-mbrsh,

matkl like mara-matkl,

end of itab.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = p_infile

I_BEGIN_COL = 1

I_BEGIN_ROW = 1

I_END_COL = 100

I_END_ROW = 100

TABLES

INTERN = 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.

sort itab by matnr.

loop at itab.

write:/ itab.

*modify ztable from table itab.

endloop.