Converting Query results into HTML email

Hi,
I am using oracle 11g. I' m using the following procedure to send out html emails from a static query in the procedure and it works fine. I wanted to make it dynamic and pass the sql query as a parameter to procedure and build the html tags based on the query. Any thoughts?
CREATE OR REPLACE PROCEDURE html_sql_results
is
    v_rows clob;
    v_header clob;
    cursor v_cursor is
    select SR_NO,STATE,DUE_DT,PROCESS_DT,STATUS,DAY_NO,SEQ_NO
    from T_TABLE;
    BEGIN
    v_header := '<table border=1>
              <tr style=''background:#8DB3E2''>
              <td><p><b>SR_NO</b></p></td>
              <td><p><b>STATE</b></p></td>
              <td><p><b>DUE_DT</b></p></td>
              <td><p><b>PROCESS_DT</b></p></td>
              <td><p><b>STATUS</b></p></td>
              <td><p><b>DAY_NO</b></p></td>
              <td><p><b>SEQ_NO</b></p></td>
              </tr>';
    v_rows := Null;
    FOR i in v_cursor
    LOOP
    v_rows  := v_rows ||
            '<tr>
            <td> <p>' || I.SR_NO||'</p></td>
            <td> <p>' || I.STATE||'</p></td>
            <td> <p>' || I.DUE_DT ||'</p></td>
            <td> <p>' || I.PROCESS_DT ||'</p></td>
            <td> <p>' || I.STATUS||'</p></td>
            <td> <p>' || I.DAY_NO ||'</p></td>
            <td> <p>' || I.SEQ_NO||'</p></td>
            </tr> ';
    END LOOP;
    if v_rows is not null then
    v_rows:= v_header ||v_rows ||' </table> ' ;
    dbms_output.put_line(v_rows); 
    email_results(v_rows);
    end if ;
    end ;
/

A possible way :
SQL> var result clob
SQL> DECLARE
  2
  3    ctx  dbms_xmlgen.ctxHandle;
  4    qry  varchar2(2000) := 'SELECT * FROM hr.employees WHERE department_id = :1';
  5
  6    xsl  xmltype := xmltype('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  7   <xsl:output method="html"/>
  8   <xsl:template match="/ROWSET">
  9    <table border="1">
10     <tr style="background:#8DB3E2">
11      <xsl:for-each select="ROW[1]/*">
12       <td><p><b><xsl:value-of select="name()"/></b></p></td>
13      </xsl:for-each>
14      <xsl:apply-templates/>
15     </tr>
16    </table>
17   </xsl:template>
18   <xsl:template match="ROW">
19    <tr><xsl:apply-templates/></tr>
20   </xsl:template>
21   <xsl:template match="ROW/*">
22    <td><p><b><xsl:value-of select="."/></b></p></td>
23   </xsl:template>
24  </xsl:stylesheet>');
25
26    res  clob;
27
28  BEGIN
29
30    ctx := dbms_xmlgen.newContext(qry);
31    dbms_xmlgen.setBindValue(ctx, '1', 90);
32    dbms_xmlgen.setNullHandling(ctx, dbms_xmlgen.EMPTY_TAG);
33    dbms_xmlgen.setXSLT(ctx, xsl);
34
35    :result := dbms_xmlgen.getXML(ctx);
36    dbms_xmlgen.closeContext(ctx);
37
38    --dbms_output.put_line(res);
39
40  END;
41  /
PL/SQL procedure successfully completed.
SQL> print result
RESULT
<table border="1"><tr style="background:#8DB3E2"><td><p><b>EMPLOYEE_ID</b></p></
td><td><p><b>FIRST_NAME</b></p></td><td><p><b>LAST_NAME</b></p></td><td><p><b>EM
AIL</b></p></td><td><p><b>PHONE_NUMBER</b></p></td><td><p><b>HIRE_DATE</b></p></
td><td><p><b>JOB_ID</b></p></td><td><p><b>SALARY</b></p></td><td><p><b>COMMISSIO
N_PCT</b></p></td><td><p><b>MANAGER_ID</b></p></td><td><p><b>DEPARTMENT_ID</b></
p></td><tr><td><p><b>100</b></p></td><td><p><b>Steven</b></p></td><td><p><b>King
</b></p></td><td><p><b>SKING</b></p></td><td><p><b>515.123.4567</b></p></td><td>
<p><b>17/06/03</b></p></td><td><p><b>AD_PRES</b></p></td><td><p><b>24000</b></p>
</td><td><p><b></b></p></td><td><p><b></b></p></td><td><p><b>90</b></p></td></tr
<tr><td><p><b>101</b></p></td><td><p><b>Neena</b></p></td><td><p><b>Kochhar</b></p></td><td><p><b>NKOCHHAR</b></p></td><td><p><b>515.123.4568</b></p></td><td><
p><b>21/09/05</b></p></td><td><p><b>AD_VP</b></p></td><td><p><b>17000</b></p></t
d><td><p><b></b></p></td><td><p><b>100</b></p></td><td><p><b>90</b></p></td></tr
<tr><td><p><b>102</b></p></td><td><p><b>Lex</b></p></td><td><p><b>De Haan</b></p></td><td><p><b>LDEHAAN</b></p></td><td><p><b>515.123.4569</b></p></td><td><p><
b>13/01/01</b></p></td><td><p><b>AD_VP</b></p></td><td><p><b>17000</b></p></td><
td><p><b></b></p></td><td><p><b>100</b></p></td><td><p><b>90</b></p></td></tr></
tr></table>Typically, XSLT stylesheets may be stored in the database too, so that you can modify and use different presentation templates without touching the code.

Similar Messages

  • Send BW query results as HTML email from ABAP program

    I have published a code sample for sending BW query results as HTML email from ABAP program. if you have any questions or clarification, please post them here.
    the same can be accessed from this link.
    http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/b7658119-0a01-0010-39a9-b600c816f370
    Regards
    Raja
    Message was edited by: Durairaj Athavan Raja

    OK forget about my earlier post.
    do the following changes.
    declare the following variables:
    data: xtext type standard table of solix .
    DATA: atta_sub TYPE sood-objdes .
    after the call of FM SCMS_STRING_TO_FTEXT add the following code.
    CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'
      EXPORTING
        ip_solitab        = text
    IMPORTING
       EP_SOLIXTAB       = xtext .
    and after the following statement
    document = cl_document_bcs=>create_document(
                              i_type    = 'HTM'
                              i_text    = text
                              i_length  = conlengths
                              i_subject = subject ).
    add the following code
    CALL METHOD document->add_attachment
                EXPORTING
                  i_attachment_type    = 'htm'
                  i_attachment_subject = atta_sub
                  i_att_content_hex    = xtext.
    now you will have results both in the body as well as attachment. (this is for test you can remove one of them )
    Regards
    Raja

  • Sending query result as html email

    hi,
    I have requirement to send query result as html emial to user, is there a possibility to send it?
    database is 11.2.3
    thanks,
    7Z

    Google is your friend
    http://oracle-base.com/articles/misc/email-from-oracle-plsql.php
    https://www.google.nl/search?q=send+email+oracle+database+11g

  • Query results to HTML table

    I'm looking for a more efficient way to convert a query result into an HTML table so that I can paste it into an email. The procedure in sqldeveloper (version 3.1.07) is just too clunky and involves too many keystrokes and mouse clicks. And you can't save the HTML to the clipboard. (I'm talking about the "Export..." action here.)
    Am I missing something? Are there any alternatives?
    Thanks!

    ... but sqlplus is so last millenium....
    Seriously? I'm from the last millennium too, nevertheless I don't consider myself out of date
    SQL*PLUS is still my first choice when I have to run a script. I'ts behaviour is reliably the same whereever my script is executed. I would never trust a script that needs another tool to be executed.
    Generating a HTML-mail is IMHO out of scope for a database tool. It's a feature I would expect in a BI tool that specializes on reporting.
    Regards
    Marcus

  • How to output a query results into a text file

    How to output a query results into a text file instead of outputing it to the screen..
    is there a way for us to write a SQL query which specifies to output the query results to a text file.
    Pls let me know how to do it
    Thanking u in advance
    regards
    Muraly

    Muraly,
    If you are using SQL*Plus 8.1.6 or later, you can also spool output to a file in HTML format, eg
    SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON
    SPOOL c:\temp\report.html
    SELECT DEPARTMENT_NAME, CITY
    FROM EMP_DETAILS_VIEW
    WHERE SALARY>12000;
    SPOOL OFF
    SET MARKUP HTML ENTMAP OFF
    In iSQL*Plus 9.0.1 (the browser-based interface to SQL*Plus) onwards, you can also send the HTML output to a new web browser window, or an html file -- much easier than the command line method.
    Alison

  • Is it possible to convert PDF file into HTML

    Dear friends
    Is it possible to convert PDF file into HTML. I have few hundread PDF files i like to convert this files into HTML. I hope it can be done through Java but i don't know how to start this coding. anybody can give me a brief idea to go ahead.

    Why do you want to do this yourself? I quick search on Google showed several utilities to do this, some freeware, some commercial.

  • Is there a way to combine their query results into a single function

    say I have a bunch of functions that return a query:
    <cffunction name="getDeals" access="remote"
    returntype="query">
    <cffunction name="getDeals2" access="remote"
    returntype="query">
    is there a way to combine their query results into a single
    function that returns a struct of the various results?

    Umm, it's probably more suited to an array - effectively
    making it into a list of queries. You'd then loop the array and
    output each.
    I use a similar approach when creating system messages to the
    user. Most of my functions that are called do their bit, then at
    the end call another function I call "messages". This function
    grabs whatever my function sends and appends it to a messages
    array.
    This way enables me to output a long list of messages -
    because I could be calling several functions at the same time. If I
    just output a message from each function, each one would overwrite
    the other. So I'd get one message at a time.
    Immediately after it's output, I then destroy the message
    array so that old messages aren't kept inside of it.
    Mikey.

  • Anyone know a tool to convert PLSQL comments into HTML/other formats?

    Hi - does anyone know if there's a tool out there to convert PLSQL comments into HTML or other formats like you can do in Java? Thanks in advance - Jon

    This is only useful if you're using PL/SQL Developer. It has a free plugin called plsqldoc which will generate html pages that are similar to Javadoc pages.
    check here for more information
    http://www.allroundautomations.nl/plsqldevplugins.html
    As an aside , if you haven't already, you may want to devise a way of auto generating your HTML when a change is made or by running a regular batch job. This will ensure that your docs are in sync with the code. Documentation is only valuable if it is kept up to date.
    There is nothing worse than looking at the html docs for a package only to realise the docs are several versions behind the code.

  • Http 404 error exporting query result into Excel.

    Hello. I'm getting an Http 404 The webpage cannot be found" error when trying to export any APEX application's query results into Excel (Application Express 3.2.1.00.10). This was working fine before. Nothing changed with our APEX application. I've been always using I.E. Version 7.0.5730.11 with no problems. I've reset the I.E. defaults and still the problem exists. I've downloaded Mozilla Firefox and the problem does not happen. However, I would like to know why my I.E. still gets this error? Any feedback or suggestions would greatly be appreciated. Thanks for your time.

    My EI settings are as follows:
    Tools -> Internet Options -> Security
    All Three: Internet, Local Intrarnet, and Trusted Sites ... at Custom Level have the following settings:
    Downloads:
    Automatic prompting for file downloads = Enable
    File download = Enable
    Font download = Enable
    Problem still exists.
    Thanks for the help.... any additional feedback or suggestions would greatly be appreciated. Thanks for your time.

  • Write big query results into a file  ? ?  ?

    Hi all,
    The problem is: I want to write a simple query results into a file. I have no idea how to do that. Only thing I know is utl_ functions. Please advise GURUS how can I use them for big queries. Any example will be really appreciable.
    Thank you in advance.
    Message was edited by:
    v838

    hi,
    i´ld do it like that:
    filedir     varchar2(30):= '/usr/frajo/';
    filename     varchar2(30):= 'file.txt';
    fhandle     utl_file.file_type;
    cursor x is
    select ... (what ever)
    begin
         fhandle := utl_file.fopen (filedir, filename,'a');
         open x;
         loop
              fetch x into (what ever)
              exit when x%notfound;
              utl_file.put_line (fhandle,'text and you results');
         end loop;
         utl_file.fclose(fhandle);
    end;
    happy xmas. franz

  • How to pass query result to HTML table?

    Hi,
      i want to get the query result in HTMl table instead of Display Grid. how to do it? i searched in help, it suggests use icommand to do this. but i dont know how to pass the select query result to HTML table.. please help me.
    -senthil

    Hi Senthil,
    You can create an icommand query. You can then use the icommand retrieval methods to capture and manipulate the query data.
    (http://help.sap.com/saphelp_xmii115/helpdata/en/Applet_Reference_Details/iCom
    mand_Reference.htm)
    Basically what we did was, use the getColumnCount() and getRowCount() methods, once you have these two numbers you can set two for loops and use String getValue(int ColID, int RowID) , within the for loops you can generate the inner html content and write the values either in a html table or html form (which is what we did). This seems to work well, I'm still playing around with it and may post this approach on sdn by end of this week.
    Mahwish

  • How to insert the select query result into table?

    How to insert the select query result into table?
    SELECT  top 20 creation_time  
            ,last_execution_time 
            ,total_physical_reads
            ,total_logical_reads  
            ,total_logical_writes
            , execution_count 
            , total_worker_time
            , total_elapsed_time 
            , total_elapsed_time / execution_count avg_elapsed_time
            ,SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,
             ((CASE statement_end_offset 
              WHEN -1 THEN DATALENGTH(st.text)
              ELSE qs.statement_end_offset END 
                - qs.statement_start_offset)/2) + 1) AS statement_text
    FROM sys.dm_exec_query_stats AS qs
    CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
    ORDER BY total_elapsed_time / execution_count DESC;
    Thanks,
    Tirumala

    1. SELECT INTO
    Below method will create table when data is inserted from one table to another table. Its useful when you need exactly same datatype as source table.
    Use AdventureWorks2008R2;
    Go
    ---Insert data using SELECT INTO
    SELECT AddressLine1, City
    INTO BothellAddresses
    FROM Person.Address
    where City = 'Bothell';
    GO
    ---VERIFY DATA
    Select AddressLine1, City
    FROM BothellAddresses
    ---DROP TABLE
    DROP TABLE BothellAddresses
    GO
    2. INSERT INTO SELECT
    Below method will need table to be created prior to inserting data. Its really useful when table is already created and you want insert data from
    another table.
    Use AdventureWorks2008R2;
    Go
    ---Create Table
    CREATE TABLE BothellAddresses (AddressLine1 NVARCHAR(60), City NVARCHAR(30))
    ---Insert into above table using SELECT
    INSERT INTO BothellAddresses(AddressLine1, City)
    SELECT AddressLine1, City
    FROM Person.Address
    where City = 'Bothell';
    ---VERIFY DATA
    Select AddressLine1, City
    FROM BothellAddresses
    ---DROP TABLE
    DROP TABLE BothellAddresses
    GO
    Regards,
    Vishal Patel
    Blog: http://vspatel.co.uk
    Site: http://lehrity.com

  • How to convert table content into html format?

    Hi,
    Experts,
    How to convert internal data into HTML format is there any function module or piece of code to download content into HTML.
    Thank u,
    Shabeer Ahmed.

    Then use this code....
    REPORT  ytest_table_html1.
    *        D A T A   D E C L A R A T I O N
    *-HTML Table
    DATA:
      t_html TYPE STANDARD TABLE OF w3html WITH HEADER LINE,
                                           " Html Table
    *- Declare Internal table and Fieldcatalog
      it_flight TYPE STANDARD TABLE OF sflight WITH HEADER LINE,
                                           " Flights Details
      it_fcat TYPE lvc_t_fcat WITH HEADER LINE.
                                           " Fieldcatalog
    *-Variables
    DATA:
      v_lines TYPE i,
      v_field(40).
    *-Fieldsymbols
    FIELD-SYMBOLS: <fs> TYPE ANY.
    *        S T A R T - O F - S E L E C T I O N
    START-OF-SELECTION.
      SELECT *
        FROM sflight
        INTO TABLE it_flight
        UP TO 20 ROWS.
    *        E N D - O F - S E L E C T I O N
    END-OF-SELECTION.
    *-Fill the Column headings and Properties
    * Field catalog is used to populate the Headings and Values of
    * The table cells dynamically
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'SFLIGHT'
        CHANGING
          ct_fieldcat            = it_fcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2.
      DELETE it_fcat WHERE fieldname = 'MANDT'.
      t_html-line = '<html>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<thead>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<tr>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<td><h1>Flights Details</h1></td>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '</tr>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '</thead>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<table border = "1">'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<tr>'.
      APPEND t_html.
      CLEAR t_html.
    *-Populate HTML columns from Filedcatalog
      LOOP AT it_fcat.
        CONCATENATE '<th bgcolor = "green" fgcolor = "black">'
            it_fcat-scrtext_l
            '</th>' INTO t_html-line.
        APPEND t_html.
        CLEAR t_html.
      ENDLOOP.
      t_html-line = '</tr>'.
      APPEND t_html.
      CLEAR t_html.
      DESCRIBE TABLE it_fcat LINES v_lines.
    *-Populate HTML table from Internal table data
      LOOP AT it_flight.
        t_html-line = '<tr>'.
        APPEND t_html.
        CLEAR t_html.
    *-Populate entire row of HTML table Dynamically
    *-With the Help of Fieldcatalog.
        DO v_lines TIMES.
          READ TABLE it_fcat INDEX sy-index.
          CONCATENATE 'IT_FLIGHT-' it_fcat-fieldname INTO v_field.
          ASSIGN (v_field) TO <fs>.
          t_html-line = '<td>'.
          APPEND t_html.
          CLEAR t_html.
          t_html-line = <fs>.
          APPEND t_html.
          CLEAR t_html.
          t_html-line = '</td>'.
          APPEND t_html.
          CLEAR t_html.
          CLEAR v_field.
          UNASSIGN <fs>.
        ENDDO.
        t_html-line = '</tr>'.
        APPEND t_html.
        CLEAR t_html.
      ENDLOOP.
      t_html-line = '</table>'.
      APPEND t_html.
      CLEAR t_html.
    *-Download  the HTML into frontend
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = 'C:\Flights.htm'
        TABLES
          data_tab                = t_html
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          OTHERS                  = 22.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    *-Display the HTML file
      CALL METHOD cl_gui_frontend_services=>execute
        EXPORTING
          document               = 'C:\Flights.htm'
          operation              = 'OPEN'
        EXCEPTIONS
          cntl_error             = 1
          error_no_gui           = 2
          bad_parameter          = 3
          file_not_found         = 4
          path_not_found         = 5
          file_extension_unknown = 6
          error_execute_failed   = 7
          synchronous_failed     = 8
          not_supported_by_gui   = 9
          OTHERS                 = 10.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    none of the above function modules r obsolete...

  • Converting SPool information into HTML Format

    Hi Friends,
    How to Converting SPool information into HTML Format
    and send this HTML INFORMATION INTO MAIL..
    can anyone send program for this issue pls.
    it is an urgent issue
    regards,

    Hi Rich,
    once again thanks for your kindly reply.
    but i am developing below Code.. that HTMAL AATCHMENTS ARE NOT COMING IN MAIL.
    PLS can you you verify the below code.
                           DATA DECLARATIONS                             *
    DATA: I_LIST   LIKE ABAPLIST OCCURS 0  WITH HEADER LINE,
          VARIANT  LIKE RSVAR-VARIANT,
          DOC_CHNG  LIKE SODOCCHGI1,
           RECLIST LIKE SOMLRECI1  OCCURS 5  WITH HEADER LINE,
    data:  spoolid    type tsp01-rqident.
    DATA IT_MAIL LIKE TSP01 OCCURS 0 WITH HEADER LINE.
    data  report_html like W3HTML  OCCURS 0 WITH HEADER LINE.
    DATA: G_ICONS(32) OCCURS 10 WITH HEADER LINE.
    DATA LISTOBJECT LIKE ABAPLIST OCCURS 0 WITH HEADER LINE.
    DATA  sent_to_all like sonv-flag.
    data : RECEIVER(30),
          spoolid    type tsp01-rqident,
           it_buffer like SOLI occurs 10 with header line.
    data: list type table of  abaplist with header line.
    data: htmllines type table of w3html with header line.
    data: maildata   like sodocchgi1.
    data: mailtxt    like solisti1 occurs 10 with header line.
    data: mailrec    like somlrec90 occurs 0  with header line.
                           TABLE DECLARATIONS                            *
    TABLES : TSP01.
                               SELECTION-SCREEN                          *
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN: SKIP.
    PARAMETERS : RQ2NAME LIKE TSP01-RQ2NAME .
                RQIDENT like TSP01-RQIDENT.
    SELECT-OPTIONS :  S_RECVR FOR RECEIVER  NO INTERVALS.
    SELECTION-SCREEN: SKIP.
    SELECTION-SCREEN: END OF BLOCK B1.
                               START-OF-SELECTION                        *
    START-OF-SELECTION.
    PERFORM SEND_TO_SPOOL.
      PERFORM GET_SPOOL_ID.
      loop at it_mail.
        PERFORM CONVERT_SPOOL_TO_PDF.
        PERFORM SEND_MAIL.
      endloop.
    Save the list
      call function 'SAVE_LIST'
           tables
                listobject         = list
           exceptions
                list_index_invalid = 1
                others             = 2.
    *&      Form  GET_SPOOL_ID
          Getting the Latest Spool Request Number
    FORM GET_SPOOL_ID.
      SELECT *
            FROM TSP01 INTO TABLE  IT_MAIL
           and   RQIDENT    = RQIDENT.
              WHERE  RQ2NAME   =  RQ2NAME .
    ENDFORM.                    " GET_SPOOL_ID
    *&      Form  CONVERT_SPOOL_TO_PDF
          Converting the Spool to PDF Document
    FORM CONVERT_SPOOL_TO_PDF.
    *--Assigning the Spool number
    WRITE :/ IT_MAIL-RQIDENT.
    spoolid = IT_MAIL-RQIDENT.
    *--Converting the Spool to PDF
    CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
      EXPORTING
        RQIDENT                    =  spoolid
      FIRST_LINE                 = 1
      LAST_LINE                  =
      TABLES
        BUFFER                     = it_buffer
    EXCEPTIONS
      NO_SUCH_JOB                = 1
      NOT_ABAP_LIST              = 2
      JOB_CONTAINS_NO_DATA       = 3
      SELECTION_EMPTY            = 4
      NO_PERMISSION              = 5
      CAN_NOT_ACCESS             = 6
      READ_ERROR                 = 7
      OTHERS                     = 8
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LISTOBJECT = IT_BUFFER.
    CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
    EXPORTING
      REPORT_NAME         =
       TEMPLATE_NAME       = 'WEBREPORTING_REPORT'
      TABLES
        HTML                = report_html
        LISTOBJECT          = LISTOBJECT
       LISTICONS           = G_ICONS.
    ENDFORM.                    " CONVERT_SPOOL_TO_PDF
    FORM SEND_MAIL.
    call function 'WWW_LIST_TO_HTML'
           tables
                html = htmllines.
    maildata-obj_name = 'TEST'.
      maildata-obj_descr = 'Test Subject'.
      loop at htmllines.
        mailtxt = htmllines.
        append mailtxt.
      endloop.
    LOOP AT S_RECVR.
    reclist-receiver = S_RECVR-LOW.
    reclist-rec_type = 'U'.
    append reclist.
    call function 'SO_NEW_DOCUMENT_SEND_API1'
           exporting
                document_data              = maildata
                document_type              = 'HTM'
                put_in_outbox              = 'X'
           tables
                object_header              = report_html "mailtxt
                object_content             = mailtxt
                receivers                  = reclist "mailrec
           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.
      if sy-subrc = 0.
    write 'mail sent'.
      endif.
    ENDLOOP.
    regards,
    venu.

  • How to convert xml data into html format in bpel

    Hi ,
    Can any one tel me how to conevrt xml into html in oracle bpel.
    Does bpel support this functionality or not.
    Regards,
    Ana
    Edited by: user10181991 on Apr 5, 2009 11:16 PM

    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.

Maybe you are looking for