DDE Package Issue
AbinNov 9 2011 — edited Nov 9 2011Dear Friends,
I am using DDE package in forms 10g to load data from excel to oracle.
Locally it is working fine. But when we deploy the form on application server (10g) and run, system is throwing an error ORA-106556. (Basically it is creating the problem while initiating the problem).
Os info: Windows server 2003
Any help or work around would be appreciated.
PROCEDURE get_from_xls IS
CONVID PLS_INTEGER;
APPID PLS_INTEGER;
i number;
x number;
v_code VARCHAR2(55);
v_close varchar2(75);
Code varchar2(4);
v_unit varchar2(3);
v_group varchar2(25);
v_cat1 varchar2 (25);
v_cat2 varchar2 (25);
v_cat3 varchar2 (25);
v_cat4 varchar2 (25);
v_cat5 varchar2 (25);
v_cat6 varchar2 (25);
v_cat7 varchar2 (25);
v_fname varchar2(800);
OUT_FILR TEXT_IO.FILE_TYPE;
v_path_excel varchar2(600);
umcd varchar2(3);
valid_check varchar2(1);
BEGIN
synchronize; --C:\Program Files\Microsoft Office\OFFICE11
-- Appid := dde.app_begin('C:\Program Files\Microsoft Office\Office\excel.exe C:\ora_xls\creadit.xls',dde.app_mode_minimized);
BEGIN --finding excel path
Client_Win_API.API_ENABLED := TRUE;
v_path_excel := client_win_api_environment.Read_Registry ('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\Excel\InstallRoot','Path');
v_path_excel := v_path_excel||'excel.exe';
Exception
WHEN OTHERS THEN v_path_excel :='C:\Program Files\Microsoft Office\Office\excel.exe';
END;
:blkinfo.msg_fld :=v_path_excel;pause;
v_fName := webutil_file.file_selection_dialog ('C:\',null,'Excel files(*.xls)|*.xls|','Select Excel File');
--:titl.msg_fld := 'After Web Util';pause;
--:blkinfo.msg_fld := v_path_excel||'EXCEL.EXE "'|| v_fName ||'"';pause;
--Appid := dde.app_begin('C:\Program Files\Microsoft Office\Office11\excel.exe' ||' ' || v_fName,dde.app_mode_minimized);
Appid := dde.app_begin(v_path_excel||''|| v_fName,dde.app_mode_minimized);
--Appid := dde.app_begin(v_path_excel ||' ' || v_fName,dde.app_mode_minimized);
synchronize;
:blkinfo.msg_fld :='After Opening Excel';pause;
dde.app_focus(appid);
--:titl.msg_fld :='Before Opening Excel Sheet';pause;
--convid := dde.initiate('EXCEL.EXE','Sheet1' );
convid := dde.initiate('EXCEL',v_fName);
:blkinfo.msg_fld := 'Hello-Before Opening';pause;
x := 0;
FOR I IN 6..100000 loop
dde.request(convid,'R' || to_char(i) ||'C1',v_code,dde.cf_text,100000);
dde.request(convid,'R' || to_char(i) ||'C16',v_close,dde.cf_text,100000);
:blkinfo.msg_fld :='Inside Loop after Reading';pause;
if substr(v_close,1,length(v_close)-2) is null then
Exit;
End if;
--:titl.msg_fld := substr(v_brn,1,length(v_brn)-2); pause;
--:titl.msg_fld := substr(v_no,1,length(v_no)-2); pause;
/*insert into sls_item_mst(sim_cocd,sim_dvcd,sim_dpcd,sim_itcd,sim_desc,sim_unit,sim_type,sim_cat1,sim_cat2,sim_cat3,sim_cat4,sim_cat5,sim_cat6,sim_cat7,sim_usid,sim_date) VALUES(:global.cocd,:global.mdvcd,:global.mdpcd, substr(v_item,1,length(v_item)-2),substr(v_desc,1,length(v_desc)-2),substr(v_unit,1,length(v_unit)-2),substr(v_group,1,length(v_group)-2),substr(v_cat1,1,length(v_cat1)-2),substr(v_cat2,1,length(v_cat2)-2),
substr(v_cat3,1,length(v_cat3)-2),substr(v_cat4,1,length(v_cat4)-2),substr(v_cat5,1,length(v_cat5)-2), substr(v_cat6,1,length(v_cat6)-2),substr(v_cat7,1,length(v_cat7)-2),:global.usid,sysdate );*/
Select substr(substr(v_code,1,length(v_code)-2),instr(substr(v_code,1,length(v_code)-2),'(')+1,4) into Code from dual;
:blkinfo.msg_fld :='Code= ' || Code ;pause;
Update pfm_portfolio_det set ppd_curval=to_number(substr(v_close,1,length(v_close)-2)) where ppd_code=code;
if sql%found then
x:= x + 1;
End if;
--:sls_enquiry_det.sed_itcd := substr(v_brn,1,length(v_brn)-2) ;
--:sls_enquiry_det.sed_qty := to_number(substr(v_no,1,length(v_no)-2));
End loop;
--:blkinfo.msg_fld := 'Hello-After Opening';pause;
COMMIT;
:blkinfo.msg_fld :=x || ' Records are Saved successfully';
dde.terminate(convid);
dde.app_end(appid);
END;
-----------------------------------------------------------------------------------------------------------------------------------------------
Any correction in the above code is required. or do I need to update any patches
Regards Abin