Javax.print binary format

HI!
I know there are several posts about javax.print and the binary format, but i found nothing that helps me.
I'm trying to print a txt file
public class print{
     public static void main(String args[]){
//          Input the file
     InputStream textstream=null;
     try {
          textstream = new BufferedInputStream(new FileInputStream("test.txt"));
     catch (FileNotFoundException ffne) {
          ffne.printStackTrace();     
//          Set the document type
     DocFlavor myFormat = DocFlavor.INPUT_STREAM.TEXT_PLAIN_UTF_8;
//          Create a Doc
     Doc myDoc = new SimpleDoc(textstream, myFormat, null);
//          Build a set of attributes
     PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
     aset.add(new Copies(5));
     aset.add(MediaSizeName.ISO_A4);
     PrintService services =
          PrintServiceLookup.lookupPrintServices(myFormat, aset);
//          Create a print job from one of the print services
     if (services.length > 0) {
          DocPrintJob job = services.createPrintJob();
          try {
               job.print(myDoc, aset);
          catch (PrintException pe) {
               pe.printStackTrace();
     else
     System.out.println("!hello");
What's wrong witht this code?
If I run it I get the output hello which meas that there is no printer to handle the file.
Does anybody know a good tutorial about printing files?
Pls help
Thanks Jerome

There's a long standing thread under Advanced Language Topics:
javax.print and binary formats
I'm surprised that a search of the forums didn't turn it up. - MOD

Similar Messages

  • Printing binary data in PDF format

    HI all,
      Any idea on how to print Binary content in a PDF format
    I have read a PDF format from application server in a Binary format, I need to print the binary content on a printer in PDF format
    Any help on this is appreciated <REMOVED BY MODERATOR>
    Thanks
    Aakash
    Edited by: Alvaro Tejada Galindo on Jun 9, 2008 3:15 PM

    Hi papick,
    this may be easier than expected for a million dollar erp system:
    You need a PDF printer.
    When I played around with adobe interactive forms our basis guys created a new printer in SPAD with
    Device Attributes
    Device Type PDF1
    Device Class Stabdard Printer
    location PDF-Frontend printer = Standard printer for workstation
    Access Method
    Host Spool Access Method FF
    Host printer                          PDF
    Then need some expremimenting with Functions
    RSPO_OUTPUT_DEVICEDATA Spool Output Control of an Internal Table with Formatted Data
    or something alike (see function group SPOD)
    Then you should be able to create an entry in spooler (SP01) with spool request type adobe pdf document.
    Sorry, I don't have this problem, thus I did not check out the details yet.
    But I'm convinced it should work that way because the ADS server creates a complete PDF binary and it can be printed using the above described printer - actually a HP Laserjet V was configured as frontend printer and it can print the pdf.
    Regards,
    Clemens

  • Print binary as background job

    Hi experts,
    Is there a way to send binary(xstring) to a printer, eg. jpg/doc/pdf, as a background job with abap.
    Mvh,
    Alex

    Alexander,
    check these threads:
    Printing binary data in PDF format
    Solution! (Hopefully) :Print label image in GIF format
    Save print output as PDF file in front end system using PDF printer output device

  • How can I print a html Using javax.print

    Hi friends,
    I am in big trouble . I use following code to print a html file using javax.print api.
    import java.io.*;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import javax.print.event.*;
    public class PrintPS
         public static void main(String args[]) {
              PrintPS html = new PrintPS();
         public PrintPS() {
         DocFlavor flavor = DocFlavor.INPUT_STREAM.TEXT_HTML_HOST;
         PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
         aset.add(MediaSizeName.ISO_A4);
         aset.add(new Copies(1));
         aset.add(MediaTray.MAIN);
         PrintService pservices = PrintServiceLookup.lookupDefaultPrintService();
         if(pservices==null)
              System.out.println(" printer not found");
         if (pservices!= null) {
         System.out.println("selected printer " + pservices.getName());
         DocPrintJob pj = pservices.createPrintJob();
         try {
         InputStream fis = new FileInputStream("abc.html");
         Doc doc = new SimpleDoc(fis, flavor, null);
    System.out.println("printing started ");
         pj.print(doc, aset);
    System.out.println("printing completed");
         } catch (IOException ie) {
         System.err.println(ie);
         } catch (PrintException e) {
         System.err.println(e);
    This code gives me "sun.print.PrintJobFlavorException: invalid flavor"
    So i use all four TEXT_HTML flavor but i do not find the solution.
    I am able to print pdf, jpg, gif files but i can not able to print txt and html file.
    My printer supports txt and html printing becaue i do printing directolly by browser's or notpad's print command .

    Hi friends,
    I am in big trouble . I use following code to print a
    html file using javax.print api.Use Code Tags
    http://forum.java.sun.com/help.jspa?sec=formatting
    My printer supports txt and html printing becaue i do
    printing directolly by browser's or notpad's print
    command .Notepad & your browser prob. convert to the HTML/text(1) into the printers native format.
    1) I am suprised that it does not print text.

  • Read DMS document in binary format

    Hi,
    I have a requirement to read DMS document in binary format into internal table.
    and i want to print the data in internal table through SAP spool.
    Please let me know how to handle this requirement.
    Thanks
    Srini

    Hi,
    Check scms pakage, FG - SCMS_CONV for conversions..
    Regards
    Surjit

  • PDF printing using javax.print

    Hi!
    I need to create an aplication that generates a PDF document and then prints it. For creating the PDF doc, I use the iText package.
    I have some problems with printing. I don't know how to print the document I generate. Could you give me a hint please? (I can print GIF docs, yet I do not know how to convert the PDF to GIF).
    Thanks in advance,
    Alex

    import javax.print.*;
    import javax.print.attribute.DocAttributeSet;
    import javax.print.attribute.HashDocAttributeSet;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    import javax.print.attribute.standard.Copies;
    import javax.print.attribute.standard.MediaSizeName;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    public class PDFfilePrinter {
    public static void main(String[] args) {
    DocAttributeSet fset = new HashDocAttributeSet();
    PrintRequestAttributeSet pset = new HashPrintRequestAttributeSet();
    String filename = "somefile.pdf"; //name of file to print
    DocFlavor docf = DocFlavor.INPUT_TYPE.PDF;
    PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
    if (0 < services.length) {
    DocPrintJob printer = services[0].createPrintJob(); //default printer on my system
    try {
    FileInputStream fis = new FileInputStream(filename);
    Doc toprint = new SimpleDoc(fis, docf, fset);
    pset.add(MediaSizeName.ISO_A4);
    pset.add(new Copies(1));
    printer.print(toprint, pset);
    } catch (PrintException e) {
    e.printStackTrace();
    } catch (FileNotFoundException fnfe) {
    fnfe.printStackTrace();
    Here's the code I'm working with for printing. This stuff works .... in a very strange way - it prints out all sort of crazy characters. I know I am doing something wrong and I think it's all in this line:
    DocFlavor docf = DocFlavor.INPUT_TYPE.PDF;
    Should I use a different flavor? I read somewhere that the PDF file format is not entirely supported bye javax.print. Could this be the problem?
    Thanks in advance,
    Alex

  • Javax.print problems on applet - bug on mac os implementation?

    Dear All,
    I am working on an applet and application that include a print function and I get a weird behaviour on MacOS in applet mode (both with Safari and Firefox - Mac OS X Versione 10.4.9 (Build 8P135) ). In contrast, things work fine on Windows XP (both Explorer 7 and Firefox with Java Plug-in 1.6.0_01) and even in MacOS when using the application.
    The problems are:
    - the print dialogue goes on and off a few times before letting the user interact with it
    - the page format in the dialogue is set to A5 (instead of the printer's default)
    - there is a small empty window appearing together with the dialogue and not disappearing even after the applet is closed
    Is this a known problem? If so, are there work-arounds?
    (I had no luck on Google about this)
    To reproduce the problem I created a stripped down version of the applet, in 2 files, I report it at the bottom of this message. I am using a modified version the PrintUtilities class from http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-Printing.html
    Am I doing something wrong? Or shall I consider submitting a bug report?
    Any suggestion is welcome! Please let me know if I should provide more detailed information.
    Thank you in advance,
    Enrico
    PrintMe.java
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import javax.swing.JApplet;
    import javax.swing.JPanel;
    public class PrintMe extends JApplet implements MouseListener{
         private static final long serialVersionUID = 1L;
         private JPanel jContentPane = null;
         public PrintMe() {
              super();
         private class MyComponent extends JPanel{
              private static final long serialVersionUID = 1L;
              public void paintComponent(Graphics g) {
                   super.paintComponent(g);
                  Graphics2D g2 = (Graphics2D) g;
                  g2.setColor(Color.black);
                  g2.drawString( "Test text", 0, g2.getFontMetrics().getHeight() );
         public void init() {
              MyComponent aComponent = new MyComponent();
              jContentPane = new JPanel();
              jContentPane.setLayout(new BorderLayout());
              jContentPane.add(aComponent);
              this.setContentPane(jContentPane);
              this.addMouseListener(this);
         public void print(){
              try{
                   PrintUtilities.printComponent(this);
              }catch (Exception e) {
                   e.printStackTrace();
         public void mouseClicked(MouseEvent e) {
              print();
         public void mouseEntered(MouseEvent e) {
              // not used
         public void mouseExited(MouseEvent e) {
              // not used
         public void mousePressed(MouseEvent e) {
              // not used
         public void mouseReleased(MouseEvent e) {
              // not used
    PrintUtilities.java
    import java.awt.Component;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.print.PageFormat;
    import java.awt.print.Printable;
    import java.awt.print.PrinterException;
    import java.awt.print.PrinterJob;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    import javax.swing.RepaintManager;
    import javax.swing.RootPaneContainer;
    /** A simple utility class that lets you very simply print
    *  an arbitrary component. Just pass the component to the
    *  PrintUtilities.printComponent. The component you want to
    *  print doesn't need a print method and doesn't have to
    *  implement any interface or do anything special at all.
    *  If you are going to be printing many times, it is marginally more
    *  efficient to first do the following:
    *    PrintUtilities printHelper = new PrintUtilities(theComponent);
    *  then later do printHelper.print(). But this is a very tiny
    *  difference, so in most cases just do the simpler
    *  PrintUtilities.printComponent(componentToBePrinted).
    *  7/99 Marty Hall, http://www.apl.jhu.edu/~hall/java/
    *  May be freely used or adapted.
    public class PrintUtilities implements Printable {
         private Component componentToBePrinted;
         public static void printComponent(Component c) {
              new PrintUtilities(c).print();
         public PrintUtilities(Component componentToBePrinted) {
              this.componentToBePrinted = componentToBePrinted;
         public void print() {
              try{
                   PrinterJob printJob = PrinterJob.getPrinterJob();
                   printJob.setPrintable(this);
                   PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
                   if( printJob.printDialog(attributes) ){
                        try {
                             printJob.setJobName("MyName");
                             printJob.print(attributes);
                        } catch(PrinterException pe) {
                             System.err.println("Error printing: " + pe);
                             pe.printStackTrace();
              }catch (Exception e) {
                   e.printStackTrace();
         public int print(Graphics g, PageFormat pageFormat, int pageIndex) {
              if (pageIndex > 0) {
                   return(NO_SUCH_PAGE);
              } else {
                   RootPaneContainer rpc = (RootPaneContainer)(this.componentToBePrinted);
                   rpc.getRootPane().getGlassPane().setVisible( false );
                   Graphics2D g2d = (Graphics2D)g;
                   double sy = pageFormat.getImageableHeight() / componentToBePrinted.getHeight();
                   double sx = pageFormat.getImageableWidth() / componentToBePrinted.getWidth();
                   if( sx > sy ){
                        sx = sy;
                   }else{
                        sy = sx;
                   g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
                   g2d.scale(sx, sy);
                   disableDoubleBuffering(componentToBePrinted);
                   componentToBePrinted.paint(g2d);
                   enableDoubleBuffering(componentToBePrinted);
                   return(PAGE_EXISTS);
         /** The speed and quality of printing suffers dramatically if
          *  any of the containers have double buffering turned on.
          *  So this turns if off globally.
          *  @see enableDoubleBuffering
         public static void disableDoubleBuffering(Component c) {
              RepaintManager currentManager = RepaintManager.currentManager(c);
              currentManager.setDoubleBufferingEnabled(false);
         /** Re-enables double buffering globally. */
         public static void enableDoubleBuffering(Component c) {
              RepaintManager currentManager = RepaintManager.currentManager(c);
              currentManager.setDoubleBufferingEnabled(true);
    }

    Trying to answer to myself..
    Is it possible that the problems are due to me mixing java.awt.print and javax.swing.print ?

  • Javax.print postscript support

    The DocFlavors supported by the print services I've queried using the javax.print package haven't included the specific Postscript DocFlavor. They all return the autosense DocFlavor though. Some of these printers will automatically detect and print postscript and some won't but I haven't been able to tell until I actually send the print job to the printer. How widely supported is postscript on current printers or where can I go to find this information? Are there other ways to determine programmatically what formats a printer supports?

    Hey how you find in answer for this yet please let me know as soon as possible thanks.

  • How to print a formatted page in java?

    hi all
    i've made my simple application that writes and retrieves information to/from a database, and organizes them in reports
    now, i got to print these reports in formatted pages like, for example:
    title centered and bold
    first db record
    second db record
    eccc
    i followed the http://java.sun.com/products/java-media/2D/forDevelopers/sdk12print.html documentation and wrote this class
    import java.awt.print.*;
    import java.awt.*;
    import java.text.*;
    import java.awt.geom.*;
    import java.awt.font.*;
    public class print implements Printable
    //the "\n" token doesn't allow me to do a new line, as i want!!
        String mText="The JavaTM Print Service \n is a new Java Print API that allows printing on all Java platforms, including platforms requiring a small footprint, such as a J2ME profile, but still supports the current Java 2 Print API. Thie Java Print Service API includes an extensible print attribute set based on the standard attributes specified in the Internet Printing Protocol (IPP) 1.1 from the IETF. With the attributes, client and server applications can discover and select printers that have the capabilities specified by the attributes. In addition to the included StreamPrintService, which allows applications to transcode data to different formats, a third party can dynamically install their own print services through the Service Provider Interface ";
        AttributedString mStyledText=new AttributedString(mText);
        static public void main (String args[])
            PrinterJob printerJob=PrinterJob.getPrinterJob();
            PageFormat format=new PageFormat();
            format=printerJob.pageDialog(format);
            Book book=new Book();
            book.append(new print(),format);
            printerJob.setPageable(book);
            boolean doPrint=printerJob.printDialog();
            if(doPrint)
                try
                    printerJob.print();
                catch(PrinterException ex)
                    ex.printStackTrace();
        public int print(java.awt.Graphics g, java.awt.print.PageFormat format, int param) throws java.awt.print.PrinterException
            Graphics2D g2d=(Graphics2D)g;
            g2d.translate(format.getImageableX(), format.getImageableY());
            g2d.setPaint(Color.black);
            g2d.setFont(new Font("Serif",Font.PLAIN,5));  //this doesn't work!!!
            Point2D.Float pen=new Point2D.Float();
            AttributedCharacterIterator charIterator=mStyledText.getIterator();
            LineBreakMeasurer measurer=new LineBreakMeasurer(charIterator,g2d.getFontRenderContext());
            float wrappingWidth=(float) format.getImageableWidth();
            while(measurer.getPosition()<charIterator.getEndIndex())
                TextLayout layout=measurer.nextLayout(wrappingWidth);
                pen.y +=layout.getAscent();
                float dx=layout.isLeftToRight()?0:(wrappingWidth-layout.getAdvance());
                layout.draw(g2d,pen.x+dx, pen.y);
                pen.y+=layout.getDescent()+layout.getLeading();
            return Printable.PAGE_EXISTS;
    }this works, and is great the dialog to choose the paper orientation and the printer, but i'm still not able to do the simplest things: like
    - change the font of my text (as you can see in the print() method)
    - do a new line in my text (as you can see in the beginning of the code)
    so, now that i'm able to print some text, i'd like to be able to change the format of my printable page
    any advice?
    i didn't find any tutorial really complete! anyone can suggest me any?
    thanx a lot in advance
    sandro

    I'm not sure if you still need this, but try \n\r instead of simply \n.
    \n is a new line, but \r signifies the carriage return, back to the left. I'm not sure if it's always necessary, but it was in my case.

  • Javax.print problem: data not of declared type

    Hi all,
    I'm trying to print a simple text-only document with the below code but it keeps giving me an illegal argument exception. By the way, I've tried all the combinations of DocFlavor.*.* and SERVICE_FORMATTED.PRINTABLE and SERVICE_FORMATTED.PAGEABLE are the only ones working for me. Is this normal?
    Thanks!
    IllegalArgumentException:
    java.lang.IllegalArgumentException: data is not of declared type
            at javax.print.SimpleDoc.<init>(SimpleDoc.java:82)
            at DiagnosticsPane.actionPerformed(DiagnosticsPane.java:350)
    import java.io.*;
    import javax.print.*;
    import javax.print.attribute.*;
    class testPrint
         public static void main(String args[])
              PrintRequestAttributeSet pras =     new HashPrintRequestAttributeSet();
              DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
              PrintService ps[] = PrintServiceLookup.lookupPrintServices(flavor, pras);
              PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
              PrintService service = ServiceUI.printDialog(null, 200, 200, ps, defaultService, flavor, pras);
              if (service != null) {
                   try {
                        DocPrintJob job = service.createPrintJob();
                        DocAttributeSet das = new HashDocAttributeSet();
                        FileInputStream fis = new FileInputStream("report.txt");
                        Doc doc = new SimpleDoc(fis, flavor, das);
                        try {
                             job.print(doc, pras);
                             System.err.println("Job sent to printer.");
                        } catch (PrintException e) {
                             System.err.println("Print error!\n\n" + e.getMessage());
                   } catch (FileNotFoundException e) {
                        System.err.println("File not found!\n\n" + e.getMessage());
    }

    Hi duffymo,
    I've tried all the available DocFlavors and even wrote a little program to list all my supported DocFlavors. And, I've only got 2 available for each of my printers, one being a Canon i320 and the other is a Adobe PDF printer.
    import javax.print.*;
    import javax.print.attribute.*;
    class listDocFlavor
      public static void main(String args[])
        PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
        DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
        PrintService ps[] = PrintServiceLookup.lookupPrintServices(flavor, pras);
        for (int j = 0; j < ps.length; j++) {
          DocFlavor df[] = ps[j].getSupportedDocFlavors();
          for (int i = 0; i < df.length; i++)
            System.err.println(j + ": " + df);
    0: application/x-java-jvm-local-objectref; class="java.awt.print.Pageable"
    0: application/x-java-jvm-local-objectref; class="java.awt.print.Printable"
    1: application/x-java-jvm-local-objectref; class="java.awt.print.Pageable"
    1: application/x-java-jvm-local-objectref; class="java.awt.print.Printable"

  • Create a Document in DMS and attach a file coming in binary format

    Hi to all,
    I have to create a new document in DMS (trx: CV01N) with an attachment but this attachment is a pdf file in binary format. Can I use bapi "BAPI_DOCUMENT_CREATE2"? It support binary files in input or I have to convert files in someway? Or I have to use another BAPI?
    I'm using an r/3 4.6c and I know that it is a big limit.
    Please, I need help.
    Thank you very much in advance,
    Enrico

    That assumes two things:
    1. That Apple would have let Microsoft have access to its file format.
    2. That Microsoft would want to spend the time and trouble to write filters for file formats that Apple can't be bothered doing for its own software.
    Peter

  • Replace the XML Tags which are in binary format in 4.6C Version

    Hi Experts,
    I have an issue. I am working on 4.6 c version of sap. I have a requirement to send  ftp of an xml file. I created an internal table which has components of table type too ( For Line items ). After appending a record of sales order into the table I am using   SDIXML_DATA_TO_DOM ( To attach the to the document ) and SDIXML_DOM_TO_XML ( To convert the document contents into XML ( Binary Format ).
           CLASS cl_ixml DEFINITION LOAD.
          g_ixml = cl_ixml=>create( ).
          CHECK NOT g_ixml IS INITIAL.
          m_document = g_ixml->create_document( ).
          CHECK NOT m_document IS INITIAL.
          CALL FUNCTION 'SDIXML_DATA_TO_DOM'
            EXPORTING
              NAME               = 'xmldata'   " data in character format
              DATAOBJECT         = xmldata[]
           IMPORTING
             DATA_AS_DOM        = l_dom
           CHANGING
             DOCUMENT           = m_document
           EXCEPTIONS
             ILLEGAL_NAME       = 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.
          CHECK NOT l_dom IS INITIAL.
          w_rc = m_document->append_child( new_child = l_dom ).
          IF w_rc IS INITIAL.
          WRITE 'OK'.
          ELSE.
          WRITE: 'ERR ='.
          ENDIF.
          CALL FUNCTION 'SDIXML_DOM_TO_XML'
            EXPORTING
              DOCUMENT            = m_document
            PRETTY_PRINT        = ' '
            IMPORTING
              XML_AS_STRING       = w_string
              SIZE                = w_size
            TABLES
              XML_AS_TABLE        = it_xml   " Final XML data ( with xml tags ( xml tags are the field names of internal table ) ) in bin
            EXCEPTIONS
              NO_DOCUMENT         = 1
              OTHERS              = 2
          IF SY-SUBRC = 0.
          WRITE 'OK'.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ELSE.
          WRITE: 'ERR =',
          sy-subrc.
          ENDIF.
    So, it_xml has the binary format of XML data.
    Now the requirement is that I need to get rid of some XML tags in the final internal table XML data. Because by default, at the start of the the table row the <item> and </item> tags are inserted. This is automatically done in the Function module
    SDIXML_DOM_TO_XML.
    I want to find out the binary string of <item> and </item> and replace them by null binary string. I know how to replace the character strings but not for binary strings in 4.6 C.
    It is little bit urget. I would appreciate the quicker answer.

    Hi,
    check this program , I think this will help you
    TYPE-POOLS: ixml.
    TYPES: BEGIN OF xml_line,
    data(256) TYPE x,
    END OF xml_line.
    data : itab like catsdb occurs 100 with header line.
    data : file_location type STRING.
    data : file_name like sy-datum.
    data : file_create type STRING.
    file_name = sy-datum .
    file_location = 'C:\xml\'.
    concatenate file_location file_name into file_create.
    concatenate file_create '.XML' into file_create.
    DATA: l_xml_table TYPE TABLE OF xml_line,
    l_xml_size TYPE i,
    l_rc TYPE i.
    select * from catsdb into table itab.
    append itab .
    CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
    EXPORTING
    I_FIELD_SEPERATOR =
    I_LINE_HEADER =
    I_FILENAME =
    I_APPL_KEEP = ' '
    I_XML_DOC_NAME =
    IMPORTING
    PE_BIN_FILESIZE = l_xml_size
    TABLES
    i_tab_sap_data = itab
    CHANGING
    I_TAB_CONVERTED_DATA = l_xml_table
    EXCEPTIONS
    CONVERSION_FAILED = 1
    OTHERS = 24
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL METHOD cl_gui_frontend_services=>gui_download
    EXPORTING
    bin_filesize = l_xml_size
    filename = file_create
    filetype = 'BIN'
    CHANGING
    data_tab = l_xml_table
    EXCEPTIONS
    OTHERS = 24.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    write : 'INTERNAL TABLE DATA IS SUCCESSFULLY DOWNLOADED TO LOCATION', file_create .
    Thanks.

  • How to read a file containing bitmap message in binary format

    Dear all,
    Can anybody tell me how to read bitmap message which stored data in binary format? The messages are stores like this :
    A file contain some messages along with these bitmaps in square zeroes.
    I want to again convert it into ASCII.

    Double post: http://forum.java.sun.com/thread.jspa?threadID=587497

  • How to read 16-bit signed integer in binary format with 2 byte sync. preceding??

    A flowmeter provides data as 16-bit signed integer in binary format with 2 byte sync. preceding
    I got i small problem by understanding the synchronasation.
    I read the data provided by the flowmeter, and then write it to a binaryfile.dat. i need to convert the data to decimal format. is it better to convert the data before or after writing it to the binary file. Coz i need to read the data out again for calculations and save it again in a new file.
    I understand that the synchronization  help one to see where to begin reading the usable data. is it right?
    Need any suggestions
    Thank you !
    Zamzam
    HFZ
    Attachments:
    DataOut.JPG ‏37 KB

    HI Rolf.k.
    Thank you for the small program it was helpfull.
    You got right about that proberly there  will be conflict with some spurios data, I can already detect that when writing the data to a spreadsheet file.
    I writes the data in such a way, that in each line there will be a date, a timestamp, a tab and a timestamp at the end. That means two columns.
    When i set given samplerate up, that controls the rate of the data outflow from the device, (1,56 Hz - 200 Hz),   the data file that i write to , looks unorderet.
     i get more than one timestamp and severel datavalues in every line and so on down the spreadsheet file.
    Now the question is: Could it be that the function that writes the data to the file,  can't handle the speed of the dataflow in such a way that the time stamp cant follow with the data flowspeed. so i'm trying to set the timestamp to be  with fractions of the seconds by adding the unit (<digit>) in the timestamp icon but its not working. Meaby when i take the fractions off a second within the timestamp i can get every timestamp with its right data value. Am i in deeb water or what do You mean!??
    AAttached Pics part of program and a logfile over data written to file
    regards
    Zamzam
    HFZ
    Attachments:
    DataFlowWR.JPG ‏159 KB
    Datalogfile.JPG ‏386 KB

  • How to convert image to binary format

    Hi all,
      We have developed an Employee search  mobile web application in .net which is hosted on an exposed IP server, we need to show the employee data along with the image of the employee on mobile.
    When we run this application through our desktop we are able to see the image of the employee since we are doing this through <b>intranet</b> , but when we try to access the same from any mobile device we are able to see only the data but no image, since we are doing this through <b>internet(exposed server).</b>
    Please suggest some way to get this image,
    is there any<b> function module in ABAP</b> which can <b>convert image to binary format</b>
    so that we <b>export binary data</b> to .net application

    Hei evryone!
    CAn anyone pls help me on how to solve this error:
    java.security.AccessControlException: access denied (java.security.SecurityPermission insertProvider.SunJCE)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkSecurityAccess(Unknown Source)
         at sun.plugin.security.ActivatorSecurityManager.checkSecurityAccess(Unknown Source)
         at java.security.Security.check(Unknown Source)
         at java.security.Security.insertProviderAt(Unknown Source)
         at java.security.Security.addProvider(Unknown Source)
         at CryptoTest.processFile(SwingApplet.java:68)
         at CryptoTest.<init>(SwingApplet.java:65)
         at SwingApplet.init(SwingApplet.java:39)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Is it allright for a swing code to access local resources? like in my case i want my swing app to decrypt and encrypt an image file but when i tried to access the method for decrypting and encrypting i got this error message on my console. Do i have to make my code signed before i could write/read a file on my hard drive?
    Any help / suggestions would be much appreciated.Thanks!

Maybe you are looking for