‎2007 Sep 20 2:12 PM
hi how can ı to import data into my z** tables from excel and msaccess
please give me an example me?thnks
‎2007 Sep 20 7:54 PM
Hi onyedi,
Try using this code...
CONSTANTS : c_asc TYPE rlgrap-filetype VALUE 'ASC'.
DATA: l_srow TYPE i,
l_erow TYPE i.
>> Read excel file..
l_srow = p_srow.
l_erow = p_erow.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_fname
i_begin_col = c_scol
i_begin_row = l_srow
i_end_col = c_ecol
i_end_row = l_erow
TABLES
intern = txxl_dat
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.
ELSE.
>> Parse data read from excel sheet into UPLOAD record fmt..
LOOP AT txxl_dat.
CASE txxl_dat-col.
WHEN 1.
t_upl-matnr = txxl_dat-value.
WHEN 2.
t_upl-prctr = txxl_dat-value.
WHEN 3.
t_upl-meins = txxl_dat-value.
WHEN 4.
t_upl-meinh = txxl_dat-value.
WHEN 5.
t_upl-umrez = txxl_dat-value.
WHEN 6.
t_upl-umren = txxl_dat-value.
WHEN 7.
t_upl-glcaf = txxl_dat-value.
WHEN 8.
t_upl-invalid = txxl_dat-value.
ENDCASE.
AT END OF row.
APPEND t_upl.
CLEAR t_upl.
ENDAT.
ENDLOOP.
ENDIF.
‎2007 Sep 20 2:27 PM
<b>Hi,
Try this Function module FAA_FILE_UPLOAD_EXCEL.</b>
<b><REMOVED BY MODERATOR></b>
Message was edited by:
Sathyaa
Message was edited by:
Alvaro Tejada Galindo
‎2007 Sep 20 7:43 PM
‎2007 Sep 20 7:55 PM
You can write a custom program which will upload Excel file to SAP. This way, excel data will reside in internal table.
If file upload is successful, you can insert this data to your custom table.
For reference check this link -
‎2007 Sep 20 7:54 PM
Hi onyedi,
Try using this code...
CONSTANTS : c_asc TYPE rlgrap-filetype VALUE 'ASC'.
DATA: l_srow TYPE i,
l_erow TYPE i.
>> Read excel file..
l_srow = p_srow.
l_erow = p_erow.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_fname
i_begin_col = c_scol
i_begin_row = l_srow
i_end_col = c_ecol
i_end_row = l_erow
TABLES
intern = txxl_dat
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.
ELSE.
>> Parse data read from excel sheet into UPLOAD record fmt..
LOOP AT txxl_dat.
CASE txxl_dat-col.
WHEN 1.
t_upl-matnr = txxl_dat-value.
WHEN 2.
t_upl-prctr = txxl_dat-value.
WHEN 3.
t_upl-meins = txxl_dat-value.
WHEN 4.
t_upl-meinh = txxl_dat-value.
WHEN 5.
t_upl-umrez = txxl_dat-value.
WHEN 6.
t_upl-umren = txxl_dat-value.
WHEN 7.
t_upl-glcaf = txxl_dat-value.
WHEN 8.
t_upl-invalid = txxl_dat-value.
ENDCASE.
AT END OF row.
APPEND t_upl.
CLEAR t_upl.
ENDAT.
ENDLOOP.
ENDIF.