Sending report output via E-mail (excel pivoted format)

Hi all,
i have a written a report where i need to send the report output to somebody via
E-mail.i am sending this report output via E-mail successfully.The receiver receives, my output in excel format.but this excel is not <b>pivoted</b>.
i want , the receiver should get my output in pivoted excel format.i.e my output data should be exactly fit in the excel sheet.
now the columns in excel sheet are overlapping.once i double clicked, the columns are getting separated.i do not want to double click.i want all the columns should come properly i.e excel field  length should be adjusted as per the output field length.
i am giving my coding below.plz suggest how i can do the above thing .it's urgent.
any idea will be highly appreaciated.
Regards
if not p_email1 is initial.
     perform fill_report_csv.
     perform f_send_internet_mail.
  endif.
FORM fill_report_csv.
   data :   l_text(232) type c,
           v_matnr1(21) type c,
           v_matnr(21) type c,
           v_matkl(14) type c,
           v_maktx(45) type c,
           v_ttlstk(14) type c,
           v_verpr(14) type c,
           v_werks(14) type c,
           v_lgort(14) type c,
           v_char(10) type c,
           v_stks type p ,
           v_po(40) type c,
           v_qty(13) type c,
            v_qty1 type sy-datum,
           v_date(15) type c,
           v_date1(15) TYPE C,
           v_name(35) type c,
           v_eknam(18) type c,
           v_lifnr(15) type c,
        l_po(40) type c,
        v_matnr(20) type c,
         l_rate(11) type  p decimals 5,
         l_flag type c.
  concatenate c_equal c_colon 'PO no.' c_colon
                into v_po.
  concatenate c_equal c_colon 'Material no.' c_colon
                into v_matnr.
  concatenate c_equal c_colon 'Description.' c_colon
                into v_maktx.
  concatenate c_equal c_colon 'Due Qty.' c_colon
                into v_qty.
  concatenate c_equal c_colon 'Del Date.' c_colon
                into v_date.
  concatenate c_equal c_colon 'Vendor.' c_colon
                into v_name.
  concatenate c_equal c_colon 'Buyer.' c_colon
                into v_eknam.
  concatenate c_equal c_colon 'Vendor Code.' c_colon
                into v_lifnr.
concatenate
         v_po v_matnr v_maktx v_qty
         v_date v_name v_eknam v_lifnr
         into i_download
         SEPARATED BY con_tab.
  append i_download .
clear : v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
clear wa_output.
loop at i_output into wa_output.
   on change of wa_output-ebeln.
     clear v_lines.
     loop at i_eket into wa_eket
             where ebeln = wa_output-ebeln.
       v_lines = v_lines + 1.
       clear wa_eket.
     endloop.
**-- Checking of page break
     v_lines = sy-linno + v_lines .
     if 55 < v_lines  .
       write:/0(161) sy-uline.
       new-page.
     endif.
  clear v_lines.
      loop at i_eket into wa_eket
              where ebeln = wa_output-ebeln.
        v_lines = v_lines + 1.
        clear wa_eket.
      endloop.
*-- Calculating the due qty.
    wa_output-dumng = wa_output-menge - wa_output-wemng.
*-- Writing the Line items of the PO.
    read table i_ekpo into wa_ekpo
          with key ebeln = wa_output-ebeln
                   ebelp = wa_output-ebelp.
     l_rate = wa_ekpo-netpr / wa_ekpo-peinh.
*-- Writing of PO detail
     if wa_output-dumng gt 0 .
     v_qty = wa_output-dumng.
    v_date1 = wa_output-eindt.
    v_maktx = wa_output-maktx.
     if wa_output-maktx+0(1) = '"' .
            concatenate  c_equal wa_output-maktx
               into v_maktx  .
         else .
            concatenate  c_equal c_colon wa_output-maktx c_colon
               into v_maktx  .
         endif .
   if wa_output-name1+0(1) = '"' .
            concatenate  c_equal wa_output-name1
               into v_name  .
         else .
            concatenate  c_equal c_colon wa_output-name1 c_colon
               into v_name  .
         endif .
    v_name = wa_output-name1.
    v_lifnr = wa_output-lifnr.
     write wa_output-eindt to v_date1 DD/MM/YYYY.
     concatenate '="' wa_output-ebeln '/'
            wa_output-ebelp '"' into v_po .
     concatenate '="' wa_output-matnr '"' into v_matnr .
         concatenate  c_equal c_colon wa_output-maktx c_colon
           into v_maktx  .
          concatenate  c_equal c_colon wa_output-dumng c_colon
           into v_qty1  .
           concatenate  c_equal c_colon wa_output-eindt c_colon
           into v_date1  .
          concatenate  c_equal c_colon wa_output-name1 c_colon
           into v_name  .
            concatenate  c_equal c_colon wa_output-eknam c_colon
            into v_eknam  .
          concatenate  c_equal c_colon wa_output-lifnr c_colon
           into v_lifnr  .
          concatenate  c_equal c_colon wa_mard-werks '/'
           wa_mard-lgort c_colon
           into v_lgort .
             concatenate '="' wa_output-lifnr '"' into v_lifnr .
condense:v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
     concatenate
         v_po v_matnr v_maktx v_qty
         v_date1 v_name v_eknam v_lifnr
         into i_download
         SEPARATED BY con_tab.
    concatenate con_cret i_download INTO i_download .
    append i_download .
  endif.
clear : v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
endloop.
ENDFORM.                    " fill_report_csv
*&      Form  f_send_internet_mail
      text
-->  p1        text
<--  p2        text
FORM f_send_internet_mail.
Variables
data:   it_packing_list like sopcklsti1 occurs 0 with header line,
        it_contents like solisti1 occurs 0 with header line,
        it_receivers like somlreci1 occurs 0 with header line,
        it_attachment like solisti1 occurs 0 with header line,
        gd_cnt type i,
        gd_sent_all(1) type c,
        gd_doc_data like sodocchgi1,
        gd_error type sy-subrc.
data:   it_message type standard table of SOLISTI1 initial size 0
                with header line.
data : found_receiver type c,
       v_title(80) type c,
       l_text(180) type c.
Fill the document data.
  gd_doc_data-doc_size = 1.
Adds text to email text table
  append 'Pls see attached open purchase order report.' to it_message.
  append '' to it_message.
  concatenate 'Note: This is system generated report'
              ', figures may subject to actual physical count.'
              into l_text separated by space.
  append l_text to it_message.
Populate the subject/generic message attributes
  CLEAR gd_doc_data.
  READ TABLE i_download INDEX w_cnt.
  gd_doc_data-doc_size =
     ( w_cnt - 1 ) * 255 + STRLEN( i_download ).
  gd_doc_data-obj_langu  = sy-langu.
  gd_doc_data-obj_name   = 'SAPRPT'.
if p_asdate is initial .
     concatenate p_title ' '
              sy-datum sy-uzeit into v_title separated by space.
else .
    concatenate p_title ' '
             p_bldat p_cputm into v_title separated by space.
endif .
  gd_doc_data-obj_descr  = v_title .
  gd_doc_data-sensitivty = 'F'.
  CLEAR t_attachment.
  REFRESH t_attachment.
  t_attachment[] = i_download[].
Describe the body of the message
  clear it_packing_list.
  refresh it_packing_list.
  it_packing_list-transf_bin = space.
  it_packing_list-head_start = 1.
  it_packing_list-head_num = 0.
  it_packing_list-body_start = 1.
  describe table it_message lines it_packing_list-body_num.
  it_packing_list-doc_type = 'RAW'.
  append it_packing_list.
Create attachment notification
  it_packing_list-transf_bin = 'X'.
  it_packing_list-head_start = 1.
  it_packing_list-head_num   = 1.
  it_packing_list-body_start = 1.
  DESCRIBE TABLE t_attachment LINES it_packing_list-body_num.
  it_packing_list-doc_type   =  'XLS'.
  it_packing_list-obj_descr  =  'OPEN PURCHASE ORDER' .
  it_packing_list-obj_name   =  'PO.XLS' .
  it_packing_list-doc_size   =  it_packing_list-body_num * 255.
  APPEND it_packing_list.
assign SAP user smtp address from successful retrieval.
  loop at p_email.
Add the recipients email address
     found_receiver = 'X' .
     it_receivers-receiver = p_email-low.
     it_receivers-rec_type = 'U'.
     it_receivers-com_type = 'INT'.
     it_receivers-notif_del = ''.
     it_receivers-notif_ndel = 'X'.
     append it_receivers .
  endloop .
Add default recipient email when unable to locate purc group email
   if found_receiver is initial .
       it_receivers-receiver = p_email.
       it_receivers-rec_type = 'U'.
       it_receivers-com_type = 'INT'.
       it_receivers-notif_del = ''.
       it_receivers-notif_ndel = 'X'.
      append it_receivers.
   endif .
Call the FM to post the message to SAPMAIL
  call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
       exporting
            document_data              = gd_doc_data
            put_in_outbox              = 'X'
            commit_work                = 'X'
       importing
            sent_to_all                = gd_sent_all
       tables
            packing_list               = it_packing_list
            contents_bin               = t_attachment
            contents_txt               = it_message
            receivers                  = it_receivers
       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.
Store function module return code
  gd_error = sy-subrc.
Get it_receivers return code
  loop at it_receivers.
  endloop.
Instructs mail send program for SAPCONNECT to send email.
  wait up to 2 seconds.
  if gd_error eq 0.
      submit rsconn01 with mode = 'INT'
                    with output = ' '
                    and return.
  endif.
ENDFORM.                    " f_send_internet_mail

Hi,
go through this link,
http://www.sapdevelopment.co.uk/reporting/email/emailhome.htm
you have some sample programs.
Regards,
Raghavendra

Similar Messages

  • Report output via E-mail

    Hi all,
    i have a written a report where i need to send the report output to somebody via
    E-mail.i am sending this report output via E-mail successfully.The receiver receives, my output in excel format.but this excel is not <b>pivoted</b>.
    i want , the receiver should get my output in pivoted excel format.i.e my output data should be exactly fit in the excel sheet.
    now the columns in excel sheet are overlapping.once i double clicked, the columns are getting separated.i do not want to double click.i want all the columns should come properly i.e excel field  length should be adjusted as per the output field length.
    i am giving my coding below.plz suggest how i can do the above thing .it's urgent.
    any idea will be highly appreaciated.
    Regards
    if not p_email1 is initial.
         perform fill_report_csv.
         perform f_send_internet_mail.
      endif.
    FORM fill_report_csv.
       data :   l_text(232) type c,
               v_matnr1(21) type c,
               v_matnr(21) type c,
               v_matkl(14) type c,
               v_maktx(45) type c,
               v_ttlstk(14) type c,
               v_verpr(14) type c,
               v_werks(14) type c,
               v_lgort(14) type c,
               v_char(10) type c,
               v_stks type p ,
               v_po(40) type c,
               v_qty(13) type c,
                v_qty1 type sy-datum,
               v_date(15) type c,
               v_date1(15) TYPE C,
               v_name(35) type c,
               v_eknam(18) type c,
               v_lifnr(15) type c,
            l_po(40) type c,
            v_matnr(20) type c,
             l_rate(11) type  p decimals 5,
             l_flag type c.
      concatenate c_equal c_colon 'PO no.' c_colon
                    into v_po.
      concatenate c_equal c_colon 'Material no.' c_colon
                    into v_matnr.
      concatenate c_equal c_colon 'Description.' c_colon
                    into v_maktx.
      concatenate c_equal c_colon 'Due Qty.' c_colon
                    into v_qty.
      concatenate c_equal c_colon 'Del Date.' c_colon
                    into v_date.
      concatenate c_equal c_colon 'Vendor.' c_colon
                    into v_name.
      concatenate c_equal c_colon 'Buyer.' c_colon
                    into v_eknam.
      concatenate c_equal c_colon 'Vendor Code.' c_colon
                    into v_lifnr.
    concatenate
             v_po v_matnr v_maktx v_qty
             v_date v_name v_eknam v_lifnr
             into i_download
             SEPARATED BY con_tab.
      append i_download .
    clear : v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
    clear wa_output.
    loop at i_output into wa_output.
       on change of wa_output-ebeln.
         clear v_lines.
         loop at i_eket into wa_eket
                 where ebeln = wa_output-ebeln.
           v_lines = v_lines + 1.
           clear wa_eket.
         endloop.
    **-- Checking of page break
         v_lines = sy-linno + v_lines .
         if 55 < v_lines  .
           write:/0(161) sy-uline.
           new-page.
         endif.
      clear v_lines.
          loop at i_eket into wa_eket
                  where ebeln = wa_output-ebeln.
            v_lines = v_lines + 1.
            clear wa_eket.
          endloop.
    *-- Calculating the due qty.
        wa_output-dumng = wa_output-menge - wa_output-wemng.
    *-- Writing the Line items of the PO.
        read table i_ekpo into wa_ekpo
              with key ebeln = wa_output-ebeln
                       ebelp = wa_output-ebelp.
         l_rate = wa_ekpo-netpr / wa_ekpo-peinh.
    *-- Writing of PO detail
         if wa_output-dumng gt 0 .
         v_qty = wa_output-dumng.
        v_date1 = wa_output-eindt.
        v_maktx = wa_output-maktx.
         if wa_output-maktx+0(1) = '"' .
                concatenate  c_equal wa_output-maktx
                   into v_maktx  .
             else .
                concatenate  c_equal c_colon wa_output-maktx c_colon
                   into v_maktx  .
             endif .
       if wa_output-name1+0(1) = '"' .
                concatenate  c_equal wa_output-name1
                   into v_name  .
             else .
                concatenate  c_equal c_colon wa_output-name1 c_colon
                   into v_name  .
             endif .
        v_name = wa_output-name1.
        v_lifnr = wa_output-lifnr.
         write wa_output-eindt to v_date1 DD/MM/YYYY.
         concatenate '="' wa_output-ebeln '/'
                wa_output-ebelp '"' into v_po .
         concatenate '="' wa_output-matnr '"' into v_matnr .
             concatenate  c_equal c_colon wa_output-maktx c_colon
               into v_maktx  .
              concatenate  c_equal c_colon wa_output-dumng c_colon
               into v_qty1  .
               concatenate  c_equal c_colon wa_output-eindt c_colon
               into v_date1  .
              concatenate  c_equal c_colon wa_output-name1 c_colon
               into v_name  .
                concatenate  c_equal c_colon wa_output-eknam c_colon
                into v_eknam  .
              concatenate  c_equal c_colon wa_output-lifnr c_colon
               into v_lifnr  .
              concatenate  c_equal c_colon wa_mard-werks '/'
               wa_mard-lgort c_colon
               into v_lgort .
                 concatenate '="' wa_output-lifnr '"' into v_lifnr .
    condense:v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
         concatenate
             v_po v_matnr v_maktx v_qty
             v_date1 v_name v_eknam v_lifnr
             into i_download
             SEPARATED BY con_tab.
        concatenate con_cret i_download INTO i_download .
        append i_download .
      endif.
    clear : v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
    endloop.
    ENDFORM.                    " fill_report_csv
    *&      Form  f_send_internet_mail
          text
    -->  p1        text
    <--  p2        text
    FORM f_send_internet_mail.
    Variables
    data:   it_packing_list like sopcklsti1 occurs 0 with header line,
            it_contents like solisti1 occurs 0 with header line,
            it_receivers like somlreci1 occurs 0 with header line,
            it_attachment like solisti1 occurs 0 with header line,
            gd_cnt type i,
            gd_sent_all(1) type c,
            gd_doc_data like sodocchgi1,
            gd_error type sy-subrc.
    data:   it_message type standard table of SOLISTI1 initial size 0
                    with header line.
    data : found_receiver type c,
           v_title(80) type c,
           l_text(180) type c.
    Fill the document data.
      gd_doc_data-doc_size = 1.
    Adds text to email text table
      append 'Pls see attached open purchase order report.' to it_message.
      append '' to it_message.
      concatenate 'Note: This is system generated report'
                  ', figures may subject to actual physical count.'
                  into l_text separated by space.
      append l_text to it_message.
    Populate the subject/generic message attributes
      CLEAR gd_doc_data.
      READ TABLE i_download INDEX w_cnt.
      gd_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( i_download ).
      gd_doc_data-obj_langu  = sy-langu.
      gd_doc_data-obj_name   = 'SAPRPT'.
    if p_asdate is initial .
         concatenate p_title ' '
                  sy-datum sy-uzeit into v_title separated by space.
    else .
        concatenate p_title ' '
                 p_bldat p_cputm into v_title separated by space.
    endif .
      gd_doc_data-obj_descr  = v_title .
      gd_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = i_download[].
    Describe the body of the message
      clear it_packing_list.
      refresh it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      describe table it_message lines it_packing_list-body_num.
      it_packing_list-doc_type = 'RAW'.
      append it_packing_list.
    Create attachment notification
      it_packing_list-transf_bin = 'X'.
      it_packing_list-head_start = 1.
      it_packing_list-head_num   = 1.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES it_packing_list-body_num.
      it_packing_list-doc_type   =  'XLS'.
      it_packing_list-obj_descr  =  'OPEN PURCHASE ORDER' .
      it_packing_list-obj_name   =  'PO.XLS' .
      it_packing_list-doc_size   =  it_packing_list-body_num * 255.
      APPEND it_packing_list.
    assign SAP user smtp address from successful retrieval.
      loop at p_email.
    Add the recipients email address
         found_receiver = 'X' .
         it_receivers-receiver = p_email-low.
         it_receivers-rec_type = 'U'.
         it_receivers-com_type = 'INT'.
         it_receivers-notif_del = ''.
         it_receivers-notif_ndel = 'X'.
         append it_receivers .
      endloop .
    Add default recipient email when unable to locate purc group email
       if found_receiver is initial .
           it_receivers-receiver = p_email.
           it_receivers-rec_type = 'U'.
           it_receivers-com_type = 'INT'.
           it_receivers-notif_del = ''.
           it_receivers-notif_ndel = 'X'.
          append it_receivers.
       endif .
    Call the FM to post the message to SAPMAIL
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           exporting
                document_data              = gd_doc_data
                put_in_outbox              = 'X'
                commit_work                = 'X'
           importing
                sent_to_all                = gd_sent_all
           tables
                packing_list               = it_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = it_receivers
           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.
    Store function module return code
      gd_error = sy-subrc.
    Get it_receivers return code
      loop at it_receivers.
      endloop.
    Instructs mail send program for SAPCONNECT to send email.
      wait up to 2 seconds.
      if gd_error eq 0.
          submit rsconn01 with mode = 'INT'
                        with output = ' '
                        and return.
      endif.
    ENDFORM.                    " f_send_internet_mail

    ans

  • Send Report output as attachment in excel

    Hi All,
    I am scheduling background Job for Auto mail of standard SAP report. I am able to send the details in html format, please guide me how to send report details in excel format.
    I have already check SCN but unable to find exact solution for same.
    Regards
    Rashid

    Rashid,
    When u Go  SM37 Follow This Step Then U Get The Data In Excel Format.
    Follow step
    Select Spool Option
    Then U got the screen
    Select the type option then u got screen.
    In This Screen U Find the option save in Local File  then get the option.
    When U Select the Spreadsheet Option You can Able to save your data in excel format.
    Hope its help full for you

  • Send report output via email as zipped attachment

    Is it possible for the report output to be zipped before being attached to an email when running on a windows reports_server? On unix we theoretically have the ability to modify the mail.sh shell script that performs the mail operation for reports.

    Hi Richard
    This is a Reports 9i solution.
    You may create a batch file that runs the report, compresses the file and invokes, say, a Java application that mails the given .zip file.
    More "advanced" options would be:
    You may create a pluggable destination that captures report output. Next, your code does the compresses the output file and mails it.
    A simpler solution would be to run two reports. First, that creates the reports output file. In its AFTER_REPORT trigger, call Java method (thru. Java Importer), that picks up the output file and compresses it. Second, that uses XML distribution feature of Reports 9i and mails the .zip file as a file attachment using appropriate construct.
    Regard
    Sripathy

  • Sending ALV output in a mail in PDF format

    Hi folks,
                I have a requiremtnt. If i execute my ALV report in background, the output should be sent to the reciepient's mail in pdf format. i have used the function moudles CONVERT_ABAPSPOOLJOB_2_PDF and SO_DOCUMENT_SEND_API1. Now i am able to see my report output in spool in some pdf formt. how can i send this to the reciever mail as an attachement...pls send me any sample report which suits my reqirement...thanks in advance,
               Ram.

    REPORT ZSAP_EMAIL MESSAGE-ID Z001.
    *TABLES: rlgrap, btcxpm." zlookup.
    DATA:
    V_ZCODE(3) TYPE C,
    *svrname LIKE zlookup-zdesc,
    WA_ERROR(80) TYPE C,
    GLOBAL_FILEMASK_ALL(80).
    DATA: T_SOUD LIKE SOUD.
    DATA: P_INFOLDER LIKE SOFDK.
    DATA: P_OUTFOLDER LIKE SOFDK.
    DATA: OBJECT_HD_DISPLAY LIKE SOOD2.
    DATA: OBJECT_ID LIKE SOODK.
    DATA: DOCUMENT LIKE SOOD4.
    DATA: HEADER_DATA LIKE SOOD2.
    DATA: LINK_FOLDER_ID LIKE SOODK.
    DATA: FOLDER_SELECTIONS LIKE SOFDS.
    DATA: FOLDER_LIST LIKE SOXLI OCCURS 0 WITH HEADER LINE.
    DATA: RECEIVERS LIKE SOOS1 OCCURS 0 WITH HEADER LINE.
    DATA: OBJCONT LIKE SOLI OCCURS 0 WITH HEADER LINE.
    DATA: OBJHEAD LIKE SOLI OCCURS 0 WITH HEADER LINE.
    DATA: OBJECT_CONTENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
    DATA: OBJECT_HD_CHANGE LIKE SOOD1.
    DATA: BEGIN OF FILES OCCURS 0,
    LINE(200) TYPE C,
    END OF FILES.
    DATA: LISTOBJECT LIKE ABAPLIST OCCURS 1 WITH HEADER LINE.
    *Email to addresses
    SELECTION-SCREEN: BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-BL1.
    PARAMETERS: P_MAILTO(240) TYPE C.
    *PARAMETERS:P_MAILTO TYPE SOLI-LINE.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN COMMENT 10(2) TEXT-001.
    *Use zlookup-ztype as group to define multiple email to addresses
    *SELECT-OPTIONS: s_mailto FOR zlookup-ztype.
    SELECTION-SCREEN: END OF BLOCK BL1.
    *Subject
    SELECTION-SCREEN: BEGIN OF BLOCK BL2 WITH FRAME TITLE TEXT-BL2.
    PARAMETERS: P_SUBJ LIKE DOCUMENT-OBJDES.
    SELECTION-SCREEN: END OF BLOCK BL2.
    *Body
    SELECTION-SCREEN: BEGIN OF BLOCK BL3 WITH FRAME TITLE TEXT-BL3.
    PARAMETERS: P_BODY1 LIKE SOLISTI1-LINE LOWER CASE.
    PARAMETERS: P_BODY2 LIKE SOLISTI1-LINE LOWER CASE.
    PARAMETERS: P_BODY3 LIKE SOLISTI1-LINE LOWER CASE.
    PARAMETERS: P_BODY4 LIKE SOLISTI1-LINE LOWER CASE.
    PARAMETERS: P_BODY5 LIKE SOLISTI1-LINE LOWER CASE.
    PARAMETERS: P_BODY6 LIKE SOLISTI1-LINE LOWER CASE.
    SELECTION-SCREEN: END OF BLOCK BL3.
    *Attachments
    SELECTION-SCREEN: BEGIN OF BLOCK BL4 WITH FRAME TITLE TEXT-BL4.
    PARAMETERS: P_FNAME1 LIKE FILES-LINE.
    PARAMETERS: P_FNAME2 LIKE FILES-LINE.
    PARAMETERS: P_FNAME3 LIKE FILES-LINE.
    PARAMETERS: P_FNAME4 LIKE FILES-LINE.
    PARAMETERS: P_FNAME5 LIKE FILES-LINE.
    PARAMETERS: P_FNAME6 LIKE FILES-LINE.
    SELECTION-SCREEN: END OF BLOCK BL4.
    AT SELECTION-SCREEN.
      PERFORM CHK_SELECTION.
      IF NOT WA_ERROR IS INITIAL.
        MESSAGE E001 WITH WA_ERROR.
      ENDIF.
    START-OF-SELECTION.
    END-OF-SELECTION.
      PERFORM SEND_EMAIL.
    FORM chk_selection
    FORM CHK_SELECTION.
      CLEAR WA_ERROR.
    *Loop only once ???
    *If more checkings to be done.
    *Think about it and if not clear.
    *Let it sink in for a couple of minutes.
    *Still doesn't make sence? Go home and sleep on it.
      DO 1 TIMES.
    *Check Email to
        IF P_MAILTO IS INITIAL .
    *AND s_mailto IS INITIAL.
          WA_ERROR = 'Invalid or no EMAIL TO selection'.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.                    "chk_selection
    *& Form send_email
    *text
    *--> p1 text
    *<-- p2 text
    FORM SEND_EMAIL.
      PERFORM GET_FOLDER_INFO.
      PERFORM FILL_BODY.
      PERFORM INS_NEW_OBJECT.
      PERFORM CRT_ATTACHMENTS.
      PERFORM FILL_RECEIVERS_INFO.
      PERFORM SND_EMAIL.
    ENDFORM. " send_email
    *--+--
    *FORM Get_folder_info
    FORM GET_FOLDER_INFO.
      CLEAR T_SOUD.
    *Small so should be quick.
      SELECT * FROM SOUD
      INTO T_SOUD
      WHERE SAPNAM = SY-UNAME.
        P_INFOLDER-FOLTP = 'FOL'.
        P_INFOLDER-FOLYR = T_SOUD-INBYR. "inbox
        P_INFOLDER-FOLNO = T_SOUD-INBNO.
        P_OUTFOLDER-FOLTP = 'FOL'.
        P_OUTFOLDER-FOLYR = T_SOUD-OUTYR. "outbox
        P_OUTFOLDER-FOLNO = T_SOUD-OUTNO.
      ENDSELECT.
    ENDFORM.                    "get_folder_info
    *FORM fill_body *
    FORM FILL_BODY.
      OBJECT_CONTENT-LINE = P_BODY1.
      APPEND OBJECT_CONTENT.
      OBJECT_CONTENT-LINE = P_BODY2.
      APPEND OBJECT_CONTENT.
      OBJECT_CONTENT-LINE = P_BODY3.
      APPEND OBJECT_CONTENT.
      OBJECT_CONTENT-LINE = P_BODY4.
      APPEND OBJECT_CONTENT.
      OBJECT_CONTENT-LINE = P_BODY5.
      APPEND OBJECT_CONTENT.
      OBJECT_CONTENT-LINE = P_BODY6.
      APPEND OBJECT_CONTENT.
    ENDFORM.                    "fill_body
    *FORM ins_new_object *
    FORM INS_NEW_OBJECT.
      OBJECT_HD_CHANGE-OBJNAM = 'Notes'.
      OBJECT_HD_CHANGE-OBJDES = P_SUBJ.
      CALL FUNCTION 'SO_OBJECT_INSERT'
        EXPORTING
          FOLDER_ID                  = P_OUTFOLDER
          OBJECT_HD_CHANGE           = OBJECT_HD_CHANGE
          OBJECT_TYPE                = 'RAW'
          OWNER                      = SY-UNAME
        IMPORTING
          OBJECT_HD_DISPLAY          = OBJECT_HD_DISPLAY
          OBJECT_ID                  = OBJECT_ID
        TABLES
          OBJCONT                    = OBJECT_CONTENT
          OBJHEAD                    = OBJHEAD
        EXCEPTIONS
          ACTIVE_USER_NOT_EXIST      = 1
          COMMUNICATION_FAILURE      = 2
          COMPONENT_NOT_AVAILABLE    = 3
          DL_NAME_EXIST              = 4
          FOLDER_NOT_EXIST           = 5
          FOLDER_NO_AUTHORIZATION    = 6
          OBJECT_TYPE_NOT_EXIST      = 7
          OPERATION_NO_AUTHORIZATION = 8
          OWNER_NOT_EXIST            = 9
          PARAMETER_ERROR            = 10
          SUBSTITUTE_NOT_ACTIVE      = 11
          SUBSTITUTE_NOT_DEFINED     = 12
          SYSTEM_FAILURE             = 13
          X_ERROR                    = 14
          OTHERS                     = 15.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "ins_new_object
    *FORM crt_attachments *
    *--> P_SUBJ *
    FORM CRT_ATTACHMENTS.
      DOCUMENT-FOLTP = P_OUTFOLDER-FOLTP.
      DOCUMENT-FOLYR = P_OUTFOLDER-FOLYR.
      DOCUMENT-FOLNO = P_OUTFOLDER-FOLNO.
      DOCUMENT-OBJTP = OBJECT_ID-OBJTP.
      DOCUMENT-OBJYR = OBJECT_ID-OBJYR.
      DOCUMENT-OBJNO = OBJECT_ID-OBJNO.
      DOCUMENT-OBJNAM = 'Notes'.
      DOCUMENT-OBJDES = P_SUBJ.
      DOCUMENT-OKCODE = 'CHNG'.
      DOCUMENT-FILE_EXT = 'TXT'.
      LINK_FOLDER_ID = OBJECT_ID.
      HEADER_DATA-OBJLA = 'EN'.
      HEADER_DATA-OBJNAM = DOCUMENT-OBJNAM.
      HEADER_DATA-OBJDES = DOCUMENT-OBJDES.
      HEADER_DATA-OBJPRI = '5'.
      HEADER_DATA-OBJSNS = 'O'.
      HEADER_DATA-FILE_EXT = 'TXT'.
      REFRESH FILES.
      CLEAR FILES.
      IF NOT P_FNAME1 IS INITIAL.
        FILES-LINE = P_FNAME1.
        APPEND FILES.
      ENDIF.
      IF NOT P_FNAME2 IS INITIAL.
        FILES-LINE = P_FNAME2.
        APPEND FILES.
      ENDIF.
      IF NOT P_FNAME3 IS INITIAL.
        FILES-LINE = P_FNAME3.
        APPEND FILES.
      ENDIF.
      IF NOT P_FNAME4 IS INITIAL.
        FILES-LINE = P_FNAME4.
        APPEND FILES.
      ENDIF.
      IF NOT P_FNAME5 IS INITIAL.
        FILES-LINE = P_FNAME5.
        APPEND FILES.
      ENDIF.
      IF NOT P_FNAME6 IS INITIAL.
        FILES-LINE = P_FNAME6.
        APPEND FILES.
      ENDIF.
      IF NOT FILES[] IS INITIAL.
        CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
          EXPORTING
            METHOD      = 'ATTCREATEFROMPC'
          TABLES
            FILES       = FILES
          CHANGING
            DOCUMENT    = DOCUMENT
            HEADER_DATA = HEADER_DATA.
        IF SY-SUBRC = 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    ENDFORM.                    "crt_attachments
    *FORM fill_receivers_info *
    FORM FILL_RECEIVERS_INFO.
      DATA: BEGIN OF RECLIST OCCURS 0,
      REC LIKE RECEIVERS-RECEXTNAM,
      END OF RECLIST.
    *Build reclist
      REFRESH RECLIST.
      IF NOT P_MAILTO IS INITIAL.
        RECLIST-REC = P_MAILTO.
        APPEND RECLIST.
      ENDIF.
    *IF NOT s_mailto IS INITIAL.
    *SELECT zdesc
    *INTO reclist-rec
    *FROM zlookup
    *WHERE ztype IN s_mailto.
    *APPEND reclist.
    *ENDSELECT.
    *ENDIF.
      REFRESH RECEIVERS.
      LOOP AT RECLIST.
        FOLDER_SELECTIONS-FOLNAM = 'INBOX'.
        CALL FUNCTION 'SO_FOLDER_LIST_READ'
          EXPORTING
            FOLDER_SELECTIONS          = FOLDER_SELECTIONS
            OWNER                      = SY-UNAME
            REGION                     = 'P'
          TABLES
            FOLDER_LIST                = FOLDER_LIST
          EXCEPTIONS
            COMPONENT_NOT_AVAILABLE    = 1
            OPERATION_NO_AUTHORIZATION = 2
            OWNER_NOT_EXIST            = 3
            PARAMETER_ERROR            = 4
            X_ERROR                    = 5
            OTHERS                     = 6.
        IF SY-SUBRC = 0.
          CLEAR RECEIVERS.
          MOVE: SY-DATUM TO RECEIVERS-RCDAT,
      SY-UZEIT TO RECEIVERS-RCTIM,
      ' ' TO RECEIVERS-RECESC,
      P_MAILTO TO RECEIVERS-RECNAM,
      'X' TO RECEIVERS-SNDEX.
          APPEND RECEIVERS.
         RECEIVERS-RCDAT = SY-DATUM.
         RECEIVERS-RCTIM = SY-UZEIT.
         RECEIVERS-RECNAM = RECLIST-REC.
         RECEIVERS-RECNO = FOLDER_LIST-PARNO.
         RECEIVERS-RECTP = FOLDER_LIST-PARTP.
         RECEIVERS-RECYR = FOLDER_LIST-PARYR.
         RECEIVERS-SNDTP = FOLDER_LIST-PARTP.
         RECEIVERS-SNDYR = FOLDER_LIST-PARYR.
         RECEIVERS-SNDNO = FOLDER_LIST-PARNO.
         RECEIVERS-SNDNAM = SY-UNAME.
         RECEIVERS-SNDPRI = '1'.
         RECEIVERS-MSGID = 'SO'.
         RECEIVERS-MSGNO = '619'.
         RECEIVERS-DELIVER = 'X'.
         RECEIVERS-NOT_DELI = 'X'.
         RECEIVERS-READ = 'X'.
         RECEIVERS-MAILSTATUS = 'E'.
    **receivers-ADR_NAME
         RECEIVERS-RESEND = ' '.
         RECEIVERS-SORTFIELD = ' '. "'USER WF_BATCH INDIGO BATCH'.
         RECEIVERS-SORTCLASS = '5'.
         APPEND RECEIVERS.
        ELSE.
          CLEAR RECEIVERS.
          RECEIVERS-SEL = 'X'.
          RECEIVERS-RECESC = 'U'.
          RECEIVERS-RECNAM = 'U-'.
          RECEIVERS-RECEXTNAM = RECLIST-REC.
          RECEIVERS-DELIVER = 'X'.
          RECEIVERS-NOT_DELI = 'X'.
          RECEIVERS-READ = 'X'.
          RECEIVERS-MAILSTATUS = 'E'.
          RECEIVERS-ADR_NAME = RECLIST-REC.
          RECEIVERS-SORTFIELD = RECLIST-REC.
          RECEIVERS-SORTCLASS = '5'.
          APPEND RECEIVERS.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "fill_receivers_info
    *FORM snd_email *
    FORM SND_EMAIL.
      CALL FUNCTION 'SO_OBJECT_SEND'
        EXPORTING
          FOLDER_ID                  = P_OUTFOLDER
          OBJECT_ID                  = OBJECT_ID
          OUTBOX_FLAG                = 'X'
          OWNER                      = SY-UNAME
          CHECK_SEND_AUTHORITY       = 'X'
          ORIGINATOR_TYPE            = 'J'
          LINK_FOLDER_ID             = LINK_FOLDER_ID
        TABLES
          OBJCONT                    = OBJECT_CONTENT
          RECEIVERS                  = RECEIVERS
        EXCEPTIONS
          ACTIVE_USER_NOT_EXIST      = 1
          COMMUNICATION_FAILURE      = 2
          COMPONENT_NOT_AVAILABLE    = 3
          FOLDER_NOT_EXIST           = 4
          FOLDER_NO_AUTHORIZATION    = 5
          FORWARDER_NOT_EXIST        = 6
          NOTE_NOT_EXIST             = 7
          OBJECT_NOT_EXIST           = 8
          OBJECT_NOT_SENT            = 9
          OBJECT_NO_AUTHORIZATION    = 10
          OBJECT_TYPE_NOT_EXIST      = 11
          OPERATION_NO_AUTHORIZATION = 12
          OWNER_NOT_EXIST            = 13
          PARAMETER_ERROR            = 14
          SUBSTITUTE_NOT_ACTIVE      = 15
          SUBSTITUTE_NOT_DEFINED     = 16
          SYSTEM_FAILURE             = 17
          TOO_MUCH_RECEIVERS         = 18
          USER_NOT_EXIST             = 19
          ORIGINATOR_NOT_EXIST       = 20
          X_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.
    ENDFORM.                    "snd_email
    go through this.
    Thanks

  • To send report output to a mail with PDF attachment

    Hi All,
    I have developed a code and the output of the code as to send to a mial id's mentioned on the selection screen with a PDF attachemnt.
    So can any one suggest me how to do and it won't run in background it should always run in foreground.
    Any examples please let me know ASAP.
    Thanks
    Sagar.

    Hi Try this code with the same requirement i have also been working with i have got this code in SDN.
    Check this copy paste and execute i am getting the PDF file but not opening any how try and see
    *& Report  ZSDNF                                                       *
    REPORT  ZSDNF.
    TABLES :
      vbak,
      vbap,
      vbpa,
      mara.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:
    s_vkorg FOR vbak-vkorg OBLIGATORY,
    s_vtweg FOR vbak-vtweg OBLIGATORY,
    s_spart FOR vbak-spart OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    SELECT-OPTIONS:
    s_vbeln FOR vbak-vbeln,
    s_matnr FOR mara-matnr.
    PARAMETERS:
    p_kunnr TYPE vbak-kunnr.
    SELECT-OPTIONS:
    s_erdat FOR vbak-erdat OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b2.
    DATA : w_spono  LIKE  tsp01-rqident,
         w_binsize TYPE i,
         w_filelen TYPE i,
         t_sale LIKE TABLE OF tline WITH HEADER LINE.
    DATA:
    BEGIN OF t_sales OCCURS 0,
      vbeln TYPE vbak-vbeln,
      vkorg TYPE vbak-vkorg,
      vtweg TYPE vbak-vtweg,
      spart TYPE vbak-spart,
      erdat TYPE vbak-erdat,
      kunnr TYPE vbak-kunnr,
      posnr TYPE vbap-posnr,
      matnr TYPE vbap-matnr,
      arktx TYPE vbap-arktx,
      parvw TYPE vbpa-parvw,
      kwmeng TYPE vbap-kwmeng,
      kunnr1 TYPE vbpa-kunnr ,
    END OF t_sales.
    START-OF-SELECTION.
      SELECT vbak~vbeln
             vkorg
             vtweg
             vbak~spart
             vbak~erdat
             vbak~kunnr
             vbap~posnr
             matnr
              arktx
              parvw
             kwmeng
             vbpa~kunnr
        INTO CORRESPONDING FIELDS OF TABLE t_sales
        FROM ( ( vbak JOIN vbap ON vbapvbeln EQ vbakvbeln )
        JOIN vbpa ON vbpavbeln EQ vbakvbeln
                            and vbpaposnr eq vbapposnr
                               AND vbpa~parvw EQ 'WE' )
        WHERE vkorg IN s_vkorg
          AND vtweg IN s_vtweg
          AND vbak~spart IN s_spart
          AND vbak~vbeln IN s_vbeln
          AND matnr IN s_matnr
          AND vbak~kunnr EQ p_kunnr
          AND vbak~erdat IN s_erdat.
      IF sy-subrc EQ 0.
        NEW-PAGE PRINT ON.
        PERFORM display_sales_data.
        NEW-PAGE PRINT OFF.
      ELSE.
        MESSAGE 'No records found with the spcified criteria' TYPE 'E'.
      ENDIF.
      w_spono = sy-spono.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          src_spoolid                    = w_spono
      NO_DIALOG                      =
      DST_DEVICE                     =
      PDF_DESTINATION                =
       IMPORTING
         pdf_bytecount                  = w_binsize
      PDF_SPOOLID                    =
      LIST_PAGECOUNT                 =
      BTC_JOBNAME                    =
      BTC_JOBCOUNT                   =
       TABLES
         pdf                            = t_sale
       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.
      ENDIF.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
         bin_filesize                  = w_binsize
          filename                      =
                 'C:\Documents and Settings\Desktop\SO.pdf'
         filetype                      = 'BIN'
      APPEND                        = ' '
      WRITE_FIELD_SEPARATOR         = 'X'
      HEADER                        = '00'
      TRUNC_TRAILING_BLANKS         = ' '
      WRITE_LF                      = 'X'
      COL_SELECT                    = ' '
      COL_SELECT_MASK               = ' '
      DAT_MODE                      = ' '
      CONFIRM_OVERWRITE             = ' '
      NO_AUTH_CHECK                 = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      WRITE_BOM                     = ' '
    IMPORTING
      FILELENGTH                    = w_filelen
        TABLES
          data_tab                      = t_sale
       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.
    *&      Form  display_sales_data
       This subroutine is used to display the sales report               *
       No interface parameters
    FORM display_sales_data .
      LOOP AT t_sales.
        AT NEW spart.
          SKIP 3.
          WRITE :/ 'Sales Organization : ', t_sales-vkorg,
            / 'Distribution Channel : ', t_sales-vtweg,
            / 'Division             : ', t_sales-spart.
          SKIP.
          WRITE:/ 'Sales Order'(001),
            15 'Order Date'(002),
            30 'Sold-to-party'(003),
            50 'Ship-to-party'(004),
            65 'Item'(005),
            75 'Material'(006),
            90 'Quantity'(007).
          SKIP.
        ENDAT.
        IF t_sales-kunnr1 IS INITIAL.
          t_sales-kunnr1 = p_kunnr.
        ENDIF.
        WRITE :/ t_sales-vbeln UNDER text-001,
          t_sales-erdat UNDER text-002,
          t_sales-kunnr UNDER text-003,
          t_sales-kunnr1 UNDER text-004,
          t_sales-posnr UNDER text-005,
          t_sales-matnr UNDER text-006,
          t_sales-kwmeng UNDER text-007.
      ENDLOOP.
    ENDFORM.

  • 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.

  • Report Output to be mailed as an attachment-On Schedule

    Hi ,
    I have a requirement to develop a oracle report with reportbuilder6i,the report output should be in excel format,needs to be run every monday and has to be mailed to some id [email protected]
    While converting it to excel output emp.xls using text_io iam saving it in some location .I want that emp.xls to be mailed to an email id ,also the report has to be scheduled to run periodically.
    If any one has done it,can u share the details and code.
    Thanks in Advance.
    Regards,
    Roja

    At the first outset, I dont think, this is possible.  Moreover, this approach is definitely not recommended since it will severely impact on the system performance and if there is a Security Team, they will not allow to have this practice.
    Normally, either we can send as PDF attachment to any internal user via email or this can also be sent externally via PDF.  There is also an option to view as PDF from the existing output itself.
    G. Lakshmipathi

  • User exit to change vendor e-mail address used for PO output via e-mail...

    We have two vendor e-mail addresses for a particular vendor. Ignoring output determination, it looks like I will need to control which of the two e-mail vendor addresses is used when the PO is output via e-mail.
    The default is the first one e-mail address, but for PO's I would like to force the second vendor e-mail address.
    There are tonnes of exits available for PO output by the looks of it so I am trying to discover which is relevant for what I am trying to achieve.
    Jas
    Edited by: Jason Stratham on Apr 30, 2009 5:53 PM

    Thanks Martin,
    I guess that's the same path that I took earlier when using SPRO and looking at the Purchasing->Messages. In my case it's ZMEDRUCK, but that does not help me in regards to controlling the vendors e-mail address being used. When sending the PO as an e-mail it uses (by default) the first e-mail address of the Vendor, whereas the vendor could have multiple ones. In my test case my vendor has two addresses but it always defaults to using the first. I know that I need to modify this behaviour somehow, but how I have no idea as I can find no Exit routine.
    Jas

  • How to send purchase order via e-mail.

    Please could someone let me know how to send purchase order via e-mail.
    I am an BC.
    e-mailing is functionning however I am not very familiar in settings for MM

    No, you do not need to touch ME_PRINT_PO. You need to put code before and after ME_PRINT_PO in the print program.
    Step 1 - Copy the standard print program SAPFM06P to make a Z version, lets call it ZSAPFM06P
    Step 2 - Copy include FM06PE02 to make a Z version, lets call that ZFM06PE02.
    Step 3 - ZSAPFM06P change the statement "Include FM06PE02" to read "Include ZFM06PE02".
    Step 4 - In include ZFM06PE02 you will find a subroutine called "ENTRY_NEU". In this subroutine you will see it first calls ME_READ_PO_FOR_PRINTING then calls ME_PRINT_PO. Before it calls ME_PRINT_PO just put:
    l_nast-nacha = 1.
    CLEAR l_nast-dimme.
    This means that ME_PRINT_PO will not e-mail, it will create a spool request.
    Step 5 - Still in ZFM06PE02, after ME_PRINT_PO has been called, add new code. First check that ent_retco EQ 0. If it does not then exit.
    Step 6 - Get the spool ID created by ME_PRINT_PO by either moving sy-msgv1 to a variable or select from NAST.
    Step 7 - Call function CONVERT_OTFSPOOLJOB_2_PDF using the spool ID from step 6, and put the result from table PDF into an internal table you can use later. ALso store the export variable pdf_bytecount, you will need it later.
    Step 8 - Call function SX_TABLE_LINE_WIDTH_CHANGE using the table from step 7 as content_in and put the results from content_out into a new internal table.
    Step 9 - Add some text into a internal table of type solisti1, this will be the body text of the e-mail.
    Step 10 - Add whatever receivers you want into an internal table of type somlreci1. If you just want it to go to the address that the PO would have gone to anyway, select the e-mail address from ADR6 where the address number = l_doc-xekko-adrnr, that is the data from the PO.
    Step 11 - Populate an internal table of type sopcklsti1 with data relevant to your PDF table from step 8 and the text table from step 9. You will have to put the size of the PDF from step 7 (pdf_bytecount) on the PDF line and the size of the text will be the number of lines of text * 255.
    Step 12 - Add info to a structure of type sodocchgi1. You can add the e-mail title in here, field obj_descr. Also add the size of the PDF and the size of the text from step 12 into doc_size, and give the doc a name in field obj_name. This can be anything, ZPDFPO for example.
    Step 13 - Call SO_DOCUMENT_SEND_API1 using the tables from steps 8, 9, 10 and 11 and the structure from step 12. You can amend the sending e-mail also. Set commit_work to space.
    Step 14 - That is all you need, but I actually call function RSPO_R_RDELETE_SPOOLREQ to delete the spool request created in step 4, then call NAST_PROTOCOL_UPDATE to add some more messages to the processing log of the PO.
    That is all.

  • How to send a file via e-mail with director

    Is it even possible to have a button in a free-standing
    projector that would send a file via e-mail, or open up an e-mail
    program and have the file attached and addressed? Or is it possible
    to put a file on a server? Of course, both of these methods would
    alert the user and ask for their permission.

    To just open the user's email program, you can use the
    standard lingo:
    goToNetPage(mailto:[email protected])
    That approach is kind of annoying because it actually opens
    an empty
    browser window then the user's email program. I don't think
    you can use
    that approach to send attachments though.
    A much better way is the fabulous DirectEmail xtra from
    DirectXtras.
    Check out their site:
    http://www.directxtras.com/demail_home.asp?UUID=1217348
    DirectEmail can do everything you are asking for (and more).
    It is
    cross-platform, shockwave safe, can handle text or HTML
    email, can do
    attachments, can use a mail server or not, and is really easy
    to use.
    The same company makes DirectFTP which you can get from:
    http://www.directxtras.com/DFTP_home.asp?UUID=1217348
    DirectFTP can put files onto an FTP site with a minimum of
    fuss. I have
    used both on quite a few occasions and they rock. You can
    actually
    write a full-fledged email or ftp program with those xtras
    and Director.

  • Trying to send a photo via e-mail from iPhoto.  But it says my e-mail and password are wrong and won't send and I don't know how to correct it.  Where do I go?

    Trying to send a photo via e-mail from iPhoto.  But it says my e-mail and password are wrong and won't send and I don't know how to correct it.  Where do I go?

    In the iPhoto preferences ==> accounts delete the account and re-enter it
    LN

  • Sending report output to Excel

    Dear buddies
    I'm using OLE Object in my report to send its output to excel. I find this way from an example at the same forum. But I feel that this example is for very small sized reports which have to send a few cells to excel because in this method we've to map each boiler plate and data field to excel like this.
    function B_DEPTNOFormatTrigger return boolean is
    begin
    RPT2XLS.put_cell(1, 'DEPTNO', FontColor => 10, FontSize => 8, FontStyle => RPT2XLS.BOLD);
    RPT2XLS.new_line;
    return (TRUE);
    end;
    In this way its very hard to map large reports to excel which have more than 50 or 60 data fields and labels. So is there any short way to send its output to excel. Be careful that I also dont wanna use Delimited option coz Delimited file has also to be formatted while importing to Excel. Is there anyway that OLE Object should automatically detect all my Report Labels and fields or some other solution in yours minds???

    If you are using 10g reports you can use the latest parameter desformat=spreadsheet
    Rajesh Alex

  • Forms sending report output horizantally in excel...

    Hi....when I send my group above report output to exel it arranges each group horizantally. For example if there are two master groups 'A' & 'B' each of them having 500 child rows, then in excel fristly appears the Group 'A' with its 500 child records downwards. And group 'B' appears ahead of Group 'A' instead of down to Group 'A'. Is it not possible to arrange output in excel like that of oracle reports previewer???

    Is there no one to answer this???

  • Send Report Output to Excell?

    Hi all,
    can anyone say me, how can I send the output of Report to the Excell Worksheet?
    Regards

    Hi Leonid,
    you can try this:
    In AFTERPARAMETERFORM trigger:
    myfile TEXT_IO.FILE_TYPE;
    begin
    myfile := TEXT_IO.FOPEN(:DESNAME, 'W');
    TEXT_IO.PUT(myfile, 'first column heading');
    TEXT_IO.PUT(myfile, chr(9));
    etc...
    end;
    PROCEDURE write_xls IS -- report program unit
    myfile TEXT_IO.FILE_TYPE;
    begin
    myfile := TEXT_IO.FOPEN(:DESNAME, 'A');
    TEXT_IO.PUT(myfile, :column1);
    TEXT_IO.PUT(myfile, chr(9));
    etc...
    TEXT_IO.FCLOSE(myfile);
    end;
    In the repeating frame trigger:
    write_xls;
    RETURN (TRUE);
    Good luck,
    Monica

Maybe you are looking for

  • AQ Sort Order (priority,enq_time)

    HI I am trying to subscribe to a topic with Sort Order (priority,enq_time) using oracle.jms API.Payload type is an ADT generated from jpublisher.Though the same worked with Oracle.AQ API.After publishing i am updating the priority.But the subscribing

  • FUnction to calculate unique key

    Hi All, I have a situation where my source is 32 char length and destination InfoObject is only 20 char length. I want to derive a 20 char or less key from 32 char and store it in my InfoObject. The key should be unique to a char sequence. I should a

  • Difference in SRM 4.0 & 5.0

    Hi All, Can anyone throw light on the major differences in SRM 4.0 and 5.0 from an abaper's perspective? What all Badi's are added in 5.0? Thanks Nandalal

  • Is there a extensions for master and details pages?

    I want to know if there is an extension for the master page and detail page for Cs4.  I want to display the master page and have separate details pages.  I am using PHP.  I haven't anything on PHP but I have for ASP.  Can any one help me?

  • Suspend 2 Ram Guide (Like MS Sleep Feature in Windows)

    Suspend 2 Ram Guide Requirements: 1.Kernel 2.6.* with Sleep States Power Management Opitions -> Acpi -> Sleep States 2.Vbetool I think any 2.6.* kernel will work I am not sure Setup: 1. Make sure you have a kernel with Sleep States Compiled in. Any a