How to convert XMLTYPE data into CLOB without using getclobval()

Please tell me how to convert data which is stored in the table in XMLTYPE column to a CLOB.
When i use getClobVal(), i get an error. So please tell me some other option except getClobVal()

CREATE OR REPLACE PACKAGE BODY CONVERT_XML_TO_HTML AS
     FUNCTION GENERATE_HTML(TABLE_NAME VARCHAR2, FILE_NAME VARCHAR2, STYLESHEET_QUERY VARCHAR2, WHERE_CLAUSE VARCHAR2, ORDERBY_CLAUSE VARCHAR2) RETURN CLOB IS
     lHTMLOutput XMLType;
     lXSL CLOB;
          lXMLData XMLType;
          FILEID UTL_FILE.FILE_TYPE;
          HTML_RESULT CLOB;
          SQL_QUERY VARCHAR2(300);
          WHERE_QUERY VARCHAR2(200);
          fileDirectory VARCHAR2(100);
          slashPosition NUMBER;
          actual_fileName VARCHAR2(100);
          XML_HTML_REF_CUR_PT XML_HTML_REF_CUR;
          BEGIN
               IF WHERE_CLAUSE IS NOT NULL AND ORDERBY_CLAUSE IS NOT NULL THEN
               SQL_QUERY := 'SELECT * FROM ' || TABLE_NAME ||' WHERE ' || WHERE_CLAUSE || ' ORDER BY ' || ORDERBY_CLAUSE;
                    ELSE IF WHERE_CLAUSE IS NOT NULL AND ORDERBY_CLAUSE IS NULL THEN
                         SQL_QUERY := 'SELECT * FROM ' || TABLE_NAME || ' WHERE ' || WHERE_CLAUSE;
                         ELSE IF WHERE_CLAUSE IS NULL AND ORDERBY_CLAUSE IS NOT NULL THEN
                              SQL_QUERY := 'SELECT * FROM ' || TABLE_NAME || ' ORDER BY ' || ORDERBY_CLAUSE;
                              ELSE IF WHERE_CLAUSE IS NULL AND ORDERBY_CLAUSE IS NULL THEN
                              SQL_QUERY := 'SELECT * FROM ' || TABLE_NAME;
               END IF;
                    END IF;
                         END IF;
                              END IF;
               OPEN XML_HTML_REF_CUR_PT FOR SQL_QUERY;
          lXMLData := GENERATE_XML(XML_HTML_REF_CUR_PT);
               --lXSL := GET_STYLESHEET(STYLESHEET_QUERY);
                              if(lXMLData is not null) then
                              dbms_output.put_line('lXMLData pass');
                              else
                                        dbms_output.put_line('lXMLData fail');
               end if;
               lHTMLOutput := lXMLData.transform(XMLType(STYLESHEET_QUERY));
               --INSERT INTO TEMP_CLOB_TAB2 VALUES(CLOB(lHTMLOutput));
               if(lHTMLOutput is not null) then
                              dbms_output.put_line('lHTMLOutput pass');
                              else
                                        dbms_output.put_line('lHTMLOutput fail');
               end if;
               HTML_RESULT := lHTMLOutput.getclobVal();
               if(HTML_RESULT is not null) then
                              dbms_output.put_line('HTML_RESULT pass'||HTML_RESULT);
                              else
                                        dbms_output.put_line('HTML_RESULT fail');
               end if;
               -- If the filename has been supplied ...
     IF FILE_NAME IS NOT NULL THEN
-- locate the final '/' or '\' in the pathname ...
     slashPosition := INSTR(FILE_NAME, '/', -1 );
     IF slashPosition = 0 THEN
     slashPosition := INSTR(FILE_NAME,'\', -1 );
     END IF;
-- separate the filename from the directory name ...
     fileDirectory := SUBSTR(FILE_NAME, 1,slashPosition - 1 );
     actual_fileName := SUBSTR(FILE_NAME, slashPosition + 1 );
               END IF;
                    DBMS_OUTPUT.PUT_LINE(fileDirectory||' ' ||actual_fileName);
               FILEID := UTL_FILE.FOPEN(fileDirectory,actual_fileName, 'W');
               UTL_FILE.PUT_LINE(FILEID, '<title> hi </title>');
          UTL_FILE.PUT_LINE(FILEID, HTML_RESULT);
               UTL_FILE.FCLOSE (FILEID);
DBMS_OUTPUT.PUT_LINE('CLOB SIZE'||DBMS_LOB.GETLENGTH(HTML_RESULT));               
               RETURN HTML_RESULT;
               --RETURN lHTMLOutput;
          EXCEPTION
                    WHEN OTHERS
                         THEN DBMS_OUTPUT.PUT_LINE('ERROR!!!!!!!!!!!!');
          END GENERATE_HTML;
     FUNCTION GENERATE_XML(XML_HTML_REF_CUR_PT XML_HTML_REF_CUR) RETURN XMLType IS
          qryCtx DBMS_XMLGEN.ctxHandle;
          result CLOB;
          result1 xmltype;
          BEGIN
               qryCtx := DBMS_XMLGEN.newContext(XML_HTML_REF_CUR_PT);
               result := DBMS_XMLGEN.getXML(qryCtx);
               --dbms_output.put_line(result);
               result1 := xmltype(result);
               INSERT INTO temp_clob VALUES(result);
               if(result1 is not null) then
                              dbms_output.put_line('pass');
                              else
                                        dbms_output.put_line('fail');
               end if;
                    return result1;
                    DBMS_XMLGEN.closeContext(qryCtx);
     END GENERATE_XML;     
END CONVERT_XML_TO_HTML;
This is the code which i am using to generate the XML and subsequently to generate the HTML output out of that using a XSL stylesheet.
The error is Numeric or value error..

Similar Messages

  • How to convert row data into columns without using pivot table?

    Hello guys
    I have a report that has several columns about sales call type and call counts
    It looks like this:
    Calls Type Call Counts
    Missed 200
    Handled 3000000
    Rejected 40000
    Dropped 50000
    Now I wanna create a report that look like this:
    Missed call counts Handled Call counts Rejected Counts Drop counts Other Columns
    200 300000000 40000 50000 Data
    So that I can perform other calculations on the difference and comparison of handled calls counts vs other call counts..
    I know pivot table view can make the report look like in such way, but they cant do further calculations on that..
    So I need to create new solid columns that capture call counts based on call types..
    How would I be able to do that on Answers? I don't have access to the RPD, so is it possible to do it sololy on answers? Or should I just ask ETL support on this?
    Any pointers will be deeply appreciated!
    Thank you

    Thanks MMA
    I followed your guidance and I was able to create a few new columns of call missed count, call handled counts and call abandoned counts.. Then I create new columns of ave missed counts, ave handled counts and so forth..
    Then I went to the pivot view, I realized there is a small problem.. Basically the report still includes the column "call types" which has 3 different types of call "miss, abandon and handled". When I exclude this column in my report, the rest of the measures will return wrong values. When I include this column in the report, it shows duplicate values by 3 rows. It looks like this:
    Queue name Call types Call handled Call missed Call abondoned
    A Miss 8 10 15
    A Handled 8 10 15
    A Abandoned 8 10 15
    in pivot table view, if I move call type to column area, the resulted measures will become 8X3, 10X3 and 15X3
    So is there a way to eliminate duplicate rows or let the system know not to mulitply by 3?
    Or is this as far as presentation service can go in terms of this? Or should I advice to provide better data from the back end?
    Please let me know, thanks

  • How to convert blob data into clob using plsql

    hi all,
    I have requirement to convert blob column into clob .
    version details
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE     11.1.0.7.0     Production
    TNS for 32-bit Windows: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    DECLARE
       v_blob      temp.blob_column%TYPE;------this is blob data type column contains  (CSV file which is  inserted  from screens)
       v_clob      CLOB; --i want to copy blob column data into this clob
       v_warning   NUMBER;
    BEGIN
       SELECT blob_column
         INTO v_blob
         FROM temp
        WHERE pk = 75000676;
       DBMS_LOB.converttoclob (dest_lob          => v_clob,
                               src_blob          => v_blob,
                               amount            => DBMS_LOB.lobmaxsize,
                               dest_offset       => 1,
                               src_offset        => 1,
                               blob_csid         => 1, -- what  is the use of this parameter
                               lang_context      => 1,
                               warning           => v_warning
       DBMS_OUTPUT.put_line (v_warning);
    EXCEPTION
       WHEN OTHERS
       THEN
          DBMS_OUTPUT.put_line (SQLCODE);
          DBMS_OUTPUT.put_line (SQLERRM);
    END;I am not getting what is the use of blob_csid , lang_context parameters after going the trough the documentation .
    Any help in this regard would be highly appreciated .......
    Thanks
    Edited by: prakash on Feb 5, 2012 11:41 PM

    Post the 4 digit Oracle version.
    Did you read the Doc for DBMS_LOB.CONVERTTOCLOB? - http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_lob.htm
    The function can convert data from one character set to another. If the source data uses a different character set than the target you need to provide the character set id of the source data.
    The blob_csid parameter is where you would provide the value for the source character set.
    If the source and target use the same character set then just pass zero. Your code is passing a one.
    >
    General Notes
    You must specify the character set of the source data in the blob_csid parameter. You can pass a zero value for blob_csid. When you do so, the database assumes that the BLOB contains character data in the same character set as the destination CLOB.
    >
    Same for 'lang_context' - your code is using 1; just use 0. It is an IN OUT
    >
    lang_context
    (IN) Language context, such as shift status, for the current conversion.
    (OUT) The language context at the time when the current conversion is done.
    This information is returned so you can use it for subsequent conversions without losing or misinterpreting any source data. For the very first conversion, or if do not care, use the default value of zero.

  • Insert XMLTYPE data into CLOB column

    Hi,
    I am trying to insert XMLTYPE datatype column value into the CLOB datatype column.
    I get an error -
    ORA - 00932: Inconsistent datatypes: expected CLOB got -
    How do I insert xml type data into clob?
    Thanks!

    Here is my sql code:
    I have a view :
    create or replace view test_view
    (id,
    code,
    desc)
    as select
    id,
    code,
    xmlroot(xmlelement("empname", ename), version '1.0') as desc
    from employee;
    I have a table emp_details_table. The columns in the emp_details_table are
    ID number,
    CODE varchar2,
    EMP_DETAILS CLOB
    I am tring to insert the 'test_view' data into the 'emp_details_table' and I get an error cannot insert xmltype data into clob.
    insert into emp_details_table
    (ID , CODE, EMP_DETAILS)
    select
    (ID, CODE, DESC) from test_view;
    Thanks.

  • How to convert system Date into DD-MMM-YYYY Format

    hi friends,
    please help me How to convert system Date into DD-MMM-YYYY Format.
    Regards
    Yogesh

    HI..
    data: w_dt(11) type c,
             w_month(2),
             w_mon(3).
    w_month = p_date+4(2). **p_date = given date**
    case w_month.
    when '01'.
    w_mon = 'Jan'.
    when '02'.
    w_mon = 'Feb'.
    when '03'.
    w_mon = 'Mar'.
    when '04'.
    w_mon = 'Apr'.
    when '05'.
    w_mon = 'May'.
    when '06'.
    w_mon = 'Jun'.
    when '07'.
    w_mon = 'Jul'.
    when '08'.
    w_mon = 'Aug'.
    when '09'.
    w_mon = 'Sep'.
    when '10'.
    w_mon = 'Oct'.
    when '11'.
    w_mon = 'Nov'.
    when '12'.
    w_mon = 'Dec'.
    endcase.
    Now...
      concatenate p_date6(2)  '-'  w_mon  '-'   p_date0(4)  into w_dt.
    write w_dt.

  • How to convert BLOB data into string format.

    Hi,
    I have problem while converting blob data into string format.
    for example,
    Select dbms_lob.substr(c.shape.Get_wkb(),4000,1) from geotable c
    will get me the first 4000 byte of BLOB .
    When i using SQL as i did above,the max length is 4000, but i can get 32K using plsql as below:
    declare
    my_var CLOB;
    BEGIN
    for x in (Select X from T)
    loop
    my_var:=dbms_lob.substr(x.X,32767,1)
    end loop
    return my_var;
    I comfortably convert 32k BLOB field to string.
    My problem is how to convert blob to varchar having size more than 32K.
    Please help me to resolve this,
    Thanx in advance for the support,
    Nilesh

    Nilesh,
    . . . .The result of get_wkb() will not be human readable (all values are encoded into some binary format).
    SELECT utl_raw.cast_to_varchar2(tbl.geometry.get_wkt()) from FeatureTable tbl;
    -- resulting string:
        ☺AW(⌂özßHAA
    Å\(÷. . . .You may also want to have a look at { dbms_lob | http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm#i1015792 } "The DBMS_LOB package provides subprograms to operate on BLOBs, CLOBs, NCLOBs, BFILEs, and temporary LOBs."
    Regards,
    Noel

  • How to convert julian Date into Calendar Date

    Hi,
    I want convert julian Date to calendar Date (mm/dd/yyyy or mm/dd/yy format) in java.
    Can any one help me how to convert julian date to calendar Date.
    Thanks,
    Krishore.

    import java.util.*;
    import java.text.*;
    public class jdate {
    Calendar date;
    public jdate(int j)
    date = Calendar.getInstance();
    date.set(Calendar.DAY_OF_YEAR, j);
    public String toString()
    SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
    return (formatter.format( date.getTime() ));
    public static void main(String args[])
    if(args.length == 1)
    int j = Integer.parseInt(args[0]);
    jdate julian = new jdate(j);
    System.out.println("Julian date(" + j + ") = " + julian.toString());
    }

  • How to convert XML data into binary data (opaque data)

    Hi,
    I am trying to develop a process that delivers files after reading data from a database.
    However, it is required not to deliver the data immediately. We want to perform some checks before the files get written.
    So the way we want to design this is,
    1. Read data from database (or any other input). The data is in XML format (this is a requirement, as in general, we have xml data)
    2. This data is written, opaquely, to a JMS queue that can store binary data, along with what is the filename of the file that would be written (filename is passed using JMS Headers)
    3. When required, another process reads the JMS queue's binary data, and dumps into a file
    The reason I want to use opaque data while inserting in the JMS queue is, that enables me to develop a single process in Step 3 that can write any file, irrespective of the format.
    My questions are
    1. How to convert the xml data to opaque data. In BPEL I may use a embedded java, but how about ESB. Any other way....?
    2. how to pass filename to the jms queue, when payload is opaque. Can I use a header attribute...custom attributes?
    3. Which jms message type is better for this kind of requirement - SYS.AQ$_JMS_BYTES_MESSAGE or SYS.AQ$_JMS_STREAM_MESSAGE

    Ana,
    We are doing the same thing--using one variable with the schema as the source of the .xsl and assigning the resulting html to another variable--the content body of the email, in our case. I just posted how we did it here: Re: Using XSLT to generate the email HTML body
    Let me know if this helps.

  • How do I put data into a template using the Labview report generation toolkit for Microsoft Office?

    I am running Lookout 5.0 and have recently purchased the Labview Report Generation Toolkit for Microsoft Office to create reports from my Lookout logged data. Since I have never used Labview I am having my problems. I tried following the tutorials but they do not seem to be examples of what I want to do.
    I log rainfall totals (1 spreadsheet)in Lookout from 40 different sites in 5 minute increments. I copy these totals and paste them into another spreadsheet which sums them up to give me hourly totals and then paste those totals into a spreadsheet for distribution.
    In Labview I create a new report and use the distribution sheet as my template, but how do I complete
    the steps of loading the raw 5 minute data into labview and then paste it into the hourly total spreadsheet and then transfer those totals into the distribution template?
    I have been trying to figure this out for over a week, and I am getting nowhere.
    Any response would be appreciated.
    Thanks
    Jason P
    Jason Phillips

    Lookout saves the files in .csv form which can be opened in Excel. I did make some progress by using the "append table to report" vi which allowed me to put values into an array and then those values were entered into my template on my report vi.
    Where I am stuck now is I want to be able to put values into my template from a .csv file, not from an array I have to manually put numbers in.
    Once those values are in my template I want to pull summed values from the template and place them into a final excel file for printing.
    I have attached examples of the files I am working with to help you better understand what I am trying to do.
    I hope that makes sense.
    Jason Phillips
    Attachments:
    HourlyTotalsTemplate.xls ‏120 KB
    eb_rain_gauge_ss.csv ‏23 KB
    EastBankHourlyRainReport.xls ‏28 KB

  • How to delete the data from KNVP without using the delete statement

    Hello friends,
    I have a requirement that I have to delete the data from KNVP table without using any delete statement. For it I have to use the Standard BAPI or any standard program.
    Can you please tell me the name of the standard program or BAPI to delete the data .
    Thanks in Advance
    Kuldeep

    Hello Raymond,
    I have use the function 'CUSTOMER_UPDATE' in which I only gives the data in T_XKNVP table only but still the data is not get deleting. Please see the code below.
    =============================================================
    REPORT  ZK_TEST2                                .
    data :
        I_KNA1     LIKE     KNA1,
        I_KNB1     LIKE     KNB1,
        I_KNVV     LIKE     KNVV,
        I_YKNA1     LIKE     KNA1,
        I_YKNB1     LIKE     KNB1.
    Data :
    T_XKNAS       LIKE     FKNAS occurs 0,
    T_XKNB5     LIKE     FKNB5 occurs 0,
    T_XKNBK     LIKE     FKNBK occurs 0,
    T_XKNVA     LIKE     FKNVA occurs 0,
    T_XKNVD     LIKE     FKNVD occurs 0,
    T_XKNVI     LIKE     FKNVI occurs 0,
    T_XKNVK     LIKE     FKNVK occurs 0,
    T_XKNVL     LIKE     FKNVL occurs 0,
    T_XKNVP     LIKE     FKNVP occurs 0 with header line,
    T_XKNVS     LIKE     FKNVS occurs 0,
    T_XKNEX     LIKE     FKNEX occurs 0,
    T_XKNZA     LIKE     FKNZA occurs 0,
    T_YKNAS     LIKE     FKNAS occurs 0,
    T_YKNB5     LIKE     FKNB5 occurs 0,
    T_YKNBK     LIKE     FKNBK occurs 0,
    T_YKNVA     LIKE     FKNVA occurs 0,
    T_YKNVD     LIKE     FKNVD occurs 0,
    T_YKNVI     LIKE     FKNVI occurs 0,
    T_YKNVK     LIKE     FKNVK occurs 0,
    T_YKNVL     LIKE     FKNVL occurs 0,
    T_YKNVP     LIKE     FKNVP  occurs 0 with header line,
    T_YKNVS     LIKE     FKNVS occurs 0,
    T_YKNEX     LIKE     FKNEX occurs 0,
    T_YKNZA     LIKE     FKNZA occurs 0.
    T_XKNVP-KUNNR     =     '7000002648'     .
    *T_XKNVP-VKORG     =     '0001'     .
    *T_XKNVP-VTWEG     =     '01'     .
    *T_XKNVP-SPART     =     '01'     .
    T_XKNVP-KZ      =     'D'     .
    append T_XKNVP to T_XKNVP.
    CALL FUNCTION 'CUSTOMER_UPDATE'
      EXPORTING
        I_KNA1        = I_KNA1
        I_KNB1        = I_KNB1
        I_KNVV        = I_KNVV
        I_YKNA1       = I_YKNA1
        I_YKNB1       = I_YKNB1
      TABLES
        T_XKNAS       = T_XKNAS
        T_XKNB5       = T_XKNB5
        T_XKNBK       = T_XKNBK
        T_XKNVA       = T_XKNVA
        T_XKNVD       = T_XKNVD
        T_XKNVI       = T_XKNVI
        T_XKNVK       = T_XKNVK
        T_XKNVL       = T_XKNVL
        T_XKNVP       = T_XKNVP
        T_XKNVS       = T_XKNVS
        T_XKNEX       = T_XKNEX
        T_XKNZA       = T_XKNZA
        T_YKNAS       = T_YKNAS
        T_YKNB5       = T_YKNB5
        T_YKNBK       = T_YKNBK
        T_YKNVA       = T_YKNVA
        T_YKNVD       = T_YKNVD
        T_YKNVI       = T_YKNVI
        T_YKNVK       = T_YKNVK
        T_YKNVL       = T_YKNVL
        T_YKNVP       = T_YKNVP
        T_YKNVS       = T_YKNVS
        T_YKNEX       = T_YKNEX
        T_YKNZA       = T_YKNZA
    =============================================================

  • How to convert raw data into pdf ?

    Hi everyone,
    I have a requirement where I have to print the document present in application server.
    I used below code to do this
    * Open the file in binary mode
       OPEN DATASET gv_filepath FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.
       DO.
         TRY.
    * Since the file is opened in Binary mode, the entire contents of the
    * file is read in one go!
             READ DATASET gv_filepath INTO gv_filedata.
             IF sy-subrc <> 0.
               EXIT.
             ENDIF.
           CATCH cx_sy_conversion_codepage.
         ENDTRY.
         APPEND gv_filedata TO gt_file_table.
         CLEAR gv_filedata.
       ENDDO.
       CLOSE DATASET gv_filepath.
    DESCRIBE TABLE gt_file_table LINES lv_lines.
      lv_pages = lv_lines.
      lv_dest = 'LP01'.
      lv_spoolname = 'LOCW'.
      CALL FUNCTION 'RSPO_SX_OUTPUT_TEXTDATA'
        EXPORTING
    *     NAME           = lv_spoolname
          DEST           = lv_dest
          ROWS           = lv_lines
          STARTROW       = 1
          PAGES          = 99
          RQTITLE        = 'Print Spool'
          RQCOPIES       = 1
          RQOWNER        = sy-uname
          IMMEDIATELY    = ' '
        IMPORTING
          RQID           = lv_spoolid
        TABLES
          TEXT_DATA      = gt_file_table
        EXCEPTIONS
          NAME_MISSING   = 1
          NAME_TWICE     = 2
          NOT_FOUND      = 3
          ILLEGAL_LAYOUT = 4
          INTERNAL_ERROR = 5
          SIZE_MISMATCH  = 6
          OTHERS         = 7.
      IF SY-SUBRC <> 0.
    * Implement suitable error handling here
      ENDIF.
    Passed the spool id generated to below FM but it is not converting into pdf
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          SRC_SPOOLID                    = lv_spoolid
         NO_DIALOG                      = ' '
         DST_DEVICE                     = 'LOCW'
         PDF_DESTINATION                = 'X'
    *     NO_BACKGROUND                  =
    *     GET_SIZE_FROM_FORMAT           =
    *     USE_CASCADING                  = ' '
    *   IMPORTING
    *     PDF_BYTECOUNT                  = lv_bytecount
    *     PDF_SPOOLID                    = lv_pdf1
    *     LIST_PAGECOUNT                 =
    *     BTC_JOBNAME                    =
    *     BTC_JOBCOUNT                   =
    *     BIN_FILE                       = lv_pdf
       TABLES
         PDF                            = lt_pdf
       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
      IF SY-SUBRC <> 0.
    * Implement suitable error handling here
      ENDIF.
    When I go to SP01 and check the spool generated it is in raw document type.
    How can I convert this raw document to pdf type ??
    Please help me to resolve this.
    Regards,
    Krishna

    Ok, since I can't edit the post anymore, here the new version of code, without the use of SCMS_XSTRING_TO_BINARY for intermediate table. Reasons: effectively doubles the memory use and I don't want to check if the kernel is cutting off the hexdecimal nulls when the last spool line is written, or to relay of that behaviour.
    Matthew Billingham, and other mods: it would be really nice if you could hide the old version please (this post here). The number of google results for that FM is scary and I really don't want to contribute to promoting its use...
    REPORT zjbtst2.
    PARAMETERS: p_file TYPE string
       LOWER CASE
       DEFAULT '/usr/sap/....'
       OBLIGATORY.
    PARAMETERS: p_dest TYPE rspopname
      DEFAULT 'LP01'
      OBLIGATORY .
    PERFORM main USING p_file p_dest.
    *&      Form  main
    FORM main
      USING
        i_file TYPE string
        i_dest TYPE  rspopname.
      DATA: lo_handle TYPE REF TO cl_rspo_spool_handle .
      DATA: l_spoolid TYPE rspoid.
      DATA: l_content TYPE xstring .
      DATA: l_message_text TYPE string .
      PERFORM get_file USING i_file CHANGING l_content .
      PERFORM new_spool USING i_dest CHANGING lo_handle l_spoolid.
      PERFORM write_spool USING lo_handle l_spoolid l_content .
      l_message_text = |Spool { l_spoolid } created| .
      MESSAGE l_message_text TYPE 'I' .
    ENDFORM .                  "main
    *&      Form  get_file
    FORM get_file
       USING i_file TYPE string
       CHANGING c_content TYPE xstring.
      DATA: l_message_text TYPE string .
      CLEAR c_content .
      OPEN DATASET i_file FOR INPUT IN BINARY MODE
        MESSAGE l_message_text.
      IF sy-subrc NE 0 .
        MESSAGE l_message_text TYPE 'E' .
      ELSE.
        READ DATASET i_file INTO c_content .
        CLOSE DATASET i_file.
      ENDIF .
    ENDFORM .                   "get_file
    *&      Form  new_spool
    FORM new_spool
       USING
         i_destination TYPE rspopname
       CHANGING
         co_handle TYPE REF TO cl_rspo_spool_handle
         c_spoolid TYPE rspoid .
      cl_rspo_spool_handle=>open(
        EXPORTING
          dest           = i_destination
          name           = 'Test'
          layout         = 'G_RAW'
          doctype        = 'BIN'
        IMPORTING
          ref            = co_handle
          spoolid        = c_spoolid
        EXCEPTIONS
          device_missing = 1
          name_twice     = 2
          no_such_device = 3
          operation_failed = 4
          OTHERS         = 5
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM .                    "new_spool
    *&      Form  WRITE_SPOOL
    FORM write_spool
      USING
        io_handle TYPE REF TO cl_rspo_spool_handle
        i_spoolid TYPE rspoid
        i_content TYPE xstring .
      DATA: l_buffer(128) TYPE x ."Hmm, 128 does work, 4096 doesn't...
      DATA: l_buffer_length TYPE i .
      DATA: l_full_buffers_count TYPE i .
      DATA: l_part_buffer_length TYPE i .
      DATA: l_offset TYPE i .
      DATA: l_length TYPE i .
      l_buffer_length = xstrlen( l_buffer ) .
      l_full_buffers_count = xstrlen( i_content ) DIV l_buffer_length .
      l_part_buffer_length = xstrlen( i_content ) MOD l_buffer_length .
      DO l_full_buffers_count + 1 TIMES .
        IF sy-index LE l_full_buffers_count .
          l_length = l_buffer_length .
        ELSEIF l_part_buffer_length GT 0 .
          l_length = l_part_buffer_length .
        ELSE.
          EXIT .
        ENDIF .
        l_buffer = i_content+l_offset(l_length) .
        ADD l_length TO l_offset .
        io_handle->write_binary(
          EXPORTING
            data           = l_buffer
            length         = l_length
          EXCEPTIONS
            not_open       = 1
            operation_failed = 2
            OTHERS         = 3
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDDO .
      io_handle->close(
        EXPORTING
          final          = 'X'
        EXCEPTIONS
          operation_failed = 1
          already_closed = 2
          OTHERS         = 3
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM .                    "write_spool

  • How to convert exponential data into number for the downloaded excelsheet

    Hi
    I have downloaded one field data i.e. having char of 50,  into excel sheet and it is displaying as  exponential in the excel sheet. 
    The data numbers should display as text only i.e 1236547896321 and not exponential
    Is anyone can tell how we can do this
    Thanks
    Pallavi

    Hello Pallvai,
    The problem of exponential is with the excel. Excel converts the large numbet into exponential.
    To avoid this you can make the number into text then excel won't convert it into exponential.
    For that you can do a simple trick. Just prefix a single quote ( ' ) in the field.
    eg:
    field = 1236547896321.
    then,
    constants c_quote type c value '''.   "<-- single quote
    concatenate c_quote field into field.
    " This will make the EXCEL to consider this field as text not number and hence it will not be considered
    " as exponential.
    Hope this solves your problem.
    Regards,
    Sachinkumar Mehta

  • How to convert labview data into opc tag

    Hi all,
    Can any one please tell me how i can convert the labview data global into a OPC tag? I have some data globals reading and writing data to the globals. Now i wanted to use a PLC device to send its outputs to the field.
    The PLC device will supports the OPC tags so i wanted t create OPC recognised tags in my labview. Is it possible. I saw that labview also having OPC functinalities. Please any one guide me in doing this.
    I will be very thankful to them
    Ramme..

    As I said, I believe you can do this for globals as well by opening its front panel (double click the global) and using a DS connection for the control that represents that specific global.
    As for other alternatives:
    NI sells the DSC module which comes with an OPC server and with better tags.
    You can use a common protocol like Modbus to interact with the PLC.
    You can use the custom protocol used by the PLC.
    The last two would require that you would change your program structure, so you would only want to use them under certain conditions.
    I believe the practical limit for OPC tags with DS is a few hundred tags, but I never used it myself so I didn't run into it. You can try searching the forums to find out more.
    Try to take over the world!

  • How to convert excel data into OTF and FAX

    Hi All,
    We have a requirement where in we have a smartform output (OTF data) converted into PDF, and an excel sheet, both being sent as email attachments.
    Now, we need to send the content of both the attachments as FAX.
    Since smartform output was OTF convertible, FAX was being sent using 'CONVERT_OTF_AND_FAX' FM.
    Can you let me know, if there is a possible way for manipulating the data that is converted to EXCEL, as OTF, and then FAX it?
    Or else, please suggest me an alternative way to FAX normal data (other than using 'CONVERT_OTF_AND_FAX').
    Thanks in advance,
    RAVI

    Hi All,
    We have a requirement where in we have a smartform output (OTF data) converted into PDF, and an excel sheet, both being sent as email attachments.
    Now, we need to send the content of both the attachments as FAX.
    Since smartform output was OTF convertible, FAX was being sent using 'CONVERT_OTF_AND_FAX' FM.
    Can you let me know, if there is a possible way for manipulating the data that is converted to EXCEL, as OTF, and then FAX it?
    Or else, please suggest me an alternative way to FAX normal data (other than using 'CONVERT_OTF_AND_FAX').
    Thanks in advance,
    RAVI

  • How to convert LRAW data into the Format of JPEG TIF

    Hi All,
    I am getting data in LRAW from the table DRAO i want to change it into Binary for display,
    I want to display the content into JPEG TIF
    I am getting error when display that format is not suitable.
    Thanks,

    Hello Shilpi,
    you can use SCMS_XSTRING_TO_BINARY to convert the RAW data to Binary.
    BR, Saravanan

Maybe you are looking for

  • Using an iPod with Windows Me

    As far as I know, you can't use iTunes with Windows Me. I knew that when I bought my iPod, but I figured surely I'd be able to use it without iTunes--with a different program, maybe, like Winamp. Apparently not: my computer wouldn't recognize the iPo

  • CommandButton with conditional-rendered doesn't work???

    Hi, My problem: I just would like to show the Submit-Button (commandButton) after I change the value of the "selectOneMenu ". So for that I set the boolean variable for the rednerer to true. After that the Submit-Button is shown. But when I click on

  • ESB dbadapter WSDL cache

    Hi, Is there any way to reset the WSDL cache in ESB? I am making changes to a dbadapter wsdl in a ESB project in Jdeveloper and then re-registering it with the ESB console. If you look at the dbadapter wsdl on the server it has been refreshed with th

  • KDE doesn't show an icon for Adobe Reader v8.1.1?

    Is it me or is KDE (desktop and K menu) not showing the Adobe Reader v8.1.1 icon? I checked the KDE shortcut/link properties and I can see the icon (system icon) it used. Here is a screen capture: http://img205.imageshack.us/img205/62/adobereader8ico

  • Append new field after call cl_abap_typedescr= describe_by_name( tabname )

    Dears :   i use cl_abap_typedescr=>describe_by_name( tabname ) to create a new structure type. The parameter tabname could be 'MARA' .   and now i want to append a new field such as 'ZTEST' to this structure, is this possible ?   ths in advance!