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

msaccess or excel

Former Member
0 Likes
559

hi how can ı to import data into my z** tables from excel and msaccess

please give me an example me?thnks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
528

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.

4 REPLIES 4
Read only

Former Member
0 Likes
528

<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

Read only

Former Member
0 Likes
528

could you pls help me about this subject

Read only

0 Likes
528

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 -

http://www.sap-img.com/abap/upload-direct-excel.htm

http://www.sapdevelopment.co.uk/file/file_upexcel.htm

Read only

Former Member
0 Likes
529

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.