Emailing IR results as CSV attachment

Hello All,
I have a requirement to email IR results as a CSV attachment.
I can get the SQL for the IR by querying APEX_APPLICATION_PAGE_IR.SQL_QUERY but that is just the "base" query and doesn't include computed column. It also includes columns I may have have chosen to suppress. How can I reference the "current" IR filter??
I think once I can construct the SQL statement to match the current IR display, I can save it as a blob and the construct and send the email and attachment using APEX_MAIL.SEND and APEX_MAIL.ADD_ATTACHMENT.
So, is this the desired approach? Or is there an easier way to email the results of an IR in CSV format?
Thanks,
Monty

Hi Monty,
In Apex 4.1 (not sure about earlier versions) if you go to "Download" under the "Actions" drop down you will get an option for email. Obviously you will have to have the email service set up in Apex for it to work. This sends the report as an HTML attachment, I'm not sure if this can be tweaked to send as CSV. Obviously you could down load the results as a csv and then mail them manually.
Regards
Andre

Similar Messages

  • Can I precalculate a BEx query and email the results as an attachment?

    We are on BW 3.5, currently pulling data from R/3 4.6C (but upgrading to ECC 6.0 in mid-July). I have been successful (once, once I was able to talk my email administrator into letting a  .js file through) in sending an email, but the results are in HTML in the body of the email.  I need to send the results as an Excel spreadsheet attachment.  From all of the SAP documentation I've read, it seems this should be possible, but I haven't been able to make it happen. It seems to ignore the setting in the Broadcast scheduling screen. I've tried it with both "Execute" and time-based scheduling.
    Many thanks for any documentation, pointers, or magic tricks.

    Hi,
    This can be done via Information Broadcasting.
    Pls check
    http://help.sap.com/saphelp_nw04/helpdata/en/a5/359840dfa5a160e10000000a1550b0/frameset.htm
    For Bi 7
    http://help.sap.com/saphelp_nw70/helpdata/en/a5/359840dfa5a160e10000000a1550b0/frameset.htm
    Eddy
    PS. Reward useful answers and earn points yourself

  • End the result of an sql query by Email as an excel file attachement

    Hi,
    I would like to create a PL/SQL function that send the result of an sql query by Email as an excel file attachement.
    i'm newbie in pl/sql an d i dont know if it's possible to do such task.
    regards,

    i think a regular expression is he way to go in your case...
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com

  • How to Extract .CSV attachment from Email

    We have a working scenario for (.csv)File to R/3 via ABAP Proxy. The file is currently placed on the application server manually. It will soon start arriving by e-mail as an attachment. Is it possible to use XI to detach the .csv attachment and place the file on the server ? Required process is Email -> File -> XI -> R/3

    Shawn,
    You can do a EMAIL -- XI -- File to send the file to the Target directory.
    To extract the file from the Mail Attachment, you need to use the Payload Swap Bean .
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/bf37423cf7ab04e10000000a1550b0/content.htm
    Regards,
    Bhavesh

  • SSIS question - Email the results of the table in pipe delimited format to the users

    I am new to SSIS and I have a requirement.  I have a sales table that has transactions for all months.  I am trying to automate the process which involves following steps:
    I need to query the table based on previous month.
    Email the results of the table in pipe delimited format to the users.
    What I am currently doing:
    I created a temp table and load the query results in it every month by truncating the previous month’s data.  Saved the query results in excel format. Open the excel and save it in csv format. Use SSIS package to convert csv to txt format and email
    them manually with the txt file name as “Salesresults_<previousmonth>.
    I just want to automate this process but the main challenge comes up with email with txt attached. Please help me out.

    First create a SSIS variable(@[User::Path]) that store folder path as "C:\Test".
    Select the "Expression" tab in Send Mail Task Editor and select the appropriate property(FileAttachments) and assign the below expression.
    @[User::Path] + "\\Salesresults_" + (DT_WSTR, 10) MONTH( GETDATE() ) + (DT_WSTR, 10) YEAR( GETDATE() ) + ".txt"
    Regards, RSingh

  • Send csv attachment in the e-mail

    Data are collected in the internal table.. in a zreport
    This has to be send as an csv  attachment via email.
    How to get the datas in the csv attachment ?

    Hi,
    Here is the sample example:
    REPORT ytest_email.
    This example shows how to send
      - a simple text provided in an internal table of text lines
      - to some internet email address.
    All activities done via facade CL_BCS!
    INCLUDE rlb_invoice_data_declare.
    DATA: send_request       TYPE REF TO cl_bcs.
    DATA: text               TYPE bcsy_text.
    DATA: document           TYPE REF TO cl_document_bcs.
    DATA: sender             TYPE REF TO cl_sapuser_bcs.
    DATA: recipient          TYPE REF TO if_recipient_bcs.
    DATA: bcs_exception      TYPE REF TO cx_bcs.
    DATA: sent_to_all        TYPE os_boolean.
    START-OF-SELECTION.
      PERFORM main.
          FORM main                                                     *
    FORM main.
      DATA: ls_bil_invoice TYPE lbbil_invoice.
      DATA: lf_fm_name            TYPE rs38l_fnam.
      DATA: ls_control_param      TYPE ssfctrlop.
      DATA: ls_composer_param     TYPE ssfcompop.
      DATA: ls_recipient          TYPE swotobjid.
      DATA: ls_sender             TYPE swotobjid.
      DATA: lf_formname           TYPE tdsfname.
      DATA: ls_addr_key           LIKE addr_key.
      DATA: ls_dlv_land           LIKE vbrk-land1.
      DATA: ls_job_info           TYPE ssfcrescl.
      DATA: i_cust TYPE  scustom.
      DATA: i_book TYPE ty_bookings,
            i_conn TYPE ty_connections.
      DATA: w_i_size TYPE i,
           i_docs  TYPE TABLE OF docs,
           i_lines TYPE TABLE OF tline.
      DATA: i_otf TYPE tsfotf.
      DATA: i_bin TYPE solix_tab.
      DATA: gd_buffer TYPE string,
      it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
      it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE.
      DATA: wa_lines LIKE LINE OF i_lines,
            wa_pdf  LIKE LINE OF i_bin.
      DATA: pdf_content        TYPE solix_tab.
      DATA: lp_pdf_size        TYPE so_obj_len.
      DATA: w_xstr  TYPE xstring,
            w_len   TYPE i.
      TRY.
    SF_EXAMPLE_01
          CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
                EXPORTING  formname           = 'SF_EXAMPLE_01'
                    variant            = ' '
                    direct_call        = ' '
                IMPORTING  fm_name            = lf_fm_name
                EXCEPTIONS no_form            = 1
                           no_function_module = 2
                           OTHERS             = 3.
          IF sy-subrc  EQ 0.
      error handling
          ENDIF.
          ls_control_param-getotf = 'X'.
          ls_control_param-no_dialog = 'X'.
    call smartform invoice
          CALL FUNCTION lf_fm_name
               EXPORTING
                          archive_index        = toa_dara
                          archive_parameters   = arc_params
                          control_parameters   = ls_control_param
                    mail_appl_obj        =
                          mail_recipient       = ls_recipient
                          mail_sender          = ls_sender
                          output_options       = ls_composer_param
                          user_settings        = space
                          customer              = i_cust
                          bookings              = i_book
                          connections           = i_conn
                          is_repeat            = repeat
               IMPORTING  job_output_info      = ls_job_info
                        document_output_info =
                        job_output_options   =
               EXCEPTIONS formatting_error     = 1
                          internal_error       = 2
                          send_error           = 3
                          user_canceled        = 4
                          OTHERS               = 5.
          IF sy-subrc = 0.
            i_otf = ls_job_info-otfdata[].
          ENDIF.
          CALL FUNCTION 'CONVERT_OTF_2_PDF'
       EXPORTING
         USE_OTF_MC_CMD               = 'X'
         ARCHIVE_INDEX                =
           IMPORTING
             bin_filesize                 =   w_i_size
            TABLES
              otf                          =  i_otf
              doctab_archive               =  i_docs
              lines                        =  i_lines
       EXCEPTIONS
         ERR_CONV_NOT_POSSIBLE        = 1
         ERR_OTF_MC_NOENDMARKER       = 2
         OTHERS                       = 3
          IF sy-subrc  Eq 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    Transfer the 132-long strings to 255-long strings
          LOOP AT i_lines INTO wa_lines.
            TRANSLATE wa_lines USING '~'.
            CONCATENATE gd_buffer wa_lines 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.
          CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
            EXPORTING
              input_length = w_i_size
              first_line   = 0
              last_line    = 0
            IMPORTING
              buffer       = w_xstr
            TABLES
              binary_tab   = it_mess_att
            EXCEPTIONS
              failed       = 1
              OTHERS       = 2.
          IF sy-subrc  Eq 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
    pdf_content = cl_document_bcs=>xstring_to_solix( ip_xstring = w_xstr ).
        -------- create persistent send request ------------------------
          send_request = cl_bcs=>create_persistent( ).
        -------- create and set document -------------------------------
        create document from internal table with text
         APPEND 'Hello world!' TO text.
          document = cl_document_bcs=>create_document(
                          i_type    = 'RAW'
                          i_text    =  text
                          i_length  = '21'
                          i_subject = 'FORM TEST' ).
    **add attachment to document
          CALL METHOD document->add_attachment
            EXPORTING  i_attachment_type    = 'PDF'
                       i_attachment_subject = 'MY ORDER CONFIRMATION'
                      i_attachment_size    = W_len
                       i_att_content_hex   = pdf_content .
        add document to send request
          CALL METHOD send_request->set_document( document ).
        --------- set sender -------------------------------------------
        note: this is necessary only if you want to set the sender
              different from actual user (SY-UNAME). Otherwise sender is
              set automatically with actual user.
         sender = cl_sapuser_bcs=>create( sy-uname ).
         CALL METHOD send_request->set_sender
           EXPORTING
             i_sender = sender.
        --------- add recipient (e-mail address) -----------------------
        create recipient - please replace e-mail address !!!
          recipient = cl_cam_address_bcs=>create_internet_address(
                                            'give email address here' ).
        add recipient with its respective attributes to send request
          CALL METHOD send_request->add_recipient
            EXPORTING
              i_recipient = recipient
              i_express   = 'X'.
          recipient = cl_sapuser_bcs=>create( sy-uname ).
          CALL METHOD send_request->add_recipient
            EXPORTING
              i_recipient = recipient
              i_express   = 'X'.
        ---------- send document ---------------------------------------
          CALL METHOD send_request->send(
            EXPORTING
              i_with_error_screen = 'X'
            RECEIVING
              result              = sent_to_all ).
          IF sent_to_all = 'X'.
            WRITE text-003.
          ENDIF.
          COMMIT WORK.
    *                     exception handling
    * replace this very rudimentary exception handling
    * with your own one !!!
        CATCH cx_bcs INTO bcs_exception.
          WRITE: text-001.
          WRITE: text-002, bcs_exception->error_type.
          EXIT.
      ENDTRY.
    ENDFORM.                    "main
    Regards,
    Rama.

  • How to populate a table by sending a csv attachment to a particular mail id

    Hi Experts,
    I have to populate a table in the database by sending a csv attachment to a particular mail id.
    Eg:
    I have a table , test
    with fields: name, designation, address
    and i am sending a csv attachemnt with the values , name, designation, address to a generic email id say : [email protected]
    my table -test should be populated automatically with the values from the attached csv.
    Any idea how this can be achieved ?
    Regards,
    Archana

    Hi,
    Why cant you try uploading the data in your csv file to your table by using external table concepts? This would help you much i beleive.
      CREATE TABLE "EXT_EMP_TEST"
       (     "EMPNO" NUMBER,
         "EMPNAME" VARCHAR2(20 BYTE),
         "JOB" VARCHAR2(20 BYTE)
       ORGANIZATION EXTERNAL
        ( TYPE ORACLE_LOADER
          DEFAULT DIRECTORY "DUMP_DIR"
          ACCESS PARAMETERS
          ( RECORDS DELIMITED BY NEWLINE
               BADFILE 'emp.bad'
                          LOGFILE 't.log_xt'               
                          FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY ' " ' LDRTRIM
                          REJECT ROWS WITH ALL NULL FIELDS
                "EMPNO",
              "EMPNAME",
              "JOB"                                                                         
          LOCATION
           ( 'emp_det.dat'
       REJECT LIMIT UNLIMITED;
    {code}
    In the above code, default directory is the place where the file resides in your server. So before creating an external table you need to follow the below steps,
    1. Create a default directory.
    2. Place your file into that directory.
    3. Create an external table using the above script.
    4. Just execute the simple select statement upon that external table, {code} select * from EXT_EMP_TEST {code}
    *NOTE: In the above exaple i have used .dat file to load the data, you need to specify .csv over there*
    Regards,
    Sakthi.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Receive CSV attachment via Mail Adapter and process into ABAP proxy

    Hi,
    I have the following scenario:
    1. Receive e-mail with CSV attachment
    2. Process through Mail adapter (KeepAttachments = Yes in order to retain the CSV attachment)
    3. Receive into ABAP proxy (with CSV attachment)
    The next step is to read the attachment in the ABAP proxy and process the CSV attachment data into CRM.
    The CSV attachment contains the data I wish to process - the body of the e-mail will not contain this information.
    The problem I have is reading the attachment data in the proxy - not sure of the methods/class to call - anyone got any ideas ?
    Another question is this the best way to do this and process the CSV attachment data ?
    I know I could use the PayloadSwapBean to switch the payload to the attachment but then I am stumped with how the attachment is processed through PI 7.1 - how do you transform the CSV format payload into XML so PI will be able to process it through mapping.
    Either option is viable - an answer to either question would be great.
    1. How do you read the attachment data in an inbound ABAP proxy ?
    2. How do you transform the CSV attachment data after the PayloadSwapBean from CSV to XML ?
    Kind regards
    Colin.

    Hi Colin
    As you are not interested in processing the body of email. Swap the payload to the attachment using the PayloadSwapBean
    Change the content from CSV to XML using MessageTransformBean. Now pass this information to Proxy. You dont need to deal with attachments in proxy.
    It is not possible to read attachment in server proxy because the class and interface you create will not have data type which can refer to an attachment processing interface in ABAP.
    Thanks
    Gaurav

  • Navigation in JSF when downloading the results to CSV .. html in CSV files

    Hi,
    I am new to JSF and am struggling with navigation.
    I tried using CommandLink and CommandButton to invoke the action in the backing bean.
    I am either getting html code written in the .CSV file or the click on the
    link is working in alternate attempts.. Please respond as soon as possible
    Below is the code in the backing bean :
    public String getHardCopyContactsFilterResultsAsCSV(){
              this.setFilterReportPrefId("HARDCOPY");
              FacesContext context = FacesContext.getCurrentInstance();
              HttpServletResponse response = (HttpServletResponse) ectx.getResponse();          
              response.setHeader("Content-disposition",
              "attachment; filename=Hard Copy Contacts Fliter Results Report.csv");
         E contec     response.setContentLength(getHeaderForFliterResultsReport().length());
              response.setContentType("application/text");     
              //response.getWriter();
              try {
              response.getOutputStream().write(getHeaderForFliterResultsReport().getBytes());     
              if(this.hardcopyResultsDTO!=null){
                   response.getOutputStream().write(getHardCopyContactsForFilterReport().getBytes());
              response.getOutputStream().flush();
              response.getOutputStream().close();
              //context.responseComplete();
              } catch (Exception e) {          
              e.printStackTrace();
              return "temporaryPage";
    Note:: I Tried to comment and uncomment the context.reponseComplete() .
    Case A:)When The above line is commented i.e responseComplete is called what I am observing is once I click the link to view the Results as .CSV First time I am able to save the results once I try to clik the se cond time the page is getting refreshed rather than opening the dialog as shown for the first attempt.
    Every alternate attempt it is working as required i.e opening a dialog.
    Case B:
    Here the line responseComplete is commented. So when click on link every time a dialog opens
    But what I see in te saved .CSV file is the Html code also rendered after the results written in the JSP

    Appreciate your response. Thank you.
    Yes, I did make the bean action method as void and also did FacesContext#responseComplete. But here the problem is on the first click it opens the CSV but on the second click the page is getting refereshed . So ever alternate click on the link opens the CSV,
    I am using the link in the jsp emmbed in the tabbed pane, I am providing the code in the tabbed pane as well the code to invoke the link..
    Tabbed pane code :::>>>>
    <h:form id="czAnnmtFilterReportOnlineForm">
         <t:panelTabbedPane id="czAnnmtFilterPane" bgcolor="#FFFFCC" activeTabStyleClass="editorPane_activeTab" inactiveTabStyleClass="editorPane_inactiveTab" tabContentStyleClass="editorPane_tabContent" >
    <t:panelTab id="allResults" label="All Contacts" title="All Contacts" >
              <jsp:include page="CzAnnmtFilterAllReport.jsp"/>
         <t:panelTab id="hardCopyResults" label="Hard Copy Contacts" title="Hard Copy Contacts" >
              <jsp:include page="CzAnnmtFilterHardCopyReport.jsp"/>
         </t:panelTab>
    Code to perform the action of view Results as .csv in CzAnnmtFilterHardCopyReport.jsp
    <h:commandLink styleClass="c14_green_under" value ="View Hard Copy Contact Results as .csv" action="#{announcementBackingBean.getHardCopyContactsFilterResultsAsCSV}" rendered="#{!empty announcementBackingBean.hardcopyResultsDTO}"/>
    Please let me know the nest approach to solve this problem
    That is the reson I was trying other approaches of fowarding to another page in the faces Context but even then
    I am not succesful.

  • Why cant I send a vid clip via email, it just won't attach ?

    Why can't I send a vid clip via email, it just won't attach ?

    You could compress it by creating a zip file - right click on the file and then select 'Compress' - a zip file will be created. Although when you're compressing a single file the resulting .zip files tends only to be a litlle small than the original.
    A much better alternative would be to sign up for dropbox.com - which literally puts a folder on a desktop that syncs with 'the cloud'. Then you can share your files from there (as well as have them available form any browser whereever you are!. It's super easy to use - but really useful!

  • How do you email poll results?

    How do you email poll results?

    sorry about the typo error on the p.s
    i have attached my vi with an excel file with my measurements i am talking about.the first column goes from segment 1-35 while the second column goes from 1-42.
    i want to compare these 2 columns on the same time axis
    Attachments:
    segment analysis.xls ‏24 KB
    Testing Cepstrum Algo.vi.vi ‏201 KB

  • I have created a form in InDesign, exported to a pdf, created an editable form and saved.  When I open the form and make changes and save, the reopen the changes are there.  If try to email this form as an attachment after editing, the attachment is alway

    I have created a form in InDesign, exported to a pdf, then created an editable form and saved.  When I open the form and make changes and save, then reopen the changes are there.  If try to email this form as an attachment after editing, the attachment is always minus the edits.   ????

    Hi chuck,
    If you ave created the form and then filling it yourself and saving the form, the filled data should be there when you reopen the same form.
    Can you please send the form to me at [email protected]  so that I can have a look.
    Regards,
    Rave

  • How can I have a newsletter I created in PDF appear in the body of an email I send, rather than attach it.

    How can I get a newsletter created in PDF format to appear in the body of an email I send, rather than attach it.

    You cannot. (A few email programs might show it automatically; you cannot stop that either).

  • I need to remove an AOL email account that is not attached to my Apple ID.  This is on an iPAD.  It is not showing in Accounts.  However, I cannot delete the mailbox,. Please advise

    I need to remove an AOL email account that is not attached to my Apple ID.
    I am receiving email and I cannot delete the mailbox. Please advise.
    the account is not viewable in settings.

    I am assuming that this mail is coming into the Mail App, not another third party app, correct?
    Is the AOL account showing up as its own mailbox in the mail app? (e.g. I see "All inboxes", "iCloud", and a third mailbox that is my second email address.)
    Every "mailbox" except the "all inboxes" are going to be in the settings under mail, Contacts and calendars.
    If the mail is coming into a mailbox that isnt the AOL mailbox, then it sounds like you have your AOL mail being forwarded to another email adress.

  • FILE- EMAIL with pdf as an attachment and message body.

    I have a scenario where FILE to EMAIL with PDF as an attachment; I also need to send to have Email body with some text. For this i have tried using Mail Package then i wont be receiving any attachment. If I use both Mail package + Keep attachments i do not see any attachments in mail.
    Let me know  the possible ways that can used in the current scenario where i need to send pdf attachment along with messsage body.
    Thanks in advance,
    nik

    Hi Nik
    To get the customized email body you need to use the Mail package. Keep attachments tab should be selected
    Now sending PDF attachment - Do you need to send data passed by File adapter as pdf attachment or File adapter is reading message other than this attachment.
    Case 1. File adapter send message that you need to send as email attachment. Then using mail package use
    <content_type>application/pdf</content_type>
    you can even add name of the file going as an attachment.
    <content_type>application/pdf;name="filename.pdf"</content_type>
    Secondly you can use the MessageTransformBean at communication channel as an additional standard module.
    Case2: You need to pick file from file adapter as attachment. that is possible only when you use NFS with this file you read as source and attachment has be of same name type eg: you read input.txt then attachment has to be input.pdf
    Thanks
    Gaurav
    Edited by: Gaurav Bhargava on Oct 7, 2008 5:46 AM

Maybe you are looking for