|
|
Question : DDE in Oracle forms
|
|
I'm trying to write data to excel from Oracle Form.
Everytjing works fine if I specify parameter DDE.APP_MODE_NORMAL or DDE.APP_MODE_MAXIMIZED. For DDE.APP_MODE_MINIMIZED I'm getting error DDE.DMLERR_NOTPROCESSED
Following is the code ----------------------------------------------------------------------------------------------- PROCEDURE p_load_excel IS appid PLS_INTEGER; convid PLS_INTEGER; docid PLS_INTEGER; i number := 0; filename varchar(150); rowcol1 varchar(15); rowcol2 varchar(15); v_product_name varchar2(75); rowcol3 varchar(75); rowcol4 varchar(15); rowcol5 varchar(15); v_field1 table0.field1%type; v_field2 table1.folder_id%type; v_field3 table2.field3%type; v_field4 table3.field4%type; v_product_id table1.product_id%type; conv_established BOOLEAN := FALSE; CURSOR table_data_c IS SELECT s.field1, t.field2, p.field3, l.field4, product_id FROM table0 s, table1 t, table2 p, table3 l, table4 subpr WHERE ( (s.seq_nmbr = table.seq_nmbr) AND (t.seq_nmbr = p.seq_nmbr) AND (table.p_seq_nmbr = p.p_seq_nmbr) AND (p.p_seq_nmbr = l.p_seq_nmbr) AND (subpr.p_subtype_seq_nmbr = t.p_subtype_seq_nmbr) and s.p_subtype_code = :P_SUBTYPTE_CD ); BEGIN
/* Start Excel */ /* This line assumes that Excel is in the directory C:\Program Files\Microsoft Office\Office\excel.exe */ host('del c:\test.xls', NO_SCREEN); APPID := DDE.APP_BEGIN('C:\Program Files\Microsoft Office\Office\excel.exe', DDE.APP_MODE_MINIMIZED); --DDE.APP_MODE_NORMAL); --DDE.APP_MODE_MAXIMIZED);
/* 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 */ filename := 'c:\test.xls'; DDE.EXECUTE(convid, '[Save.As("' || filename || '")]', 10000); DDE.EXECUTE(convid, '[Open("C:\TEST.xls")]', 10000);
/* Initiate conversation with Excel document */ docid := DDE.INITIATE('excel', 'C:\TEST.xls'); /* process putting of data into an excel worksheet*/ i :=2; open table_data_c; loop fetch table_data_c into v_field1 ,v_field2 ,v_field3 ,v_field4 ,v_product_id; EXIT WHEN table_data_c%NOTFOUND;
DDE.POKE(docid, 'R1C1',Field1', DDE.CF_TEXT, 1000); DDE.POKE(docid, 'R1C2','Field2', DDE.CF_TEXT, 1000); DDE.POKE(docid, 'R1C3','Product Name', DDE.CF_TEXT, 1000); DDE.POKE(docid, 'R1C4','Field3', DDE.CF_TEXT, 1000); DDE.POKE(docid, 'R1C5','Field4', DDE.CF_TEXT, 1000); rowcol1 := 'R' || to_char(i) || 'C1'; rowcol2 := 'R' || to_char(i) || 'C2'; rowcol3 := 'R' || to_char(i) || 'C3'; rowcol4 := 'R' || to_char(i) || 'C4'; rowcol5 := 'R' || to_char(i) || 'C5'; /* Begin transfer to Excel */ v_field3 := nvl(v_field3,' '); v_field4 := nvl(v_field4,' '); v_product_name := substr(table_get_product_nm_f (v_product_id),1,75); DDE.POKE(docid, rowcol1,v_field1, DDE.CF_TEXT, 1000); DDE.POKE(docid, rowcol2,v_field2, DDE.CF_TEXT, 1000); DDE.POKE(docid, rowcol3,v_product_name, DDE.CF_TEXT, 1000); DDE.POKE(docid, rowcol4,v_field3, DDE.CF_TEXT, 1000); DDE.POKE(docid, rowcol5,v_field4, DDE.CF_TEXT, 1000); i := i + 1; PKG_MSG.SHOW_ERROR('A TRANSACTION ' || (i - 2) ); end loop; PKG_MSG.SHOW_ERROR(' counted '|| (i - 2) );
/*End transfer to Excel */ --DDE.TERMINATE(docid); --DDE.TERMINATE(convid); --DDE.APP_END(appid);
/* Handle exceptions */ EXCEPTION WHEN DDE.DDE_APP_FAILURE THEN PKG_MSG.SHOW_ERROR('WINDOWS APPLICATION CANNOT START.'); WHEN DDE.DDE_PARAM_ERR THEN PKG_MSG.SHOW_ERROR('A NULL VALUE WAS PASSED TO DDE'); WHEN DDE.DMLERR_NO_CONV_ESTABLISHED THEN PKG_MSG.SHOW_ERROR('DDE CANNOT ESTABLISH A CONVERSATION'); WHEN DDE.DMLERR_NOTPROCESSED THEN PKG_MSG.SHOW_ERROR('A TRANSACTION FAILED at row' || (i - 2) ); WHEN OTHERS THEN PKG_MSG.SHOW_ERROR('EROOR '|| SQLCODE||SUBSTR(SQLERRM,1,60) ); /* End of trigger */ END;
|
Answer : DDE in Oracle forms
|
|
hi
i got these messages from oracle
1. A transaction failed. The item name in a DDE.POKE or DDE.REQUEST transaction may be in error.
2. Check whether excel is installed in ur PC and check in which language it is installed.
3. do u have the excel file created in ur PC.
regards annamalai
|
|
|
|
|