Shared Top Border

Enterprise Resource
Planning Portal

 

Advertise | Founder BLOG

ERPGenie.COM ABAP Tips and Tricks Database

THE ultimate
ERP website

 

Forums | Vote for us |

Google    Other Search Options

Login

Login to view more content!!!





Lost Password?
No account yet? Register

Registered Access

Poll

What area of ABAP are you interested in?
 
Home arrow Sample Code arrow ABAP Reports arrow Working with Excel
Working with Excel PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Anon.   
Saturday, 20 January 2007
Interface between Microsoft Excel and ABAP/4 with up- and  downloading of data plus executing Microsoft 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  USR04 INTO TABLE USER .
 
 * ---------------------------------------------------------------------*
 * Example: Downloading data in Microsoft Excel Format with automatic   *
 * prompt popup dialog.                                                 *
 * ---------------------------------------------------------------------*
   CALL FUNCTION 'DOWNLOAD'
     EXPORTING
       FILENAME     = 'C:\tmp\SAPEXL1.XLS'
       FILETYPE     = 'WK1'   "ASC, WK1, DBF, DAT, bin
       MODE         = ' '     "Mode ' ' = Rewrite Mode 'A' = Appending
     TABLES
       DATA_TAB     = USER.
 
 * ---------------------------------------------------------------------*
 * 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.      "Clear buffer
  REFRESH USER.    "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   *
 *----------------------------------------------------------------------*
 CALL FUNCTION 'WS_EXCEL'
   EXPORTING
     FILENAME = 'C:\tmp\SAPEXL.XLS'
     SYNCHRON = ' '
   TABLES
     DATA     = USER.
 --------------------------------------------------------------------------------
 
< Prev   Next >

Google Search

Statistics

Contribution Activity
Utilities: 38
Tips and Tricks: 334
Sample Code: 166
Total Contributions: 553

Member Activity
Members: 6305 since 2/1/2007!
New: 0 since yesterday!
Visitors: 1167862
We have 1 guest online

Newest Members

Welcome our newest members:

Google Ads

Shared Bottom Border

Contact Us | Polls | Add URL | Contribute | Privacy | Terms | Feedback

Discussion Forum | BLOG | Consultants: Post your resume | Companies: Advertise on ERPGenie.COM | Post Job
Financials Consultant | Consultant Review | Gallia Consulting | Supply Chain Project | SAP Financials Forum
GenieHoldings.COM, Inc. | Genie Press | WorkflowGenie | ESAGenie | ERPTopSites | ABAP Tips and Tricks | SAP Solutions Database

EDIGenie | Searching Survivor