Block List ALV Output Send As Email Attachment

Hi,  All The ABAP Gurus,
I have made a block ALV Report. I want that this output should be converted into .xls with HTML format and this should be send in email as attachment. This all will be made in a background job which will be scheduled daily.
How can I achieve this? I know that the output of classical report can be attached as pdf in email.But I want in Block ALV.
Thanks in Advance.
Regards,
Bharti Jain
Edited by: Bharti Jain on Jun 28, 2011 10:20 AM

Hi
Not 100 percent sure what you want to do here.  I am confused by the .xls in html format.   If you want the output in html you can submit the program and export the list to memory,  Then retrieve the list and convert it to html.  i have done this with the program 1sdbf12l/rv14akzy . see code below.  This converts the output to html, you are left with a binary itab and size at the end of the routine and this can be attached to an email.
Submit Program and export the list to Memory
SUBMIT /1sdbf12l/rv14akzy USING SELECTION-SCREEN '1000'
  WITH SELECTION-TABLE lt_params_new EXPORTING LIST TO MEMORY AND RETURN.
  CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
      listobject = lt_list
    EXCEPTIONS
      not_found  = 1
      OTHERS     = 2.
Convert the List to html
  IF sy-subrc = 0.
    DATA: it_html TYPE TABLE OF bapihtml WITH HEADER LINE,
          it_html_out TYPE TABLE OF bapihtml WITH HEADER LINE,
          lt_html TYPE TABLE OF bapihtml WITH HEADER LINE,
          lv_html LIKE LINE OF it_html,
          lv_html_out TYPE string.
    DATA: lv_html_tab_wide(50000) TYPE c.
    DATA: lineno TYPE i, length TYPE i, size TYPE i.
    DATA: gui_codepage(4) TYPE n,        " added for message 500824
          is_unicode TYPE rststype-sel_ok.
    DATA: convert_output TYPE xstring,
          convert_buffer TYPE xstring.
    CALL FUNCTION 'LIST_FREE_MEMORY'
      TABLES
        listobject = lt_list.
    CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
         EXPORTING
              REPORT_NAME   =
              template_name = 'WEBREPORTING_REPORT'
         TABLES
              html          =  it_html
              listobject    =  lt_list.
    DESCRIBE TABLE it_html LINES lineno .
    DESCRIBE FIELD it_html LENGTH length IN BYTE MODE.
    size = length * lineno.
    CALL 'CUR_LCL' ID 'GUICP'  FIELD gui_codepage.
    CALL FUNCTION 'SCP_GET_CODEPAGE_PROPERTIES'
      EXPORTING
        codepage         = gui_codepage
      IMPORTING
        can_unicode      = is_unicode
      EXCEPTIONS
        codepage_unknown = 1.
    IF sy-subrc <> 0.
      CLEAR gui_codepage.
    ENDIF.
    IF is_unicode EQ 'X'.         "in case of unicode, always use utf-8
      gui_codepage = '4110'.
    ENDIF.
    CLEAR: convert_output, convert_buffer.
    LOOP AT it_html INTO lv_html.
      REPLACE ALL OCCURRENCES OF c_bg_def IN lv_html WITH c_bg_white.
      CALL FUNCTION 'SCP_TRANSLATE_CHARS'
        EXPORTING
          inbuff           = lv_html
          outcode          = gui_codepage
          csubst           = 'X'
          substc_space     = 'X'
        IMPORTING
          outbuff          = convert_output
        EXCEPTIONS
          invalid_codepage = 1
          internal_error   = 2
          cannot_convert   = 3
          fields_bad_type  = 4
          OTHERS           = 5.
      IF sy-subrc <> 0.
       message i020 raising download_error.
      ENDIF.
      CONCATENATE convert_buffer convert_output INTO convert_buffer IN
      BYTE MODE.
      CONCATENATE lv_html_out lv_html INTO lv_html_out.
    ENDLOOP.
    ev_html_string = lv_html_out.
    i = 0.
    DESCRIBE FIELD html_tab_converted LENGTH tablength IN BYTE MODE.
    WHILE i < XSTRLEN( convert_buffer ).
      dummy = XSTRLEN( convert_buffer ) - i.
      IF tablength > dummy.
        html_tab_converted-line = convert_buffer+i(dummy).
      ELSE.
        html_tab_converted-line = convert_buffer+i(tablength).
      ENDIF.
      i = i + tablength.
      APPEND html_tab_converted.
    ENDWHILE.
    et_bin[] = html_tab_converted[].
    ev_bin_size = size.

Similar Messages

  • Top of page in Block list ALV

    HI,
    I have a Requirement where i have a Block list ALV . I have 4 blocks to be Displayed in the output and the output has to be transfered to the PDF.
    I am able to get the 4 blocks in the output and the Top of Page for the Report in each page.
    But the Problem is when i download the output containing the top of page of output with 4 blocks into a PDF.
    I want the Top of page of Report to be the Top of Page of the PDf also.
    In PDF the Top of page of Report is coming in the center of the PDF also in some other places also.
    How to make sure the Top of page of Report comes in the top of the PDf
    Can you kinldy help me in this.
    Thanks,
    Gokul

    Duplicate post.
    Reported.

  • Regarding Excel Download in Block list ALV

    Hi Abaper's,
    I am facing with one problem during downloading of the BlockList ALV.
    <b>If I click on the standart toolbar  'local file button '( ctrl + shift + F9) it is downloading the ALV data into the excel file but the ALV header information starts from column 1 and ALV data information starts from the 2nd column.</b>
    Please suggest me is it the expected functionality of the Block List ALV or I have written wrong code. Please suggest me.

    I think there is something wrong with the output...maybe you should check your fieldcatalog wheter it matches to the structure of your internal table of data you want to show.
    Normally you should get an output per column with the fieldnames in the first line starting with 1st column and the data starting in 2nd line starting with 1st col.
    hope that helps you off, please award if useful!
    Clemens

  • Error 829 in SOST tcode while sending an email attachment ??

    Hi..
    I am using the function module "SO_NEW_DOCUMENT_ATT_SEND_API1" to send an email attachment.
    The program is getting executed successfully but when i see in SOST transaction, i am getting an error message.
    Error number is 829 and it says " Internal error: SO_OBJECT_MIME_GET Exception: 2 "...
    How do i resolve this error   ....??

    Hi,
    Please check this links will help you.
    Error in SOST transaction for Mail Triggered from SAP
    Re: need help in implementing a note

  • I do not want BCC names listed when I send an email

    I do not want BCC names listed when I send an email.

    Bcc: means BLIND Carbon Copy. These Addressees will receive a copy of the email, but other recipients will not see their names.
    Try sending the email to your own Address to see exactly what it will look like.
    If it is not satisfactory, you may have to BBC to a LIST.

  • Report output as an email attachment

    Hi ,
    I am sending report output as email attachment by using 'mail recipient ' CLTR+ F7' option in alv list.
    But this is sending mail as pdf attachment. I want it as excel format.
    Is there any option to change type of attachment which sending mail?

    Hi,
    This is not possible to change the filetype of the attachment. Instead you can have your own functionality in the program to send email with excel attachment
    Refer to this link..http://docs.google.com/Doc?id=dfv2hmgs_0fm22tggx&hl=en

  • Send pdf email attachment

    Hi,
    I m running the custom concurrent program through pl-sql code and sending the output of the same conc program on to the email id of vendor.
    When i was tryng to send the output in text file it was allowing me to send the text message as well as attachment.
    But with the same code I want to send the pdf output.
    so earlier I was using the UTL_MAIL.send_attach_varchar2 .
    And for pdf attachment I am using the UTL_MAIL.send_attach_raw.
    So custom program is generating the output but
    while sending an email, it is not attaching the output into the email.
    What could be the problem.
    Please help as I needed it urgently.
    revert me if anyone has any query.
    Thanks,
    Bluetooth_25

    No it's not generating the .pdf file.
    It's only generating the .out file.
    so is that the possibility that it is not attaching the pdf in email.
    Here is my code:
    /*Variable declaration*/
    fhandle UTL_FILE.file_type;
    flen NUMBER;
    bsize NUMBER;
    ex BOOLEAN;
    vtextout RAW (32767);
    UTL_FILE.fgetattr ('EMAIL_OUTPUT','o'||v_request_id ||'.out',ex,flen,bsize);
    fhandle := UTL_FILE.fopen('EMAIL_OUTPUT','o'||v_request_id ||'.out', 'r');
    LOOP
    BEGIN
    UTL_FILE.get_raw (fhandle,vtextout,flen);
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    EXIT;
    END;
    END LOOP;
    UTL_FILE.fCLOSE(fhandle);
    FOR email_rec in c2_vendor_email_add(po_rec.po_header_id)
    LOOP
    UTL_MAIL.send_attach_raw
    sender => '[email protected]',
    recipients => email_rec.email_address,
    subject => 'Testmail',
    MESSAGE => 'This is test mail',
    attachment => vtextout,
    att_mime_type =>'application/pdf',
    att_filename =>'o'||v_request_id ||'.out'
    and i have one more question how to send an email to multiple recipients using utl_mail.send_attach_raw

  • .pdf is missing when send as email attachment (Outlook) from Adobe Reader 11.0.06

    The PDF is streamed from our webserver application to an IFRAME in Internet Explorer 9.
    The headers Content-type (application/pdf), Content-disposition (random-unique-filename.pdf), Content-length are all set.
    Acrobat Reader plugin opens up inside the IFRAME and presents the PDF without problems.
    When our users try "Send file as email attachment" Outlook 2010 opens up and the file is attached - without the file extension.
    The name of the attachment is the same name as the Java Servlet that delivered the streamed file.
    If we save the streamed PDF to disc, open it in Acrobat and do the same maneuver - the file extension is added to the attached file name in Outlook.
    Message was edited by: Solson

    We have the same problem !
    Tested this today with adobe reader 9.5.x , file is attached as  "filename.do.pdf"
    If we use adobe reader 11.0.x file is attached as "filename.do"
    If you use save file as , it does get the "pdf" extension automatically
    Solution appreciated !

  • Convert spool to PDF and send as email attachment

    When i try to convert SAP spool to PDF and send it as email attachment,  size of PDF document becomes large as compared to size of the PDF cocument i download using the same spool.
    I am using following FMs.
    CONVERT_ABAPSPOOLJOB_2_PDF to convert spool to PDF
    and
    SO_NEW_DOCUMENT_ATT_SEND_API1 to send email with attchment.
    some times size of attchment exceeds 2MB and email results in error in SAP connect (SOST).
    Any idea on how to compress the PDF attchment??
    Thanks

    Hi Venkat,
    Can you plesae assist me.
    I have a requirement to convert spool to pdf
    send an email to users
    issue is that attachement is big cant go through
    I have used compress, but when I open the pdf file error that file was not correclty decoded
    please assist, anyone

  • How do i create a group contact list inorder to send out emails to multiple persons?

    how do i create a contact list for emailing from my iphone4?

    I have created a free iphone application to send group emails, as you cannot do it natively.
    http://itunes.apple.com/fr/app/easy-group/id461469079?mt=8
    Rémi
    Note: I may receive some form of compensation, financial or otherwise,from my recommendation or link.

  • Sending an email attachment for xls file

    Hi all,
    I am executing the reports in background, i am getting spool after executing. Just i need to convert the spool to xls format and email through attachment and mail to the user.The xls file should not be saved on local system.
    I need your help.
    Regards
    Vinay.

    see this link
    to send xls as attachment.
    http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm

  • Sending as email attachment from Word 2013 gets stuck in Outbox

    I am using Office 2013 and use the send document as attachment option within Word to email documents. The documents that I email are from a shared exchange mailbox. Whenever I do this the emails get through to the receiver but are stuck in my personal outbox
    rather than sending and heading to the shared sent box.
    This only occurs when I use this option from Word, eg: I can send Excel attachments from within Excel and it goes to the shared Sent box.
    I am also able to successfully send emails from with Outlook via the shared account.
    I am unable to find any settings in Word that affect this behavior, any ideas?

    Hi,
    Please run Word in Safe Mode to test if it's 3rd-party add-ins related:
    Press Win + R and type “word.exe /safe” in the blank box, then press Enter.
    If there’s no problem in Safe Mode, disable the suspicious add-ins to verify which add-ins caused this issue.
    We can also refer to the link below, to learn more and check the possible settings that may affect this behavior:
    http://www.msoutlook.info/question/278
    Regards.
    Melon Chen
    TechNet Community Support
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Problem in sending an email attachment

    Hi,
    I have to send an email with attachment. I am trying it by using method 'add_attachment' of class cl_document_bcs.
    I have data in a internal table of type char. i am passing my intrenal table to this parameter  i_att_content_text   in the method.
    In the attachment all the data is coming but in a single row. Do i need to convert the text data in my internal table to the type of i_att_content_text parameter. if so wat is the method i have to use to do the conversion. like soli_to_solix,txt_to_soli etc.
    thanks,
    Regards,
    Ram

    Hi,
    Use this.
    if you have xstring type data then
    <SOLIX TYPE INTERNAL TABLE> = cl_document_bcs=>xstring_to_solix( <YOUR XSTRING> ).
    if you have string type data or char..
    (<SOLI TYPE INTERNAL TABLE>) = cl_document_bcs=>STRING_TO_SOLI(< YOUR STRING >)
    Hope this helps.
    Regards,
    -Sandeep
    Edited by: sandeep2719 on Dec 2, 2011 5:08 PM

  • Producing a narrated slideshow, save and send via email attachment?

    I'm wondering if one can produce a slides show in keynote, add narrative to it, save it in a iMovie or some other format, and be able to send it as a stand alone presentation to someone via email attachment or clickthrough on a website.
    Is it possible to do with within the Apple family of products? If so, how do you add the narrative and in what format should it be saved?
    I need to be able to give clients a sample of a live presentation. Not the talking head, but the slide content with voice over.
    Any suggestions or experience would be greatly appreciated.

    Garageband, iMovie, iPhoto and QuickTime Pro can make your file and save (export) to a QuickTime file format. Keynote could "make" the video portion (export to QuickTime formats). QuickTime Pro can "record" audio (supported device required). A "mix and match" use of these apps could help reduce the file size.
    Things to consider:
    Email has file size limits on attachments and even a very short file would probably exceed them. You could post your file on any "server" and just send a link to the file in your email.

  • Send as email attachment the billing document as pdf when created and saved

    HI All,
    I have already searched the forum but could not find  a satisfying answer so i am posting this question,
    The requirement is to send an email containing biiling document converted to pdf format when a billing document
    is created and saved in VF01 transaction.
    I have already converted the output to pdf format in my driver program and also know how to send an email containing the same ..but this works only when user prints using VF31 .
    Kindly tell the configuration steps which are required...and hot to achieve the same.
    Regards,
    Prateek

    Hi Prateek,
    There is a blog on a similar topic which explains how to email purchase order in SAP to the vendor. The settings are required in Vendor Master, NACE and SCOT.
    Following is the link to it.
    http://architectsap.com/blog/sap/sap-mm-purchasing-send-purchase-order-by-mail-to-vendor-in-sap/
    It has given steps to trigger the output.
    Its not exactly what you require, but might be helpful.
    Regards,
    Abhijeet Kapgate

Maybe you are looking for

  • Volume button not working in vibe x2

    Hi my device is lenove vibe x2-apafter upgrading to lollipop my phones volume button not workingwhile incoming call coming not able to put in silent mode also.this is serious problem, please fix it. please realse the update asap.

  • Standard IDOC/BAPI to create work order in CRM from ECC PS

    Hello Guys, Any input on any standard IDOC/BAPI I could use to create a work order in SAP CRM based on the data feed from SAP ECC (Project systems)? Any help on this would be really appreciated.

  • Problem in processing internal table

    Hi All, Im facing some problem with an internal table with header. This is Xvbkd with heaer line. Header     100     0000000049     000010                         EXW     China 1     100     0000000049     000000                         CIF     HK 2 

  • Multiple Usage of a Delta Extractor from R/3

    Dear all, do anybody know if a Delta Extractor from one R/3 system could be used in different SAP BW Systems? Many thanks Didi

  • In which language is ICM in NWCE7.1 written?

    Hi, I happen to find that ICM in NWCE7.1 seems not be a java program, so by what language is ICM written in? C language? Many thanks. Eric