How to send report output from SUBMIT statement

Hi,
I need to develop one report whcih can be use to send any report output in mail as attachment in txt of execl format. So i will be using SUBMIT statement to execute the report in my new report and i need to convert the reportout in txt or excel format and need to send as attachment in mail. This new report can be use to execute any report which may have ALV GRid, Normal outout screen. So what could be the best way to develop this kind of report.
Br,
Piyush

>
piyush mathur wrote:
> Hi Suhas,
>
> LIST_TO_ASCI will give me data in lines. and its difficult to separate the columns in another internal table for attachment file. As this report is going to use to send any report output so i can not fixed the delimiter. So i am looking some function which can split the data in columns when I am reading from List.
> Br,
> Piyush
No need to seperate nothing additionally, this will come automatically in the attached file. Draft below
DATA list_tab TYPE TABLE OF abaplist.
SUBMIT your_report EXPORTING LIST TO MEMORY
              AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
  TABLES
    listobject = list_tab
  EXCEPTIONS
    not_found  = 1
    OTHERS     = 2.
DATA string_tab TYPE list_string_table.
"use table type appropriate for attchement
DATA ascii_tab TYPE soli_tab.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
   listasci                 = ascii_tab
   listobject               = list_tab.
CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    filename = 'C:\test.txt'
    filetype = 'ASC'
  TABLES
    data_tab = ascii_tab.
DATA go_email_doc TYPE REF TO cl_document_bcs.
go_email_doc = cl_document_bcs=>create_document(
                                      i_type = 'TXT'
go_email_doc->add_attachment( i_attachment_type = 'TXT'
                              i_attachment_subject = 'My Attachment'
                              i_att_content_text = ascii_tab ).
Regards
Marcin

Similar Messages

  • Very urjent how to send report output in mail

    hi experts,
    how to send report output in mail which function module should i use wht parameters should i pass.
    thanks in addavnce,
    points to be awarded.

      CALL FUNCTION 'GET_PRINT_PARAMETERS'
           EXPORTING
                destination    = '026c'
                copies         = count
                list_name      = 'VATS_ASBUILT'
                list_text      = v_list
                immediately    = 'X'
                release        = 'X'
                new_list_id    = 'X'
                expiration     = days
                line_size      = 132
                line_count     = 65
                layout         = 'X_65_132'
    *            sap_cover_page = 'X'
    *            cover_page     = 'X'
                receiver       = 'SAP*'
                department     = 'VATS'
                no_dialog      = 'X'
           IMPORTING
                out_parameters = params
                valid          = valid.
      SUBMIT zppr_vats_asbuilt  WITH p_aufnr EQ v_aufnr
                   TO SAP-SPOOL WITHOUT SPOOL DYNPRO
                      SPOOL PARAMETERS params
                         AND RETURN.
      SELECT SINGLE rqident FROM tsp01 INTO l_spoolno
                         WHERE rqtitle = v_list .
    * convert report to PDF format
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = l_spoolno
                no_dialog                = 'X'
           TABLES
                pdf                      = l_ipdf
           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.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        EXIT .
      ENDIF.
    Now comes the part to send the mail
      try.
    * -------- create persistent send request ------------------------
          send_request = cl_bcs=>create_persistent( ).
          clear document.
    * -------- create and set document with attachment ---------------
    * create document from internal table with text
          document = cl_document_bcs=>create_document(
          i_type = 'RAW'
          i_text = text
          i_length = '12'
          i_subject = '' ).
    *changing the content of the attachment
          binary_content[] = l_iobjbin[].
    *change the name of the PDF attachment
          concatenate 'Build ID' s_buildid_i 'Rev' v_buildid_rev
                              into i_att_sub separated by space.
    * add attachment to document
          call method document->add_attachment
            exporting
              i_attachment_type    = 'PDF'
              i_attachment_subject = i_att_sub
              i_att_content_hex    = binary_content.
    *setting the option to send an e-mail more than 50 characters
          call method send_request->set_message_subject
            exporting
              ip_subject = t_sub.
    * add document to send request
          call method send_request->set_document
            exporting
              i_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( 'VATSUPPORT' ).
          call method send_request->set_sender
            exporting
              i_sender = sender.
    *Send the list based on receivers list obtained
          loop at l_ireclist.
            AD_SMTPADR = l_ireclist-receiver.
    * --------- add recipient (e-mail address) -----------------------
    * create recipient - please replace e-mail address !!!
          recipient = cl_cam_address_bcs=>create_internet_address(
          AD_SMTPADR ).
    * add recipient with its respective attributes to send request
          call method send_request->add_recipient
            exporting
              i_recipient = recipient
              i_express   = 'X'.
          ENDLOOP.
          call method send_request->set_status_attributes
            exporting
              i_requested_status = 'E'
              i_status_mail      = 'E'.
    * To send the mail immediately
          call method send_request->set_send_immediately( 'X' ).
    * ---------- send document ---------------------------------------
          call method send_request->send( ).
          commit work.

  • How to send report output to  two  detinations at a time from command line?

    Hi ,
    how to send my report to two detinations at a time from command line i.e FILE and Mail ?
    i created batchfile in that i mentioned one line for file(DESTYPE=FILE) perpose and another line for mail perpose(DESTYPE=Mail).i don't want to mention to lines.
    i want to send my report out put two destinations at a time insted of running two times.
    thx in advance.....
    raghu

    hello,
    did you try to use distribution for that ? check out the reports distribution facilities available in 6i.
    regards,
    the oracle reports team

  • How to send report output to printer

    Hi,
    In Oracle applications one of my AR report has printer parameter
    when user submitting the request he needs to choose the printer name for that
    parameter then this report output needs to go to automatically to that printer after completion of report.
    Do I need to change report system parameter values for this?
    Could you help me in this?
    Thanks in advance.

    Hi,
    If you use ORARRP, you reports will automatically go to the default printers.
    Regards,
    Soumyajit

  • Does anyone know how to convert the output from the standard report to xml?

    Does anyone know how to convert the output from the standard SAP report to xml?

    since it a standard report which you cannot modify you can only do the following.
    submit report exporting list to memory
    then
    list from memory and then
    use the returned itab along with CALL TRNSFORMATION key word to convert to xml.
    but this only going to place the whole list content (including data and formating lines,etc) into a xml element and not the actual data alone in the list .

  • How to send the output to PDF format in reports 6i?

    Hi,
    How to send the output to PDF format in reports 6i? I given Mode = BITMAP.
    DESTYPE = File, DESFORMAT = PDF, DESNAME = C:\x.pdf.
    Report is running fine. But PDF file not generated. I don't know what i missed. Any one can help this?
    Thanks
    Kavitha

    Hello,
    Do you get this problem only for DESFORMAT=PDF ?
    Test with :
    DESFORMAT = RTF, DESNAME = C:\x.rtf
    or
    DESFORMAT = HTMLCSS, DESNAME = C:\x.html
    does it work ?
    Check if DESNAME is modified in the reports itself.
    Regards

  • How To Send ALV Output By Email.

    Hi !
    I wanted to ask how to send ALV output of report by email.
    I know that i have to use the fms :
    1. 'WWW_HTML_FROM_LISTOBJECT' - in order to convert the table to HTML.
    2. 'SO_NEW_DOCUMENT_ATT_SEND_API1' - in order to  send the HTML file.
    My problem is how to convert the ALV screen output to the apropriate table parameter of the function 'WWW_HTML_FROM_LISTOBJECT' to listobject type ?
    thanks
    moshe

    Hi look at the following program.
    *& Report  ZSM17_EMAIL1
    REPORT  zsm17_email.
    tables : mara.
    data: begin of it_mara occurs 0,
          matnr like  mara-matnr,
          ernam like mara-ernam,
          mtart like mara-mtart,
          matkl like mara-matkl,
          end of it_mara.
    data: begin of it_final occurs 0,
          v_string(255),
          end of it_final.
    *DATA: objpack LIKE sopcklsti1 OCCURS  2 WITH HEADER LINE,
         objhead LIKE solisti1   OCCURS  1 WITH HEADER LINE,
         objbin  LIKE solisti1   OCCURS 10 WITH HEADER LINE,
         objtxt  LIKE solisti1   OCCURS 10 WITH HEADER LINE,
         reclist LIKE somlreci1  OCCURS  5 WITH HEADER LINE.
    DATA: objpack LIKE sopcklsti1 OCCURS  0 with header line,
          objhead LIKE solisti1   OCCURS  0 WITH HEADER LINE,
          objbin  LIKE solisti1   OCCURS 0 WITH HEADER LINE,
          objtxt  LIKE solisti1   OCCURS 0 WITH HEADER LINE,
          reclist LIKE somlreci1  OCCURS  0 WITH HEADER LINE.
    data: wa_objbin like line of objbin.
    DATA: doc_chng LIKE sodocchgi1.
    DATA: tab_lines LIKE sy-tabix.
    select-options s_matnr for mara-matnr.
    *--- Selecting data from mara
    select matnr
           ernam
           mtart
           matkl
           into table it_mara
           from mara
           where matnr in s_matnr.
    if sy-subrc ne 0.
    write:/ 'no data found'.
      exit.
    else.
    loop at it_mara.
       concatenate it_mara-matnr
                   it_mara-ernam
                   it_mara-mtart
                   it_mara-matkl
         into it_final-v_string separated by '~'.
        append it_final.
        clear it_final.
    endloop.
    endif.
    Creating the document to be sent
    doc_chng-obj_name = 'TEST'.   "name of the document
    title of document or subject
    doc_chng-obj_descr = 'Test Email program'.
    body of the mail
    objtxt = 'A test report'.
    APPEND objtxt.
    objtxt = 'is enclosed as an attachment.'.
    APPEND objtxt.
    *clear objtxt.
    DESCRIBE TABLE objtxt LINES tab_lines.
    Size of SAPoffice Document (for API1)
    doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
    Creating the entry for the compressed attachment
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num   = 0.
    objpack-body_start = 1.
    objpack-body_num   = tab_lines.
    objpack-doc_type   = 'RAW'.
    *objpack-obj_name   = 'ATTACHMENT'.
    *objpack-obj_descr = 'Test Email Program'.
    *objpack-doc_size   = tab_lines * 255.
    APPEND objpack..
    *--- Populating the records in the attachment
    data: w_str(255) TYPE c.
    loop at it_final into wa_objbin.
    append wa_objbin to objbin.
    append objbin.
    clear wa_objbin.
    endloop.
    DESCRIBE TABLE objbin LINES tab_lines.
    tab_lines = tab_lines + 1.
    objhead = 'test_report.txt'.
    append objhead.
    Creating the entry for the compressed attachment
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num   = 1.
    objpack-body_start = 1.
    objpack-body_num   = tab_lines.
    objpack-doc_type   = 'txt'.
    objpack-obj_name   = 'txt'.
    objpack-obj_descr = 'Test Email Program'.
    objpack-doc_size   = tab_lines * 255.
    APPEND objpack..
    *write:/ 'object text', objtxt.
    Entering names in the distribution list
    reclist-receiver = '[email protected]'.
    reclist-rec_type = 'U'.
    APPEND reclist.
    Sending the document
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data              = doc_chng
        put_in_outbox              = 'X'
        commit_work                = 'X'
      TABLES
        packing_list               = objpack
        object_header              = objhead
        contents_bin               = objbin
        contents_txt               = objtxt
        receivers                  = reclist
      EXCEPTIONS
        too_many_receivers         = 1
        document_not_sent          = 2
        operation_no_authorization = 4
        OTHERS                     = 99.
    CASE sy-subrc.
      WHEN 0.
        WRITE: / 'Result of the send process:'.
        LOOP AT reclist.
          WRITE:  reclist-receiver(48), ':'.
          IF reclist-retrn_code = 0.
            WRITE 'sent successfully'.
          ELSE.
            WRITE 'not sent'.
          ENDIF.
        ENDLOOP.
       loop at objbin.
         write: objbin-line.
       endloop.
      WHEN 1.
        WRITE: / 'no authorization to send to the specified number of' .
        "'recipients!'.
      WHEN 2.
        WRITE: / 'document could not be sent to any of the recipients!'.
      WHEN 4.
        WRITE: / 'no authorization to send !'.
      WHEN OTHERS.
        WRITE: / 'error occurred during sending !'.
    ENDCASE.

  • Changing the seeded rdf report output from text to PDF

    Hi All,
    I am trying to change the seeded report "Print Requisition Report" output from text to PDF. I changed the output format in the concurrent program definition from text to pdf. The report is now getting displayed in pdf format, but the alignment of the fields are changed. The output is not printing as it was printing while in the text output format. The output looks very sloppy, with uneven fonts and too much of text wrapping.
    I tried some formatting and fields are somehow getting displayed but doesnt look in proper format. I am not able to change the font style in the report builder 6i, even if i change it is printing in the same font style with uneven font size. I think reducing the font size might help, but i am unable to change.We are on 11.5.10.2. Please provide your valuable suggestions on how to go about.
    Thanks
    Sarvesh

    Hi Hussein,
    Thanks for the information. After the adjustments in the layout and the font change the report is now getting displayed without any clipping when clicked on view output. But when the same report is printed some characters on the left and and right side is getting clipped. Please help on how to solve this issue.
    Thanks,
    Sarvesh

  • How to send the output of one step as input to next step

    Hello All,
                   I have a question that how to send the output of the first step as the input to the next step.
     for e.g
                  consider a test sequence as below,
      1.battery ON.
      2. read Voltage
      3. Check battery voltage.
     as initially the battery gets ON when ever the test starts. in the second step it reads the voltage. let us assume that the voltage is 11.5V,
    in the third step we r checking/validating that battery voltage in the range 11V to 12 V. . I mean if the vloltage value is  less than 11V or greater than 12V te test has to FAIL.
     so in order to check that voltage we need to send the voltage read from the second step.
    so how can I send the voltage read from the second step to the third step so that I can check the battery voltage test.
    kindly suggest me this using LabVIEW/Test stand.

    Hi,
    Why do you need the third step, if the second step is a Numeric Limit Test step type, you can setup the limits of this step for your required limits of 11V and 12V. Your result is returned from your VI to Step.Results.Numeric which will be evaluated in the Status Expression giving you a Pass / Fail status.
    Look at the example TestStand\examples\demo\..\Computer Motherboard Test\computer.seq
    But to answer your reoriginal question, some additional information is required.
    What are your inputs and outputs assigned to in TestStand, do you use the Step properties, Locals, FileGlobals?
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • How to export report output into excel.

    Hi all
    how to export report output into excel sheet can any on give me answer step by step please as soon as possible
    kk

    Hi Prashanth,
    If you are executing Query from WAD  ---> Right click on Table (only on Characteristics Data)  --> Enhanced Menu ---> Export as --> CSV file or MS Excel
    assign points if this helps,
    Thanks,
    Sudhakar

  • How to call Report output in Modulepools

    hi
    can any one suggest me
    How to call Report output in Modulepools
    i have a push button in modulepool after clicking that pushbutton i need a report output
    how to do this
    Thanks & Regards
    kalyan

    Hi Kalyan,
    From Module pool program you have to go display A Report output..
    So at User-Command of PAI use LEAVE TO LIST PROCESSING.
    Regarding this check the Demo program DEMO_LEAVE_TO_LIST_PROCESSING.
    And for further reference please check this SAP Help
    http://help.sap.com/saphelp_nw70/helpdata/en/9f/db9d2f35c111d1829f0000e829fbfe/frameset.htm
    For more help please check this thread
    Re: LEAVE TO LIST-PROCESSING
    Hope this would help you.
    Good luck
    Narin

  • How to restrict report output?.

    Hi
    how to restrict report output?.
    My Query:
    select a.deptno,b.empno,b.ename,b.hiredate from dept a,emp b
    Based on the following condition i have to generate the report.
    for each record
    if hiredate < '10-oct-03' then
    select count(*) from xyz where abc_date <= emp.hiredate
    else
    select count(*) from xyz where pqr_date <= emp.hiredate
    end if
    if count(*) = 0 then
         generate report
    end if
    end each record

    Hi friend,
    For your case, I think set up an authority-object is suitable.
    You can have a look at this http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/a92195a9-0b01-0010-909c-f330ea4a585c&overridelayout=true
    Good luck,
    Thanks,

  • Discoverer report - Output from Discoverer plus is not the same as Discoverer desktop

    As a part of Upgrade project we are migrating the discoverer reports from 11i (11.5.10.2) to R12 (12.1.3) .After migrating to R12, for a custom discoverer report the output given by discoverer desktop is correct (24 rows for a scenario). But the report output from Discoverer plus does not show the credit transactions (2 rows). The output from Discoverer plus shows only 22 rows (24 - 2), which is incorrect. The query is the same in Discoverer desktop and Discoverer plus.
    Please let me know why these transactions that are appearing when the report is run from discoverer desktop are not appearing in discoverer plus. Is there any setup in discoverer plus for this?
    Regards,
    Brajesh

    Pretty hard to answer a question like this.  Best bet would be to copy the existing discoverer plus book and start removing conditions, fields, etc until those two rows from desktop show up and see if you can work it out. 

  • How to send a file from FTP to external server

    My requirement is to send a file from FTP to D3(External) server.
    Now I am able to store the file in Appln server.
    I want to send the file created by the program thru FTP to D3 server.
    I know the username,Password,HostID,RFC destination details.
    How to send the file from FTP to D3.
    If u have any program,Plz send it...
    I dont want the function modules name...I want the example code ....
    Thanks in advance.

    Hi Sumi,
    You could do it so that you create a .bat or .cmd script to your server which does your ftp transfer.
    To do this you must use sm69 to create a external operating system command which you can call from FM SXPG_COMMAND_EXECUTE. To SXPG_COMMAND_EXECUTE you the file you need to transfer as a parameter.
    What happens is that your abap program passes the file to windows batch script (.bat .cmd) which will then do the transfer for you.
    Here's a sample of ftp-script for windows:
    echo open IP_ADDRESS_TO_YOUR_SERVER > c:zftp_transfer.ftp
    echo USERNAME>> c:zftp_transfer.ftp
    echo PASSWORD>> c:zftp_transfer.ftp
    echo put YOUR_FILE>> c:zftp_transfer.ftp
    echo quit>> c:zftp_transfer.ftp
    ftp -s:c:zftp_transfer.ftp
    also take a look here for more details:
    http://support.microsoft.com/?kbid=96269
    Ok, this might be a bit trivial but if your server is unix/aix etc.. Instead of using batch script you must do a shell script.
    Regards,
    Ville

  • How to send the data from mac pc to External drive

    how to send the data from mac pc to External HDD
    or Pen Drive but with out deleting the preview as data

    You can use "Finder", which is in your dock, to copy files from your iMac folders over to the external hard drive.
    Hope this helps

Maybe you are looking for

  • Windows 8.1 erasing and changing files with chkdsk on external drives. Unnaceptable.

    I work for IT support for a small production studio. They use Windows 7 and Windows 8.1 for they workstations and linux on the rendering farm. There is an automated system with a nas to make backups of the production assets and renderings. They have

  • From keynote slides to saved pictures

    How do I take an email with a powerpoint/keynote presentation and save the individual slides in iPhoto?

  • EA3:  Unable to See the contents in Materialized Views

    I have been using sql developer 1.2.1. I exported my connections as an xml and imported it in EA3 Version 1.5.0.53. In Version 1.2.1, I am able to see the tables under Materialized Views, but in EA3, If I click on the folder which says "Materialized

  • 10g Download for standalone PC

    I want to get to grips with the 10g Db and JDeveloper and therefore intend to do some research on my home PC to get an understanding of the products. I've got a couple of questions. 1. Will J2EE work with access directly to a DB on the same PC, no ap

  • Xsql-011  error   FOP

    hello, i run my app in jdeveloper 902 using a xsql-file and xsl-file . i get the message above. who can help me ? thx Oracle XDK Java 9.2.0.4.0 Production XSQL-011: Error processing XSLT stylesheet: createFOP.xsl file:/C:/oracle/ora902/jdev/jdev/mywo