Sunday, June 3, 2018

signer information does not match signer information of other classes in the same package in Oracle forms java bean


  • The Main issue to this ,is there are many jar File have same package name on it
  • To Solve the issue ,used  JDeveloper or any java developer to combine Class from multiple jar into only one jar and sign  as example :-
clientinfos.jar has main pakge name is :-package
and javahost.jar has also smae page name 

combine this into one package  as follow using  JDeveloperVersion 11.1.1.2.0
  1. Create new Project and give it any name 
  2. Then  add all class from clientinfos.jar,javahost.jar using coy past 
  3. After add both Class ,creat JAR profile and Sign it using wbutile sign script :-C:\Oracle\midtierhome\jdk\bin>C:\Oracle\midtierhome\forms\webutil\sign_webutil.bat C:\Oracle\midtierhome\forms\java\newjar.jar

Wednesday, May 30, 2018

custom ON-ERROR And ON-MESSAGE On Oracle forms

At Forms Level 
create tow Trigger

1-ON-ERROR 

declare
     errnum number := ERROR_CODE;
     errtxt varchar2(80) := ERROR_TEXT;
     errtype varchar2(3) := ERROR_TYPE;
     field_name varchar2(30);
begin

     field_name := substr(:SYSTEM.TRIGGER_ITEM ,instr(:SYSTEM.TRIGGER_ITEM ,'.') + 1);
     message( 'ERROR ' || field_name || ': ' ||errtxt); message( 'ERROR ' || field_name || ': ' ||errtxt);
     display_error;
     raise form_trigger_failure;
     end;

2-ON-MESSAGE

DECLARE
  lv_errtype VARCHAR2(3)  := MESSAGE_TYPE;
  lv_errcod NUMBER        := MESSAGE_CODE;
  lv_errtxt VARCHAR2(80)  := MESSAGE_TEXT;
BEGIN
  IF lv_errcod = 40400 THEN
     Message('saved Successfully'); Message('saved Successfully');
 -- ELSIf lv_errcod in(42100) Then
    --null;
 ELSIF lv_errcod IN( 42100 ) AND lv_errtype='FRM' THEN
  NULL;
 ELSE
 
    Message(lv_errtype||'-'||to_char(lv_errcod)||':  '||lv_errtxt);
    Message(lv_errtype||'-'||to_char(lv_errcod)||':  '||lv_errtxt);
  END IF;
END; 

Tuesday, May 1, 2018

sign oracle forms jar file

to enable security for jar file we need to sign it using the following step

1.    using dos command do the following : cmd> keytool -genkey -alias keystore01 -keyalg RSA -keystore mypassword
where C:\Oracle\midtierhome is the oracle home 
Enter keystore password:  mypassword
What is your first and last name?
  [Unknown]:  Joe Bloggs
What is the name of your organizational unit?
  [Unknown]:  My Department
What is the name of your organization?
  [Unknown]:  My Company
What is the name of your City or Locality?
  [Unknown]:  My City
What is the name of your State or Province?
  [Unknown]:  My State
What is the two-letter country code for this unit?
  [Unknown]:  UK
Is CN=Joe Bloggs, OU=My Department, O=My Company, L=My City, ST=My State, C=UK correct?
  [no]:  yes

Enter key password for <myapp>
        (RETURN if same as keystore password):
2.    then use the keystore to sign the jar file by using command line run this:


C:\Oracle\midtierhome\jdk\bin\jarsigner -keystore keystore01  -storepass mypassword C:\Oracle\midtierhome\forms\java\hl_icons.jar keystore01

Tuesday, April 24, 2018

scan to pdf from oracle forms 10g to shared folder


To scan document from oracle forms to shared folder

In This post, we will explain one way to scan document to pdf or image forms, the attached forms use the following third party tool (naps2) which scan to pdf using command line parameter

In addition, we will call VBscipt  which in turn call naps2 file using command prompt using java bean, this java bean simply execute any command prompt from oracle forms as below code

Step :-1 frist add bean to your forms
Step :-2 add button to your forms which will call the following code:-
FILE_NAME will be file location example d:\f.pdf or \\filserver\doc\a.pdf
pdfscan.vbs is the vbscript wich accept filename as input and it call naps2 file
pdfscan.vbs can be on clinet user machine or smpliy in sahred folder like \\filserver\doc\

declare

               CMD varchar2(300);
begin
CMD:='cmd /c wscript \\filserver\doc\pdfscan.vbs '||:FILE_NAME;
 Set_Custom_Property( 'BL.BEAN', 1, 'SET_PROG', CMD ) ;
 

END;

Step :-3 using notpade past this code and save it as pdfscan.vbs and put this file in location we can be accessed from any forms like \\filserver\doc\pdfscan.vbs
=====================================================
Option Explicit
Dim oTxtFile
Dim InputFile
Dim objFSO, strDoc, objFile,oWord,oShell
InputFile= WScript.Arguments(0)
 'Msgbox InputFile
With (CreateObject("Scripting.FileSystemObject"))
  If .FileExists(InputFile) Then
      Msgbox "File Exist"
      Set oShell = WScript.CreateObject ("WScript.Shell")
      'Msgbox "C:\NAPS2\NAPS2.Console.exe -i "& InputFile &" -o "& InputFile &" -f"
      oShell.run   "C:\NAPS2\NAPS2.Console.exe -i "& InputFile &" -o "& InputFile &" -f"
      Set oShell = Nothing'
  Else
      'Set oTxtFile = .CreateTextFile(InputFile)
      Msgbox "File Created"
     
      Set oShell = WScript.CreateObject ("WScript.Shell")
      oShell.run   """C:\NAPS2\NAPS2.Console.exe"" -o" &InputFile
      Set oShell = Nothing'
  End If

End With

WScript.Quit(1) 

=========================================

Step :-4 just scan
Thanks

attached form:-

Monday, January 1, 2018

Could not reserve record 2 tries keep trying oracle forms -Sloution


  1. This error happens because there is locked session and the solution to kill the session using the following steps :-
  • first fin the locked session using this query from db account select sid,serial# from v$session where sid in (select a.SESSION_ID from v$locked_object a, dba_objects b where a.object_id = b.object_id and a.SESSION_ID not in (select a.SESSION_ID from v$locked_object a, dba_objects b where a.object_id = b.object_id and session_id in (select sid from v$lock where block = 1)));
  • Then kill the locked session using sid,serial# from the first query  using this :- alter system kill session '119,148 ' immediate;

Open Word Document From Oracle 10g Form

1-Configure webutil as per this post
10g.htmlhttp://oracleformtips.blogspot.com/2017/12/setup-webutil-for-developer-suite-10g.html
2-on button press use this
begin
app CLIENT_OLE2.OBJ_TYPE;
docs CLIENT_OLE2.OBJ_TYPE;
doc CLIENT_OLE2.OBJ_TYPE;
selection CLIENT_OLE2.OBJ_TYPE;
args CLIENT_OLE2.LIST_TYPE;
pid WEBUTIL_HOST.PROCESS_ID;
FilePath varchar2(250);
file_doc_no varchar2(80);
c number;
 AppID PLS_INTEGER;
BEGIN

   --example : FilePath:=d:\d.doc
   --you can pass this from function
  FilePath:='d:\d.doc';
 
   
if webutil_file.file_exists (FilePath) then
 


app := CLIENT_OLE2.CREATE_OBJ('Word.Application');
CLIENT_OLE2.SET_PROPERTY(app,'Visible', 1);
docs := CLIENT_OLE2.INVOKE_OBJ(app, 'documents'); 
args := CLIENT_OLE2.create_arglist;
CLIENT_OLE2.add_arg(args, FilePath);
doc := CLIENT_OLE2.INVOKE_OBJ(docs,'Open', args);
CLIENT_OLE2.destroy_arglist(args);
CLIENT_OLE2.release_obj(docs);
CLIENT_OLE2.release_obj(app);


   
else
 

  app := CLIENT_OLE2.CREATE_OBJ('Word.Application');

  CLIENT_OLE2.SET_PROPERTY(app,'Visible',1);
  docs := CLIENT_OLE2.GET_OBJ_PROPERTY(app, 'Documents');
  doc  := CLIENT_OLE2.INVOKE_OBJ(docs, 'add'); 
  selection := CLIENT_OLE2.GET_OBJ_PROPERTY(app, 'Selection');

  -- insert data into new document from long item
  --CLIENT_OLE2.SET_PROPERTY(selection, 'Text', :ole.oletext);

  -- save document as example.tmp
  args := CLIENT_OLE2.CREATE_ARGLIST;
 
  CLIENT_OLE2.ADD_ARG(args, FilePath);

  CLIENT_OLE2.INVOKE(doc, 'SaveAs', args);
  CLIENT_OLE2.DESTROY_ARGLIST(args);

end if;

end;

How to create the Hierarchical Tree menu for system in oracle forms

1-create Schema object Table and USER object
CREATE TABLE  SCM_OBJECTS
(
  OBJECT_ID         VARCHAR2(100 BYTE),
  OBJECT_TYPE       VARCHAR2(1 BYTE),
  PARENT_OBJECT_ID  VARCHAR2(60 BYTE),
  SEQUENCE_NUMBER   NUMBER(4),
  CLASSIFICATION    VARCHAR2(2 BYTE),
  OBJECT_DESC_A     VARCHAR2(150 BYTE),
  OBJECT_DESC_E     VARCHAR2(150 BYTE),
  A_OBJECT_NAME     VARCHAR2(25 BYTE),
  APPL_TYPE         NUMBER,
  OBJECT_PRVLG      NUMBER,
  ACCESS_MODE       NUMBER,
  REPT_PARAM        VARCHAR2(300 BYTE),
  PARENT_SEQUENCE   NUMBER,
  CHILD_SEQUENCE    NUMBER,
  ICON              VARCHAR2(60 BYTE)
)

OBJECT_ID  -forms name or report or menu name
OBJECT_TYPE -Forms or report or Menu
PARENT_OBJECT_ID  ID -for PARENT
OBJECT_DESC_A   Title in ARABIC
 OBJECT_DESC_E  Title IN ENGLISH
A_OBJECT_NAME  Object name
 PARENT_SEQUENCE -PARENT sequence represent the order of the PARENT
CHILD_SEQUENCE -CHILD sequence represent the order of the PARENT-CHILD order
ICON -ICON name should appear need to put all icon in gif  using jar file

CREATE TABLE USER_OBJECTS
(
  EMP_CODE       NUMBER(6)                      NOT NULL,
  OBJECT_ID      VARCHAR2(200 BYTE)             NOT NULL,
  FORM_ACCESS    CHAR(1 BYTE),
  FORM_INSERT    CHAR(1 BYTE),
  FORM_UPDATE    CHAR(1 BYTE),
  FORM_DELETE    CHAR(1 BYTE),
  CREATED_BY     VARCHAR2(50 BYTE),
  CREATED_DATE   DATE,
  MODIFIED_BY    VARCHAR2(50 BYTE),
  MODIFIED_DATE  DATE,
  ACCESS_MODE    NUMBER
)

2-create tree object



3-create PROCEDURE :-Create_tree
PROCEDURE Create_tree IS
BEGIN
declare
Treerg Recordgroup;
  X Number ; 
  rg_id RECORDGROUP;
begin


       
rg_id := FIND_GROUP('MAIN.Tree');

IF NOT ID_NULL(rg_id) THEN

DELETE_GROUP(rg_id);

END IF;
rg_id := CREATE_GROUP_FROM_QUERY('G' ,' SELECT 1,level,Description,icon NODE_ICON,object_id
  from (
  SELECT object_id,OBJECT_DESC_A Description,icon,parent_object_id,PARENT_SEQUENCE,CHILD_SEQUENCE  
                     FROM scm_objects
                    WHERE object_type = '||''''||'M'||''''||
                     'and object_id IN(
                                             select  
                                              PARENT_OBJECT_ID
                                              from USER_OBJECTS,SCM_OBJECTS
                                              where EMP_CODE='||''''||:PARAMETER.P_EMP_NO||''''||
                                              'and USER_OBJECTS.OBJECT_ID =SCM_OBJECTS.OBJECT_ID 
                                              group by PARENT_OBJECT_ID)
                                              union SELECT SCM_OBJECTS.object_id,OBJECT_DESC_A Description,icon,parent_object_id,PARENT_SEQUENCE,CHILD_SEQUENCE  
                     FROM USER_OBJECTS,SCM_OBJECTS
                     where    USER_OBJECTS.OBJECT_ID =SCM_OBJECTS.OBJECT_ID 
                     and EMP_CODE='||''''||:PARAMETER.P_EMP_NO||''''||')'||
                     
             'CONNECT BY PRIOR object_id = NVL(parent_object_id,0) 
             START WITH   parent_object_id  is null
           ORDER BY PARENT_SEQUENCE,CHILD_SEQUENCE  ');--parent_object_id =0 order by ');

           X := Populate_Group('G');
Ftree.Set_Tree_Property('MAIN.Tree', Ftree.Record_Group, 'G');
Delete_Group ('G');
exception when others then 
message(sqlerrm ) ; 
End ;
end;


Note:-:PARAMETER.P_EMP_NO Come from Login Screen 

4-on WHEN-NEW-FORM-INSTANCE add this;
       Create_tree;


signer information does not match signer information of other classes in the same package in Oracle forms java bean

The Main issue to this , is there are many jar File have same package name on it To Solve the issue ,used  JDeveloper or any java develo...