Accessing SAP from JAVA
Hi Friends,
I've a requiremnet to create SO where data will be provided in JAVA screens. Is there any way to access SAP from java as we can do this through VB using API methods.
Regards,
Anupam
see these links
[link1|http://www.sapdevelopment.co.uk/java/jco/jcohome.htm]
[link2|http://searchsap.techtarget.com/expert/KnowledgebaseAnswer/0,289625,sid21_cid417095,00.html]
[link3|http://www.experts-exchange.com/Database/Software/ERP/SAP_ERP/Q_20693539.html]
Regards,
SAPient
Similar Messages
-
Jintegra problem - accessing Matlab from Java??
Hi:
Sorry if this post doesn't belong here!!
I am accessing Matlab from JAVA using JIntegra for COM. I tried running the example in their website.
(http://j-integra.intrinsyc.com/support/com/doc/other_examples/Matlab.htm)
I have also posted the example below. I am using their trial version and have included all the jars as said. I get the an unexpected output (all zero's) for reading a variable in the matlab workspace. I don't understand why I get this. Can anyone let me know if this runs for you??
Thanks
Pavan
Example code from Jintegra website:
public class MatlabExample {
public static void main(java.lang.String[] args) throws Exception {
try {
// DCOM authentication: Make sure NT Domain, NT User, NT Password are valid credentials.
// Uncomment this line if MatlabExample.java remotely accesses MATLAB :
// com.linar.jintegra.AuthInfo.setDefault("NT DOMAIN", "NT USER", "NT PASSWORD");
// Create the MATLAB object
// Specify host name or IP address of MATLAB machine as parameter if
// MatlabExample.java remotely accesses MATLAB.
// mlapp.MLApp mlApp = new mlapp.MLApp("123.456.789.0");
mlapp.MLApp mlApp = new mlapp.MLApp();
String result = mlApp.execute("a = [1 2 3 4; 5 6 7 8;]");
System.out.println("Execute result is " + result);
double mreal[][] = new double[2][4];
double mimage[] = new double[0];
mlApp.getFullMatrix("a", "base", new Object[]{mreal}, new Object[]{mimage});
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 4; j++) {
System.out.println(mreal[i][j]);
} finally {
com.linar.jintegra.Cleaner.releaseAll();
}......How are you declaring the class in your JSP? ... are you instantiating it as a bean using the useBean tag, or just instantiating it in your code like normal.
Maybe you could post the relevant JSP code too?
Hello again,
Only the last string is populating after the file has be tokenized. What I'll like to accomplish is passing the very first string in the file. I did not get too far in the JSP file setup because the code is still in it's testing stage, but any help will be highly appreciated.
Here is the JSP code
<%@page import="dev.*" %>
<%@page session="true" language="java" import="java.io.*" %>
<jsp:useBean id="wagerhist" scope="request" class="dev.RoundDetail2" />
<html>
<head>
<title>Round Detail</title>
<body>
<table width="530" bordercolor="#000000" valign="top">
<tr>
<td align="left" width="19%">Game ID<%=wagerhist.string_gameID%></td>
<td align="left" width="30%"> </td>
<td align="left" width="20%">card1</td>
<td align="left" width="31%"> </td>
</tr>
</table>
</body>
</html> -
[JDBC][ODBC] How to compact access database from Java ?
Hello,
I'm developping a java applcation wich is connected to an MS Access file database.
For now, I don'y compact it but it would be better.
So How can I compact an access database from Java ?
thanks :)Hi ypiel,
Try this:
1) Download JETCOMP.exe (freeware from Microsoft);
2) Put the following code in your app (assuming your database file name is: "DB.mdb"):
try {
File current = new File("DB.mdb");
File backup = new File("BACKUP.mdb");
if (current.renameTo(backup)) {
Runtime.getRuntime().exec("jetcomp -src:BACKUP.mdb -dest:DB.mdb");
} catch (Exception e) {
System.out.println(e.getMessage());
Best regards,
YT. -
Calling MS Access queries from Java
Anyone have any idea if it's possible to call MS Access queries from Java? I have a client who is insistent on keeping MS Access for their database, and it'd be nice if I didn't have to receate all their queries in Java.
I've successfully connected to and queried the Access MDB, but I need to know if it's even possible to execute the stored MS Access queries they have setup in the database.
Thanks!See reply 6 in the following....
http://forum.java.sun.com/thread.jspa?forumID=48&threadID=203818 -
Hi, how can I access SAP from my mac OS X?
I used to work on an IBM with Internet Explorer 7 and had no issues with accessing my company's SAP portals but I can't access SAP from my mac web browser (Safari). Any clues??
Thankshttp://www.orchestrateam.com/blogs/sap-business-one-mac-details
you can run bootcamp and run windows from that.
or a VM (parallels and vmware fusion). -
I am creating an inventory system. I have used Java for front-end where i have created forms which display the vendor table, customer table, item table, order table, invoice tbl etc.
I have created class files for each form that im displaying. i have also made connection to the oracle dbs succesfully. i can access data from the dbs.
but my problem is,
1)
for instance i have created a vendor_master table in oracle with certain constraints like vendor_number can contain only 5 varchar2 characters ,
eg.
create table vendor_master
(v_no varchar2(5) constraint v_no_pk primary key,
v_name varchar2(25),
v_add varchar2(15),
city varchar2(15),
st varchar2(15),
zip number(10),
tel number(11),
fax number(11));
now when i want 2 insert any row in the table i should be able 2 insert only "certain" characters of "certain" length depending on the constraints i have set. how do i do tht? coz java does not allow me 2 set the max chars like VB in the properties column
i have my vendor Master class file here:
code:--------------------------------------------------------------------------------
package mainpage;
import java.io.*;
import java.io.Serializable;
import java.awt.*;
import java.awt.event.*;
import java.lang.String.*;
import javax.swing.*;
import javax.swing.JPanel;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSet;
import java.util.Vector;
import oracle.jdbc.driver.OracleDriver;
import oracle.jdbc.OracleResultSet;
import java.sql.PreparedStatement;
public class VendorMaster extends JPanel implements java.io.Serializable
JFrame venMastFrame = new JFrame("Vendor Master");
JLabel vennolbl = new JLabel();
JLabel venNamelbl = new JLabel();
JLabel venAdd = new JLabel();
JTextField venAddtxt = new JTextField();
JTextField venNotxt = new JTextField();
JTextField venNmtxt = new JTextField();
JLabel venCitylbl = new JLabel();
JTextField venCitytxt = new JTextField();
JLabel venStlbl = new JLabel();
JTextField venSttxt = new JTextField();
JLabel venZiplbl = new JLabel();
JTextField venZiptxt = new JTextField();
JLabel venTellbl = new JLabel();
JTextField venTeltxt = new JTextField();
JLabel venFaxlbl = new JLabel();
JTextField venFaxtxt = new JTextField();
JButton vPrevbtn = new JButton();
JButton vNxtbtn = new JButton();
JButton vExitbtn = new JButton();
JButton vNewbtn = new JButton();
JButton vDelbtn = new JButton();
JButton vUpdtbtn = new JButton();
JButton vSavebtn = new JButton();
int currentIndex = 0;
int totalRecords = 0;
private Vector vendorMasterRecords = new Vector();
public VendorMaster()
venMastFrame.setSize(850,760);
venMastFrame.setVisible(true);
//venMastFrame.show();
try
jbInit();
} catch (Exception e)
e.printStackTrace();
} // end of constructor
private void jbInit() throws Exception
Connection myConnection = DataManager.createConnection();
vendorMasterRecords = loadVendorMasterRecords(myConnection);
VendorMasterBean vmBean = null;
venMastFrame.getContentPane().setLayout(null);
if(vendorMasterRecords != null)
{ vmBean = (VendorMasterBean)vendorMasterRecords.elementAt(0);
totalRecords = vendorMasterRecords.size();
currentIndex = 0;
if(vmBean == null)
vmBean = new VendorMasterBean();
venNamelbl.setText("Vendor Name:");
venNamelbl.setBounds(new Rectangle(22, 87, 89, 23));
venNmtxt.setBounds(new Rectangle(153, 81, 224, 22));
venNmtxt.setEnabled(false);
venNmtxt.setText(vmBean.getVendorName());
venAdd.setText("Address:");
venAdd.setBounds(new Rectangle(25, 130, 113, 31));
venAddtxt.setBounds(new Rectangle(152, 126, 201, 22));
venAddtxt.setEnabled(false);
venAddtxt.setText(vmBean.getAddress());
vennolbl.setText("Vendor No:");
vennolbl.setBounds(new Rectangle(23, 41, 73, 22));
venNotxt.setBounds(new Rectangle(155, 38, 108, 22));
venNotxt.setEnabled(false);
venNotxt.setText(vmBean.getVendorNumber());
venCitylbl.setText("City:");
venCitylbl.setBounds(new Rectangle(25, 175, 61, 29));
venCitytxt.setBounds(new Rectangle(153, 172, 156, 24));
venCitytxt.setEnabled(false);
venCitytxt.setText(vmBean.getCity());
venStlbl.setText("State:");
venStlbl.setBounds(new Rectangle(25, 225, 64, 32));
venSttxt.setBounds(new Rectangle(152, 223, 158, 24));
venSttxt.setEnabled(false);
venSttxt.setText(vmBean.getState());
venZiplbl.setText("Zip:");
venZiplbl.setBounds(new Rectangle(24, 275, 58, 24));
venZiptxt.setBounds(new Rectangle(150, 272, 108, 24));
venZiptxt.setEnabled(false);
venZiptxt.setText(vmBean.getZipcode());
venTellbl.setText("Telephone No:");
venTellbl.setBounds(new Rectangle(25, 323, 106, 26));
venTeltxt.setBounds(new Rectangle(149, 326, 108, 26));
venTeltxt.setEnabled(false);
venTeltxt.setText(vmBean.getTelephone());
venFaxlbl.setText("Fax No:");
venFaxlbl.setBounds(new Rectangle(27, 375, 97, 26));
venFaxtxt.setBounds(new Rectangle(149, 375, 107, 26));
venFaxtxt.setEnabled(false);
venFaxtxt.setText(vmBean.getFax());
/* code for buttons */
vExitbtn.setBounds(new Rectangle(681, 457, 111, 29));
vExitbtn.setText("EXIT");
vExitbtn.addKeyListener(new VendorMaster_vExitbtn_keyAdapter(this));
vExitbtn.addActionListener(new VendorMaster_vExitbtn_actionAdapter(this));
vPrevbtn.setText("PREVIOUS");
vPrevbtn.addKeyListener(new VendorMaster_vPrevbtn_keyAdapter(this));
vPrevbtn.addActionListener(new VendorMaster_vPrevbtn_actionAdapter(this));
vPrevbtn.setBounds(new Rectangle(14, 457, 110, 29));
vPrevbtn.setEnabled(false);
vNxtbtn.setText("NEXT");
vNxtbtn.addKeyListener(new VendorMaster_vNxtbtn_keyAdapter(this));
vNxtbtn.addActionListener(new VendorMaster_vNxtbtn_actionAdapter(this));
vNxtbtn.setBounds(new Rectangle(124, 457, 111, 29));
vNewbtn.setText("NEW");
vNewbtn.setBounds(new Rectangle(235, 457, 111, 29));
vNewbtn.setActionCommand("NEW");
vNewbtn.addActionListener(new VendorMaster_vNewbtn_actionAdapter(this));
vNewbtn.addKeyListener(new VendorMaster_vNewbtn_keyAdapter(this));
vDelbtn.setText("DELETE");
vDelbtn.setBounds(new Rectangle(346, 457, 111, 29));
vDelbtn.setHorizontalAlignment(SwingConstants.CENTER);
vDelbtn.addActionListener(new VendorMaster_vDelbtn_actionAdapter(this));
vDelbtn.addKeyListener(new VendorMaster_vDelbtn_keyAdapter(this));
vUpdtbtn.setText("UPDATE");
vUpdtbtn.addActionListener(new VendorMaster_vUpdtbtn_actionAdapter(this));
vUpdtbtn.setBounds(new Rectangle(457, 457, 113, 29));
vUpdtbtn.setMaximumSize(new Dimension(71, 25));
vUpdtbtn.setMinimumSize(new Dimension(71, 25));
vUpdtbtn.setPreferredSize(new Dimension(71, 25));
/* Add all the txtboxes, lbls and buttons to the frame */
vSavebtn.setBounds(new Rectangle(570, 457, 111, 29));
vSavebtn.setText("SAVE");
vSavebtn.addActionListener(new VendorMaster_vSavebtn_actionAdapter(this));
venMastFrame.getContentPane().add(vennolbl, null);
venMastFrame.getContentPane().add(venNotxt, null);
venMastFrame.getContentPane().add(venNamelbl, null);
venMastFrame.getContentPane().add(venNmtxt, null);
venMastFrame.getContentPane().add(venAdd, null);
venMastFrame.getContentPane().add(venAddtxt, null);
venMastFrame.getContentPane().add(venCitylbl, null);
venMastFrame.getContentPane().add(venCitytxt, null);
venMastFrame.getContentPane().add(venStlbl, null);
venMastFrame.getContentPane().add(venSttxt, null);
venMastFrame.getContentPane().add(venZiplbl, null);
venMastFrame.getContentPane().add(venZiptxt, null);
venMastFrame.getContentPane().add(venTellbl, null);
venMastFrame.getContentPane().add(venTeltxt, null);
venMastFrame.getContentPane().add(venFaxlbl, null);
venMastFrame.getContentPane().add(venFaxtxt, null);
venMastFrame.getContentPane().add(vPrevbtn, null);
venMastFrame.getContentPane().add(vNxtbtn, null);
venMastFrame.getContentPane().add(vNewbtn, null);
venMastFrame.getContentPane().add(vDelbtn, null);
venMastFrame.getContentPane().add(vUpdtbtn, null);
venMastFrame.getContentPane().add(vSavebtn, null);
venMastFrame.getContentPane().add(vExitbtn, null);
} // end of jbinit
public static void main(String[] args)
VendorMaster vendorMaster1 = new VendorMaster();
} //end of main
/* this is where the data will be retrieved from the dbs */
protected Vector loadVendorMasterRecords(Connection connection)
//Connection connection = null;
Vector masterRecords = new Vector();
// From database getting values
try
//connection = connectionManager.getConnection();
Statement stmt = connection.createStatement();
String queryall = "Select * from vendor_master order by v_no";
ResultSet rs = stmt.executeQuery(queryall);
while (rs.next())
String vendorNumber = rs.getString("v_no");
String vendorName = rs.getString("v_name");
String address = rs.getString("v_add");
String city = rs.getString("city");
String state = rs.getString("st");
String zipCode = rs.getString("zip");
String telephone = rs.getString("tel");
String fax = rs.getString("fax");
VendorMasterBean vendorMasterBean = new VendorMasterBean(vendorNumber,
vendorName,
address,
city,
state,
zipCode,
telephone,
fax);
/* data retrieved from the vendormasterbean is then inserted in vector*/
masterRecords.addElement(vendorMasterBean);
} // end of while
} catch (Exception e) // end of try & start of catch
e.printStackTrace();
} // end of catch
finally
if(connection != null)
DataManager.freeConnection(connection);
return masterRecords; /* the data stored in
masterRecords is passed 2 vendormasterRecords*/
} // finally ends here
} // end of loadvendorMasterrecords
/*example- when previous button is pressed then an event is triggered
captured by the key listener and then actionPerformed method is called
which in turn calls the getPreviousRecord*/
/* to insert records */
protected void addVendorMasterRecord(VendorMasterBean vmBean )
Connection connection = null;
Vector masterRecords = new Vector();
// first check whether all the textboxes are empty
// also check whether there is already a record
//existing with the same v_no
// From database getting values
try
connection = DataManager.createConnection();
PreparedStatement newRecord = connection.prepareStatement("insert into vendor_master values(?,?,?,?,?,?,?,?)");
newRecord.setString(1,vmBean.getVendorNumber());
newRecord.setString(2, vmBean.getVendorName());
newRecord.setString(3, vmBean.getAddress());
newRecord.setString(4, vmBean.getCity());
newRecord.setString(5, vmBean.getState());
newRecord.setString(6, vmBean.getZipcode());
newRecord.setString(7, vmBean.getTelephone());
newRecord.setString(8, vmBean.getFax());
newRecord.executeUpdate();
// Insert statement
// PreparedStatement pStmt = ....;
// The assign each value in the vmBean to the pStmt
// and finally execute the pStmt
} catch (Exception e) // end of try and begin of catch
e.printStackTrace();
} // end of catch
finally
if(connection != null)
DataManager.freeConnection(connection);
}// end of if
} // end of finally
} // end of addVendorMasterRecord
void vNewbtn_actionPerformed(ActionEvent e)
/* First empty all the textboxes */
venNotxt.setText(" ");
venNmtxt.setText(" ");
venAddtxt.setText(" ");
venCitytxt.setText(" ");
venSttxt.setText(" ");
venZiptxt.setText(" ");
venTeltxt.setText(" ");
venFaxtxt.setText(" ");
venNotxt.setEnabled(true);
venNmtxt.setEnabled(true);
venAddtxt.setEnabled(true);
venCitytxt.setEnabled(true);
venSttxt.setEnabled(true);
venZiptxt.setEnabled(true);
venTeltxt.setEnabled(true);
venFaxtxt.setEnabled(true);
vPrevbtn.setEnabled(false);
vNxtbtn.setEnabled(false);
void vNewbtn_keyPressed(KeyEvent e)
/* to delete records */
protected void removeVendorMasterRecord(VendorMasterBean vmBean )
Connection connection = null;
Vector masterRecords = new Vector();
// From database getting values
try
connection = DataManager.createConnection();
PreparedStatement deleteRecord = connection.prepareStatement("delete from vendor_master where v_no = ?");
deleteRecord.setString(1, vmBean.getVendorNumber());
deleteRecord.executeUpdate();
// Delete statement for where condition pass the vendor number as parameter
//"delete from vendor_master where v_no = ?"
//PreparedStatement pStmt = ....;
// The assign v_no in the vmBean to the pStmt
// and finally execute the pStmt
} catch (Exception e)
e.printStackTrace();
finally
// After executing this new record should be removed from the Vector of results.
// uncomment this
if(connection != null){
DataManager.freeConnection(connection);
} // end of finally
} // end of removeVendorMasterRecord
void vDelbtn_actionPerformed(ActionEvent e)
String vendorNumber = venNotxt.getText();
String vendorName = venNmtxt.getText();
String address = venAddtxt.getText();
String city = venCitytxt.getText();
String state = venSttxt.getText();
String zipCode = venZiptxt.getText();
String telephone = venTeltxt.getText();
String fax = venFaxtxt.getText();
VendorMasterBean vmBean = new VendorMasterBean(vendorNumber,vendorName, address, city, state, zipCode, telephone, fax);
removeVendorMasterRecord(vmBean);
void vDelbtn_keyPressed(KeyEvent e)
/* To get next record */
protected VendorMasterBean getNextRecord()
VendorMasterBean vmBean = new VendorMasterBean();
if(currentIndex < totalRecords)
vmBean =(VendorMasterBean)vendorMasterRecords.elementAt(++currentIndex);
if(currentIndex == (totalRecords-1) )
// reached last, so disable the Next button
vNxtbtn.setEnabled(false);
// enable the Previous
vPrevbtn.setEnabled(true);
} // end of if stmt
} // end of outer if stmt
return vmBean;
} // end of getnextrecord
void vNxtbtn_keyPressed(KeyEvent e)
void vNxtbtn_actionPerformed(ActionEvent e)
VendorMasterBean vmBean = getNextRecord();
venNotxt.setText(vmBean.getVendorNumber());
venNmtxt.setText(vmBean.getVendorName());
venAddtxt.setText(vmBean.getAddress());
venCitytxt.setText(vmBean.getCity());
venSttxt.setText(vmBean.getState());
venZiptxt.setText(vmBean.getZipcode());
venTeltxt.setText(vmBean.getTelephone());
venFaxtxt.setText(vmBean.getFax());
/* to get previous record */
protected VendorMasterBean getPreviousRecord()
VendorMasterBean vmBean = new VendorMasterBean();
if(currentIndex > 0)
vmBean =(VendorMasterBean)vendorMasterRecords.elementAt(--currentIndex);
if(currentIndex == 0)
// reached first so disable the Previous button
vPrevbtn.setEnabled(false);
// enable the Next
vNxtbtn.setEnabled(true);
} // end of inner if stmt
} // end of outer if stmt
return vmBean;
} // end of previousrecord
void vPrevbtn_actionPerformed(ActionEvent e)
VendorMasterBean vmBean = getPreviousRecord();
venNmtxt.setText(vmBean.getVendorName());
venAddtxt.setText(vmBean.getAddress());
venNotxt.setText(vmBean.getVendorNumber());
venCitytxt.setText(vmBean.getCity());
venSttxt.setText(vmBean.getState());
venZiptxt.setText(vmBean.getZipcode());
venTeltxt.setText(vmBean.getTelephone());
venFaxtxt.setText(vmBean.getFax());
void vPrevbtn_keyPressed(KeyEvent e)
void vUpdtbtn_actionPerformed(ActionEvent e)
/* when the update button is pressed , only the v_no is disabled
vPrevbtn.setEnabled(false);
vNxtbtn.setEnabled(false);
venNmtxt.setEnabled(true);
venAddtxt.setEnabled(true);
venCitytxt.setEnabled(true);
venSttxt.setEnabled(true);
venZiptxt.setEnabled(true);
venTeltxt.setEnabled(true);
venFaxtxt.setEnabled(true);
//then the user should press the save button
void vExitbtn_actionPerformed(ActionEvent e)
venMastFrame.setDefaultCloseOperation(venMastFrame.EXIT_ON_CLOSE);
void vExitbtn_keyPressed(KeyEvent e)
void vSavebtn_actionPerformed(ActionEvent e)
String vendorNumber = venNotxt.getText();
String vendorName = venNmtxt.getText();
String address = venAddtxt.getText();
String city = venCitytxt.getText();
String state = venSttxt.getText();
String zipCode = venZiptxt.getText();
String telephone = venTeltxt.getText();
String fax = venFaxtxt.getText();
VendorMasterBean vmBean = new VendorMasterBean(vendorNumber, vendorName,address, city, state, zipCode, telephone, fax);
addVendorMasterRecord(vmBean);
} // end of vSavebtn_actionPerformed
} // end of class vendormaster
//Adapter classes
class VendorMaster_vNxtbtn_actionAdapter implements java.awt.event.ActionListener
VendorMaster adaptee;
VendorMaster_vNxtbtn_actionAdapter(VendorMaster adaptee)
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e)
adaptee.vNxtbtn_actionPerformed(e);
class VendorMaster_vNxtbtn_keyAdapter extends java.awt.event.KeyAdapter
VendorMaster adaptee;
VendorMaster_vNxtbtn_keyAdapter(VendorMaster adaptee)
this.adaptee = adaptee;
public void keyPressed(KeyEvent e)
adaptee.vNxtbtn_keyPressed(e);
class VendorMaster_vPrevbtn_actionAdapter implements java.awt.event.ActionListener
VendorMaster adaptee;
VendorMaster_vPrevbtn_actionAdapter(VendorMaster adaptee)
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e)
adaptee.vPrevbtn_actionPerformed(e);
class VendorMaster_vPrevbtn_keyAdapter extends java.awt.event.KeyAdapter
VendorMaster adaptee;
VendorMaster_vPrevbtn_keyAdapter(VendorMaster adaptee)
this.adaptee = adaptee;
public void keyPressed(KeyEvent e)
adaptee.vPrevbtn_keyPressed(e);
class VendorMaster_vExitbtn_actionAdapter implements java.awt.event.ActionListener
VendorMaster adaptee;
VendorMaster_vExitbtn_actionAdapter(VendorMaster adaptee)
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e)
adaptee.vExitbtn_actionPerformed(e);
class VendorMaster_vExitbtn_keyAdapter extends java.awt.event.KeyAdapter
VendorMaster adaptee;
VendorMaster_vExitbtn_keyAdapter(VendorMaster adaptee)
this.adaptee = adaptee;
public void keyPressed(KeyEvent e)
adaptee.vExitbtn_keyPressed(e);
class VendorMaster_vNewbtn_actionAdapter implements java.awt.event.ActionListener
VendorMaster adaptee;
VendorMaster_vNewbtn_actionAdapter(VendorMaster adaptee)
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e)
adaptee.vNewbtn_actionPerformed(e);
class VendorMaster_vNewbtn_keyAdapter extends java.awt.event.KeyAdapter
VendorMaster adaptee;
VendorMaster_vNewbtn_keyAdapter(VendorMaster adaptee)
this.adaptee = adaptee;
public void keyPressed(KeyEvent e)
adaptee.vNewbtn_keyPressed(e);
class VendorMaster_vDelbtn_actionAdapter implements java.awt.event.ActionListener
VendorMaster adaptee;
VendorMaster_vDelbtn_actionAdapter(VendorMaster adaptee)
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e)
adaptee.vDelbtn_actionPerformed(e);
class VendorMaster_vDelbtn_keyAdapter extends java.awt.event.KeyAdapter
VendorMaster adaptee;
VendorMaster_vDelbtn_keyAdapter(VendorMaster adaptee)
this.adaptee = adaptee;
public void keyPressed(KeyEvent e)
adaptee.vDelbtn_keyPressed(e);
class VendorMaster_vUpdtbtn_actionAdapter implements java.awt.event.ActionListener {
VendorMaster adaptee;
VendorMaster_vUpdtbtn_actionAdapter(VendorMaster adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.vUpdtbtn_actionPerformed(e);
class VendorMaster_vSavebtn_actionAdapter implements java.awt.event.ActionListener {
VendorMaster adaptee;
VendorMaster_vSavebtn_actionAdapter(VendorMaster adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.vSavebtn_actionPerformed(e);
the following code is the vendorMasterBean class file- this file helps 2 assign data to the various textboxes.
code:--------------------------------------------------------------------------------
package mainpage;
public class VendorMasterBean
private String vendorNumber;
private String vendorName;
private String address;
private String city;
private String state;
private String zipcode;
private String telephone;
private String fax;
public int Mandatory_Value;
public VendorMasterBean()
} // end of constructor
public VendorMasterBean(String vendorNumber,String vendorName,String address,String city,String state,String zipcode,String telephone,String fax)
setVendorNumber(vendorNumber);
setVendorName(vendorName);
setAddress(address);
setCity(city);
setState(state);
setZipcode(zipcode);
setTelephone(telephone);
setFax(fax);
/* Set Method */
public void setVendorNumber(String vendorNumber)
try
if ( (vendorNumber == null) || (vendorNumber.length() <= 0) || (vendorNumber.length() > 5))
throw new ValidateException(ValidateException.MANDATORY_VALUE,
"Vendor Number");
} // end of if stmt
else {
this.vendorNumber = vendorNumber;
} // end of else
catch(Exception e)
e.printStackTrace();
} // end of setVendorNumber
public void setVendorName(String vendorName)
try
if((vendorName == null) || (vendorName.length() <=0 && vendorName.length() > 25))
throw new ValidateException(ValidateException.MANDATORY_VALUE,
"Vendor Name");
}// end of if
else
this.vendorName = vendorName;
} // end of else
} // end of try
catch(Exception e)
e.printStackTrace();
}// end of set method
public void setAddress(String address)
try
if((address == null) ||(address.length() <=0 && address.length()>15))
throw new ValidateException(ValidateException.MANDATORY_VALUE,
"Address");
else
this.address = address;
catch(Exception e)
e.printStackTrace();
public void setCity(String city)
try
if((city == null) ||(city.length()<=0 && city.length() > 15))
throw new ValidateException(ValidateException.MANDATORY_VALUE,
"City");
else
this.city = city;
catch(Exception e)
e.printStackTrace();
public void setState(String state)
try
if((state == null) || (state.length()<=0 && state.length() >15))
throw new ValidateException(ValidateException.MANDATORY_VALUE,
"State");
else
this.state = state;
catch(Exception e)
e.printStackTrace();
public void setZipcode(String zipcode)
try
if((zipcode==null) ||(zipcode.length()<=0 && zipcode.length() > 10))
throw new ValidateException(ValidateException.MANDATORY_VALUE,
"Zipcode");
else
this.zipcode = zipcode;
catch(Exception e)
e.printStackTrace();
public void setTelephone(String telephone)
try
if((telephone==null) || (telephone.length() <= 0 && telephone.length()> 7))
throw new ValidateException(ValidateException.MANDATORY_VALUE,
"Telephone");
else
this.telephone = telephone;
catch(Exception e)
e.printStackTrace();
public void setFax(String fax)
try
if((fax == null) ||(fax.length()<=0 && fax.length() > 7))
throw new ValidateException(ValidateException.MANDATORY_VALUE,
"Fax");
else
this.fax = fax;
catch(Exception e)
e.printStackTrace();
/* Get method */
public String getVendorNumber()
return vendorNumber;
public String getVendorName()
return vendorName;
public String getAddress()
return address;
public String getCity()
return city;
public String getState()
return state;
public String getZipcode()
return zipcode;
public String getTelephone()
return telephone;
public String getFax()
return fax;
/* end of get method*/
} // end of class
2) the 2nd error is in the save button method , everytme i try 2 save the inserted record it gives me an error.
in case u need my mainpage.java, here it is
code:--------------------------------------------------------------------------------
package mainpage;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.JPanel;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
//import java.sql.Statement;
//import java.sql.ResultSet;
import oracle.jdbc.driver.OracleDriver;
import oracle.jdbc.OracleResultSet;
public class MainPage extends JFrame implements ActionListener
public static String title = "Warehouse Management System";
JFrame frame = new JFrame();
JMenuBar menuBar = new JMenuBar();
JMenu viewMenu = new JMenu("VIEW");
JMenuItem vendorItem = new JMenuItem("Vendor Master");
JMenuItem custItem= new JMenuItem("Customer Master");
JMenuItem salesrepItem= new JMenuItem("Sales Rep Master");
JMenuItem itemmastItem= new JMenuItem("Item Master");
JMenuItem orderItem= new JMenuItem("Order Master");
JMenuItem invoiceItem = new JMenuItem("Invoice Master");
JMenuItem payItem= new JMenuItem("Payment Master");
JMenu transactionMenu = new JMenu("EDIT");
JMenuItem veneditItem = new JMenuItem("Vendor");
JMenuItem custeditItem = new JMenuItem("Customer");
JMenuItem saleItem = new JMenuItem("Rep Information");
JMenuItem itmeditItem= new JMenuItem("Item");
JMenuItem ordeditItem= new JMenuItem("Order");
JMenuItem inveditItem = new JMenuItem("Invoice");
JMenuItem payeditItem = new JMenuItem("Payment");
JMenu exitMenu = new JMenu("EXIT2 parts to this
Limit characters in jtextfield using a custom document
http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html#customdocument
Specify a custom editor (jtextfield) for jtable (or column)
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#validtext -
Accessing EJB from Java Mapping
Hi all,
I developed an EJB, deployed it to the J2EEServer via Visual Administrator. When I do a lookup from outside (NWDS) with the JNDI Name I gave it, everything works fine.
Now I have to use this EJB in a Java Mapping. I do the same --> lookup and narrow with PortableRemoteObject and so on.
But the problem is that I always get an java.lang.NoClassDefFoundError for the home interface.
Any ideas?
Thanks a lot
OlliHello.
Check my wiki article:
http://wiki.sdn.sap.com/wiki/display/stage/SapNetweaverProcessIntegration.CallEjb3.0methodfromJavaclassmappingPI7.1
(SapNetweaver Process Integration. Call Ejb 3.0 method from Java class mapping PI 7.1) -
Accessing JFX from Java or find a workarround
Hi there, I'm a new one ...
I'm working on this project designing applications for a touch panel. I've written a little Java app that uses JNA to access the driver and grab the coordinates of touches on the panel. Works fine so far ...
Now I'm creating an UI using Java FX. I've got the thing up and running, only experiencing minor problems due to learning JFX.
When it comes to combining the UI with the Java classes that access the driver I'm not sure how to implement the whole thing. I know it's only possible to access Java from JFX, not the other way arround. My java classes though are the ones who should trigger the events the UI should react to.
I think I've read something about the possiblity to use reflection to call JFX functions from Java which is one idea I could go with. (if anyone got good links ...)
The other idea is that I implement a sort of FIFO object where my Java classes drop events and a timer in my JFX classes where I pull them out (not sure if MediaTimer is the right class to go with)
Any suggestions, tips, etc. ? :)
Greetings, AlexI think that if you create a interface in java and a class in javafx that implements that interface you can then pass that class to java. For instance:
Java:
public interface EventReceiver {
public void receive(String event);
// Then your java class that generates the events
public class EventGenerator {
private List<EventReceiver> receivers = new LinkedList<EventReceiver>();
public void registerEventReceiver(EventReceiver er) {
receiver.add(er);
public void unregisterEventReceiver(EventReceiver er) {
receiver.remove(er);
* Add code that calls EventReceiver.receive(String) method for each element in the receiver list
* when the panel is touched.
}and in the JavaFX code:
public class JavaFXEventReceiver extends EventReceiver {
public override function receive(String event) {
// Do UI updates...
}A little more indepth version can be found here:
http://www.compare-review-information.com/pure-java-code-to-call-javafx-class/
You might run into some problems though pertaining to threading...but there are workarounds for that aswell :)
- Emil H -
Accessing excel from java code
Hello
our system uses reportNet to generate reports. When reports are generated in CSV format we have a problem:
Report consists of people (can be more than one) so under name column we have same name in more than one row. BUT if more than one name is suppose to be in the CSV report then the header (column names row) is again printed.
so for example if i requested rpeort for two names A and B (reportNet uses same template which is executed twice) then report will look like this
Name (header - column name)
A
A
A
A
A
Name (header - column name)
B
B
B
B
I want to be able to remove the second header that comes before B starts.
so i was thinking i would be able to access this excel sheet from java. and keep record of every row. If the row changes from A to B...i delete the previous row (which would end up being the second header).
Can this be done thru java. I havnt before accessed excel sheets from java so any pointers would be greatly appreciated.Hi, well CSV is not currently an Excel file, it is a Comma Separated Values
file which can be read through Excel.
Now, if you wish to remove the header, I would purpose that you develop an
application that reads the CSV file, as it is mere text, and that it also reads
another file (lets call it confirguration.txt) in which you determine the pattern
you want to remove, then you just read your report and if a string line
matches the pattern you defined in the configuration.txt file, then you simply
erase it.
And if you keep interested in reading real Excel files (xls), I would
recommend you use POI-HSSF API from Apache.org
http://jakarta.apache.org/poi/hssf/index.html
Hope this helps, cya around. -
Accessing *.XLS from Java -- Help!
Could anyone help me with some explanations about how to access MS Excel (*.elx) files from java?
I just have Accessing Access from Java.
/* 2003/02/06 eric.leung
* Source : HOME
import java.sql.*;
import java.lang.*;
public class ejdbcsel {
public static void main(String args[]) {
// eric_jsp is ODBC User DNS
// String url = "jdbc:odbc:eric_jsp";
// Using DSNless connection
String url = "";
url = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)}" +
";SERVER=127.0.0.1;DBQ=c:\\example\\ERIC_JSP.mdb";
Connection con;
String query;
query = "select * from pt_mstr";
Statement stmt;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException e) {
System.err.print("ClassNotFoundException " );
System.err.println(e.getMessage());
try {
con = DriverManager.getConnection (url,"","");
stmt = con.createStatement();
ResultSet rec = stmt.executeQuery(query);
// Scan the Database
while(rec.next()) {
System.out.println(rec.getString("pt_part") + "\t"
+ rec.getString("pt_desc"));
stmt.close();
con.close();
} catch (SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
catch (Exception e) {
System.err.println("Error: " + e.toString() + " " + e.getMessage()); -
I have requirement to create and write files on a NFS file storage. I need to do this from a Java application running on Windows 2008 Server.
How do i implement this requirement?. Is there any Java Library to achieve this?.
I have read documentation on WebNFS (Java Extended File System API). Where can i download this library?.
WebNFS is renamed to YaNFS and made as open source (http://java.net/projects/yanfs). But YaNFS project doesn't appear to be active anymore.
Thanks.809385 wrote:
I have requirement to create and write files on a NFS file storageSo how would you do this outside of Java? Presumably you would mount the NFS on some Windows 2008 mount point (a quick Google search says this is not difficult). Why can't you do the same from Java (Process builder springs to mind) and then access the NFS using standard Java IO. -
Is RFC destination is required for accessing BAPI from java/VB program.
I am not able to understant that all BAPI are Remote enabled ,but no where I observed that RFC destination is required.
Can any body tell me exact flow and things step by step.
Any example/full source code so that I can call from java program.
I have tried some java code posted here but not able to understand ..
please provide me setttings also in SAP and java systemHi Nagaraju,
Thank you very much. your post resolve one of my basic need .really appreciate your post.
I was not able to execute bapi BAPI_MATERIAL_GETLIST but I executed BAPI_PO_GETDETAIL succesfully.
Still I have 2 doubt.
[1]. I called BAPI function module(BAPI_PO_GETDETAIL) from simple java program,But I need to call API method ( GETDETAIL) created for this BAPI not direct BAPI function module.
[2] this is something apart from original topic.
I have tested your java code in java as well as similar in ECC 6.0
But I am not getting any output in JAVA program.
I am getting output in ECC6.0 only when I will take internal table lt_mara[] with header line.
if I will take separate workarea output is not coming. I think this is the problem in JAVA also.
Please see the code and tell me where I am wrong.
REPORT ZTEST1.
types: begin of ty_mara .
include STRUCTURE BAPIMATRAM.
TYPES: END OF ty_mara.
types: begin of ty_list .
include STRUCTURE BAPIMATLST.
TYPES: END OF ty_list.
data: lt_mara type STANDARD TABLE OF ty_mara with HEADER LINE.
data: lt_list type STANDARD TABLE OF ty_list,
ls_list like LINE OF lt_list.
START-of-SELECTION.
lt_mara-SIGN = 'I'.
lt_mara-option = 'EQ'.
lt_mara-matnr_low = '000000000000000088'. "'P1001087'.
lt_mara-matnr_high = ''.
APPEND lt_mara.
lt_mara-SIGN = 'I'.
lt_mara-option = 'EQ'.
lt_mara-matnr_low = '000000000000000089'. "'P1001087'.
lt_mara-matnr_high = ''.
APPEND lt_mara.
CALL FUNCTION 'BAPI_MATERIAL_GETLIST'
TABLES
MATNRSELECTION = lt_mara
MATNRLIST = lt_list[] .
WRITE / 'output: '.
LOOP AT lt_list into ls_list .
write: ls_list .
ENDLOOP.
REPORT ZTEST2.
types: begin of ty_mara .
include STRUCTURE BAPIMATRAM.
TYPES: END OF ty_mara.
types: begin of ty_list .
include STRUCTURE BAPIMATLST.
TYPES: END OF ty_list.
data: lt_mara type STANDARD TABLE OF ty_mara, ">> Without header line
ls_mara like line of lt_mara.
data: lt_list type STANDARD TABLE OF ty_list,
ls_list like LINE OF lt_list.
START-of-SELECTION.
ls_mara-SIGN = 'I'.
ls_mara-option = 'EQ'.
ls_mara-matnr_low = '000000000000000088'. "'P1001087'.
ls_mara-matnr_high = ''.
APPEND ls_list to lt_mara.
ls_mara-SIGN = 'I'.
ls_mara-option = 'EQ'.
ls_mara-matnr_low = '000000000000000089'. "'P1001087'.
ls_mara-matnr_high = ''.
APPEND ls_list to lt_mara.
CALL FUNCTION 'BAPI_MATERIAL_GETLIST'
TABLES
MATNRSELECTION = lt_mara
MATNRLIST = lt_list[] .
WRITE / 'output: '.
LOOP AT lt_list into ls_list .
write: ls_list .
ENDLOOP. -
New bee - accessing CIS from java
Hi ,
On the same line. I want to access the CIS from Java. Can you guide me on how I can implement this . Both from a standalone java program and from a web layer ?
I have installed content server 10gR3. I want to acess this server from Java.
Any help is appreciated.I think that if you create a interface in java and a class in javafx that implements that interface you can then pass that class to java. For instance:
Java:
public interface EventReceiver {
public void receive(String event);
// Then your java class that generates the events
public class EventGenerator {
private List<EventReceiver> receivers = new LinkedList<EventReceiver>();
public void registerEventReceiver(EventReceiver er) {
receiver.add(er);
public void unregisterEventReceiver(EventReceiver er) {
receiver.remove(er);
* Add code that calls EventReceiver.receive(String) method for each element in the receiver list
* when the panel is touched.
}and in the JavaFX code:
public class JavaFXEventReceiver extends EventReceiver {
public override function receive(String event) {
// Do UI updates...
}A little more indepth version can be found here:
http://www.compare-review-information.com/pure-java-code-to-call-javafx-class/
You might run into some problems though pertaining to threading...but there are workarounds for that aswell :)
- Emil H -
Accessing connection from java and generated code
In JDeveloper 10.1.2.x I set up a connection and selected a stored procedure and generated java to call the stored proc. All good.
Now, in a web service application I want to call the method in that class that was generated.
So, the generated class has setConnectionContext(), getConnectionContext(), etc methods. I don't know how to use them. What is a ConnectionContext?
How do I provide the database connection information and call the method in the generated code that I need?
My Oracle AS server has a datasource configured that is the one I would like to use, but I don't know how to 'access' it via java in the context of this generated class.
I am deploying to Oracle AS 10.1.2,
thanksHi, well CSV is not currently an Excel file, it is a Comma Separated Values
file which can be read through Excel.
Now, if you wish to remove the header, I would purpose that you develop an
application that reads the CSV file, as it is mere text, and that it also reads
another file (lets call it confirguration.txt) in which you determine the pattern
you want to remove, then you just read your report and if a string line
matches the pattern you defined in the configuration.txt file, then you simply
erase it.
And if you keep interested in reading real Excel files (xls), I would
recommend you use POI-HSSF API from Apache.org
http://jakarta.apache.org/poi/hssf/index.html
Hope this helps, cya around. -
Printing Access report from Java JButton
hi would anyone be able to help me i need to print a MS access report from a JButton on a Java interface i have connected to the database using JDBC-ODBC and can retrieve data from the table and store it in text fields on java GUI however i have problems when it comes to printing the reports.
Help I Need Somebody. :)Not possible using Java.
I would guess that it is possible to do this using C/C++ and windows API calls. And once you figured that out then you could use JNI to call that code and that would allow you to use java.
I can think of one other odd solution....
1. Acquite 'AutoIt' - search for it on google
2. Create an AutoIt script that runs Access, opens the database and runs the report.
3. Use Runtime.exec() in Java to run AutoIt passing in the script from 2.
Maybe you are looking for
-
Hello, I have a question - my ex boyfriend set up my Iphone when I got it so he used his Apple Id (he has a macbook) but since then we broke up and I hav ecreated my own Apple Id but all of a sudden, my phone is asking me of his Apple Id to update my
-
Question: How do I copy (old) music content from iPod to iTunes on a new PC? I don't want to lose the content on my iPod.
-
Error while trying to access content admin
Hi, I am trying to access content admin using J2EE_ADMIN user id but not able to login and it throws an error. Please see below for the error. Unknown message (ID = java.lang.ExceptionInInitializerError at com.sap.i18n.cp.ConvertBase.CheckConverter
-
Moving to UK for a year from US - What are my options?
Okay, so my wife and I are moving to Edinburgh in two weeks, for a 1yr stay. I currently have an iPhone 4 and she has the iPhone 3Gs. I just got off the phone with AT&T and my options are to put our account on a 'reduced rate suspension' which means
-
Database Development with JDeveloper tutorial
When I run the EMP_FETCHER body I do not get a Run PL/SQL dialog. Has anyone else had this problem? I using JDeveloper 10.1.3.0.4, Oracle database 10g Express Edition and Windows XP PRO. Thanks