Try OpenEdge Now
skip to main content
ABL Reference
ABL Syntax Reference : DDE REQUEST statement
 

DDE REQUEST statement

(Windows only)
Retrieves the current value of a dynamic data exchange (DDE) server data item associated with the specified DDE conversation.
This statement is supported only for backward compatibility. Use the Component Object Model (COM) instead.
Note: Does not apply to SpeedScript programming.

Syntax

DDE REQUEST ddeid TARGET field ITEM name
[ TIME seconds]
[ NO-ERROR ]
ddeid
An integer expression that equals the channel number of the conversation opened for the specified data item. It is the value returned by the DDE INITIATE statement that opened the conversation.
TARGET field
Specifies a character field or variable that receives the value of the data item as a character string.
ITEM name
Specifies the name of the server data item from which to retrieve a value. The data item name is a character expression that identifies the data item according to the conventions of the server application (for example, the row and column coordinates of a worksheet cell, such as R2C1 in Microsoft Excel).
TIME seconds
Specifies the maximum number of seconds that the ABL client waits for the DDE REQUEST statement to complete, where seconds is an integer expression. If you do not specify the TIME option or specify a value of 0, the AVM waits indefinitely for the statement to complete.
NO-ERROR
By default, if the statement fails to retrieve the data item value, the AVM raises the ERROR condition and posts the error to the DDE frame DDE-ERROR attribute. If you specify NO-ERROR, the AVM does not raise the ERROR condition but does post the error to the DDE frame.

Example

The following fragment shows a typical use of the DDE REQUEST statement. It assumes that the Microsoft Excel application is running, and has created the default Excel worksheet, Sheet1. It then uses the DDE INITIATE statement to open a conversation with Sheet1 as the topic. This allows the AVM to exchange data with the cells of the worksheet.
In this example, the fragment builds 10 new Customer records from data obtained from the first 4 columns in the worksheet using the DDE REQUEST statement. The data includes Customer name, year-to-date sales, state, and zip code. (The requests start from row 2, because row 1 contains column headings.)
DEFINE VARIABLE Rowi     AS INTEGER   NO-UNDO. /* Worksheet row counter */
DEFINE VARIABLE ItemName AS CHARACTER NO-UNDO. /* Item Name */
DEFINE VARIABLE CustName AS CHARACTER NO-UNDO. /* Customer name receptor */
DEFINE VARIABLE YTDsales AS CHARACTER NO-UNDO. /* YTD sales receptor */
DEFINE VARIABLE StateAbr AS CHARACTER NO-UNDO. /* State name receptor */
DEFINE VARIABLE ZipCode  AS CHARACTER NO-UNDO. /* Zip code receptor */
DEFINE VARIABLE Sheet1   AS INTEGER   NO-UNDO. /* DDE-ID to worksheet */
DEFINE VARIABLE DDEframe AS HANDLE    NO-UNDO. /* DDE frame handle */

CREATE FRAME DDEframe.                         /* Create DDE frame */
. . .
/* Open a DDE conversation with Sheet1 and create 10 Customer records from
   the data in four columns of the worksheet. */
DDE INITIATE Sheet1 FRAME DDEframe APPLICATION "Excel" TOPIC "Sheet1".

REPEAT Rowi = 2 TO 11:
  CREATE Customer.
  Customer.CustNum = Rowi - 1.
  ItemName = "R" + STRING(Rowi) + "C1".
  DDE REQUEST Sheet1 TARGET CustName ITEM ItemName.
  Customer.Name = CustName.
  ItemName = "R" + STRING(Rowi) + "C2".
  DDE REQUEST Sheet1 TARGET YTDsales ITEM ItemName.
  Customer.YtdSls = DECIMAL(YTDsales).
  ItemName = "R" + STRING(Rowi) + "C3".
  DDE REQUEST Sheet1 TARGET StateAbr ITEM ItemName.
  Customer.State = StateAbr.
  ItemName = "R" + STRING(Rowi) + "C4".
  DDE REQUEST Sheet1 TARGET ZipCode  ITEM ItemName.
  Customer.PostalCode = INTEGER(ZipCode).
  RELEASE Customer.
END.
. . .

Note

For more information on using the DDE protocol to exchange data with non-ABL applications, see OpenEdge Development: Programming Interfaces.

See also

DDE INITIATE statement