Professional Documents
Culture Documents
Enterprise Resource
Planning Portal
Enterprise Resource
Planning Portal
Google Search
Web
ERPGenie Menu
ERPGenie.
COM
Consultant Corner
Client Corner
Advertise | BLOG
ERPGenie.COM -> SAP Technical -> ABAP -> Example code -> Working with Excel
REPORT ZZBGS010 .
*----------------------------------------------------------------------*
* Example: Interface between Microsoft Excel and ABAP/4 with up- and
*
* downloading of data plus executing Microsoft Excel.
*
*----------------------------------------------------------------------*
TABLES: USR04.
DATA: SIZE TYPE I.
DATA: BEGIN OF USER OCCURS 100.
INCLUDE STRUCTURE USR04.
DATA: END OF USER.
* ---------------------------------------------------------------------*
* Example: Select some data into an internal table.
*
* ---------------------------------------------------------------------*
SELECT * FROM
*
*
*
*
---------------------------------------------------------------------*
Example: Downloading data in Microsoft Excel Format with automatic
*
prompt popup dialog.
*
---------------------------------------------------------------------*
---------------------------------------------------------------------*
Example: Downloading data in Microsoft Excel Format without automatic*
prompt popup.
*
---------------------------------------------------------------------*
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME
= 'C:\tmp\SAPEXL2.XLS'
FILETYPE
= 'WK1'
"ASC, WK1, DBF, DAT, bin
MODE
= ' '
"Mode ' ' = Rewrite Mode 'A' = Appending
TABLES
DATA_TAB
= USER.
CLEAR USER.
REFRESH USER.
"Clear buffer
"Refresh, empty internal table
*----------------------------------------------------------------------*
* Example: Uploading Microsoft Excel to ABAP/4 internal table.
*
*----------------------------------------------------------------------*
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = 'C:\tmp\SAPEXL.prn'
FILETYPE = 'ASC'
IMPORTING
FILESIZE = SIZE
TABLES
DATA_TAB = USER.
*----------------------------------------------------------------------*
* Example: Starting Microsoft Excel and load sheet.
*
*----------------------------------------------------------------------*
CALL FUNCTION 'WS_EXECUTE'
EXPORTING
COMMANDLINE
= 'C:\tmp\SAPEXL1.XLS'
PROGRAM
= 'F:\APPL\WINDOWS\EXCEL5DK\EXCEL.EXE'
.
*----------------------------------------------------------------------*
* Example: Starting Microsoft Excel and load internal table as sheet
*
*----------------------------------------------------------------------*
http://www.erpgenie.com/abap/code/abap42.htm (2 of 3)11/27/2007 12:21:23 PM