Read pdf in oracle forms 9i/10g

please checkout www.startwithoracle.com , oracle forms portion to read
articles on how to show pdf hosted on application server...

I saw your article on www.startwithoracle.com. Can I 'embed' the pdf in a form? I want to view the document directly in the form without having to click on a button.

Similar Messages

  • How to get report in excel format instead of pdf from oracle forms.

    Hi,
    How to get report in excel format instead of pdf from oracle forms.
    Form & Report developer 10g
    report format .rdf

    create a report using report builder.
    call the report from form using the following procedure
    DECLARE
         RO_Report_ID REPORT_OBJECT;
         Str_Report_Server_Job VARCHAR2(100);
         Str_Job_ID VARCHAR2(100);
         Str_URL VARCHAR2(100);
         PL_ID PARAMLIST ;
    BEGIN
    PL_ID := GET_PARAMETER_LIST('TEMPDATA');
         IF NOT ID_NULL(PL_ID) THEN
    DESTROY_PARAMETER_LIST(PL_ID);
         END IF;
         PL_ID := CREATE_PARAMETER_LIST('TEMPDATA');
         RO_Report_ID := FIND_REPORT_OBJECT('RP2RRO');
         Add_Parameter(pl_id,'P_SUPCODE',TEXT_PARAMETER,:CONTROL.S_CODE);
    Add_Parameter(pl_id,'P_INVOICE_NO',TEXT_PARAMETER,:CONTROL.IN_NO);
    Add_Parameter(pl_id, 'PARAMFORM', TEXT_PARAMETER, 'NO');
         SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_FILENAME, 'INVOICE_REG_DETAILS.rep');
         SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_COMM_MODE, SYNCHRONOUS);
         SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_EXECUTION_MODE, BATCH);
         SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_DESTYPE, FILE);
         SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_DESFORMAT, 'SPREADSHEET');
         SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_SERVER, 'rep_dbserver_frhome1');
         Str_Report_Server_Job := RUN_REPORT_OBJECT(RO_Report_ID, PL_ID);
         Str_Job_ID := SUBSTR(Str_Report_Server_Job, LENGTH('rep_dbserver_frhome1') + 2, LENGTH(Str_Report_Server_Job));
         Str_URL      := '/reports/rwservlet/getjobid' || Str_Job_ID || '?server=rep_dbserver_frhome1';
         WEB.SHOW_DOCUMENT(Str_URL, '_SELF');
         DESTROY_PARAMETER_LIST(PL_ID);
    END;

  • How to insert special character from Oracle form builder 10g

    Dear all,
    I need help. how to insert special character like 'Superscript or Subscript ' from oracle form builder 10g. I had try in Oracle form builder 6i with press ALT+ASCII code in the text item and it work, but in the oracle form builder 10g this method doesn't work... would you like to help me...somebody please...
    Best Regard,
    Dedy P.T.

    What do you mean by insert ... from Forms Builder? Do you mean you want to add it as text in a string of pl/sql code or as part of boiler plate text (label) or a value on the Property Palette?
    For special characters you would need set NLS_LANG to something that would support the characters you want to use. For the Builder to see the change, you would need to set NLS_LANG to something like:
    NLS_LANG=AMERICAN_AMERICA.UTF8
    This can be done in the Windows Registry or system. As I mentioned, this will only apply to the Builder and will have nothing to do with a running form. For running forms you would need to set this in default.env. As for things like super and sub scripts, these are font formats and not necessarily characters. For the most part, I don't believe these are supported in Forms.

  • Oracle forms 9i/10g connecting SQL Server 2000

    Could anyone please guide me in detail to connect Oracle Forms 9i/10g with MS SQL Server database?
    To connect with Oracle Database, we need to copy and paste the tnsnames.ora file from the Oracle Database folder to the Oracle Forms folder.
    But how do i connect with other databases like SQL Server, MS Access, and so on?
    Thanks in advance.

    Follwoing is the soluton which I got from orafaq forum:
    <<<<<
    I'd go for an ODBC on the database server, using HSODBC. It worked quite well on a data warehouse project using OWB. I fail to see why it wouldn't work for Forms.
    MHE
    >>>>>
    Now I'm fully in a confused and frustrated state. Each person is saying different solutions for the problem. One person is saying to connect using ODBC driver while other is saying to connect JDBC driver. Actually which driver should I configure? Also no one is giving a clear picture for the problem.
    How can I get a detailed solution for this problem (with screen shots) which include step by step procedure to configure a driver?
    So, I would be pleased if you could please guide me with step by step procedure to get connected with Oracle Forms using SQL Server?
    Or atleast some reference site where I can find the same.
    Thanks.

  • Unable to run forms in oracle forms developer 10g

    I am using oracle forms developer 10g on oracle application Release 12.
    When i run form i am getting error that weblistener is not running on default port 8888. Then i changed it to 8000. But still i am not able to run the forms.

    Nivas,
    In addition to running OC4J, you must also have your browser configured to use a Java Runtime Environment. The easiest - and preferred - method is to install the Oracle JInitiator as there is not configuration needed other than the installation. You can also use Sun's JRE, but you would have to research how to configure your PC correctly. The other option is to change your FormsWeb.cfg file to use the Browser Native JRE. Edit the formsweb.cfg file and find the IE= directive. The Default is IE=jinitiator. Change this to IE=Native, save your changes and you are done. This is not the preferred solution, but it does work.
    Craig...

  • Oracle Forms Builder 10g release 2 documentation?

    I'm trying to locate a book about Oracle Forms Builder 10g release 2. I'm needing a beginner's guide. I've seen the advanced techniques one, but I can't seem to find one for someone that is just starting out. Does anyone have any suggestions?

    There are a couple of books by Albert Lulushi that will give you the basics you can build upon. These are older books, but the concepts they present are still valid.
    <ul>
    <li>Developing Oracle Forms Applications (Aug 1996)
    <li>Oracle Forms Developer's Handbook (Dec 2000)
    </ul>
    Probably more helpful would be some online tutorials. Again, some of these are a little old, but the concepts are still valid for Forms 10g and 11g.
    Although a few of the following links are for older Forms versions, the concepts are still valid across all Forms versions.
    <ul>
    <li>A Tutorial on Oracle9i Forms and Reports
    <li>Tutorial for Oracle10g Forms / Reports
    <li>iSelfSchooling - Basic Introduction to Forms
    <li>Oracle Forms 10g: Demos, Tips and Techniques
    </ul>
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Oracle Portal, Application Express, Oracle Forms/Reports 10g - which one?

    Hi,
    I have Oracle 10g database and Application Express installed on one linux box.
    second linux box has Oracle HTTP server running from where i call the htmldb pages.
    3rd linux box has Oracle Application Server 10.1.2 installed along with SSO, Portal 10.1.4 , Forms Server etc.
    Now, i see there are 3 ways i can develop web applications
    1. using Application Express and http server which is very basic and simple.
    2. using Oracle Forms/Reports 10g and forms/reports server
    3. Oracle Portal 10.1.4 in Application Server 10.1.2
    Can someone guide me, which one of the above 3 is worth sticking on forever for developing web applications. i am really not sure which one of the above is best for Web developement in terms of long term planning. and i believe all 3 of the above can be integrated with Oracle SSO for authentication.
    Can someone guide me please to select one of the above and can you explain me why for my better understanding of the different tools?
    Thanks,
    Philip.

    Hi Philip.
    If you already have Oracle Portal, I think that portal is the best solution.
    Portal can be integrated with others applications using SSO.
    Oracle portal have a lot of features that help you to develop web applications.
    If portal does not offer what you want, you can develop your own portlets using java or plsql.
    Take a look at the default home page of oracle portal.
    Look better the features that portal offer to you.
    http://portalcenter.oracle.com
    Thanks.

  • Oracle Forms Builder 10g Questions

    Good day everyone,
    I want to start off by saying that I'm very new to Oracle Forms Builder (it was dumped on my table about a month ago) and I'm having some issues I need resolved in order to complete a project for a client.
    I'm looking mainly for documentation or resources that will show me how to do the following in Oracle Forms Builder 10g:
    * Use either the ENTER button or mouse click to navigate between mandatory fields in a form (currently only TAB works)
    * Populate a field[s] after pressing a search button based on a SQL query
    * Populate a field[s] on launch based on a SQL query
    * Throw a warning message if an SQL query returns with a specific result
    * Populate a drop down menu based on a SQL query (ie only show valid options to user)
    * Remove static highlighting (fields should only be highlighted if necessary, which is never on this particular form)

    I've been able to reduce my problem down to the fact that Oracle Forms Builder 10g is not configured correctly on my machine for my environment. I can seem to get Oracle Forms Builder to see my libraries. When I load the form I'm working on I get the following error:
    FRM-18108: Failed to load the following objects.
    Source Module:utlf_gui
    Source Object: TOOLBAR_MDI
    +... (many more of the one above)+
    I press ok and get the following error:
    FRM-10102: Cannot attach PL/SQL library sdsl. This library attachment will be lost if the module is saved.
    +... (many more of the one above)+
    From my various searches on the internet I've learned that this is because Oracle Forms Developer can not find the listed PL/SQL libraries and I should check my Environmental variables. I've set up two Environmental variables with the following:
    Forms_Path = C:\<project path>\Lib\   (This is the folder in the project folder where all the PL/SQL libraries are stored)
    Forms90_Path = C:\<project path>\Lib\   (This is the folder in the project folder where all the PL/SQL libraries are stored)
    I created both Environmental variables because there wasn't any consistency on the sites I was checking to which was needed.
    Also if I try to attack a PL/SQL library I get the following error:
    Attached library name <name> contains a non-portable directory specification. Remove path?
    I press yes or no and get the following error:
    PDE-PLI038 Cannot open file for use as a PL/SQL library.
    Any help is much appreciated.
    Edited by: ThomasBoxall on 12-Dec-2011 12:18

  • Blank browser when run oracle form developer 10g

    Hi, all
    I'm newbie on oracle developer.
    I'm using oracle form developer 10g, database also 10g and default browser firefox.
    I made a form n give EMPLOYEE_MDL for the name.
    I got problem when i try to run form, first time shown "*ORACLE FORMS.*" on browser and then the browser getting blank(just white space), the url is:
    http://red-erie:8889/forms/frmservlet
    Hope you can help me.
    Regards n Thanks
    eRie

    It worked for me in Windows 7 Home premium, both in 32 and 64 bit operating systems...
    What I did was,
    After successful instalaltion of developer suite, I've installed latest JRE from www.java.com and configured formsweb.cfg and default.env file.
    I've used IE8 only. I haven't tested on any other browsers.
    Do modify these lines to configure formsweb.cfg to change to JRE from Jinitiator (As said by CraigB )
    # Page displayed to users to allow them to download Sun's Java Plugin.
    # Sun's Java Plugin is typically used for non-Windows clients.
    # (NOTE: you should check this page and possibly change the settings)
    ### Original
    #jpi_download_page=http://java.sun.com/products/archive/j2se/1.4.2_06/index.html
    ### New
    jpi_download_page=http://www.oracle.com/technetwork/java/javase/downloads/index.html
    # Parameter related to the version of the Java Plugin
    ### Original
    #jpi_classid=clsid:CAFEEFAC-0014-0002-0006-ABCDEFFEDCBA
    ### New
    jpi_classid=clsid:CAFEEFAC-0016-0000-0024-ABCDEFFEDCBA
    # Parameter related to the version of the Java Plugin
    ### Original
    #jpi_codebase=http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab#Version=1,4,2,06
    ### New
    jpi_codebase=http://java.sun.com/update/1.6.0/jinstall-6-windows-i586.cab#Version=1,6,0,24
    # Parameter related to the version of the Java Plugin
    ### Original
    #jpi_mimetype=application/x-java-applet;jpi-version=1.4.2_06
    ### New
    jpi_mimetype=application/x-java-applet;jpi-version=1.6.0_24I also recommend you change the following variable as well.
    # System parameter: base HTML file for use with JInitiator client
    #baseHTMLjinitiator=basejini.htm
    baseHTMLjinitiator=basejpi.htmEdited by: Charan on Jul 1, 2011 8:46 AM

  • Running oracle form builder 10g in windows 7 64 bit

    i am working in windows 7 64 bit
    oracle db 11g enterprise edition 11.2.0.10 64 bit
    form builder 10.12.0.2  32 bit
    my default browser is Google Chrome
    i have java 6 standard edition  1.6.0_34
    when i am trying to run any form this message appear " java (TM) is required to display some elements in this page"
    what can i do to run those forms?

    You can also refer to this OTN reference:
    Oracle Application Server 10g (10.1.2) Certification Matrix
    Other comments:
    1.  I would not recommend using Forms 10.1.2.0 with Oracle DB 11.2.x.  Patching Oracle Forms to 10.1.2.3 would be recommended.  Using version Forms 11 would be better.
    2.  Attempting to use the Developer Tools on Windows 7 is not a great idea although it can be made to work.  Developer Suite 10 is no longer supported and was never really intended for use on Win7.  Again, patching to 10.1.2.3 is recommended and required if you plan to follow the Oracle instructions and certifications.
    3.  Installing the Forms Builder (Developer Suite) on Win7-64bit is not at all certified and was never supported.
    4.  Using Java 7 was not certified and therefore not supported for use with Forms 10.x
    In general, Forms 10.1.2.x has been desupported.  Customer using this version or older should be working on a migration plan for getting to the latest supported version which is 11.1.2.1.

  • Variables Declaration in ORACLE Forms Builder 10g

    Dear Sir/Madam.
    I am new in Oracle developer suit(Forms builder 10g) .
    I want to declare three variables in Forms builder and when I press the button it will execute the querey/ retrieve data from the specific table.
    Table name= department
    Column names : dept_code number(5), dept_name varchar2(20), dept_location varchar2(25)
    Database User name; yassen
    database : test.
    Please help me to understand this problem.
    Thanks and regards,
    Ghulam Yassen
    Edited by: Ghulam Yassen on Oct 6, 2011 3:46 PM

    Yassen,
    Try,
    DECLARE
      Num_Code DEPARTMENT.DEPT_CODE%TYPE;
      Str_name  DEPARTMENT.DEPT_NAME%TYPE;
      Str_Location DEPARTMENT.DEPT_LOCATION%TYPE;
    BEGIN
       SELECT DEPT_CODE, DEPT_NAME, DEPT_LOCATION INTO Num_Code, Str_name, Str_Location FROM DEPARTMENT WHERE DEPT_CODE = <your_value>;
    END;Hope this helps.
    Regards,
    Manu.

  • Oracle forms in 10g

    Hi,
    I am new bee to oracle forms.
    I have installed oracle application server in Windows xp.
    How to start with from here.
    How to create new forms /page /design in oracle 10g
    please anyone tell that

    Oracle application server (AS) is just a runtime for forms. For creating form you need developer suite.
    I use Forms 10g. You can download it from http://www.oracle.com/technetwork/developer-tools/developer-suite/downloads/index.html
    The developer suite comes with OC4J - which is some kind of application server emulator, I'd say. But it's ok for developing purposes.
    The AS and OC4J must be configured. There are three main files:
    * formsweb.cfg
    * default.env
    * webutil.cfg
    That's shortly about AS.
    Quick introduction to forms:
    1. All data is stored in items, which can be text items, list items, radio buttons, checkboxes, buttons etc. Items are of 2 types: database item (item relates to some table column in database) or non-database item.
    2. All items are grouped in data blocks. Block are of 2 types: database block (it's source is DB table, or view, or select clause) and non-database (or control) block.
    3. All items are laid out for display on canvases.
    4. Canvases are displayed in windows.
    Events in forms are called triggers. When event occurs it is said "the trigger is fired". Names for triggers are usually self-explanatory. For instance, when-mouse-doubleclick, when-button-pressed, when-checkbox-changed. There are 3 types of triggers: item level (items can handle those events), block level (block handles the events, items cannot) and form level (form handles the events).
    And i think that's all - everything else in Oracle documentation and google.

  • Oracle form builder 10g is not opening any form ,on Vista

    I have installed DevSuite 10g and its update in my Vista machine. Everything is working fine ,but when I try to open any form in form designer(form builder) the form builder crashes and it gives me error saying-
    "Oracle form designer has stopped working
    A problem caused the priogram to stop working correctly. Windows will close the program and notify you if a solution is available."
    It does not get any problem if I try to open any other file. But it crashes when try to open any fmb file. Please help how can we resolve this issue.

    Please try this and report back:
    In your Vista platform, create a simple form. No canvas required, just two procedures:
    PROCEDURE P2 IS
    BEGIN
    NULL;
    END;
    and
    PROCEDURE P1 IS
    BEGIN
    P2;
    END;
    First, create procedure P2 and compile it.
    Then create procedure P1 and compile it.
    Go back to P2, and remove the semicolon after the NULL. If you try to compile it, it will fail.
    Go to procedure P1 and try compiling it.
    Does Forms Builder crash at this point?

  • Facing Issue while running from on desktop through oracle form builder 10g.

    Dear All,
    I am facing No plugin to show content error while trying to run oracle from on desktop through form builder 10g. please help.
    Thanks,
    Pradeep

    I am facing No plugin to show content error while trying to run oracle from on desktop through form builder 10g. What is your OS version?
    What Java version are you using?
    Have you configured your Oracle Developer Suite (ODS) 10g to run forms from the Forms Builder?
    Craig...

  • Weight scale input into oracle forms developer 10g

    Dear All Experts
    it is request to you kindly guide me full code and description of
    weight scale device input in oracle form show digits continuously in form 10g kindly proved me data device connect through port so plz help me

    Make a PJC (plugable java component) and look at RXTX library for java...
    I have done a PJC  to use a POS terminal over RS232 from oracle forms..
    It's not complicated..
    here is my example for POS terminal and RXTX library (JControl)
    [code]
    package in2.pos;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Arrays;
    import java.util.Enumeration;
    import java.util.Properties;
    import java.util.ResourceBundle;
    import java.util.StringTokenizer;
    import javax.swing.JOptionPane;
    import oracle.forms.handler.IHandler;
    import oracle.forms.properties.ID;
    import oracle.forms.ui.CustomEvent;
    import oracle.forms.ui.VBean;
    import gnu.io.*;
    * PosTerminalPjc, PJC component for Hypercom POS terminal data exchange
    * @author Peter Valencic, [email protected]
    public class PosTerminalPjc extends VBean {
      private static final long serialVersionUID = -8814623494538014849L;
      Properties res = new Properties();
      SerialPort serialPort;
      OutputStream os;
      InputStream is;
      CommPortIdentifier portId;
      Enumeration portList;
      IHandler mHandler;
      char STX = (char) 0x02;
      char ETX = (char) 0x03;
      char EOT = 4;
      char ACK = 6;
      char NAK = 15;
      char FS = 28;
      private static final ID COMPORT = ID.registerProperty("COMPORT"); // serial
      // port
      // (COM1,COM2,COM3,...)
      private static final ID AMOUNT = ID.registerProperty("AMOUNT"); // amount of
      // the
      // transaction
      // (12)
      private static final ID TRANSACTIONTYPE = ID
      .registerProperty("TRANSACTIONTYPE"); // 01-sale, 05-refund, 13
      // ticket duplicate
      private static final ID AMOUNTCURRENCY = ID
      .registerProperty("AMOUNTCURRENCY"); // ISO currency code
      private static final ID TRANSACTIONNUMBER = ID
      .registerProperty("TRANSACTIONNUMBER"); // transaction number
      private static final ID EVT_OK = ID.registerProperty("EVT_OK"); //custom event if all ok
        private static final ID EVT_ERR = ID.registerProperty("EVT_ERR"); //custom event if error occured
      // state machine variables
      long l_timeout;
      long l_wait_for = 5000; // pos terminal wait for command (5 seconds)
      long l_wait_for_transaction = 62000 * 2; // pos terminal timeout
      long l_second = 1000; // one second
      byte b_retry = 0;
      String dataValue = "";
        byte[] readBuffer = new byte[2000]; //2000 bytes buffer to read rs232 stream
      String comPort = ""; // local variable to store com port name
      // (COM1,COM2,...)
      String transactionType = "SALE"; // type of transaction to be executed (SALE
      // or REFUND) default SALE
      String amount = "0"; // default amount value is set to 0
      String transactionNumber =""; //store a transaction number from POS trminal
      String transactionProcessed;
        String transactionFlag;
        String transactionDate;
        String transactionTime;
        String transactionBatchNumber;
        String terminalTid;
        String terminalCard;
        String errDesc;
        public PosTerminalPjc() {
      super();
      System.out.println("============================");
      System.out.println("== State machine POS v1.0 ==");
      System.out.println("== Peter Valencic (c)     ==");
      System.out.println("== 03.04.2012             ==");
      System.out.println("============================");
      try {
      res.load(this.getClass().getResourceAsStream(
      "/res/language.properties")); // load language file
      } catch (Exception ex) {
      System.err.println("Err loading language.properties file: "
      + ex.toString());
      private void doTransaction() throws Exception {
      String phase = null; // initial null value for state machine phase
      long l_ack_timeout = 0; //initial value for acknowledge timeout
      // com port check
      if (getComPort().trim().equalsIgnoreCase("")) {
      this.showError(res.getProperty("s_dlg_err_title"),
      res.getProperty("s_com_invalid"));
      return;
      // transaction type chek
      System.out.println(this.getTransactionType());
      if (!getTransactionType().equalsIgnoreCase("REFUND")
      & !getTransactionType().equalsIgnoreCase("SALE")) {
      this.showError(res.getProperty("s_dlg_err_title"),
      res.getProperty("s_tran_invalid_type"));
      return;
      portList = portId.getPortIdentifiers();
      while (portList.hasMoreElements()) {
      portId = (CommPortIdentifier) portList.nextElement();
      if (portId.getName().equalsIgnoreCase(this.getComPort())) {
      System.out.println("Port is used : "
      + portId.isCurrentlyOwned());
      serialPort = (SerialPort) portId.open("ComDriver", 2000);
      serialPort.setSerialPortParams(9600, SerialPort.DATABITS_7,
      SerialPort.STOPBITS_1, SerialPort.PARITY_EVEN);
      // serialPort.addEventListener(this);
      serialPort.notifyOnDataAvailable(true);
      serialPort.notifyOnOutputEmpty(true);
      os = serialPort.getOutputStream();
      is = serialPort.getInputStream();
      break;
      if (portId == null) {
      throw new Exception(res.getProperty("s_com_not_found")
      + this.getComPort() + "\n");
      // state machine infinite loop
      while (true) {
      // SEND DATA TO POS TERMINAL
      if (phase == null) {
      System.out.println("start phase");
      byte[] req = null;
      //verify transaction type to be SALE or REFUND
      //if REFUND then transaction number must be specified
      if (getTransactionType().equalsIgnoreCase("SALE")) {
      System.out.println("--> SALE send message to the pos terminal");
      System.out.println("--> amount: " + amount);
      req = protocolStream("000000123401100" + FS + amount + FS
      + FS + "+0" + FS + "978" + FS + FS + FS + FS + FS
      + FS + FS + ETX);
      else if (getTransactionType().equalsIgnoreCase("REFUND")) {
      System.out.println("--> REFUND send message to the pos terminal");
      System.out.println("--> amount: " + amount);
      System.out.println("--> transaction number: " + getTransactionNumber());
      req = protocolStream("000000123405100" + getTransactionNumber() + FS + amount
      + FS + FS + "+0" + FS + "978" + FS + FS + FS + FS
      + FS + FS + FS + ETX);
      } else {
      // maybe VOID in the future..
      os.write(req);
      os.flush();
      l_ack_timeout = System.currentTimeMillis() + 1500;
      //wait for half second
      try {
      Thread.sleep(500);
      } catch (Exception ee) {
      l_timeout = System.currentTimeMillis() + l_wait_for; //add some time for timeout
      phase = "TO_POS_ACK";
      System.out.println("phase: " + phase);
      }//phase null
      //CHECK IF THE TIMEOUT OCCURED
                if (phase.equalsIgnoreCase("TO_POS_ACK") &
                        (l_timeout < System.currentTimeMillis()) & (b_retry < 4)) {
                    b_retry += 1;
                    System.out.println("TIMEOUT: " + b_retry);
                    l_timeout = System.currentTimeMillis() + l_wait_for;
                    if (b_retry >= 4) {
                        System.out.println("Timeout occured");
                        try {
                            serialPort.close();
                            is.close();
                            os.close();
                        } catch (Exception ee) {
                        //Timeout occured show error
                        //s_timeout
                        this.showError(res.getProperty("s_dlg_err_title"),
            res.getProperty("s_timeout"));
                        break;
              //CHECK FOR THE ACKNOWLEDGE (FIRST RESPONSE FROM POS TERMINAL)
                if (phase.equalsIgnoreCase("TO_POS_ACK") &
                        (l_ack_timeout < System.currentTimeMillis())) {
                    try {
                        int numBytes = 0;
                        dataValue = "";
                        while ((numBytes = is.read(readBuffer)) > 0) {
                            dataValue += new String(readBuffer, 0, numBytes, "ASCII");
                        if (dataValue.getBytes().length > 0) {
                            System.out.println("->first byte: " +
                                dataValue.getBytes()[0]);
                            System.out.println("total length: " +
                                dataValue.getBytes().length);
                            //check for ack byte
                            if (dataValue.getBytes()[0] == 6) {
                                System.out.println(
                                    "<--ACKNOWLEDGE received from pos terminal");
                                phase = "WAIT_FOR_TRANSACTION";
                                l_timeout = System.currentTimeMillis() +
                                    l_wait_for_transaction;
                    } catch (IOException ev) {
              //WAIT FOR TIMEOUT ON MESSAGE
                if (phase.equalsIgnoreCase("WAIT_FOR_TRANSACTION") &
                        (l_timeout < System.currentTimeMillis())) {
                    System.out.println(
                        "Error receiving response from pos terminal!!!");
                    try {
                        serialPort.close();
                        is.close();
                        os.close();
                    } catch (Exception ee) {
                    this.showError(res.getProperty("s_dlg_err_title"),
        res.getProperty("s_response_error"));
                    break;
              //WAIT FOR SOME DATA TO COME FROM POS TERMINAL OVER RS232
                if (phase.equalsIgnoreCase("WAIT_FOR_TRANSACTION")) {
                    try {
                        int numBytes = 0;
                        dataValue = "";
                        while ((numBytes = is.read(readBuffer)) > 0) {
                            dataValue += new String(readBuffer, 0, numBytes, "ASCII");
                        if (dataValue.getBytes().length > 0) {
                            System.out.println("->first byte: " +
                                dataValue.getBytes()[0] + "|" +
                                dataValue.getBytes()[1]);
                            System.out.println("->ascii: " + dataValue);
                            System.out.println("total length: " +
                                dataValue.getBytes().length);
                            if (dataValue.indexOf("PREKINIL UPORABNIK") != -1) {
                                System.out.println(
                                    "Uporabnik je prekinil povezavo!");
                                try {
                                    serialPort.close();
                                    is.close();
                                    os.close();
                                } catch (Exception ee) {
                                //transaction cancelled by user s_user_cancel
                                this.showError(res.getProperty("s_dlg_err_title"),
                    res.getProperty("s_user_cancel"));
                                break;
                            if (dataValue.indexOf("NAPACEN VNOS") != -1) {
                                System.out.println("Napačen vnos");
                                try {
                                    serialPort.close();
                                    is.close();
                                    os.close();
                                } catch (Exception ee) {
                                //invalid user entry
                                this.showError(res.getProperty("s_dlg_err_title"),
                    res.getProperty("s_user_invalid_entry"));
                                break;
                            if (dataValue.indexOf("PROSIM POCAKAJ") != -1) {
                                System.out.println("<-- PROSIM POCAKAJ");
                                continue;
                            //preberemo podatke iz stringe terminala
                            if (dataValue.indexOf("SPREJETO") != -1) {
                                try {
                                    serialPort.close();
                                    is.close();
                                    os.close();
                                } catch (Exception ee) {
                                System.out.println("<-- TRANSAKCIJA SPREJETA");
                                System.out.println(dataValue);
                                System.out.println("Prožimo event v formse");
                                this.transactionProcessed = dataValue.substring(1, 3); //podatek mora biti 10
                                this.transactionFlag = dataValue.substring(13, 15);
                                this.transactionNumber = dataValue.substring(16, 21);
                                System.out.println("transaction number: " + this.transactionNumber);
                                this.transactionDate = dataValue.substring(25, 31);
                                this.transactionTime = dataValue.substring(31, 37);
                                this.transactionBatchNumber = dataValue.substring(21, 25);
                                StringTokenizer st = new StringTokenizer(dataValue, "" + FS);
                                System.out.println(st.nextToken());
                                System.out.println(st.nextToken());
                                System.out.println(st.nextToken());
                                System.out.println(st.nextToken());
                                System.out.println(st.nextToken());
                                System.out.println(st.nextToken());
                                this.terminalTid = st.nextToken();
                                System.out.println(st.nextToken());
                                System.out.println(st.nextToken());
                                System.out.println(st.nextToken());
                                this.terminalCard = st.nextToken();
                                if (transactionProcessed.equalsIgnoreCase("10")) {
                                else
                                    CustomEvent ce = new CustomEvent(mHandler,
                                            EVT_ERR);
                                    if (transactionProcessed.equalsIgnoreCase("00")) {
                                        System.out.println(
                                            "Error in the format of the request message");
                                        this.errDesc = res.getProperty("s_tf_00");
                                    } else if (transactionProcessed.equalsIgnoreCase(
                                                "01")) {
                                        System.out.println(
                                            "Transaction accepted without authorization code");
                                        this.errDesc = res.getProperty("s_tf_01");
                                    } else if (transactionProcessed.equalsIgnoreCase(
                                                "02")) {
                                        System.out.println(
                                            "Transaction accepted with authorization code");
                                        this.errDesc = res.getProperty("s_tf_02");
                                    } else if (transactionProcessed.equalsIgnoreCase(
                                                "03")) {
                                        System.out.println("Needs voice referall");
                                        this.errDesc = res.getProperty("s_tf_03");
                                    } else if (transactionProcessed.equalsIgnoreCase(
                                                "04")) {
                                        System.out.println("Transaction refused");
                                        this.errDesc = res.getProperty("s_tf_04");
                                    } else if (transactionProcessed.equalsIgnoreCase(
                                                "05")) {
                                        System.out.println(
                                            "Needs manual card data entry");
                                        this.errDesc = res.getProperty("s_tf_05");
                                    } else if (transactionProcessed.equalsIgnoreCase(
                                                "06")) {
                                        System.out.println(
                                            "Authorization call failure");
                                        this.errDesc = res.getProperty("s_tf_06");
                                    dispatchCustomEvent(ce);
                                    return;
                                //če gre skozi potem je vse ok
                                CustomEvent ce = new CustomEvent(mHandler, EVT_OK);
                                dispatchCustomEvent(ce);
                                return;
                    } catch (IOException ev) {
                //wait 200 ms
                try {
                    Thread.sleep(200);
                } catch (InterruptedException ex) {
                    ex.printStackTrace();
                System.out.print('*');
      }//end state machine loop
      * protocolStream prepare the stream to be send over RS232 to POS terminal
      * with LRC cheksum control
      * @param data
      * @return byte[]
      private byte[] protocolStream(String data) {
      char STX = (char) 0x02;
      String tmp = "" + STX + STX + data + "" + getLRC(data);
      System.out.println("PStream: " + tmp);
      for (int i = 0; i < tmp.getBytes().length; i++) {
      System.out.print(tmp.getBytes()[i] + ":");
      // System.out.println("čeksum: " + chksm);
      return tmp.getBytes();
      * Longitudinal Redundancy Check (LRC)
      * @param packet
      * @return String
      private String getLRC(String packet) {
      char[] splitPacket = packet.toCharArray();
      char lrc = 0x00;
      for (int x = 0; x < splitPacket.length; x++) {
      lrc = (char) (lrc ^ splitPacket[x]);
      return "" + (char) lrc;
      private String paddingString(String s, int n, char c, boolean paddingLeft) {
      if (s == null) {
      return s;
      int add = n - s.length(); // may overflow int size... should not be a
      if (add <= 0) {
      return s;
      StringBuffer str = new StringBuffer(s);
      char[] ch = new char[add];
      Arrays.fill(ch, c);
      if (paddingLeft) {
      str.insert(0, ch);
      } else {
      str.append(ch);
      return str.toString();
      * Display error message inside oracle form
      * @param title
      * @param exceptionString
      private void showError(String title, String exceptionString) {
      JOptionPane.showMessageDialog(this, exceptionString, title, 0);
      public String getComPort() {
      return comPort;
      public void setComPort(String comPort) {
      this.comPort = comPort;
      public String getTransactionType() {
      return transactionType;
      public void setTransactionType(String transactionType) {
      this.transactionType = transactionType;
      public String getAmount() {
      return amount;
      public void setAmount(String amount) {
      this.amount = amount;
      public String getTransactionNumber() {
      return transactionNumber;
      public void setTransactionNumber(String transactionNumber) {
      this.transactionNumber = transactionNumber;
      public static void main(String[] args) {
      PosTerminalPjc pjc = new PosTerminalPjc();
      pjc.setComPort("COM1");
      pjc.setTransactionType("SALE");
      pjc.setAmount("1000");
      try
      pjc.doTransaction();
      catch(Exception ex)
      System.err.println(ex.toString());
    [/code]

Maybe you are looking for

  • Unable to access Data Plan

    I just bought an unlock Verizon Blackberry storm 9550. I I tried to activate a data plan with Digicel Trinidad and i am getting a message stating that "Can not activate selected plan your device is incompatable with the service". Could you please hel

  • Installer Build Error

    Hi, I am rebuilding an existing Labview application (originally done in LV8.6) using LabVIEW 2011. The application works in LV2011 as stand alone but when I try to build the installer, I get the error for which the details are in the attached text fi

  • Not able to delete IT1001 Relationship

    Hi All Can any one tell how to delete relationship It1001 for an organization unit,for which object IT1000 has already been deleted. While deleting its giving msg.. Object doesnot exist. Thanks in Advance

  • CUCMBE dtmf doesn't work via SIP Trunk to PSTN

    The dtmf events packets send by CUCMBE have incorrect UDP Length. Based on RFC 2833 a correct UDP length value for dtmf event packets is 24 (decimal), but this CUCMBE sends its events packets with UDP length set to 36 (decimal). Since the events pack

  • SRM table for messages

    Hi, I'm looking for the table in SRM wich contains the output messages with regard to Po's. I found that SRM does contain table NAST similair to R/3, however when I look into it, it isn't populated. The NAST table in R/3 only shows info for PO's that