Home > Oracle Database / Applications Tips > Oracle applications best practices > Moving data from Oracle Forms to Microsoft Excel
Oracle Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ORACLE APPLICATIONS BEST PRACTICES

Moving data from Oracle Forms to Microsoft Excel


Carol Francum
03.15.2004
Rating: -4.67- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


One way of moving Oracle report values into a Microsoft Excel file is to use the DDE.POKE function. SearchOracle.com expert Carol Francum offers an example of a DDE.POKE sequence to a SearchOracle.com reader. Click to view the original question and response. Also see MetaLink notes 37660.1 and 1018631.6 for more information on this topic.

The following is a sample trigger for using DDE to access an MS Excel spreadsheet.

/* Declare variables */ 
DECLARE 
     appid            PLS_INTEGER; 
     convid           PLS_INTEGER; 
     docid            PLS_INTEGER; 
     conv_established BOOLEAN := FALSE; 
     buffer           CHAR(100);  /* This determines the maximum size of 
                                     of the values being returned from 
                                     Excel.  Adjust it if your values exceed 
                                     this. */ 
 
/* Begin trigger DDE sample */ 
BEGIN 
 
/* Start Excel */ 
/* This line assumes that Excel is in the directory e:msofficeexcel */ 
   APPID := DDE.APP_BEGIN('E:MSOFFICEexcelexcel.EXE', 
                          DDE.APP_MODE_MINIMIZED); 
 
/* Establish a conversation with Excel */ 
/* The following loop will not end until a conversation with Excel 
   has been established.  Therefore, it can result in a endless loop, 
   so use with caution. */ 
   WHILE NOT conv_established LOOP 
     BEGIN 
       convid := DDE.INITIATE('excel', 'system'); 
       conv_established := TRUE; 
     EXCEPTION 
       WHEN DDE.DMLERR_NO_CONV_ESTABLISHED THEN 
       conv_established := FALSE; 
     END; -- loop 
 END LOOP; 
 
/* Open Excel document */ 
/* This assumes that you have an Excel spreadsheet named ddetest.xls 
   in the root of e: */ 
     DDE.EXECUTE(convid, '[Open("E:ddeTEST.xls")]', 10000); 
 
/* Initiate conversation with Excel document */ 
     docid := DDE.INITIATE('excel', 'E:ddetest.xls'); 
 
/* Begin transfer to Excel */ 
     DDE.POKE(docid, 'R2C2', 'Text', DDE.CF_TEXT, 10000); 
 
/* Begin transfer from Excel to Forms */ 
     DDE.REQUEST (docid, 'R2C2:R2C3', buffer, DDE.CF_TEXT, 1000); 
 
/* Set a text item equal to the value returned from the buffer */ 
     :TEXT_ITEM := buffer; 
 
/*End transfer to Excel */ 
     DDE.TERMINATE(docid); 
     DDE.TERMINATE(convid); 
     DDE.APP_END(appid); 
 
/* Handle exceptions */ 
EXCEPTION 
  WHEN DDE.DDE_APP_FAILURE THEN 
    MESSAGE('WINDOWS APPLICATION CANNOT START.'); 
  WHEN DDE.DDE_PARAM_ERR THEN 
    MESSAGE('A NULL VALUE WAS PASSED TO DDE'); 
  WHEN DDE.DMLERR_NO_CONV_ESTABLISHED THEN 
    MESSAGE('DDE CANNOT ESTABLISH A CONVERSATION'); 
  WHEN DDE.DMLERR_NOTPROCESSED THEN 
    MESSAGE('A TRANSACTION FAILED'); 
 
/* End of trigger */ 
END; 

Creating a default form
-----------------------

1. Startup Oracle Forms Designer, and create a default form.
2. Add a button using the Layout Editor.
3. Create a When-Button-Pressed trigger. Add the code listed in this document in the trigger.
4. Compile the trigger.
5. Add a text item named Text_item. This will display the value requested from Excel.
6. Save and generate the form.

Creating an MS Excel spreadsheet
-------------------------------
Once you have successfully generated the form, you need to create an Excel spreadsheet.

1. Start up MS Excel.
2. Add the text and formatting to the spreadsheet.
3. Save the new spreadsheet with the name ddetest.xls.

You are now ready to run the DDE sample form. Run the form and engage the trigger by pressing on the button. This should start up MS Excel and transfer the data from Oracle Forms to MS Excel and back to Oracle Forms text item.

If you have access to MetaLink, check out Notes 37660.1 and 1018631.6.


For More Information:

Check out other expert responses from Carol Francum.

See the E-Business Suite Best Web Links for resources from around the Web.

Rate this Tip
To rate tips, you must be a member of SearchOracle.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Oracle applications best practices
Where can I get more information on the Oracle CRM E-Business Suite?
Numbers to words in any language
Oracle apps DBA interview questions
The BI application consolidation challenge
Upgrading PeopleSoft, part 3: Application-specific conversions and going live
Upgrading PeopleSoft, part 2: Installation and the move to production
Upgrading PeopleSoft, part 1: The first steps
Nine steps for successful CRM implementation: Check IT List
Keep downtime short on 11i migration: Reusing a prepared software stack
Predictable Oracle applications tuning, part 3

Oracle E-Business Suite
Part 3: The final ERP transition: Crossing the finish line successfully
Part 2: Maintaining your place in the race -- ERP project management
Revving your engines: Tuning up your ERP project plan
Ventana's Mark Smith on Hyperion and Oracle BI
Oracle delivers database fixes in Critical Patch Update
Oracle CRM On Demand data integration raises big issues
Oracle applications learning guide
SMART weighs Oracle vs. SAP, picks E-Business Suite 12 for IFRS compliance
Oracle's E-Business Suite consolidates HBO's financial operations
Ellison sees new opportunities for Oracle with Java on mobile devices

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Oracle Development Solutions - SQL, J2EE, XML, SOA
HomeNewsTopicsTipsAsk the ExpertsMultimediaWhite PapersProductsBlogs
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2003 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts