Convert binary to base64

I've a special problem. I've a BSP for uploading files from Windows XP-Clients. The file should be transferred to a .NET web service where the file is written to disc (1:1, means the binary is written like it is to disc). The transfer from the file to the web service must be in base64.
My problem is, that the web service write a file with exact the same size as the file I uploaded, but I couldn’t read the file correctly. Only text files (.csv, .txt, ...) works correctly. I compared the uploaded file with the written file and there are some characters which could not converted in ABAP (hex 23 instead of the correct char). So I think I've a problem with the codepages.
I use a Unicode WAS 6.20 with UTF-8.
Please see my code:
Layout *
<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>
<%@ extension name="xhtmlb" prefix="xhtmlb" %>
<htmlb:content design="design2003">
  <htmlb:page title = "Testupload">
        <htmlb:form method= "post"
                    encodingType = "multipart/form-data"
                    id = "FRM_Pflege">
          <htmlb:fileUpload id   = "and"
                            size = "40" />
          <htmlb:button id      = "file_upload_and"/>
    </htmlb:form>
  </htmlb:page>
</htmlb:content>
oninputprocessing   *
here you see an extract from my code.
the myfile64 will be transfered to the web service
  CASE event->server_event.
    WHEN 'file_upload_and'.
      TRY.
          fileupload ?= cl_htmlb_manager=>get_data(
                                request = runtime->server->request
                                name    = 'fileUpload'
                                id      = 'and').
          IF fileupload IS NOT INITIAL.
            name         = fileupload->file_name.
            content      = fileupload->file_content.
            length       = fileupload->file_length.
            content_type = fileupload->file_content_type.
          ENDIF.
          conv = cl_abap_conv_in_ce=>create(
             encoding = '1160'
       endian = 'L'
             input = fileupload->file_content ).
          conv->read( IMPORTING data = input_string len = len ).
          CREATE OBJECT obj.
          CALL METHOD obj->encode_base64
            EXPORTING
              unencoded = input_string
            RECEIVING
              encoded   = myfile64.
          CLEAR wf_string .
the string myfile64 will be used for sending to the webservice

Hi Peter,
ah, ok - the file-upload returns the content as XSTRING, but the Xstring to String conversion method your are using converts by using a codepage - i doubt that this works with binary files.
there is a function module that converts XSTRINGS to Base64:
SCMS_BASE64_ENCODE_STR
can you try this?
Stefan.

Similar Messages

  • Sample code converting binary data to image file

    Hi experts ,
    I need sample code to convert binary data (bytes) in to an image file.
    any help will be appreciated.
    Thanks and Regards,
    Naresh

    You need to show binary and decimal?  Or now just decimal?
    If binary and decimal, you can right click on your indicator and choose "Display Format...".  If you select the Advanced Editing Mode, you can make soft interesting display formats.  This includes showing the same value in mulitple ways in the indicator.  Try something like "%032b - %d" for the format string.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Converting binary data to cluster

    Hello,
    I have a problem converting binary data to a cluster. I have to create a VI that reads out some parameter from a device, which is connected via RS232. I get an array of 128 Byte from the device. The data has the following (C-)structure:
    struct PARAM
    char cVersion[64];
    float fDeviceID;
    float fChannels;
    float fSensor;
    float fTrigger;
    float fConst[5];
    char cReserved[28];
    How can I convert the binary array to a cluster? I created a cluster (see attachment), but I couldn't connect it with the "Type Cast" VI. Has anyone an idea how to solve this problem?
    Thanks, Martin
    Attachments:
    cluster.jpg ‏16 KB

    It is tedious to convert binary data to LabVIEW data when you have arrays. You have to typecast the data with clusters of the same fixed length as in the structure. Large clusters are easily created on the diagram using Array to Cluster primitive. See the attavhed picture.
    LabVIEW, C'est LabVIEW
    Attachments:
    conversion.gif ‏11 KB

  • Convert Binary Data into Pdf & send it as attachment in a mail in Workflow

    Hi,
    Scenario:
    The interactive form saved in WebDynpro Application is sent to R/3 in binary format. It has to be converted into pdf and sent it as an attachment in mail to the respective person in workflow.
    Kindly help on these issues :
    1. How to receive the binary data in R/3 sent by the WebDynpro Application ?
    To my knowledge we can receive the binary in XSTRING data type. Plz correct me if am wrong.
    2. How do i convert the received binary data into pdf ?
    Thanks,
    Bharath Kaushik

    Hi Bharath,
    I think you should try to write dat being sent to R/3 to spool first, as in R/3 there is FM <i>CONVERT_ABAPSPOOLJOB_2_PDF</i> , with the help of which you will be able to convert Binary data to PDF format.
    Pls find one of the threads related to this , and see if this is useful to you.
    Problem in CONVERT_ABAPSPOOLJOB_2_PDF.
    Hope this atleast helps to start off.
    Regds,
    Akshay Bhagwat
    PS: Some points would be nice if it helps:)

  • How to Convert Binary Data in Binary File

    hi,
    my telecom client puts a binary file which is asn.1 encoded with BER.
    how to handle binary data in java.
    how to convert binary to hexa to ascii format
    how to convert binary to octet to ascii format
    please help me in this.
    regards,
    s.mohamed asif

    You don't need to convert the data.
    Only you can do is print it in that formats, like it:
    public static String byteArrayToHex(byte[] b) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < b.length; i++)
             sb.append(Integer.toHexString(b&255) + " ");
    return sb.toString();
    take a look at this
    http://java.sun.com/docs/books/tutorial/essential/io/

  • How to convert Binary to String?

    Hi,
    How to convert Binary to String? Thank!

    Never ceases to amaze me how many people cannot
    accept any form of criticism whatsoever. How dothey
    get through the normal day? Do they pick fightswith
    everyone who says anything to them they don'tlike?
    Was this for me????Who are you calling a psycho??

  • How to Convert binary file to s-records

    Hi all,
    can anybody help how to convert binary ".bin" files to s-record ".s" files
    any idea or code snippets are very appreciated
    best regards,
    gebi

    There is a ready-made converter: "BINARY to Motorola S-Record Conveter Utility" or BIN2MOT.
    http://www.keil.com/download/docs/bin2mot.zip.asp
    Other references:
    http://www.cs.net/lucid/moto.htm
    http://www.amelek.gda.pl/avr/uisp/srecord.htm
    http://www.seattlerobotics.org/encoder/jun99/dougl.html
    http://semmix.pl/mipc/specyf/filehex/mhexu.htm
    http://pmon.groupbsd.org/Info/srec.htm

  • Convert binary to decimal

    hi, i was wondering what's the code to convert binary numbers to decimal numbers?

    import java.io.*;
    class convertBinarytoDecimal{
         public static void main (String args[])
         throws Exception {
              System.out.println("Enter the Binary Number");
              BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
              String str = br.readLine().trim();
              int [] myArray = new int [str.length()];
              for(int i=0;i<myArray.length;i++){
                   myArray[i] = Integer.parseInt(str.charAt(i)+"");
              convertBinarytoDecimal(myArray);
         static void convertBinarytoDecimal(int [] myArray){
              int decimal = 0;
              for (int i =0;i<myArray.length;i++){
                   decimal += myArray[i] * Math.pow(2,myArray.length-(i+1));
              System.out.println(decimal);
    }

  • Convert Binary to Hexadecimal

    Hi,
    Can anyone show me how do I convert Binary to Hexadecimal ?
    Thank you,
    Any help will be appreciated.

    Well, everything is stored in binary on computers so your explanation of the problem sucks big time, however maybe you want something like this.
    String binString = "101001010101101";
    String hexString = Integer.toHexString(Integer.parseInt(binString, 2));

  • Convert Binary file to PDF file

    Can I convert Binary data in to PDF format.
    If yes, show me a sample code.

    alokpotdar wrote:
    Can I convert Binary data in to PDF format.
    If yes, show me a sample code.Which method you are using to read binary data ?
    You can use iText for pdf
    http://www.lowagie.com/iText/
    Edited by: kanad on Aug 7, 2008 7:43 AM

  • Convert file into Base64

    Hi all,
    I'm trying to convert a file into Base64 code and I'm not getting the result I expected. The file is attached to a Purchase Requisition and the process needs to run in background - this means I can't use FM's like GUI_UPLOAD to help me complete this task. Here is a portion of the code I'm using:
      Get object information
    CALL FUNCTION 'SO_OBJECT_READ'
    EXPORTING
      folder_id = folder_id
      object_id = object_id
    TABLES
      objcont   = objcont.
    READ TABLE objcont.
    i_valor = objcont-line.
    SEARCH i_valor FOR '='.
    IF sy-fdpos <> 0.
    i_valor = i_valor+sy-fdpos.
    i_valor = i_valor+1.
    SEARCH i_valor FOR space.
    i_class = i_valor(10).
    i_objid = i_valor+10.
    ENDIF.
      Get file phisical ID
    CLEAR: log, phi.
    log-class = i_class.
    log-objid = i_objid.
    CALL FUNCTION 'SO_LOIO_PHIO_GET'
    EXPORTING
       loio_object        = log
    IMPORTING
       phio_object        = phi
    EXCEPTIONS
       kpro_inconsistency = 1
       x_error            = 2
    OTHERS             = 3.
      Get file content in binary
    CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT'
      EXPORTING
         object_id           = phi
         raw_mode            = 'X'
      TABLES
        file_access_info    = access_info
        file_content_ascii  = cont_ascii
        file_content_binary = cont_binary
    EXCEPTIONS
        not_existing        = 1
        not_authorized      = 2
        no_content          = 3
        bad_storage_type    = 4
    OTHERS              = 5.
    Retrieve base64 and invoke Webservice for upload
        CLEAR: line2, first_time, last_block.
        LOOP AT cont_binary.
          DESCRIBE TABLE cont_binary LINES len_cont_binary.
          MOVE cont_binary-line TO line_aux.
    Check if it is last block
          IF sy-tabix EQ len_cont_binary.
            last_block = 'true'.
          ELSE.
            last_block = 'false'.
          ENDIF.
    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
      EXPORTING
        text   = line_aux
      IMPORTING
        buffer = input_str.
    CALL FUNCTION 'SCMS_BASE64_ENCODE_STR'
       EXPORTING
         input  = input_str
      IMPORTING
         output = output_str.
    If I compare my result in "output_str" I see it is different than when I use a software to retrieve the Base64, and when I try to open the file it is corrupted.
    Can you help me?
    Thanks in advance.
    Kind regards,
    Ricardo

    HI Hyma,
    As Stefan specifyed already as per my knowledge we dont have any standard procedure for all the requirements you specified.....we need to go for module in the adapter.
    Cheers!!!
    Naveen.

  • Converting binary data into pdf and placing into application server

    Hi Friends,
    I am able to get PO details in binary format and then using GUI_DOWNLOAD  with file type with 'bin' and file name with 'sample.pdf' extension , got  PO in pdf  format.
    But i need to get with pdf extension in application server without using GUI_DOWNLOAD.
    Is there any functional modules for it?
    With Warm Regards,
    Madhu!!!

    Hi Madhu,
    Check this code.
    *& Report  ZSPOOLTOPDF                                                 *
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& This program must be run as a background job in-order for the write *
    *& commands to create a Spool request rather than be displayed on      *
    *& screen                                                              *
    REPORT  zspooltopdf.
    PARAMETER: p_email1 LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_sender LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_delspl  AS CHECKBOX.
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Write statement to represent report output. Spool request is created
    if write statement is executed in background. This could also be an
    ALV grid which would be converted to PDF without any extra effort
      WRITE 'Hello World'.
      new-page.
      commit work.
      new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
    Alternative way could be to submit another program and store spool
    id into memory, will be stored in sy-spono.
    *submit ZSPOOLTOPDF2
           to sap-spool
           spool parameters   %_print
           archive parameters %_print
           without spool dynpro
           and return.
    Get spool id from program called above
    IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
        PERFORM convert_spool_to_pdf.
        PERFORM process_email.
        if p_delspl EQ 'X'.
          PERFORM delete_spool.
        endif.
        IF sy-sysid = c_dev.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
        ENDIF.
      ELSE.
        SKIP.
        WRITE:/ 'Program must be executed in background in-order for spool',
                'request to be created.'.
      ENDIF.
          FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
          FORM get_job_details                                          *
    FORM get_job_details.
    Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
          FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
          FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    perform send_email using p_email2.
    ENDFORM.
          FORM send_email                                               *
    -->  p_email                                                       *
    FORM send_email USING p_email.
      CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
          FORM delete_spool                                             *
    FORM delete_spool.
      DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
      ld_spool_nr = gd_spool_nr.
      CHECK p_delspl <> c_no.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                spoolid = ld_spool_nr.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           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.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    Hope this resolves your query.
    <b>Reward all the helpful answers.</b>
    Regards

  • How to convert binary file to a particular format?

    Hi,
    I am having a requirement. I have in database various kinds of files stored as binary format. Its a sybase database. Now the files can be .pdf, or .doc also. But they are stored in binary format.
    I need to read the file from database.
    Now I can use jdbc to read the particular column value which contains the file in binary format.
    But tricky part is how to convert the binary file entry in a proper respective file format? So I have another column which basically has the value to tell the type of file. So I have ".doc" or ".pdf" as each entry of file...
    So please help me how can we do this using Java?
    THanks

    Hi,
    I am having a requirement. I have in database various
    kinds of files stored as binary format. Its a sybase
    database. Now the files can be .pdf, or .doc also.
    But they are stored in binary format.
    I need to read the file from database.
    Now I can use jdbc to read the particular column
    value which contains the file in binary format.
    But tricky part is how to convert the binary file
    entry in a proper respective file format? So I have
    another column which basically has the value to tell
    the type of file. So I have ".doc" or ".pdf" as each
    entry of file...
    So please help me how can we do this using Java?
    THanks

  • Convert binary data to decimal in CAN XNET

    I am using NI-XNET Read function to read CAN frames from port CAN1 , the data out put comes in cluster in binary format is there any function that I can use to convert the binary to decimal ? I prefer not to write another sub-vi to do conversion but using the existing functions that can use my .dbc file and parse all frames in decimal format.
    Thanks.

    Yes Doug You are correct. We have a PCB and we have connected two inductive  sensors over the PCB which are measuring the distance and transpose it to voltage. The PCB has a software which transpose this voltage through an ADC and through the Can Bus we are reading the sensors .To communicate with the PCB  we are using a USB to Can device from IXXAT to communicate, we have build the Labview drivers and our problem as you mention is that we want to transpose this data to voltage. How we can do this? I try several times to upload photos or even the program we have create but for some reason the site is not letting me to do that. If you have an email i can send you the program we have create to tell us your opinion in this problem we have, we can also send you the Labview drivers and the datasheet of the sensor we are using.
    Attachments:
    Read from Can.vi ‏37 KB

  • Convert binary data (TIFF image) into XML - how ?

    Hi,
    I have the following requirement:
    1. A document is scanned and a TIFF image is saved in a directory
    2. The File adapter picks up the image file and sends into XI
    3. The binary data is converted into XML so a Web Service can be called (this web service will store the image in a database application)
    <b>The part I am struggling with is the convert of the incoming binary data into a XML format document which will allow the Web Service to be called.</b>
    Graphical mapping cannot be used therefore I am left with 3 options:
    1. XSLT mapping
    2. Java mapping
    3. ABAP mapping
    Can anyone suggest the best option to use in these circumstances and provide some sample snippet of code on how to do it.
    I am alright at XSLT mapping but this is beyond me and Java mapping is completely new to me as I have very limited Java knowledge.
    Thanks for your help
    Colin.

    Hi Colin
    Look for the below link
    https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10dd67dd-a42b-2a10-2785-91c40ee56c0b
    <b>***Reward point if helpfull</b>
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10dd67dd-a42b-2a10-2785-91c40ee56c0b">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10dd67dd-a42b-2a10-2785-91c40ee56c0b</a>

Maybe you are looking for