Printing check with multiple vendors

while printing check using F110, like to print more than one vendors. but it is printing frist vendor check only , remaining it is not printing. please help on this issue

loop the final internal table ....check whether you used the statement read table index 1. if so delete it.

Similar Messages

  • T&E postings with multiple vendor

    Hi gurus ,
    there is a scenario for T&E postings as Journal Entries :-
      SAP system will be recieving a file in the following format  from a thrid party tool--->
    One Journal Entry :-
    Company Code   Cost Center   GLAccount   Assignment   Text   Debit Amount    Credit Amount
       0004                   62100           60100            TEA125       Cattty     45
       0004                   62100           00103            TEA125       Catty       210
       0004                   82131           60100            TEA131       ADAM    34
       0004                   82131           60103            TEA131      ADAM     670
       0004                                        2xxxy           PostingDat   TEpayble                       200
       0004                                        2xxxz           PostingDat   CrdtCrdpayable             300
    Will it be possible to post the entries like :-
        employees are considered as vendors : so vendor account crediting and GL Account debbiting ?
    Like
    Posting key 31 (vendor)    9122345       Catty       45
                       40 (Debit Entry)60100         Catty       200
    or
    Shall we infer it as multiple vendor postings in one accounting Document ?
    Could anybody please give some suggestions on the above file format breaking down to one Journal Entry Posting ?
    Any information is helpful : since i have nevr checked file with multiple vendors at line item level or how shall we infer the debit side and the credit payable side as mentioned above
    Thanks
    Kylie

    is there some problem at the sdn , even if i rate a thread as Stop watching and discard it doesnot get discarded ????
    Thanks
    Kylie

  • Reg:Single Check for Multiple Vendors

    Hi Experts,
    I want to Issue a Single check for all vendor open items...
    For this is I created one Group Key and assigned in the vendor master record, but while doing the payment separate check issuing for each vendor,
    any idea

    Hi,
    Can you check the below thread of urs.
    [Reg:Single Check for Multiple Vendors]
    In addition to the above, please make sure that in OBVU, the check box separate payment for each ref is deselected for your questioned comapny code.
    You would have continued your earlier thread instead, rather than a new thread.
    Thanks,
    Srinu

  • Item master Item mapping with multiple vendors

    Hi Experts,
    I need your help, I have one item like 'TV' in item master and need to enter multiple prices make wise samsung,sony,lg like.
    How can I maintain this in SAP B1 2005B.
    One Item mapping with multiple vendors with price...
    Thanks,

    Dear Aarti,
    I would recommend to have multiple items for the different brands you are selling.
    For example, you can call the item code Samsung, Sony etc and all of these item can be added to an item group called TV.
    Then you can assign a price to the items in the price lists.
    Alternatevely, if you need to have one single item called TV and different prices according to the brand, create a number of price lists called Sony, Sumsung etc and then if you know which customers buy a particular brand you can connect the price list to the customer under
    Business partner master data - Payment Terms - Price list.
    Please, if these 2 options are not helpful let us know the exact scenario and business reason behind your request.
    Kind Regards,
    Marcella Rivi
    SAP Business One Forums Team

  • How can I modify a Landed Costs with multiple vendors

    Normally, you just open a new Landed Costs, select same vendor as the original, and choose Copy From > Landed Costs, select original and modify!.
    With multiple vendors the "Copy from" lists just turns out empty.
    I have searched similar cases but the newest post i found was from 2009 and was not resolved.
    I'm using SAP B1 9.0

    Hi,
    Tested in 8.81 version PL10.
    1. If there is no landed cost for both vendors, the list of land cost is empty. Make sure vendors that selected in landed cost should have landed cost
    2. If you add multiple vendor, system will show landed cost document for second vendor not for first vendor.
    Thanks & Regards,
    Nagarajan

  • Problem with multiple vendor Check printing with F110

    while printing check using F110, like to print more than one vendors. but it is printing frist vendor check only , remaining it is not printing. please help on this issue

    Hi,
        follow below logic
        in xk02 enter multiple email address using
         option and select any email id as default.
         select adrnr from lfa1 into gv_adrnr
           from lfa1 where vendor in s_vendor.
          select ADDRNUMBER smtp_address into it_address
             where ADDRNUMBER gv_adrnr.
         loop at it_address.
              RECLIST-RECEIVER = IT_address-smtp_address.
              RECLIST-REC_TYPE = 'U'.
              APPEND RECLIST.
              CLEAR RECLIST.
        endloop.
       CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
              DOCUMENT_DATA              = DOC_CHNG
              PUT_IN_OUTBOX              = 'X'
           IMPORTING
              SENT_TO_ALL                = SENT_TO_ALL
            NEW_OBJECT_ID              =
           TABLES
              PACKING_LIST               = OBJPACK
              OBJECT_HEADER              = OBJHEAD
              CONTENTS_BIN               = OBJBIN
              CONTENTS_TXT               = OBJTXT
              RECEIVERS                  = RECLIST
           EXCEPTIONS
              TOO_MANY_RECEIVERS         = 1
              DOCUMENT_NOT_SENT          = 2
              DOCUMENT_TYPE_NOT_EXIST    = 3
              OPERATION_NO_AUTHORIZATION = 4
              PARAMETER_ERROR            = 5
              X_ERROR                    = 6
              ENQUEUE_ERROR              = 7
              OTHERS                     = 8.
    Regards
    Amole

  • How to Maintain Payment with one check for Multiple Vendors?

    Dear Gurus,
    i have a scenario for outgoing payment, here it is
    i have some open items for multiple vendors. say it for open item
    1. with amount 5000 USD for vendor A
    2. wiht amount 10000 USD for vendor B
    my company pay both open item 1 & 2 with one check, say the check no is 27382830 and the amount is 15000 USD. The check is given to the Bank as an order to Pay the vendor. so the check does not have receiver name. i attach a formal letter to the bank to ask them for making payment with that check. the letter contains a detail the amount, vendor bank account number, account holder, and the vendor name.
    so how i can threat this business scenario into SAP? i want to trace check number used to pay the vendors.
    hope you can give some clues. is it possible to maintain scenario above with automatic payment?
    best regards,
    land lord

    Hi,
    Yes you can map this scenario in SAP and use F110 for this. But you will also have to use some Z programs..
    1. For F110 FBZP configuration, maintain outgoing bank clearing Account (this will be a dummy account and not the actual Outgoing Bank Account) as the Bank Sub Account.
    By doing this when you run payment in F110, entry will be
    Vendor A A/c...Dr.
    outgoing bank clearing Account Cr.(1)
    Vendor B A/C... Dr.
    outgoing bank clearing Account Cr.(2)
    2.Then you will have to use Post with clearing transaction codes and make one entry
    outgoing bank clearing Account Cr.(1)..Dr.
    outgoing bank clearing Account Cr.(2)..Dr.
    To Bank Outgoing Account(Actual Bank outgoing Account) Cr.
    3. Now, when you get the single cheque no. from Bank against both the vendors, then thru FB02, change the assignment field/Reference field for Che No. updates.
    But do check BRS also for its reconciliation.. If you do it on a daily basis.. then it would not be difficult.
    Hope this helps you..
    Regards,
    SAPFICO

  • Print JTable with Multiple pages and rows

    I took the printing example at http://java.sun.com/developer/onlineTraining/Programming/JDCBook/advprint.html#pe and modified it a bit to include the following:
    1) To Print Multiple pages
    2) To wrap lines that is too long for the column
    3) To print with a more proffesional style, so that it doesn't look like a screen capture is printed
    4) To align the numbers to the right and center column headings
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.print.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.awt.Dimension;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import java.text.*;
    public class Report implements Printable
         private final int LEFT_ALIGN = -1;
         private final int CENTER_ALIGN = 0;
         private final int RIGHT_ALIGN = 1;
         private JFrame frame;
         private JTable tableView;
         private String lastPrintDate;
         private Font defaultFont;
         private Font headerFont;
         private Font footerFont;
         private int headerHeight;
         private int footerHeight;
         private int cellBuffer = 5;
         private boolean first_pass;
         private ArrayList pages;
         public Report()
              frame = new JFrame("Sales Report");
              frame.addWindowListener(new WindowAdapter()
                   public void windowClosing(WindowEvent e)
                        System.exit(0);
              final String[] headers =
                   "ID",
                   "Description",
                   "open price",
                   "latest price",
                   "End Date",
                   "Quantity"
              int count = 0;
              final Object[][] data =
                   {new Integer(count++), "Box of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of Biros ppppppppppppppp", "1.00", "4.99", new Date(), new Integer(200000)},
                   {new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++),  "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++),  "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++),  "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++),  "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)}
              TableModel dataModel = new AbstractTableModel()
                   public int getColumnCount() { return headers.length; }
                   public int getRowCount() { return data.length;}
                   public Object getValueAt(int row, int col)
                        return data[row][col];
                   public String getColumnName(int column)
                        return headers[column];
                   public Class getColumnClass(int col)
                        return getValueAt(0,col).getClass();
                   public boolean isCellEditable(int row, int col)
                        return (col==1);
                   public void setValueAt(Object aValue, int row, int column)
                        data[row][column] = aValue;
              tableView = new JTable(dataModel);
              JScrollPane scrollpane = new JScrollPane(tableView);
              scrollpane.setPreferredSize(new Dimension(500, 80));
              frame.getContentPane().setLayout(new BorderLayout());
              frame.getContentPane().add(BorderLayout.CENTER,scrollpane);
              frame.pack();
              JButton printButton= new JButton();
              printButton.setText("print me!");
              frame.getContentPane().add(BorderLayout.SOUTH,printButton);
              // for faster printing turn double buffering off
              RepaintManager.currentManager(frame).setDoubleBufferingEnabled(false);
              printButton.addActionListener( new ActionListener()
                   public void actionPerformed(ActionEvent evt)
                        doPrint();
              frame.setVisible(true);
          * Reset variables before printing
         private void prepareForPrint()
              pages = new ArrayList();
              first_pass = true;
          * Display a print dialog with some hardcoded defaults
          * The print fonts are also hardcoded
         public void doPrint()
              try
                   String jobName = "Java Report";
                   defaultFont = new Font("Arial", Font.PLAIN, 8);
                   footerFont = new Font("Arial", Font.PLAIN, 6);
                   headerFont = new Font("Arial", Font.BOLD, 10);
                   PrinterJob prnJob = PrinterJob.getPrinterJob();
                   prnJob.setPrintable(this);
                   PrintRequestAttributeSet prnSet = new HashPrintRequestAttributeSet();
                   prnSet.add(new Copies(1));
                   prnSet.add(new JobName(jobName, null));
                   prnSet.add(MediaSizeName.ISO_A4);
                   PageFormat pf = prnJob.defaultPage();
                   pf.setOrientation(java.awt.print.PageFormat.PORTRAIT);
                   prnJob.setJobName(jobName);
                   PrintService[] services = PrinterJob.lookupPrintServices();
                   if (services.length > 0)
                        if (prnJob.printDialog(prnSet))
                              * Get print date
                             String dateFormat = "dd/MM/yyyy HH:mm:ss";
                             DateFormat m_DateFormat = new SimpleDateFormat(dateFormat);
                             lastPrintDate = m_DateFormat.format(new Date()).toString();
                             prepareForPrint();
                             prnJob.print(prnSet);
                   else
                        JOptionPane.showMessageDialog(frame, "No Printer was found!!", "Printer Error", JOptionPane.ERROR_MESSAGE);
                        return;
              catch (PrinterException e)
                   e.printStackTrace();
         public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException
               * Check if this is the first time the print method is called for this print action.
               * It is not guaranteed that the print will be called with synchronous pageIndex'es,
               * so we need to calculate the number of pages and which rows appear on which pages.
               * Then the correct page will be printed regardless of which pageIndex is sent through.
              if (first_pass)
                   calcPages(g, pageFormat);
              first_pass = false;
              // Stop printing if the pageIndex is out of range
              if (pageIndex >= pages.size())
                   return NO_SUCH_PAGE;
              Graphics2D     g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              // The footer will be one line at the bottom of the page, cater for this.
              g2.setFont(footerFont);
              footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
              g2.setFont(defaultFont);
              FontMetrics fontMetrics = g2.getFontMetrics();
              int fontHeight = fontMetrics.getHeight();
              int fontDescent = fontMetrics.getDescent();
              double pageHeight = pageFormat.getImageableHeight() + pageFormat.getImageableY();
              double pageWidth = pageFormat.getImageableWidth();
              double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
              // Shrink or expand the table to fit the page width
              double scale = pageWidth / (tableWidth+ (cellBuffer * tableView.getColumnCount()));
              // Calculate the width in pixels for each column
              double[] columnWidths = new double[tableView.getColumnCount()];
              for(int i = 0; i < tableView.getColumnCount(); i++)
                   columnWidths[i] = (double)tableView.getColumnModel().getColumn(i).getWidth() * scale;
              // Reset the view to the start of the page
              g2.translate(0, 0);
              // Draw a rectangle to see the printable area
              g2.draw3DRect((int)pageFormat.getImageableX(),
                        (int)pageFormat.getImageableY(),
                        (int)pageFormat.getImageableWidth(),
                        (int)pageFormat.getImageableHeight(),
                        false);
              // Calculate the header height
              g2.setFont(headerFont);
              fontMetrics = g2.getFontMetrics();
              // Print the headers and retreive the starting position for the data
              int next_row = printLine(g2, pageFormat, fontMetrics, -1, (int)pageFormat.getImageableY() + fontHeight, columnWidths);
              g2.setFont(defaultFont);
              fontMetrics = g2.getFontMetrics();
              // Start printing the detail
              ArrayList page = (ArrayList)pages.get(pageIndex);
              int start = ((Integer)page.get(0)).intValue();
              int end = ((Integer)page.get(1)).intValue();
              for (int i = start; i <= end; i++)
                   next_row = printLine(g2, pageFormat, fontMetrics, i, next_row, columnWidths);
              // Print the footer
              g2.setFont(footerFont);
              String pageFooter = "Page " + (pageIndex + 1) + " - " + lastPrintDate;
              g2.drawString(pageFooter,
                             (int)pageFormat.getWidth() / 2 - (fontMetrics.stringWidth(pageFooter) / 2),
                             (int)(pageHeight - fontDescent));
              return PAGE_EXISTS;
          * We can't guarantee that the same amount of rows will be displayed on each page,
          * the row heights are dynamic and may wrap onto 2 or more lines.
          * Thus we need to calculate the height of each row and then test how may rows
          * fit on a specific page. eg. Page 1 contains rows 1 to 10, Page 2 contains rows 11 to 15 etc.
         public void calcPages(Graphics g, PageFormat pageFormat) throws PrinterException
              Graphics2D     g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              // The footer will be one line at the bottom of the page, cater for this.
              g2.setFont(footerFont);
              footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
              g2.setFont(defaultFont);
              FontMetrics fontMetrics = g2.getFontMetrics();
              int fontHeight = fontMetrics.getHeight();
              int fontDescent = fontMetrics.getDescent();
              double pageHeight = pageFormat.getImageableHeight() - fontHeight;
              double pageWidth = pageFormat.getImageableWidth();
              double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
              // Shrink or expand the table to fit the page width
              double scale = pageWidth / (tableWidth+ (cellBuffer * tableView.getColumnCount()));
              // Calculate the width in pixels for each column
              double[] columnWidths = new double[tableView.getColumnCount()];
              for(int i = 0; i < tableView.getColumnCount(); i++)
                   columnWidths[i] = (double)tableView.getColumnModel().getColumn(i).getWidth() * scale;
              // Calculate the header height
              int maxHeight = 0;
              g2.setFont(headerFont);
              fontMetrics = g2.getFontMetrics();
              for (int j = 0; j < tableView.getColumnCount(); j++)
                   String value = tableView.getColumnName(j).toString();
                   int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                   if (numLines > maxHeight)
                        maxHeight = numLines;
              headerHeight = g2.getFontMetrics().getHeight() * maxHeight;
              g2.setFont(defaultFont);
              fontMetrics = g2.getFontMetrics();
              int pageNum = 0;
              int bottom_of_page = (int)(pageFormat.getImageableHeight() + pageFormat.getImageableY()) - footerHeight;
              int prev_row = 0;
              int next_row = (int)pageFormat.getImageableY() + fontHeight + headerHeight;
              int i = 0;
              ArrayList page = new ArrayList();
              page.add(new Integer(0));
              for (i = 0; i < tableView.getRowCount(); i++)
                   maxHeight = 0;
                   for (int j = 0; j < tableView.getColumnCount(); j++)
                        String value = tableView.getValueAt(i, j).toString();
                        int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                        if (numLines > maxHeight)
                             maxHeight = numLines;
                   prev_row = next_row;
                   next_row += (fontHeight * maxHeight);
                   // If we've reached the bottom of the page then set the current page's end row
                   if (next_row > bottom_of_page)
                        page.add(new Integer(i - 1));
                        pages.add(page);
                        page = new ArrayList();
                        page.add(new Integer(i));
                        pageNum++;
                        next_row = (int)pageFormat.getImageableY()
                                       + fontHeight
                                       + ((int)pageFormat.getHeight() * pageNum)
                                       + headerHeight;
                        bottom_of_page = (int)(pageFormat.getImageableHeight()
                                            + pageFormat.getImageableY())
                                            + ((int)pageFormat.getHeight() * pageNum)
                                            - footerHeight;
                        //Include the current row on the next page, because there is no space on this page
                        i--;
              page.add(new Integer(i - 1));
              pages.add(page);
          * Print the headers or a row from the table to the graphics context
          * Return the position of the row following this one
         public int printLine(Graphics2D g2,
                                       PageFormat pageFormat,
                                       FontMetrics fontMetrics,
                                       int rowNum,
                                       int next_row,
                                       double[] columnWidths)
                   throws PrinterException
              int lead = 0;
              int maxHeight = 0;
              for (int j = 0; j < tableView.getColumnCount(); j++)
                   String value = null;
                   int align = LEFT_ALIGN;
                   if (rowNum > -1)
                        Object obj = tableView.getValueAt(rowNum, j);
                        if (obj instanceof Number)
                             align = RIGHT_ALIGN;
                        value = obj.toString();
                   else
                        align = CENTER_ALIGN;
                        value = tableView.getColumnName(j);
                   int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                   if (numLines > maxHeight)
                        maxHeight = numLines;
                   if (fontMetrics.stringWidth(value) < columnWidths[j])
                        // Single line
                        int offset = 0;
                        // Work out the offset from the start of the column to display alignment correctly
                        switch (align)
                             case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)); break;
                             case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)) / 2; break;
                             default: offset = 0; break;
                        g2.drawString(value,
                                       lead + (int)(pageFormat.getImageableX() + offset),
                                       next_row);
                   else
                        for(int a = 0; a < numLines; a++)
                             //Multi-Line
                             int x = 0;
                             int width = 0;
                             for(x = 0; x < value.length(); x++)
                                  width += fontMetrics.charWidth(value.charAt(x));
                                  if (width > columnWidths[j])
                                       break;
                             int offset = 0;
                             // Work out the offset from the start of the column to display alignment correctly
                             switch (align)
                                  case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)); break;
                                  case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)) / 2; break;
                                  default: offset = 0; break;
                             g2.drawString(value.substring(0, x),
                                            lead + (int)(pageFormat.getImageableX() + offset),
                                            next_row + (fontMetrics.getHeight() * a));                    
                             value = value.substring(x);
                   lead += columnWidths[j] + cellBuffer;
              // Draw a solid line below the row
              g2.draw(new Line2D.Double(pageFormat.getImageableX(),
                             next_row + (fontMetrics.getHeight() * (maxHeight - 1)) + fontMetrics.getDescent(),
                             pageFormat.getImageableY() + pageFormat.getImageableWidth(),
                             next_row + (fontMetrics.getHeight() * (maxHeight - 1)) + fontMetrics.getDescent()));
              // Return the position of the row following this one
              return next_row + (fontMetrics.getHeight() * maxHeight);
         public static void main(String[] args)
              new Report();
    }

    Fixed some bugs and added a title. Just pass in a JTable and the class will do the rest.
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.print.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import java.text.*;
    import java.math.*;
    public class PrintJTable implements Printable
         private final int LEFT_ALIGN = -1;
         private final int CENTER_ALIGN = 0;
         private final int RIGHT_ALIGN = 1;
         private JFrame m_parent;
         private String m_title;
         private JTable tableView;
         private String lastPrintDate;
         private Font defaultFont;
         private Font headerFont;
         private Font footerFont;
         private int headerHeight;
         private int footerHeight;
         private int cellBuffer = 5;
         private boolean first_pass;
         private ArrayList pages;
         public PrintJTable(JFrame parent, JTable table)
              m_parent = parent;
              tableView = table;
              doPrint();
         public PrintJTable(JFrame parent, String title, JTable table)
              m_parent = parent;
              m_title = title;
              tableView = table;
              doPrint();
          * Reset variables before printing
         private void prepareForPrint()
              pages = new ArrayList();
              first_pass = true;
          * Display a print dialog with some hardcoded defaults
          * The print fonts are also hardcoded
         public void doPrint()
              try
                   String jobName = "Java Report";
                   defaultFont = new Font("Arial", Font.PLAIN, 8);
                   footerFont = new Font("Arial", Font.PLAIN, 6);
                   headerFont = new Font("Arial", Font.BOLD, 8);
                   PrinterJob prnJob = PrinterJob.getPrinterJob();
                   prnJob.setPrintable(this);
                   PrintRequestAttributeSet prnSet = new HashPrintRequestAttributeSet();
                   prnSet.add(new Copies(1));
                   prnSet.add(new JobName(jobName, null));
                   prnSet.add(MediaSizeName.ISO_A4);
                   PageFormat pf = prnJob.defaultPage();
                   pf.setOrientation(java.awt.print.PageFormat.PORTRAIT);
                   prnJob.setJobName(jobName);
                   PrintService[] services = PrinterJob.lookupPrintServices();
                   if (services.length > 0)
                        if (prnJob.printDialog(prnSet))
                              * Get print date
                             String dateFormat = "dd/MM/yyyy HH:mm:ss";
                             DateFormat m_DateFormat = new SimpleDateFormat(dateFormat);
                             lastPrintDate = m_DateFormat.format(new Date()).toString();
                             prepareForPrint();
                             prnJob.print(prnSet);
                   else
                        JOptionPane.showMessageDialog(m_parent, "No Printer was found!!", "Printer Error", JOptionPane.ERROR_MESSAGE);
                        return;
              catch (PrinterException e)
                   e.printStackTrace();
         public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException
               * Check if this is the first time the print method is called for this print action.
               * It is not guaranteed that the print will be called with synchronous pageIndex'es,
               * so we need to calculate the number of pages and which rows appear on which pages.
               * Then the correct page will be printed regardless of which pageIndex is sent through.
              if (first_pass)
                   calcPages(g, pageFormat);
              first_pass = false;
              // Stop printing if the pageIndex is out of range
              if (pageIndex >= pages.size())
                   return NO_SUCH_PAGE;
              Graphics2D     g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              // The footer will be one line at the bottom of the page, cater for this.
              g2.setFont(footerFont);
              footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
              g2.setFont(defaultFont);
              FontMetrics fontMetrics = g2.getFontMetrics();
              int fontHeight = fontMetrics.getHeight();
              int fontDescent = fontMetrics.getDescent();
              double pageHeight = pageFormat.getImageableHeight() + pageFormat.getImageableY();
              double pageWidth = pageFormat.getImageableWidth();
              double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
              // Shrink or expand the table to fit the page width
              double scale = (pageWidth - (cellBuffer * tableView.getColumnCount())) / tableWidth;
              // Calculate the width in pixels for each column
              double[] columnWidths = new double[tableView.getColumnCount()];
              double test = 0;
              for(int i = 0; i < tableView.getColumnCount(); i++)
                   columnWidths[i] = (double)Math.floor(tableView.getColumnModel().getColumn(i).getWidth() * scale);
                   test += columnWidths;
              // Reset the view to the start of the page
              g2.translate(0, 0);
              // Draw a rectangle to see the printable area
              g2.draw3DRect((int)pageFormat.getImageableX(),
                        (int)pageFormat.getImageableY(),
                        (int)pageFormat.getImageableWidth(),
                        (int)pageFormat.getImageableHeight(),
                        false);
              // Calculate the header height
              g2.setFont(headerFont);
              fontMetrics = g2.getFontMetrics();
              // Print the headers and retreive the starting position for the data
              int next_row = (int)pageFormat.getImageableY() + fontMetrics.getHeight();
              if ((m_title != null) && (!m_title.equalsIgnoreCase("")))
                   g2.drawString(m_title,
                                       (int)(pageFormat.getImageableX()),
                                       next_row);
                   Color current_color = g2.getColor();
                   g2.setColor(Color.lightGray);
                   int y = next_row + fontMetrics.getDescent();
                   g2.draw(new Line2D.Double(pageFormat.getImageableX(),
                                  y,
                                  (pageFormat.getImageableY() + pageFormat.getImageableWidth()),
                                  y));
                   g2.setColor(current_color);
                   next_row += fontMetrics.getHeight();
              next_row = printLine(g2, pageFormat, fontMetrics, -1, next_row, columnWidths);
              g2.setFont(defaultFont);
              fontMetrics = g2.getFontMetrics();
              // Start printing the detail
              ArrayList page = (ArrayList)pages.get(pageIndex);
              int start = ((Integer)page.get(0)).intValue();
              int end = ((Integer)page.get(1)).intValue();
              for (int i = start; i <= end; i++)
                   next_row = printLine(g2, pageFormat, fontMetrics, i, next_row, columnWidths);
              // Print the footer
              g2.setFont(footerFont);
              String pageFooter = "Page " + (pageIndex + 1) + " - " + lastPrintDate;
              g2.drawString(pageFooter,
                             (int)pageFormat.getWidth() / 2 - (fontMetrics.stringWidth(pageFooter) / 2),
                             (int)(pageHeight - fontDescent));
              return PAGE_EXISTS;
         * We can't guarantee that the same amount of rows will be displayed on each page,
         * the row heights are dynamic and may wrap onto 2 or more lines.
         * Thus we need to calculate the height of each row and then test how may rows
         * fit on a specific page. eg. Page 1 contains rows 1 to 10, Page 2 contains rows 11 to 15 etc.
         public void calcPages(Graphics g, PageFormat pageFormat) throws PrinterException
              Graphics2D     g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              // The footer will be one line at the bottom of the page, cater for this.
              g2.setFont(footerFont);
              footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
              g2.setFont(defaultFont);
              FontMetrics fontMetrics = g2.getFontMetrics();
              int fontHeight = fontMetrics.getHeight();
              int fontDescent = fontMetrics.getDescent();
              double pageHeight = pageFormat.getImageableHeight() - fontHeight;
              double pageWidth = pageFormat.getImageableWidth();
              double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
              // Shrink or expand the table to fit the page width
              double scale = (pageWidth - (cellBuffer * tableView.getColumnCount())) / tableWidth;
              // Calculate the width in pixels for each column
              double[] columnWidths = new double[tableView.getColumnCount()];
              for(int i = 0; i < tableView.getColumnCount(); i++)
                   columnWidths[i] = (double)Math.floor(tableView.getColumnModel().getColumn(i).getWidth() * scale);
              // Calculate the header height
              int maxHeight = 0;
              g2.setFont(headerFont);
              fontMetrics = g2.getFontMetrics();
              headerHeight = 0;
              if ((m_title != null) && (!m_title.equalsIgnoreCase("")))
                   headerHeight = fontMetrics.getHeight();
              for (int j = 0; j < tableView.getColumnCount(); j++)
                   String value = tableView.getColumnName(j).toString();
                   int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                   if (numLines > maxHeight)
                        maxHeight = numLines;
              headerHeight += g2.getFontMetrics().getHeight() * maxHeight;
              g2.setFont(defaultFont);
              fontMetrics = g2.getFontMetrics();
              int pageNum = 0;
              int bottom_of_page = (int)(pageFormat.getImageableHeight() + pageFormat.getImageableY()) - footerHeight;
              int prev_row = 0;
              int next_row = (int)pageFormat.getImageableY() + fontHeight + headerHeight;
              int i = 0;
              ArrayList page = new ArrayList();
              page.add(new Integer(0));
              for (i = 0; i < tableView.getRowCount(); i++)
                   maxHeight = 0;
                   for (int j = 0; j < tableView.getColumnCount(); j++)
                        String value = formatObject(tableView.getValueAt(i, j));
                        int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                        if (numLines > maxHeight)
                             maxHeight = numLines;
                   prev_row = next_row;
                   next_row += (fontHeight * maxHeight);
                   // If we've reached the bottom of the page then set the current page's end row
                   if (next_row > bottom_of_page)
                        page.add(new Integer(i - 1));
                        pages.add(page);
                        page = new ArrayList();
                        page.add(new Integer(i));
                        pageNum++;
                        next_row = (int)pageFormat.getImageableY()
                                       + fontHeight
                                       + ((int)pageFormat.getHeight() * pageNum)
                                       + headerHeight;
                        bottom_of_page = (int)(pageFormat.getImageableHeight()
                                            + pageFormat.getImageableY())
                                            + ((int)pageFormat.getHeight() * pageNum)
                                            - footerHeight;
                        //Include the current row on the next page, because there is no space on this page
                        i--;
              page.add(new Integer(i - 1));
              pages.add(page);
         * Print the headers or a row from the table to the graphics context
         * Return the position of the row following this one
         public int printLine(Graphics2D g2,
                                       PageFormat pageFormat,
                                       FontMetrics fontMetrics,
                                       int rowNum,
                                       int next_row,
                                       double[] columnWidths)
                   throws PrinterException
              int lead = 0;
              int maxHeight = 0;
              for (int j = 0; j < tableView.getColumnCount(); j++)
                   String value = null;
                   int align = LEFT_ALIGN;
                   if (rowNum > -1)
                        Object obj = tableView.getValueAt(rowNum, j);
                        if (obj instanceof Number)
                             align = RIGHT_ALIGN;
                        value = formatObject(obj);
                   else
                        //align = CENTER_ALIGN;
                        value = tableView.getColumnName(j);
                   int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                   if (numLines > maxHeight)
                        maxHeight = numLines;
                   if (fontMetrics.stringWidth(value) < columnWidths[j])
                        // Single line
                        int offset = 0;
                        // Work out the offset from the start of the column to display alignment correctly
                        switch (align)
                             case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)); break;
                             case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)) / 2; break;
                             default: offset = 0; break;
                        g2.drawString(value,
                                       lead + (int)(pageFormat.getImageableX() + offset),
                                       next_row);
                   else
                        for(int a = 0; a < numLines; a++)
                             //Multi-Line
                             int x = 0;
                             int width = 0;
                             for(x = 0; x < value.length(); x++)
                                  width += fontMetrics.charWidth(value.charAt(x));
                                  if (width > columnWidths[j])
                                       break;
                             int offset = 0;
                             // Work out the offset from the start of the column to display alignment correctly
                             switch (align)
                                  case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value.substring(0, x))); break;
                                  case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value.substring(0, x))) / 2; break;
                                  default: offset = 0; break;
                             g2.drawString(value.substring(0, x),
                                            lead + (int)(pageFormat.getImageableX() + offset),
                                            next_row + (fontMetrics.getHeight() * a));                    
                             value = value.substring(x);
                   lead += columnWidths[j] + cellBuffer;
              // Draw a solid line below the row
              Color current_color = g2.getColor();
              g2.setColor(Color.lightGray);
              int y = next_row + (fontMetrics.getHeight() * (maxHeight - 1)) + fontMetrics.getDescent();
              g2.draw(new Line2D.Double(pageFormat.getImageableX(),
                             y,
                             (pageFormat.getImageableY() + pageFormat.getImageableWidth()),
                             y));
              g2.setColor(current_color);
              // Return the position of the row following this one
              return next_row + (fontMetrics.getHeight() * maxHeight);
         public String formatObject(Object obj)
              String value = (obj == null) ? "" : obj.toString();
              return value;

  • Printing PDFs with Multiple lines enabled

    Hi, I need some help with Designer. I have no clue how to really use it, I've been playing with it for a week, but some things I can't figure out.
    I have a text field that fits about 1 line of text on it. I enabled multiple lines in the field, because people are going to be typing a lot. However, when I print it, only 1 of the lines shows up. Is there any way that I can fix the settings so that the box expands as the text is typed, and that if it can expand, the entire page shrinks to keep it to the same amount of page numbers instead of bumping everything down the page? If someone out there knows, please help!!!
    Thanks!!!

    Hi,
    Maybe this can help:
    1 - Save your form as a Dynamic Form
    2 - Place a subform with Flow content
    3 - Place a text box with multiple line in the sub form. Make it expand to fit (layout tab) and Data Format XHTML (binding tab)
    4 - Put the contents in the field
    5- Click outside the field and print it.
    regards

  • Printing Text with multiple Lines

    Hello,
    i want to print a list and in that is text with multiple lines.
    In the PrintPreview and in the Printout i get only one line.
    How is the best way to do this?
    Thank you,
    Markus
    Private Function Print_Remarks_Control_Get(ByVal pstrText As String) As TextBox
    Dim TextBox_Out As New TextBox
    With TextBox_Out
    .Text = pstrText
    .HorizontalAlignment = Xaml.HorizontalAlignment.Left
    .VerticalAlignment = Xaml.VerticalAlignment.Top
    .FontSize = 16
    .Margin = New Thickness(15)
    .AcceptsReturn = True
    .MinWidth = 800
    .MinHeight = 600
    End With
    Return TextBox_Out
    End Function
    Sub PrintPageList_Prepare()
    Dim i As Integer
    Dim objVM As clsTextVM
    Dim lstText_List As ObservableCollection(Of clsText)
    Dim ctrPrint_StackPanel As StackPanel
    Dim ctrPrint_Title As TextBox
    Dim ctrPrint_Description As TextBox
    Dim ctrPrint_Remarks As TextBox
    Dim objText As clsText
    mPrintPageList.Clear()
    objVM = DirectCast(Me.DataContext, clsTextVM)
    lstText_List = objVM.CustomClass_List
    ctrPrint_StackPanel = Print_StackPanel_Get()
    For i = 0 To lstText_List.Count - 1
    objText = lstText_List.Item(i)
    If objText.Name.Length > 0 Then
    ctrPrint_Title = Print_Title_Control_Get(objText.Name)
    ctrPrint_StackPanel.Children.Add(ctrPrint_Title)
    End If
    If objText.Description.Length > 0 Then
    ctrPrint_Description = Print_Description_Control_Get(objText.Description)
    ctrPrint_StackPanel.Children.Add(ctrPrint_Description)
    End If
    If objText.Remarks.Length > 0 Then
    ctrPrint_Remarks = Print_Description_Control_Get(objText.Remarks)
    ctrPrint_StackPanel.Children.Add(ctrPrint_Remarks)
    End If
    Next
    mPrintPageList.Add(ctrPrint_StackPanel)
    End Sub
    Private Sub OnGetPreviewPage(sender As Object, e As GetPreviewPageEventArgs)
    ' Das ist die MessageBox
    ' Windows.UI.Popups.MessageDialog()
    PrintPageList_Prepare()
    mPrintDok.SetPreviewPage(e.PageNumber, Me.mPrintPageList(e.PageNumber - 1))
    End Sub

    Yes, not only RichEditBox but also RichTextBlock can also do this. Besides TextBox also have TextWrapping functionality.
    -James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Printing checks with CheckMagic

    I use Quickbooks and a program called CheckMagic to print my own checks on blank check stock.  I have been doing it for years with any number of operating systems and HP laserject printers.   Now I have a Vista operating system and a new HP P1006 printer (which is going back because it's so cheap and flimsy).  My problem with it, besides it's so junky, is that when I try to print checks it doesn't print the MICR characters for routing and account numbers;  it just prints alpha numeric characters. I'm trying to find out if I'm going to have the same problem with a better new printer.  (This is very frustrating when you're trying to print paychecks!  Employees have absolutely no sense of humor about not getting their checks!)

    Have you seen this? -->  LaserJet MICR Font solutions.
     Do you have the proper MICR font for your printer installed?
    read this to get a better understanding of Secure check MICR printing.
    regards,
    erico
    ****Please click on Accept As Solution if a suggestion solves your problem. It helps others facing the same problem to find a solution easily****
    2015 Microsoft MVP - Windows Experience Consumer

  • PO process with multiple vendors

    Hi All,
    Finished product-
    BOM Header-A0001
    Components---A1, A2, A3, A4.
    Vendor A will supply A4 (sheet-10ft) material to Vendor B.
    Vendor B will use the 8ft of A4 material and 2ft scrap and will sent to Vendor C.
    Vendor C will use the components A1, A2, A3, and A4 (8ft). and make the finished Product A0001 and will sent to plant.
    How to map the above process in SAP.
    Thanks
    chindam

    I think you can map this scenario in the multiple vendors 3 rd party subcontracting process.
    I will try to put some light on ur issue .........hope this will help u in some extend..
    1) Create a PO to 1st vendor.
    2. Maintain the required entries.
    3. Go to delivery address tab tick SC Vendor
    4. Maintain 2nd vendor here.
    It means that after finishing first operation 1st vendor sends a matl. to 2nd vendor.
    If u post migo for 1st PO(i.e. for 1st PO vendor) system says that matl is with 2nd vendor.
    So u need not to send the matl to 2nd vendor.
    Similarly, do it for other vendors also.
    normaly in sucontracting process,for calculating the SCRAP ,,we should maintain this in NEGATIVE quantity in BOM.so that at the time of GR,,it wont affects,the calclation of payment to be given to vendor.
    Here important thing is U have to send a PO to respective vendors for respective operations.
    For the last vendor who gives u the finished product dont tick SC vendor to him. Maintain your company delivery address.
    Regards
    Anjali
    Edited by: anjali s on May 30, 2009 7:50 AM

  • Kanban - External procurement with multiple vendor

    Hi Gurus,
    We are working on implementation of Kanban for external procurement (Scheduling agreement) in my organisation. As per the business requirement, some of the components are supplied by more than one vendor. As per the standard process, Kanban supports automated processfor single vendor only & not multiple vendors
    Has anybody come across this issue? Could you plese share your experiene & any possible workaround or solution to this isuue
    Thanks
    Kariya

    Hi,
    This is how KANBAN works. Since sourcing is automatic.
    You could do a couple of things; first, have more than one control cycle, one for each vendor. Drawback is that you also need to have separate kanban containers for each cycle/vendor. But in the case where you have more that one supply area for a material this is not so bad.
    Another way could be working with internal demand area, in such a way that Kanban creates a stock transfer reservation. Then you need to process the requirements with MRP, and issue orders to multiple vendors (maybe using quota arrangement).
    To ilustrate the solution: your supply area is geting replenishment from the main warehouse, not directly from the vendor. These are two different storage location or plants...
    Regards,
    Mario

  • How to view print history with multiple users

    Is there an easy way to see how much different users printed on a shared officejet?
    Situation:
    We have a network with multiple computers(most of them win7) and one shared officejet 6500A connected to the LAN with an ethernet cable.
    I want to be able to see per user how many pages he / she printed but I cant find an easy way to do so.
    Any ideas?

    The way you've set it up each user has a distinct library, but is accessing a common set of media files and folders.  To accomplish what you want, you need to have a complete iTunes library (database + media) in a common location - typically this would be C:\Users\Public\Music\iTunes.  See turingtest2's notes on Make a split library portable for the steps that may be needed to bring your library into a suitable structure.  Based on your description, you'll need to select one user's library (C:\Users\username\Music\iTunes\iTunes Library.itl) to act as the shared "master" and move this to the Public folders.
    Then, for each user, hold down SHIFT while starting iTunes - when you get this prompt:
    click on Choose Library..., navigate to C:\Users\Public\Music\iTunes, select the iTunes Library.itl file you'll find there, and click Open (you'll only need to do this once for each user account).
    Note, though, that iTunes is inherently a single-user application - any attempts to run iTunes at the same time will cause errors (and, in the worst case, possible corruption).  For this reason, its a good idea to disable fast user switching in Windows so that only one user can be logged in, and running iTunes, at the same time.

  • Info records with multiple vendors

    Hello all,
    I have some info records defined for multiple vendors for subcontracting material numbers. How do I tell SAP to use a specific vendor by default when it creates the Purchase Requisition?
    Thanks in advance for information.

    Hi,
    If you have maintained source list(ME01) and "info record"(ME11) for the desired vendor and material combination and MRP indicator as 1 . It will default as "fixed vendor" in PR when you run MRP. Of course when you copy PR into PO, it is going to copy the same.
    if you want to create Subcontract PR ...you have to use special procurement key 30 for that material.
    Hope it helps you.
    Kuber

Maybe you are looking for

  • I want to turn off everything except GPS

    I was out in a remote area yesterday with no cell reception.  I was using a GPS app on my phone to record the route that I explored.  About half way through the day the phone ran out of battery and died.  I had blue-tooth and cellular data turned off

  • Finder: FIXME: IOUnserialize has detected a string that is not valid UTF-8, "

    See this message a week ago in the console. I've upgrade my Macbook Pro Mid 2010 the last three years vom SL to Lion, Ml and now Mavericks. After seeing this message, I decide for a clean install. All runs fine, but the message appears in the console

  • RAC Installation ---- Hardware Requirment Doubt

    Hi All, I have to install 10g RAC at home for learning purpose. I have two PC's with same version of linux (Oracle Enterprise Linux 32 bit each) installed, but having different hardware. One machine is laptop and other is desktop. So, will it be poss

  • Why is the master password entry window popping up twice each time I open my Firefox?

    Each time I open my Firefox, and go to a website where my password has been stored, the master password window pops up. When I enter it, it disappears, and requires me to enter it a second time. In essence, the window prompt is popping up twice. One

  • Ilustrator dejo de funcionar

    Hola, Tengo un problema con Ilustrator desde la ultima actualziación a CC 2014. Utilizo Win 8.1 Al ejecutar la aplicación durante el proceso de carga sale un mensaje "Windows está buscando una solución a su problema" y después una pantalla que dice "