Skip to Content
0
Former Member
Sep 17, 2007 at 09:30 AM

how to upload Excell file data into database table

42 Views

Hi,

can you tell me the procedure for upload excell file data into database table. Here i am sending my code, if i am wrong ket me know the actual process.

&----


*& Report ZTESTREPORT

*&

&----


*&

*&

&----


REPORT ZTESTREPORT.

*TABLES: ZCRM_DM_VBRK.

TYPES: BEGIN OF TS_ZCRM_DM_VBRK,

VBELN TYPE ZCRM_DM_VBRK-VBELN,

VKORG TYPE ZCRM_DM_VBRK-VKORG,

BUKRS TYPE ZCRM_DM_VBRK-BUKRS,

KUNAG TYPE ZCRM_DM_VBRK-KUNAG,

FKDAT TYPE ZCRM_DM_VBRK-FKDAT,

ERDAT TYPE ZCRM_DM_VBRK-ERDAT,

END OF TS_ZCRM_DM_VBRK,

TT_ZCRM_DM_VBRK TYPE STANDARD TABLE OF TS_ZCRM_DM_VBRK.

DATA: WA_ZCRM_DM_VBRK TYPE TS_ZCRM_DM_VBRK,

ITAB TYPE TT_ZCRM_DM_VBRK.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = 'C:\Documents and Settings\admin\Desktop\VBRK_DATA.XLS '

FILETYPE = 'ASC'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = ITAB

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

NO_AUTHORITY = 10

OTHERS = 11 .

IF SY-SUBRC <> 0.

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

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

ENDIF.

LOOP AT ITAB INTO WA_ZCRM_DM_VBRK.

INSERT INTO ZCRM_DM_VBRK FROM WA_ZCRM_DM_VBRK.

ENDLOOP.

I am getting errors in loop stmt (INSERT INTO ZCRM_DM_VBRK FROM WA_ZCRM_DM_VBRK.) and if i commented the loop stmt and i chked up to the F.M part in the debugging mode values are comming like #### ##### #####.. So, can u correct the error.