How to print the Jtable into paper
im facing a problem which is after i get the data to be dispaly in the jtable but im facing problem of printing the table in paper as a report.. the report must be info about the data in table..thanks
My table has narrow columns resulting in clipping of
text. Is there some way to print the full text in the
columns?I researched Manning's Swing book and found an example of printing the content of JTable without clipping. But alas, my table doesn't fit in a standard 8.5''x11'' paper even in landscape setting. When one looks at Excel's spreadsheet output, the columns can span over multiple pages. I can live with that. Any solutions?
Similar Messages
-
How to write the JTables Content into the CSV File.
Hi Friends
I managed to write the Database records into the CSV Files. Now i would like to add the JTables contend into the CSV Files.
I just add the Code which Used to write the Database records into the CSV Files.
void exportApi()throws Exception
try
PrintWriter writing= new PrintWriter(new FileWriter("Report.csv"));
System.out.println("Connected");
stexport=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
rsexport=stexport.executeQuery("Select * from IssuedBook ");
ResultSetMetaData md = rsexport.getMetaData();
int columns = md.getColumnCount();
String fieldNames[]={"No","Name","Author","Date","Id","Issued","Return"};
//write fields names
String rec = "";
for (int i=0; i < fieldNames.length; i++)
rec +='\"'+fieldNames[i]+'\"';
rec+=",";
if (rec.endsWith(",")) rec=rec.substring(0, (rec.length()-1));
writing.println(rec);
//write values from result set to file
rsexport.beforeFirst();
while(rsexport.next())
rec = "";
for (int i=1; i < (columns+1); i++)
try
rec +="\""+rsexport.getString(i)+"\",";
rec +="\""+rsexport.getInt(i)+"\",";
catch(SQLException sqle)
// I would add this System.out.println("Exception in retrieval in for loop:\n"+sqle);
if (rec.endsWith(",")) rec=rec.substring(0,(rec.length()-1));
writing.println(rec);
writing.close();
}With this Same code how to Write the JTable content into the CSV Files.
Please tell me how to implement this.
Thank you for your Service
JofinHi Friends
I just modified my code and tried according to your suggestion. But here it does not print the records inside CSV File. But when i use ResultSet it prints the Records inside the CSV. Now i want to Display only the JTable content.
I am posting my code here. Please run this code and find the Report.csv file in your current Directory. and please help me to come out of this Problem.
import javax.swing.*;
import java.util.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.table.*;
public class Exporting extends JDialog implements ActionListener
private JRadioButton rby,rbn,rbr,rbnore,rbnorest;
private ButtonGroup bg;
private JPanel exportpanel;
private JButton btnExpots;
FileReader reading=null;
FileWriter writing=null;
JTable table;
JScrollPane scroll;
public Exporting()throws Exception
setSize(550,450);
setTitle("Export Results");
this.setLocation(100,100);
String Heading[]={"BOOK ID","NAME","AUTHOR","PRICE"};
String records[][]={{"B0201","JAVA PROGRAMING","JAMES","1234.00"},
{"B0202","SERVLET PROGRAMING","GOSLIN","1425.00"},
{"B0203","PHP DEVELOPMENT","SUNITHA","123"},
{"B0204","PRIAM","SELVI","1354"},
{"B0205","JAVA PROGRAMING","JAMES","1234.00"},
{"B0206","SERVLET PROGRAMING","GOSLIN","1425.00"},
{"B0207","PHP DEVELOPMENT","SUNITHA","123"},
{"B0208","PRIAM","SELVI","1354"}};
btnExpots= new JButton("Export");
btnExpots.addActionListener(this);
btnExpots.setBounds(140,200,60,25);
table = new JTable();
scroll=new JScrollPane(table);
((DefaultTableModel)table.getModel()).setDataVector(records,Heading);
System.out.println(table.getModel());
exportpanel= new JPanel();
exportpanel.add(btnExpots,BorderLayout.SOUTH);
exportpanel.add(scroll);
getContentPane().add(exportpanel);
setVisible(true);
public void actionPerformed(ActionEvent ae)
Object obj=ae.getSource();
try {
PrintWriter writing= new PrintWriter(new FileWriter("Report.csv"));
if(obj==btnExpots)
for(int row=0;row<table.getRowCount();++row)
for(int col=0;col<table.getColumnCount();++col)
Object ob=table.getValueAt(row,col);
//exportApi(ob);
System.out.println(ob);
System.out.println("Connected");
String fieldNames[]={"BOOK ID","NAME","AUTHOR","PRICE"};
String rec = "";
for (int i=0; i <fieldNames.length; i++)
rec +='\"'+fieldNames[i]+'\"';
rec+=",";
if (rec.endsWith(",")) rec=rec.substring(0, (rec.length()-1));
writing.println(rec);
//write values from result set to file
rec +="\""+ob+"\",";
if (rec.endsWith(",")) rec=rec.substring(0,(rec.length()-1));
writing.println(rec);
writing.close();
catch(Exception ex)
ex.printStackTrace();
public static void main(String arg[]) throws Exception
Exporting ex= new Exporting();
}Could anyone Please modify my code and help me out.
Thank you for your service
Cheers
Jofin -
Problem in printing the JTable values
Dear Friends,
I have to print the JTable values (on paper using print dialogue box).
I'm using jtableObj.print to print the table values. But jtableObj.print takes more time to print the table values because it prints the values as a image(approximately 5 mins to print 10 pages).
My code is ,
boolean complete = tableObj.print(mode, header, footer, showPrintDialog, null, interactive,
null);Could anyone please tell me how to reduce the time?
Thanks in advanceHi again,
1. what problem are u facing ?
(there is no sapscript symbol / system symbol
for finding out the length )
(In abap u can use strlen)
2. data and gets trimmed
what is the meaning of it ?
3. do u mean to say that !
ABCDEF 123 45
GEF 123 45
is getting pritned like
ABCDEF 123 45 ?
GEF 123 45
4. If so , then use TABS
5. This happens because SPACE
is different in different varlues of
ABCDEF and GEF !
regards,
amit m.
Message was edited by: Amit Mittal -
How to print the message in 2 lines?
How to print the message in 2 lines?
Here i am having it like this... MESSAGE i000(zm) WITH lv_uname.
here I want to print lv_uname in 2 lines because it lengthy one.
Thanks,
Sridhar.No man, itas not comming..I am using the below logic to print my message:
CONCATENATE text-I01 lv_printdate1 text-I02 INTO lv_printname
SEPARATED BY space.
MESSAGE i002(zm) WITH lv_printname.
its printing in a single line... -
HOW TO PRINT THE MATTER IN FOR ALL ENTRIES
HI HOW T PRINT THE FOR ALL ENTRIES MATTER
Hi Naresh,
You can only use FOR ALL ENTRIES IN ...WHERE ...in a SELECT statement.
SELECT ... FOR ALL ENTRIES IN itab WHERE cond returns the union of the solution sets of all SELECT statements that would result if you wrote a separate statement for each line of the internal table replacing the symbol itab-f with the corresponding value of component f in the WHERE condition.Duplicates are discarded from the result set. If the internal table itab does not contain any entries, the system treats the statement as though there were no WHERE cond condition, and selects all records (in the current client).
For example:
SELECT * FROM sflight INTO wa_sflight
FOR ALL ENTRIES IN ftab
WHERE CARRID = ftab-carrid AND
CONNID = ftab-connid AND
fldate = '20010228'.
This condition, return all entries of the sflight.
When using FOR ALL ENTRIES the number of matching records is restricted to the number of records in the internal table. If the number of records in the database tables is too large then join would cause overheads in performance. Additionally a JOIN bypasses the table buffering.
Thanks,
Reward If Helpful. -
How to print the texts retrived by using READ_TEXT fun module in Smartform
Please tell me how to print the text which is rertrived by using the READ_TEXT function module in smartform.
I have coded all things in the program lines and in that i am retriveing the long texts.
I am getting the text lines in my internal table clearly, the thing is that I am not able to pass these lines to the text.
I have to print the trouble ticket. in that the notes log I have to pass.
its urgent. Points will be rewarded for any type of clue. whether it will work or not.There are a few ways to do it. If you need to take all of the text in the text type, in your SF text element choose "Include Text".
Populate the fields with the data that corresponds to the text type. It is similar to the interface to the FM "Read_Text.
Text Name
Text Obje
Text ID
Language
Encase any variables with the "&" symbol.
If you have already coded the call to the FM "READ_TEXT" and loaded the text into an internal table, create a loop and loop through the itab. Inside of the loop create a text element and add a variable in the text element for the field you are looking to output. -
How to Populate the JTable Object programatically with SQL Results
I'm wondering if someone could help me on how to populate the JTable Object with SQL Results wherein the Row of tjhe JTable object is automatically adjusted depending on how many records you have queried.
Thanks in advance and God bless! (",)
* frmMain.java
* Created on October 4, 2006, 6:15 AM
package tds;
import java.io.*;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.imageio.*;
import javax.swing.JFrame;
import java.sql.*;
import javax.swing.table.DefaultTableModel;
* @author Dexter.Carlit
public class frmMain extends javax.swing.JFrame {
private Connection connection = null;
private DefaultTableModel model;
/** Creates new form frmMain */
public frmMain() {
initComponents();
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
jSplitPane = new javax.swing.JSplitPane();
jScrollPane1 = new javax.swing.JScrollPane();
jPanel3 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
jTree1 = new javax.swing.JTree();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel1 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jTextField4 = new javax.swing.JTextField();
jPanel5 = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
jGrid = new javax.swing.JTable();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jProgressBar1 = new javax.swing.JProgressBar();
jPanel2 = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
getAccessibleContext().setAccessibleName("frmMain");
jSplitPane.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jSplitPane.setDividerLocation(200);
jSplitPane.setDividerSize(10);
jScrollPane2.setViewportView(jTree1);
org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel3Layout.createSequentialGroup()
.add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 916, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
jScrollPane1.setViewportView(jPanel3);
jSplitPane.setLeftComponent(jScrollPane1);
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
jLabel1.setText("First Name:");
jLabel2.setText("Last Name:");
jLabel3.setText("Position :");
jLabel4.setText("Department:");
jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Search Results"));
jGrid.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
new String [] {
"LName", "FName", "Position", "Department", "Office No", "Local No", "Office Mobile No", "Home No", "MobileNo", "Email Address"
jGrid.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
jGrid.setColumnSelectionAllowed(true);
jGrid.setName("");
jGrid.setTableHeader(jGrid.getTableHeader());
jScrollPane3.setViewportView(jGrid);
jScrollPane3.getAccessibleContext().setAccessibleName("rset");
org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 386, Short.MAX_VALUE)
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
jButton1.setText("Find");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(evt);
jButton2.setText("Clear");
jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton2MouseClicked(evt);
org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4Layout.createSequentialGroup()
.add(jLabel1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE))
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4Layout.createSequentialGroup()
.add(jLabel2)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE)
.add(1, 1, 1))
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4Layout.createSequentialGroup()
.add(jLabel3)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel4)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE))
.add(jPanel4Layout.createSequentialGroup()
.add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
jPanel4Layout.linkSize(new java.awt.Component[] {jButton1, jButton2}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel1)
.add(jTextField1))
.add(18, 18, 18)
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel2)
.add(jTextField2))
.add(16, 16, 16)
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel3)
.add(jTextField3)
.add(jLabel4)
.add(jTextField4))
.add(14, 14, 14)
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jButton2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(jButton1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.LEADING, jProgressBar1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 438, Short.MAX_VALUE))
.addContainerGap())
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jProgressBar1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
jTabbedPane1.addTab("Search", jPanel1);
org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 458, Short.MAX_VALUE)
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 401, Short.MAX_VALUE)
jTabbedPane1.addTab("Directory", jPanel2);
jSplitPane.setRightComponent(jTabbedPane1);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jSplitPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 675, Short.MAX_VALUE)
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jSplitPane)
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked
jGrid.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null, null, null}
new String [] {
"LName", "FName", "Position", "Department", "Office No", "Local No", "Office Mobile No", "Home No", "MobileNo", "Email Address"
jGrid.updateUI();
}//GEN-LAST:event_jButton2MouseClicked
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
try {
//Load and register SQL Server driver
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
//Establish a connection
Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://X.X.X.X:1433","MyAccount","MyPassword");
//Create a Statement object
Statement sql_stmt = connection.createStatement();
//Create a ResultSet object, execute the query and return a
// resultset
ResultSet rset = sql_stmt.executeQuery("SELECT * FROM EpxDirectory..Directory Order By LName");
// Populates a JTABLE Object
int i=0;
while (rset.next()){
String LName = rset.getString(1);
String FName = rset.getString(2);
String Position = rset.getString(3);
String Dept_Code = rset.getString(4);
String OffPhoneNo = rset.getString(5);
String LocalNo = rset.getString(6);
String OffMobileNo = rset.getString(7);
String HomePhoneNo = rset.getString(8);
String MobileNo = rset.getString(9);
String Email = rset.getString(10);
jGrid.updateUI();
jGrid.setValueAt(rset.getString(1).trim(),i,0);
jGrid.setValueAt(rset.getString(2).trim(),i,1);
jGrid.setValueAt(rset.getString(3).trim(),i,2);
jGrid.setValueAt(rset.getString(4).trim(),i,3);
jGrid.setValueAt(rset.getString(5).trim(),i,4);
jGrid.setValueAt(rset.getString(6).trim(),i,5);
jGrid.setValueAt(rset.getString(7).trim(),i,6);
jGrid.setValueAt(rset.getString(8).trim(),i,7);
jGrid.setValueAt(rset.getString(9).trim(),i,8);
jGrid.setValueAt(rset.getString(10).trim(),i,9);
i++;
//Close the ResultSet and Statement
rset.close();
sql_stmt.close();
//Close the database connection
connection.close();
System.out.println(Integer.toString(i) + " rows found");
} catch(Exception e) {
System.out.println("Failed to connect; Please view Stack Trace");
e.printStackTrace();
}//GEN-LAST:event_jButton1MouseClicked
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
}//GEN-LAST:event_formWindowOpened
public static void run(){
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
frmMain frmMain = new frmMain();
frmMain.setLocationRelativeTo(null); // Center the JFrame on the
frmMain.setVisible(true);
private void exitApplication() {
// try {
// //gui.putStatus("Closing the connection....please wait.....");
// if(connection != null) {
// // connection.close(); //Closing the connection object.
// } catch(SQLException ex) { //Trap SQLException
// //gui.putStatus(ex.toString());
System.exit(0); //Exit the aplication
* @param args the command line arguments
public static void main(String args[]) {
run();
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JTable jGrid;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JProgressBar jProgressBar1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JSplitPane jSplitPane;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTree jTree1;
// End of variables declaration//GEN-END:variables
}Use code tags.
Don't mix GUI and JDBC together. Split them out into separate classes.
You have a good start, but you will need to loop through your resultset and also pull the ResultSet metaData for you column headings -
How to print the list shown in the finder
I work as a photographer. For my clients I burn the pictures on DVD / CD.
Some of my clients want a indexprint from the folder on the disk.
How can print the list wich is shown in the finder? A screenshot doesn't work because there are often more items in the folder than the screen shows.
A friend told me this isn't possible in OS X. In OS9 this function was available, but removed in OS X.... ?
Regards
Walter
G5 Dual Mac OS X (10.4.8) also Intel ImacHi Walter,
To make a list, choose all (COMMAND + a) in the window than "copy" and "paste" to TextEdit or MS Word, or directly into email.
Also, If you drag a folder or entire volume onto the Print Setup Utility it will print it's contents.
-mj
[email protected] -
hi
I have used Jtable.print() command to print the JTAble but problem is that it is printing only that data which is visible row wise i.e.
if in a row one column's data is shown like
nam...
then it is printing like that only
i want to know how to print all data irrespective of how it is viewable on screen in table
please help me out
its urgent
thankspackage table;
* PrintTableDemo.java
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;
import javax.swing.*;
import javax.swing.table.*;
public class PrintTableDemo extends JFrame {
private JButton btPrint;
private JTable table;
private JTable tableToPrint;
public PrintTableDemo() {
super("PrintTableDemo");
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setSize(190,150);
setLocationRelativeTo(null);
table = new JTable();
btPrint = new JButton();
table.setModel(new DefaultTableModel(
new Object [][] {{"this should print entirely", null}},
new String [] {"Title 1", "Title 2"}
Class[] types = new Class [] {String.class, String.class};
boolean[] canEdit = new boolean [] {false, false};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
getContentPane().add(new JScrollPane(table), BorderLayout.CENTER);
btPrint.setText("Print...");
btPrint.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent evt) {
btPrintActionPerformed(evt);
getContentPane().add(btPrint, BorderLayout.NORTH);
private void btPrintActionPerformed(final ActionEvent evt) {
tableToPrint = new JTable(table.getModel());
tableToPrint.setSize(500,1500);
tableToPrint.getColumnModel().getColumn(0).setWidth(200);
tableToPrint.getColumnModel().getColumn(1).setWidth(200);
try {
tableToPrint.print();
} catch (PrinterException ex) {
ex.printStackTrace();
public static void main(final String args[]) {new PrintTableDemo().setVisible(true);}
} -
How to print the error records and success records in bdc
how to print the number of error records and success records in bdc
hai,
plz refer this program,
Z_130399130271_A
REPORT Z_130399130271_A
NO STANDARD PAGE HEADING LINE-SIZE 325.
*INCLUDE YVALIDATE.
*include bdcrecx1.
INCLUDE YINCLUDE399.
DATA ITAB LIKE TABLE OF FILE_TABLE WITH HEADER LINE.
PARAMETERS: DATASET(132) LOWER CASE.
DATA : RC TYPE I,
ERR(40) TYPE C,
SUCCESSCNT TYPE I VALUE 0,
FAILCOUNT TYPE I VALUE 0.
DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
If it is nessesary to change the data section use the rules:
1.) Each definition of a field exists of two lines
2.) The first line shows exactly the comment
'* data element: ' followed with the data element
which describes the field.
If you don't have a data element use the
comment without a data element name
3.) The second line shows the fieldname of the
structure, the fieldname must consist of
a fieldname and optional the character '_' and
three numbers and the field length in brackets
4.) Each field must be type C.
Generated data section with specific formatting - DO NOT CHANGE ***
DATA: BEGIN OF RECORD OCCURS 0,
data element: LIF16
LIFNR_001(016),
data element: KTOKK
KTOKK_002(004),
data element: ANRED
ANRED_003(015),
data element: NAME1_GP
NAME1_004(035),
data element: SORTL
SORTL_005(010),
data element: STRAS_GP
STRAS_006(035),
data element: PFACH
PFACH_007(010),
data element: ORT01_GP
ORT01_008(035),
data element: ORT02_GP
ORT02_009(035),
data element: LAND1_GP
LAND1_010(003),
data element: REGIO
REGIO_011(003),
data element: SPRAS
SPRAS_012(002),
data element: TELF1
TELF1_013(016),
data element: TELF2
TELF2_014(016),
data element: BANKS
BANKS_01_015(003),
data element: BANKK
BANKL_01_016(015),
data element: BANKN
BANKN_01_017(018),
END OF RECORD.
DATA: BEGIN OF ERRORITAB OCCURS 0,
LIFNR_001 LIKE LFA1-LIFNR,
KTOKK_002 LIKE LFA1-KTOKK,
ANRED_003 LIKE LFA1-ANRED,
NAME1_004 LIKE LFA1-NAME1,
SORTL_005 LIKE LFA1-SORTL,
STRAS_006 LIKE LFA1-STRAS,
PFACH_007 LIKE LFA1-PFACH,
ORT01_008 LIKE LFA1-ORT01,
ORT02_009 LIKE LFA1-ORT02,
LAND1_010 LIKE LFA1-LAND1,
REGIO_011 LIKE LFA1-REGIO,
SPRAS_012 LIKE LFA1-SPRAS,
TELF1_013 LIKE LFA1-TELF1,
TELF2_014 LIKE LFA1-TELF2,
BANKS_01_015 LIKE LFBK-BANKS,
BANKL_01_016 LIKE LFBK-BANKL,
BANKN_01_017 LIKE LFBK-BANKN,
ERRORMSG(60) TYPE C,
SERIAL TYPE I VALUE '1',
END OF ERRORITAB.
End generated data section ***
AT SELECTION-SCREEN ON VALUE-REQUEST FOR DATASET.
CALL FUNCTION 'TMP_GUI_FILE_OPEN_DIALOG'
EXPORTING
WINDOW_TITLE = 'select a file '
DEFAULT_EXTENSION = 'TXT'
DEFAULT_FILENAME = 'ASSIGN5.TXT'
FILE_FILTER =
INIT_DIRECTORY =
MULTISELECTION =
IMPORTING
RC =
TABLES
FILE_TABLE = ITAB
EXCEPTIONS
CNTL_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE ITAB INDEX 1.
DATASET = ITAB-FILENAME.
WRITE DATASET.
START-OF-SELECTION.
*perform open_dataset using dataset.
*perform open_group.
DATA T TYPE STRING.
T = DATASET.
IF T EQ ' '.
MESSAGE E110(ZX).
ENDIF.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = T
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = RECORD
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT RECORD.
CLEAR RC.
CLEAR ERR.
*read dataset dataset into record.
IF SY-SUBRC <> 0. EXIT. ENDIF.
RECORD-KTOKK_002 = '0001'.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0100'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RF02K-KTOKK'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'RF02K-LIFNR'
RECORD-LIFNR_001.
PERFORM BDC_FIELD USING 'RF02K-KTOKK'
RECORD-KTOKK_002.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0110'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFA1-TELX1'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'LFA1-ANRED'
RECORD-ANRED_003.
PERFORM BDC_FIELD USING 'LFA1-NAME1'
RECORD-NAME1_004.
PERFORM BDC_FIELD USING 'LFA1-SORTL'
RECORD-SORTL_005.
PERFORM BDC_FIELD USING 'LFA1-STRAS'
RECORD-STRAS_006.
PERFORM BDC_FIELD USING 'LFA1-PFACH'
RECORD-PFACH_007.
PERFORM BDC_FIELD USING 'LFA1-ORT01'
RECORD-ORT01_008.
PERFORM BDC_FIELD USING 'LFA1-ORT02'
RECORD-ORT02_009.
PERFORM BDC_FIELD USING 'LFA1-LAND1'
RECORD-LAND1_010.
PERFORM BDC_FIELD USING 'LFA1-REGIO'
RECORD-REGIO_011.
PERFORM BDC_FIELD USING 'LFA1-SPRAS'
RECORD-SPRAS_012.
PERFORM BDC_FIELD USING 'LFA1-TELF1'
RECORD-TELF1_013.
PERFORM BDC_FIELD USING 'LFA1-TELF2'
RECORD-TELF2_014.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0120'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFA1-KUNNR'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=VW'.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFBK-BANKN(01)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_FIELD USING 'LFBK-BANKS(01)'
RECORD-BANKS_01_015.
PERFORM BDC_FIELD USING 'LFBK-BANKL(01)'
RECORD-BANKL_01_016.
PERFORM BDC_FIELD USING 'LFBK-BANKN(01)'
RECORD-BANKN_01_017.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFBK-BANKS(01)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=UPDA'.
PERFORM BDC_TRANSACTION USING 'XK01' CHANGING ERR RC.
DATA: SERIAL TYPE I VALUE 1.
IF RC <> 0.
FAILCOUNT = FAILCOUNT + 1.
CLEAR ERRORITAB.
ERRORITAB-SERIAL = SERIAL.
ERRORITAB-LIFNR_001 = RECORD-LIFNR_001.
ERRORITAB-KTOKK_002 = RECORD-KTOKK_002.
ERRORITAB-ANRED_003 = RECORD-ANRED_003.
ERRORITAB-NAME1_004 = RECORD-NAME1_004.
ERRORITAB-SORTL_005 = RECORD-SORTL_005.
ERRORITAB-STRAS_006 = RECORD-STRAS_006.
ERRORITAB-PFACH_007 = RECORD-PFACH_007.
ERRORITAB-ORT01_008 = RECORD-ORT01_008.
ERRORITAB-ORT02_009 = RECORD-ORT02_009.
ERRORITAB-LAND1_010 = RECORD-LAND1_010.
ERRORITAB-REGIO_011 = RECORD-REGIO_011.
ERRORITAB-SPRAS_012 = RECORD-SPRAS_012.
ERRORITAB-TELF1_013 = RECORD-TELF1_013.
ERRORITAB-TELF2_014 = RECORD-TELF2_014.
ERRORITAB-BANKS_01_015 = RECORD-BANKS_01_015.
ERRORITAB-BANKL_01_016 = RECORD-BANKL_01_016.
ERRORITAB-BANKN_01_017 = RECORD-BANKN_01_017.
ERRORITAB-ERRORMSG = ERR.
SERIAL = SERIAL + 1.
APPEND ERRORITAB.
MODIFY RECORD TRANSPORTING KTOKK_002.
DELETE RECORD WHERE KTOKK_002 = '0001'.
ELSE.
SUCCESSCNT = SUCCESSCNT + 1.
ENDIF.
ENDLOOP.
display output********************************************************
SKIP.
FORMAT COLOR 5 INTENSIFIED OFF.
WRITE:/ 'No. of records successfully uploaded: '.
FORMAT COLOR 4 INTENSIFIED OFF.
WRITE: SUCCESSCNT.
Displaying the success table******************************************
IF SUCCESSCNT <> 0.
SKIP.
FORMAT COLOR 4 INTENSIFIED OFF.
WRITE:/ 'Successful Records'.
FORMAT COLOR 7 INTENSIFIED ON.
WRITE:/(261) SY-ULINE,
/ SY-VLINE,
'S.NO', 007 SY-VLINE,
'VENDOR ACC.NUM', 023 SY-VLINE,
'VENDOR ACC GROUP', 041 SY-VLINE,
'TITLE', 048 SY-VLINE,
'VENDOR NAME', 064 SY-VLINE,
'SORT FIELD', 076 SY-VLINE,
'HOUSE NO.& STREET', 101 SY-VLINE,
'PO.BOX NO', 116 SY-VLINE,
'CITY', 129 SY-VLINE,
'DISTRICT', 141 SY-VLINE,
'COUNTRY KEY', 156 SY-VLINE,
'REGION', 166 SY-VLINE,
'LANGUAGE KEY', 180 SY-VLINE,
'TELEPHONE NO 1', 196 SY-VLINE,
'TELEPHONE NO 2', 213 SY-VLINE,
'BANK COUNTRY KEY', 231 SY-VLINE,
'BANK KEY', 241 SY-VLINE,
'BANK ACC.NO', 261 SY-VLINE,
/1(261) SY-ULINE.
FORMAT COLOR 4 INTENSIFIED ON.
SERIAL = 1.
SORT RECORD BY LIFNR_001.
LOOP AT RECORD.
WRITE:/ SY-VLINE,
SERIAL LEFT-JUSTIFIED, 007 SY-VLINE,
RECORD-LIFNR_001(016), 023 SY-VLINE,
RECORD-KTOKK_002(004), 041 SY-VLINE,
RECORD-ANRED_003(015), 048 SY-VLINE,
RECORD-NAME1_004(035), 064 SY-VLINE,
RECORD-SORTL_005(010), 076 SY-VLINE,
RECORD-STRAS_006(035), 101 SY-VLINE,
RECORD-PFACH_007(010), 116 SY-VLINE,
RECORD-ORT01_008(035), 129 SY-VLINE,
RECORD-ORT02_009(035), 141 SY-VLINE,
RECORD-LAND1_010(003), 156 SY-VLINE,
RECORD-REGIO_011(003), 166 SY-VLINE,
RECORD-SPRAS_012(002), 180 SY-VLINE,
RECORD-TELF1_013(016), 196 SY-VLINE,
RECORD-TELF2_014(016), 213 SY-VLINE,
RECORD-BANKS_01_015(003), 231 SY-VLINE,
RECORD-BANKL_01_016(015), 241 SY-VLINE,
RECORD-BANKN_01_017(018), 261 SY-VLINE.
WRITE:/(261) SY-ULINE.
SERIAL = SERIAL + 1.
ENDLOOP.
WRITE:/1(261) SY-ULINE.
ENDIF.
SKIP.
FORMAT COLOR 5 INTENSIFIED OFF.
WRITE:/ 'No. of records not uploaded: '.
FORMAT COLOR 4 INTENSIFIED OFF.
WRITE: FAILCOUNT.
*Displaying the error table
IF FAILCOUNT <> 0.
SKIP.
FORMAT COLOR 4 INTENSIFIED OFF.
WRITE:/(320) SY-ULINE,
'Error Records'.
FORMAT COLOR 7 INTENSIFIED ON.
WRITE:/ SY-ULINE, SY-VLINE,
'S.NO', 007 SY-VLINE,
'VENDOR ACC.NUM', 023 SY-VLINE,
'VENDOR ACC GROUP', 041 SY-VLINE,
'TITLE', 048 SY-VLINE,
'VENDOR NAME', 064 SY-VLINE,
'SORT FIELD', 076 SY-VLINE,
'HOUSE NO.& STREET', 101 SY-VLINE,
'PO.BOX NO', 116 SY-VLINE,
'CITY', 129 SY-VLINE,
'DISTRICT', 141 SY-VLINE,
'COUNTRY KEY', 156 SY-VLINE,
'REGION', 166 SY-VLINE,
'LANGUAGE KEY', 180 SY-VLINE,
'TELEPHONE NO 1', 196 SY-VLINE,
'TELEPHONE NO 2', 213 SY-VLINE,
'BANK COUNTRY KEY', 231 SY-VLINE,
'BANK KEY', 241 SY-VLINE,
'BANK ACC.NO', 261 SY-VLINE,
'ERROR MESSAGE', 320 SY-VLINE.
WRITE:/(320) SY-ULINE.
FORMAT COLOR 4 INTENSIFIED ON.
SORT ERRORITAB BY LIFNR_001.
LOOP AT ERRORITAB.
WRITE:/ SY-VLINE,
ERRORITAB-SERIAL LEFT-JUSTIFIED, 007 SY-VLINE,
ERRORITAB-LIFNR_001 , 023 SY-VLINE,
ERRORITAB-KTOKK_002, 041 SY-VLINE,
ERRORITAB-ANRED_003, 048 SY-VLINE,
ERRORITAB-NAME1_004, 064 SY-VLINE,
ERRORITAB-SORTL_005, 076 SY-VLINE,
ERRORITAB-STRAS_006, 101 SY-VLINE,
ERRORITAB-PFACH_007, 116 SY-VLINE,
ERRORITAB-ORT01_008, 129 SY-VLINE,
ERRORITAB-ORT02_009, 141 SY-VLINE,
ERRORITAB-LAND1_010, 156 SY-VLINE,
ERRORITAB-REGIO_011, 166 SY-VLINE,
ERRORITAB-SPRAS_012, 180 SY-VLINE,
ERRORITAB-TELF1_013, 196 SY-VLINE,
ERRORITAB-TELF2_014, 213 SY-VLINE,
ERRORITAB-BANKS_01_015, 231 SY-VLINE,
ERRORITAB-BANKL_01_016, 241 SY-VLINE,
ERRORITAB-BANKN_01_017, 261 SY-VLINE,
ERRORITAB-ERRORMSG, 320 SY-VLINE.
WRITE:/(320) SY-ULINE.
ENDLOOP.
WRITE:/ SY-ULINE.
ENDIF.
hope this ll help you..
regards,
prema.A -
How to add the JTable results to an Object to save it in a file?
Hi... After i created a SAVE button and allow the user to enter a file name to save the results in the JTable, it didnt work. After the user entered the filename, the file was not created.
What is the type of the file the user should enter? eg. file.txt, file.doc or wat type?
When i use Vector, i added the JTable into the vector and i write the code 'out.writeObject(vector);'. Is this the right way?? Should i use vector or Object?? If i am suppose to use Object, how do i add the things in the JTable to the Object??
Thanks.thanks... the file is created but the results in the file is not readable... how do i solve this??
I use vector and i added the JTable into the vector and the results have squares and unreadable symbols....
Thanks again.... -
How to pull the data into smartform after designing layout?
how to pull the data into smartform after designing layout?
call the smartform in your Driver program and pass your output internal tables in the smartforms paramaters
Check the below Sample code.
FORM label_print.
DATA : g_fm_name TYPE rs38l_fnam,
g_output TYPE ssfcompop,
g_control TYPE ssfctrlop,
g_form TYPE tdsfname VALUE 'ZPRINT_LABELS',
g_dest TYPE rspopname,
g_printer TYPE rspoptype..
REFRESH : i_out[],i_qals[].
SELECT matnr maktx
INTO TABLE i_out
FROM makt
FOR ALL ENTRIES IN i_mseg
WHERE matnr = i_mseg-matnr
AND spras = sy-langu.
SELECT prueflos objnr ersteldat erstelzeit matnr revlv charg mengeneinh
INTO TABLE i_qals
FROM qals
FOR ALL ENTRIES IN i_mseg
WHERE matnr = i_mseg-matnr
AND charg = i_mseg-charg.
*FM to accept the device type and returns the short name of the output device
CALL FUNCTION 'EFG_GET_PRINTER'
EXPORTING
x_no_dialog = ' '
x_obligatory = 'X'
IMPORTING
y_tddest = g_dest
EXCEPTIONS
cancelled = 1
failed = 2
OTHERS = 3.
*device type name for the output device
SELECT SINGLE patype "#EC CI_NOFIELD
FROM tsp03d
INTO g_printer
WHERE padest = g_dest.
*printer setting
g_control-no_dialog = 'X'.
g_output-tdarmod = '1'.
g_output-tdcopies = '001'.
g_output-tddest = g_dest.
g_output-tdprinter = g_printer.
g_output-tdnewid = 'X'.
g_output-tdimmed = 'X'.
CLEAR wa_mseg.
LOOP AT i_mseg INTO wa_mseg.
READ TABLE i_out INTO wa_out WITH KEY matnr = wa_mseg-matnr.
check for the status and filter the records
CLEAR : wa_qals.
LOOP AT i_qals INTO wa_qals WHERE matnr = wa_mseg-matnr
AND charg = wa_mseg-charg.
CALL FUNCTION 'STATUS_TEXT_EDIT'
EXPORTING
objnr = wa_qals-objnr
spras = sy-langu
IMPORTING
line = l_status
EXCEPTIONS
object_not_found = 1
OTHERS = 2.
IF l_status CS 'LTCA' OR l_status CS 'SKIP'.
DELETE i_qals.
ENDIF.
ENDLOOP.
SORT i_qals BY ersteldat DESCENDING erstelzeit DESCENDING.
IF i_qals IS INITIAL.
l_msg = text-002.
ELSE.
READ TABLE i_qals INTO wa_qals INDEX 1.
SELECT prueflos vbewertung
INTO TABLE i_qave
FROM qave
WHERE prueflos = wa_qals-prueflos
AND kzart = 'L'.
IF sy-subrc <> 0.
l_msg1 = text-003.
ENDIF.
SORT i_qave.
CLEAR : wa_qave.
IF NOT i_qave IS INITIAL.
READ TABLE i_qave INTO wa_qave INDEX 1.
IF wa_qave-vbewertung = 'A'.
l_msg = text-002.
ELSEIF wa_qave-vbewertung = 'R'.
l_msg1 = text-003.
ELSE.
l_msg1 = text-003.
ENDIF.
ENDIF.
ENDIF.
CLEAR : wa_ser03.
READ TABLE i_ser03 INTO wa_ser03 WITH KEY mblnr = wa_mseg-mblnr.
*Calling Smartform
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = g_form
IMPORTING
fm_name = g_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
LOOP AT i_objk INTO wa_objk WHERE obknr = wa_ser03-obknr.
*Calling FM generated from the smartform
DATA : l_date(10) TYPE c,
l_date1(10) TYPE c,
l_date2(10) TYPE c,
l_date3(10) TYPE c,
l_hyphen(1) TYPE c VALUE '-'.
CLEAR : l_date,l_date1,l_date2,l_date3.
l_date1 = wa_mseg-vfdat+0(4).
l_date2 = wa_mseg-vfdat+4(2).
l_date3 = wa_mseg-vfdat+6(2).
CONCATENATE l_date1 l_hyphen l_date2 l_hyphen l_date3 INTO l_date.
CALL FUNCTION g_fm_name
EXPORTING
control_parameters = g_control
output_options = g_output
user_settings = ' '
g_matnr = wa_mseg-matnr
g_mat_text = wa_out-maktx
g_batch = wa_mseg-charg
g_rev = wa_qals-revlv
g_edate = l_date
g_lot = wa_qals-prueflos
g_qty = wa_mseg-erfmg
g_uom = wa_mseg-erfme
g_serial = wa_objk-sernr
g_smsg = l_msg
g_fmsg = l_msg1
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
CLEAR g_output-tdnewid.
ENDLOOP.
IF sy-subrc <> 0.
CLEAR : l_date,l_date1,l_date2,l_date3.
l_date1 = wa_mseg-vfdat+0(4).
l_date2 = wa_mseg-vfdat+4(2).
l_date3 = wa_mseg-vfdat+6(2).
CONCATENATE l_date1 l_hyphen l_date2 l_hyphen l_date3 INTO l_date.
CALL FUNCTION g_fm_name
EXPORTING
control_parameters = g_control
output_options = g_output
user_settings = ' '
g_matnr = wa_mseg-matnr
g_mat_text = wa_out-maktx
g_batch = wa_mseg-charg
g_rev = wa_qals-revlv
g_edate = l_date
g_lot = wa_qals-prueflos
g_qty = wa_mseg-erfmg
g_uom = wa_mseg-erfme
g_serial = wa_objk-sernr
g_smsg = l_msg
g_fmsg = l_msg1
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
CLEAR g_output-tdnewid.
ENDIF.
ENDLOOP.
IF sy-subrc = 0.
MESSAGE i000(zm).
ENDIF.
ENDFORM. " label_print -
I have the print ap but I do not see how to print the calendar on my iPad 2. Any suggestions
I have the print ap on my iPad 2. I can not figure out how to print the monthly calendar pages from my calendar on my iPad 2. Any suggestions
What print app do you have? I think that you need certain printing apps in order to print the iPad calendar. The print feature is not built into the app itself ...As far as I know.
-
How to print the superscript in smartform
Hi gurus,
Please tell me the procedure how to print the superscript in middle of the text displaying?
when we are displaying the smartform its converted to some special character like & .
please let me know procedure at the earliest
Regards
RajHi thanks for ur patience.
see my requirment was to print TM as superscript for HLL ,already smartstyle is there, and also a character format with superscript is also defined.
then aftet HLL how it prints as superscript.
for HLL we are using another character format and for superscript we are using the another character format.
If posiible send me the code to write in smartforms
Regards
RAj
Points are awarded for useful answers. -
How to print the script in condensed mode
Hi to all,
Pls help me.
How to print the script in condensed mode and particular window only print in the condensed mode.Hi,
Hi
It will remove the blank spaces in front of the variable
and if you use the extension NO-GAPS
It will remove all the blank spaces in the variable field.
DATA: ws_val1 type char12.
ws_val1 = ' 100 123'.
Condense ws_val1.
Write / ws_val1.
Condense ws_val1 no-gaps.
write / ws_val1.
It will give output as
100 123
100123
The CONDENSE statement deletes redundant spaces from a string:
CONDENSE c NO-GAPS.
This statement removes any leading blanks in the field c and replaces other sequences of blanks by exactly one blank. The result is a left-justified sequence of words, each separated by one blank. If the addition NO-GAPS is specified, all blanks are removed.
Please check this link for sample code.
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb33e6358411d1829f0000e829fbfe/content.htm
Regards,
Raj.
Maybe you are looking for
-
Unable to sign in to Creative Cloud for Desktops
Can anybody please help me identify the requirements to be able to sign in to Creative Cloud for Desktops? We are supposed to deploy CC within our organization but our desktop security environment apparently prohibits to launch CC for Desktops. - Win
-
Hello, We want to store long texts with an OData service. This text should be stored including formatting (html markup?). Does OData support this? Should I use String or Xstring Data types? Regards, Paul Lauwers.
-
Repository Creation Utility - where is the RCU.bat ?
People: I`m trying to run the Repository Creation Utility to configure dbs but i cannot find it ? it is part os soa 11g installer ? is it part of WL 11g installer ? where is it ? Thanks in advance, Nico Grossi
-
Is using Math.pow faster than multiplying myself?
Hi all, Is it faster to use Math.pow to calculate a power than to, say, multiply it myself in a loop? How about if I'm just doing a square -- is it faster to use Math.pow(x,2) than x * x? I noticed that the pow method in StrictMath has the keyword "n
-
Column number of caret position
How can I get column number of caret position. Of course I can use int dot = editorPane.getCaret().getDot(); Element root = editorPane.getDefaultRootElement int lineIndex = root.getElementIndex(dot); Element lineElement = root.getElement(line