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

Similar Messages

  • TS3276 I need to send a photo via email as an attachment and not it shown in the body of the email?

    I need to send a photo via email as an attachment and NOT have it shown in the body of the email?  Please help.

    To make attachments not appear in the body of the e-mail as a default, try using the Applications/Utilities/Terminal command below. I suggest copy and paste.
    defaults write com.apple.mail DisableInlineAttachmentViewing -bool YES

  • 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

  • Send Report output as Email attachment (PDF)

    Hi Experts,
      i am trying to send the contents of an internal table from my report as email using PDF attachment. I have coded the logic and i get the attachment in the email. When i try to open the attachement, i cannot open it.
    The message i get is "_Adobe reader could not open the attachment "attach.pdf" because it is either not a supported file type or the file has been damaged(for example, it was sent as an email attachment and wasn't correctly decoded )._
    Not sure where i went wrong.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
    CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
      ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = w_doc_data
          put_in_outbox              = 'X'
          sender_address             = ld_sender_address
          sender_address_type        = ld_sender_address_type
          commit_work                = 'X'
        IMPORTING
          sent_to_all                = w_sent_all
        TABLES
          packing_list               = t_packing_list
          contents_bin               = t_attachment
          contents_txt               = it_message
          receivers                  = t_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.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.                    "send_file_as_email_attachment

    Hello RnB,
    You can check the mentioned link for the same:
    [Simple Program to generate PDF from ABAP List Output.|http://www.abapmadeeasy.com/2011/02/sap-abap-simple-program-to-generate-pdf.html]
    Regards,
    Uttam Agrawal

  • Sending reports output to email

    Hi ,
    I would like to send output of a report to email insted of printer. Are there any setting to be done. We are running on 11i.
    Thanks
    Kiran

    Please see the user manual.
    Oracle Alert User's Guide
    http://download.oracle.com/docs/cd/B25516_18/current/acrobat/115alrug.pdf
    Also, see old threads which discuss the same topic -- http://forums.oracle.com/forums/search.jspa?threadID=&q=Send+AND+E-mail+AND+Alert&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • Report output as email

    Hi All,
    I need to send report output as email text. is anybody has done this sort of work or any function module for this.
    Please help if anyone knows it.
    Cheers,
    Lokesh

    Hi
      Check the code for similar requirement I was faced earlier.
    Type for binary attachment table.
      types: l_ty_tab_objbin type solisti1 occurs 0.
      data: l_objbin type l_ty_tab_objbin.
    Tables to hold PDF data
      data: t_doctab type docs occurs 0,
            t_line  type tline occurs 0.
      tables : soli.             "SAPoffice: line, length 255
      tables : zpsdsalrep.       "ZPSDSALREP
      data: l_email type soli-line.
      data: l_email1 type soli-line.
      data: l_adrnr like kna1-adrnr.
      data: l_objky type nast-objky.
      data: l_zzterrmg type zpsdsalrep-zzterrmg.
      data: l_zsupervisor type zpsdsalrep-zsupervisor.
      data: l_kunnr type kna1-kunnr.
      data: l_kunnr1 type vbak-kunnr.
      data: l_reclist like somlreci1 occurs 0 with header line.
      data: l_objtxt    like solisti1 occurs   0 with header line.
      data: l_objpack   like sopcklsti1 occurs 0 with header line.
      data: l_doc_chng  like sodocchgi1.
      data: l_objhead   like solisti1 occurs   0 with header line.
      data: l_tab_lines like sy-tabix.
      constants: k_true type boolean_flg value 'X'.
      data: l_mail type somlreci1-receiver.
      data: l_mail1 type somlreci1-receiver.
      data:
    l_l_mail2 TYPE somlreci1-receiver.
    l_l_mail type somlreci1-receiver.
      data: l_zzsalesrep type zpsdsalrep-zzsalesrep.
      data: l_recipents type somlreci1-receiver.
      constants: k_x(1) type c value 'X',
                 k_u(1) type c value 'U',
                 k_raw(3) type c value 'RAW'.
      call function 'CONVERT_OTF_2_PDF'
    EXPORTING
      USE_OTF_MC_CMD               = 'X'
      ARCHIVE_INDEX                =
    IMPORTING
      BIN_FILESIZE                 =
        tables
          otf                          = t_otfdata
          doctab_archive               = t_doctab
          lines                        = t_line
          exceptions
         err_conv_not_possible        = 1
         err_otf_mc_noendmarker       = 2
         others                       = 3.
      if sy-subrc <> 0.
        write: / 'error', sy-subrc.
      endif.
    ***/ Convert the PDF format to the table type required for the
    **attachment.
      call function 'QCE1_CONVERT'
        tables
          t_source_tab         = t_line
          t_target_tab         = l_objbin
        exceptions
          convert_not_possible = 1
          others               = 2.
      if sy-subrc <> 0.
        write: / 'error', sy-subrc.
      endif.
      select single kunnr from vbak into l_kunnr1
             where vbeln = nast-objky.
      select single adrnr from kna1 into l_adrnr
             where kunnr = l_kunnr1.
      check sy-subrc is initial.
      select single smtp_addr from adr6 into l_email
             where addrnumber = l_adrnr.
    SELECT SINGLE zzterrmg FROM zpsdsalrep INTO l_zzterrmg
            WHERE zzsalesrep = l_kunnr1.
    SELECT SINGLE zsupervisor FROM zpsdsalrep INTO l_zsupervisor
         WHERE  zzterrmg = l_zzterrmg.
    SELECT SINGLE kunnr FROM kna1 INTO l_kunnr
           WHERE sortl = l_zsupervisor.
    SELECT SINGLE zsupervisor FROM zpsdsalrep INTO l_zsupervisor
           WHERE  zzsalesrep = l_kunnr1.
    SELECT SINGLE zzsalesrep FROM zpsdsalrep INTO l_zzsalesrep
           WHERE zzterrmg = l_zsupervisor.
    SELECT SINGLE adrnr FROM kna1 INTO l_adrnr
              WHERE kunnr = l_zzsalesrep.
    CHECK sy-subrc IS INITIAL.
    SELECT SINGLE smtp_addr FROM adr6 INTO l_email1
            WHERE addrnumber = l_adrnr.
    SELECT SINGLE adrnr FROM kna1 INTO l_adrnr
            WHERE kunnr = l_kunnr.
    CHECK sy-subrc IS INITIAL.
    SELECT SINGLE smtp_addr FROM adr6 INTO l_email1
            WHERE addrnumber = l_adrnr.
      l_mail = l_email.
    l_mail1 = l_email1.
    l_l_mail2 = text-006.
      l_l_mail = text-007.
    Creation of the document to be sent
    File Name
      l_doc_chng-obj_name = 'SENDFILE'.
    Mail Subject
      concatenate text-001 nast-objky into l_doc_chng-obj_descr.
    l_doc_chng-obj_descr = text-001.
    Completing the recipient list
      l_reclist-receiver = l_mail.
      l_reclist-rec_type = k_u.
      append l_reclist.
    l_reclist-receiver = l_mail1.
    l_reclist-rec_type = 'U'.
    APPEND l_reclist.
      l_reclist-receiver = l_l_mail.
      l_reclist-rec_type = k_u.
      append l_reclist.
    l_reclist-receiver = l_l_mail2.
    l_reclist-rec_type = 'U'.
    APPEND l_reclist.
    Mail Contents
      l_objtxt = text-002.
      append l_objtxt.
      clear l_objtxt.     " put in a blank line
      append l_objtxt.
      data: l_subject type solisti1.
      concatenate text-003 '-' nast-objky into l_subject.
      l_objtxt = l_subject.
      append l_objtxt.
      l_objtxt = text-004 .
      append l_objtxt.
    Calculate email size in bytes
      describe table l_objtxt lines l_tab_lines.
      read table l_objtxt index l_tab_lines.
      l_doc_chng-doc_size = ( l_tab_lines - 1 ) * 255 + strlen( l_objtxt ).
    Creation of the entry for the compressed document
    for the email text
      clear l_objpack-transf_bin.
      l_objpack-head_start = 1.
      l_objpack-head_num = 0.
      l_objpack-body_start = 1.
      l_objpack-body_num = l_tab_lines.
      l_objpack-doc_type = k_raw.
      append l_objpack.
    Creation of the document attachment
    (Assume that the data in OBJBIN is in BMP format)
      describe table l_objbin lines l_tab_lines.
      l_objhead = text-001  .
      append l_objhead.
      clear l_objpack.
    **/ Creation of the entry for the compressed/attached document
      l_objpack-transf_bin = k_true.
      l_objpack-head_start = 1.
      l_objpack-head_num = 1.
      l_objpack-body_start = 1.
      l_objpack-body_num = l_tab_lines.
      l_objpack-doc_type = 'PDF'.
      l_objpack-obj_name = text-005.
      l_objpack-obj_descr = text-001.
      l_objpack-doc_size = l_tab_lines * 255.
      append l_objpack. "/ .
      delete  l_reclist where receiver = ''.
    Sending the document
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1' " IN UPDATE TASK "/ .
        exporting
          document_data              = l_doc_chng
          put_in_outbox              = k_x
        tables
          packing_list               = l_objpack
          object_header              = l_objhead
          contents_bin               = l_objbin
          contents_txt               = l_objtxt
          receivers                  = l_reclist
        exceptions
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          others                     = 99.
      if sy-subrc <> 0.
        write: / 'unsuccessful', sy-subrc.
      else.
        concatenate l_mail ',' l_mail1 ',' l_l_mail into l_recipents.
        syst-msgid = '8I'.
        syst-msgno = '000'.
        syst-msgty = 'S'.
        syst-msgv1 = text-008.
        skip.
        syst-msgv2 = text-009.
        syst-msgv3 = l_recipents.
        clear:  syst-msgv4. "syst-msgv2, syst-msgv3,
        perform protocol_update.
        write:  / 'successful'.
      endif.
    **/Take_note it is a requirement to do a commit work for the
    email to go into transaction SOST.
    COMMIT WORK.   "/Take_note .
    if sy-subrc eq 0.
    endif.
    Regards,
    Sreeram

  • How do I send a page via email in the body of the mail and not as an attachment?

    I wish to send a page via email in the body of the mail. The only option to send a page appears to be to save it first and then attatch to the mail.

    When you are in the Plan View, right click on the icon for the page that you want to omit from the menu. Near the bottom, you'll see Menu Options, click on that and you'll have the choice to Exclude Page from Menus.

  • 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

  • Reg : Sending Script output to email

    Hi,
    I need to send script output to email.I have written the code for this functionality.
    Functional guy has created output type ,but that output type is red in clor and when I click process log " it says Parameter DEVICE= is invalid "
    Is there anything to be done from abap point for this error.
    Actually I used these 2 fun.modules
    DATA: LVF_DEVICE LIKE ITCPP-TDDEVICE.
    DATA: LVS_ITCPO TYPE ITCPO,
    LVF_DIALOG(1) TYPE C VALUE ' ',
    LVS_RECIPIENT LIKE SWOTOBJID,
    LVS_SENDER LIKE SWOTOBJID,
    LVS_SNAST TYPE SNAST,
    LVF_PROGRAM LIKE SY-REPID,
    LVS_COMM_TYPE TYPE AD_COMM,
    LVS_COMM_VALUES TYPE SZADR_COMM_VALUES.
    DATA:
    W_DEPT LIKE KNVK-ABTNR, "Department
    W_PRSNR LIKE KNVK-PRSNR. "Person number
    reset return code
    RETCODE = 0.
    IF NOT NAST-TCODE IS INITIAL AND NAST-NACHA EQ '5'.
    SELECT SINGLE * FROM USR21 WHERE BNAME = SY-UNAME.
    CALL FUNCTION 'ADDR_GET_NEXT_COMM_TYPE'
    EXPORTING
    strategy = nast-tcode
    address_number = Kna1-adrnr
    IMPORTING
    comm_type = lvs_comm_type
    comm_values = lvs_comm_values
    TABLES
    STRATEGY_TABLE =
    EXCEPTIONS
    address_not_exist = 1
    person_not_exist = 2
    no_comm_type_found = 3
    internal_error = 4
    parameter_error = 5
    OTHERS = 6.
    convert communication data
    Always INT
    LVS_COMM_TYPE = 'INT'.
    clear LVS_COMM_VALUES-ADSMTP-SMTP_ADDR.
    Get Contact persons number from KNVK
    SELECT SINGLE * FROM KNVK WHERE KUNNR EQ NAST-PARNR
    AND ABTNR EQ W_DEPT.
    Get it from ADR6 table always
    Select single * from adr6 where addrnumber = kna1-adrnr
    AND PERSNUMBER = KNVK-PRSNR.
    IF SY-SUBRC EQ 0 AND adr6-Smtp_addr NE ' '.
    LVS_COMM_VALUES-ADSMTP-SMTP_ADDR = adr6-Smtp_addr.
    ENDIF.
    ENDIF.
    MOVE-CORRESPONDING nast TO LVS_SNAST .
    MOVE sy-repid TO LVF_PROGRAM.
    CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'
    EXPORTING
    pi_comm_type = lvs_comm_type
    pi_comm_values = lvs_comm_values
    pi_country = kna1-land1
    pi_repid = LVF_PROGRAM
    pi_snast = LVS_SNAST
    IMPORTING
    pe_itcpo = lvs_itcpo
    pe_device = lvf_device
    pe_mail_recipient = lvs_recipient
    pe_mail_sender = lvs_sender
    EXCEPTIONS
    comm_type_not_supported = 1
    recipient_creation_failed = 2
    sender_creation_failed = 3
    OTHERS = 4.
    fill structure itcpo
    ITCPO = LVS_ITCPO.
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
    APPLICATION = 'TX'
    ARCHIVE_INDEX = TOA_DARA
    ARCHIVE_PARAMS = ARC_PARAMS
    DEVICE = LVF_DEVICE
    DIALOG = ' '
    FORM = TNAPR-FONAM
    LANGUAGE = NAST-SPRAS
    OPTIONS = LVS_ITCPO
    MAIL_SENDER = LVS_SENDER
    MAIL_RECIPIENT = LVS_RECIPIENT
    MAIL_APPL_OBJECT = ' '
    RAW_DATA_INTERFACE = '*'
    IMPORTING
    LANGUAGE =
    NEW_ARCHIVE_PARAMS =
    RESULT =
    EXCEPTIONS
    CANCELED = 1
    DEVICE = 2
    FORM = 3
    OPTIONS = 4
    UNCLOSED = 5
    MAIL_OPTIONS = 6
    ARCHIVE_ERROR = 7
    OTHERS = 8.
    IF SY-SUBRC NE 0.
    CASE SY-SUBRC.
    WHEN 7.
    RETCODE = SY-SUBRC.
    SYST-MSGID = 'VN'.
    SYST-MSGNO = '096'.
    SYST-MSGTY = 'E'.
    SYST-MSGV1 = NAST-KSCHL.
    SYST-MSGV2 = NAST-KAPPL.
    PERFORM PROTOCOL_UPDATE.
    WHEN OTHERS.
    RETCODE = SY-SUBRC.
    PERFORM PROTOCOL_UPDATE.
    ENDCASE.
    ENDIF.
    and one more query is :
    I want to know weather
    "Are there any settings need to be done by BASIS people."
    If Anyone has any idea plz reply.

    Hi
    Use the below peace of code,I was used to send sales order confirmation script output as email.
    Change History
    Programmer   Date     Change Request Description
    FKHURRAM     9/16/02  DU1K920151     Upgrade changes.
                                         Use ADRC for Address Data
                 Print of an order confirmation by SAPscript
    REPORT rvador01 LINE-COUNT 100 MESSAGE-ID vn.
    TABLES: komk,                          "Communicationarea for conditions
            komp,                          "Communicationarea for conditions
            komvd,                         "Communicationarea for conditions
            vbco3,                         "Communicationarea for view
            vbdka,                         "Headerview
            vbdpa,                         "Itemview
            vbdpau,                        "Subitemnumbers
            conf_out,                      "Configuration data
            sadr,                          "Addresses
            tvag,                          "Reason for rejection
            vedka,                         "Servicecontract head data
            vedpa,                         "Servicecontract position data
            vedkn,                         "Servicecontract head notice data
            vedpn,                         "Servicecontract pos. notice data
            vbpa,                          "Sales Document: Partner
            kna1,                          "General Data in Customer Master
            riserls,                       "Serialnumbers
            komser,                        "Serialnumbers for print
            tvbur,                         "Sales office
            tvko,                          "Sales organisation
            adrs,                          "Communicationarea for Address
            fpltdr.                        "billing schedules
    INCLUDE yzrvadtabl.
    *INCLUDE RVADTABL.
    INCLUDE yzrvdirekt.
    *INCLUDE RVDIREKT.
    INCLUDE yzvedadata.
    *INCLUDE VEDADATA.
    DATA: retcode   LIKE sy-subrc.         "Returncode
    DATA: repeat(1) TYPE c.
    DATA: xscreen(1) TYPE c.               "Output on printer or screen
    DATA: BEGIN OF steu,                   "Controldata for output
            vdkex(1) TYPE c,
            vdpex(1) TYPE c,
            kbkex(1) TYPE c,
            kbpex(1) TYPE c,
          END OF steu.
    DATA: BEGIN OF tvbdpa OCCURS 0.        "Internal table for items
            INCLUDE STRUCTURE vbdpa.
    DATA: END OF tvbdpa.
    DATA: BEGIN OF tkomv OCCURS 50.
            INCLUDE STRUCTURE komv.
    DATA: END OF tkomv.
    DATA: BEGIN OF tkomvd OCCURS 50.
            INCLUDE STRUCTURE komvd.
    DATA: END OF tkomvd.
    DATA: BEGIN OF tvbdpau OCCURS 5.
            INCLUDE STRUCTURE vbdpau.
    DATA: END   OF tvbdpau.
    DATA: BEGIN OF tkomcon OCCURS 50.
            INCLUDE STRUCTURE conf_out.
    DATA: END   OF tkomcon.
    DATA: BEGIN OF tkomservh OCCURS 1.
            INCLUDE STRUCTURE vedka.
    DATA: END   OF tkomservh.
    DATA: BEGIN OF tkomservp OCCURS 5.
            INCLUDE STRUCTURE vedpa.
    DATA: END   OF tkomservp.
    DATA: BEGIN OF tkomservhn OCCURS 5.
            INCLUDE STRUCTURE vedkn.
    DATA: END   OF tkomservhn.
    DATA: BEGIN OF tkomservpn OCCURS 5.
            INCLUDE STRUCTURE vedpn.
    DATA: END   OF tkomservpn.
    DATA: BEGIN OF tkomser OCCURS 5.
            INCLUDE STRUCTURE riserls.
    DATA: END   OF tkomser.
    DATA: BEGIN OF tkomser_print OCCURS 5.
            INCLUDE STRUCTURE komser.
    DATA: END   OF tkomser_print.
    DATA: BEGIN OF tfpltdr OCCURS 5.
            INCLUDE STRUCTURE fpltdr.
    DATA: END   OF tfpltdr.
    DATA: pr_kappl(01)   TYPE c VALUE 'V'. "Application for pricing
    DATA: BEGIN OF char_val OCCURS 0,
            atnam LIKE cabn-atnam,
            atwrt LIKE ausp-atwrt,
          END OF char_val.
    FORM entry USING return_code us_screen.
      CLEAR retcode.
      xscreen = us_screen.
      PERFORM processing.
      IF retcode NE 0.
        return_code = 1.
      ELSE.
        return_code = 0.
      ENDIF.
    ENDFORM.                    "ENTRY
          FORM PROCESSING                                               *
    FORM processing.
      PERFORM get_data.
      CHECK retcode = 0.
      PERFORM form_open USING xscreen vbdka-land1.
      CHECK retcode = 0.
      PERFORM logo_selection.
      PERFORM form_title_print.
      CHECK retcode = 0.
      PERFORM write_header_info.
      PERFORM validity_print.
      CHECK retcode = 0.
      PERFORM header_data_print.
      CHECK retcode = 0.
      PERFORM header_serv_print.
      CHECK retcode = 0.
      PERFORM header_notice_print.
      CHECK retcode = 0.
      PERFORM header_inter_print.
      CHECK retcode = 0.
      PERFORM header_text_print.
      CHECK retcode = 0.
      PERFORM item_print.
      CHECK retcode = 0.
      PERFORM end_print.
      CHECK retcode = 0.
      PERFORM form_close.
      CHECK retcode = 0.
    *********************changes on 12/04/2007****************
      TABLES: tsp01.
      TYPES: BEGIN OF t_spool,
             rqident TYPE tsp01-rqident,
            END OF t_spool.
      DATA: i_spool TYPE STANDARD TABLE OF t_spool,
            wa_spool TYPE t_spool.
      SELECT  rqident FROM tsp01
      INTO TABLE i_spool
    WHERE rqowner = sy-uname.
      SORT i_spool DESCENDING BY rqident.
      LOOP AT i_spool INTO wa_spool.
      ENDLOOP.
    data: l_rqident type tsp01-rqident.
    SELECT SINGLE rqident FROM tsp01 INTO l_rqident
    WHERE rqowner = sy-uname.
    DATA: l_spoolno LIKE tsp01-rqident VALUE '0000024884'.
      TYPES: l_ty_tab_pdf TYPE tline OCCURS 0.
      DATA: l_pdf TYPE l_ty_tab_pdf,
            l_spool TYPE tsp01-rqident.
    Type for binary attachment table.
      TYPES: l_ty_tab_objbin TYPE solisti1 OCCURS 0.
      DATA: l_objbin TYPE l_ty_tab_objbin.
    l_spool = l_spoolno.
      l_spool = l_rqident.
      l_spool = wa_spool-rqident.
    **/ Call the standard function
      CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'             "#EC ARGCHECKED
          EXPORTING
            src_spoolid                    = l_spool
            no_dialog                      = ' '
          DST_DEVICE                     =
          PDF_DESTINATION                =
         IMPORTING
           pdf_bytecount                  = numbytes
           pdf_spoolid                    = pdfspoolid
          LIST_PAGECOUNT                 =
           btc_jobname                    = jobname
           btc_jobcount                   = jobcount
          TABLES
            pdf                            = l_pdf
          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.
        WRITE: / 'error', sy-subrc.
      ENDIF.
    **/ Convert the PDF format to the table type required for the
    *attachment.
      CALL FUNCTION 'QCE1_CONVERT'
        TABLES
          t_source_tab         = l_pdf
          t_target_tab         = l_objbin
        EXCEPTIONS
          convert_not_possible = 1
          OTHERS               = 2.
      IF sy-subrc <> 0.
        WRITE: / 'error', sy-subrc.
      ENDIF.
      TABLES : soli.
      TABLES : zpsdsalrep.
      DATA: v_email TYPE soli-line.
      DATA: v_email1 TYPE soli-line.
      DATA: l_adrnr LIKE kna1-adrnr.
      DATA: l_objky TYPE nast-objky.
      DATA: l_zzterrmg TYPE zpsdsalrep-zzterrmg.
      DATA: l_zsupervisor TYPE zpsdsalrep-zsupervisor.
      DATA: l_kunnr TYPE kna1-kunnr.
      DATA: l_kunnr1 TYPE vbak-kunnr.
      SELECT SINGLE kunnr FROM vbak INTO l_kunnr1
             WHERE vbeln = nast-objky.
      SELECT SINGLE adrnr FROM kna1 INTO l_adrnr
             WHERE kunnr = l_kunnr1.
      CHECK sy-subrc IS INITIAL.
      SELECT SINGLE smtp_addr FROM adr6 INTO v_email
             WHERE addrnumber = l_adrnr.
      SELECT SINGLE zzterrmg FROM zpsdsalrep INTO l_zzterrmg
             WHERE zzsalesrep = l_kunnr1.
      SELECT SINGLE zsupervisor FROM zpsdsalrep INTO l_zsupervisor
          WHERE  zzterrmg = l_zzterrmg.
      SELECT SINGLE kunnr FROM kna1 INTO l_kunnr
            WHERE sortl = l_zsupervisor.
      SELECT SINGLE adrnr FROM kna1 INTO l_adrnr
             WHERE kunnr = l_kunnr.
      CHECK sy-subrc IS INITIAL.
      SELECT SINGLE smtp_addr FROM adr6 INTO v_email1
             WHERE addrnumber = l_adrnr.
      DATA: l_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
      DATA: l_objtxt    LIKE solisti1 OCCURS   0 WITH HEADER LINE.
      DATA: l_objpack   LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
      DATA: l_doc_chng  LIKE sodocchgi1.
      DATA: l_objhead   LIKE solisti1 OCCURS   0 WITH HEADER LINE.
      DATA: l_tab_lines LIKE sy-tabix.
      CONSTANTS: k_true TYPE boolean_flg VALUE 'X'.
      DATA: l_mail TYPE somlreci1-receiver.
      DATA: l_mail1 TYPE somlreci1-receiver.
      DATA: k_mail2 TYPE somlreci1-receiver.
      DATA: k_mail TYPE somlreci1-receiver.
      l_mail = v_email.
      l_mail1 = v_email1.
      k_mail2 = text-006.
      k_mail = text-007.
    Creation of the document to be sent
    File Name
      l_doc_chng-obj_name = 'SENDFILE'.
    Mail Subject
      l_doc_chng-obj_descr = text-001.
    Completing the recipient list
      l_reclist-receiver = l_mail.
      l_reclist-rec_type = 'U'.
      APPEND l_reclist.
      l_reclist-receiver = l_mail1.
      l_reclist-rec_type = 'U'.
      APPEND l_reclist.
      l_reclist-receiver = k_mail.
      l_reclist-rec_type = 'U'.
      APPEND l_reclist.
      l_reclist-receiver = k_mail2.
      l_reclist-rec_type = 'U'.
      APPEND l_reclist.
    Mail Contents
      l_objtxt = text-002.
      APPEND l_objtxt.
      CLEAR l_objtxt.     " put in a blank line
      APPEND l_objtxt.
      l_objtxt = text-003.
      APPEND l_objtxt.
      l_objtxt = text-004 .
      APPEND l_objtxt.
    Calculate email size in bytes
      DESCRIBE TABLE l_objtxt LINES l_tab_lines.
      READ TABLE l_objtxt INDEX l_tab_lines.
      l_doc_chng-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( l_objtxt ).
    Creation of the entry for the compressed document
    for the email text
      CLEAR l_objpack-transf_bin.
      l_objpack-head_start = 1.
      l_objpack-head_num = 0.
      l_objpack-body_start = 1.
      l_objpack-body_num = l_tab_lines.
      l_objpack-doc_type = 'RAW'.
      APPEND l_objpack.
    Creation of the document attachment
    (Assume that the data in OBJBIN is in BMP format)
      DESCRIBE TABLE l_objbin LINES l_tab_lines.
      l_objhead = text-001  .
      APPEND l_objhead.
      CLEAR l_objpack.
    **/ Creation of the entry for the compressed/attached document
      l_objpack-transf_bin = k_true.
      l_objpack-head_start = 1.
      l_objpack-head_num = 1.
      l_objpack-body_start = 1.
      l_objpack-body_num = l_tab_lines.
      l_objpack-doc_type = 'PDF'.
      l_objpack-obj_name = text-005.
      l_objpack-obj_descr = text-001.
      l_objpack-doc_size = l_tab_lines * 255.
      APPEND l_objpack. "/ .
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1' "/ .
        EXPORTING
          document_data              = l_doc_chng
          put_in_outbox              = 'X'
        TABLES
          packing_list               = l_objpack
          object_header              = l_objhead
          contents_bin               = l_objbin
          contents_txt               = l_objtxt
          receivers                  = l_reclist
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
      IF sy-subrc <> 0.
        WRITE: / 'unsuccessful', sy-subrc.
      ELSE.
        WRITE:  / 'successful'.
      ENDIF.
    **/Take_note it is a requirement to do a commit work for the
    email to go into transaction SOST.
      COMMIT WORK.   "/Take_note .
    ENDFORM.                    "PROCESSING
          S U B R O U T I N E S                                         *
          FORM ALTERNATIVE_ITEM                                         *
          A text is printed, if the item is an alternative item.        *
    FORM alternative_item.
      CHECK vbdpa-grpos CN '0'.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'ALTERNATIVE_ITEM'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "ALTERNATIVE_ITEM
          FORM CHECK_REPEAT                                             *
          A text is printed, if it is a repeat print for the document.  *
    FORM check_repeat.
      CLEAR repeat.
      SELECT * INTO *nast FROM nast WHERE kappl = nast-kappl
                                    AND   objky = nast-objky
                                    AND   kschl = nast-kschl
                                    AND   spras = nast-spras
                                    AND   parnr = nast-parnr
                                    AND   parvw = nast-parvw
                                    AND   nacha BETWEEN '1' AND '4'.
        CHECK *nast-vstat = '1'.
        repeat = 'X'.
        EXIT.
      ENDSELECT.
    ENDFORM.                    "CHECK_REPEAT
          FORM DELIVERY_DATE                                            *
          If the delivery date in the item is different to the header   *
          date and there are no scheduled quantities, the delivery date *
          is printed in the item block.                                 *
    FORM delivery_date.
      IF vbdka-lfdat =  space AND
         vbdpa-lfdat NE space AND
         vbdpa-etenr_da = space.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'ITEM_DELIVERY_DATE'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDIF.
    ENDFORM.                    "DELIVERY_DATE
          FORM DIFFERENT_CONSIGNEE                                      *
          If the consignee in the item is different to the header con-  *
          signee, it is printed by this routine.                        *
    FORM different_consignee.
      CHECK vbdka-name1_we NE vbdpa-name1_we
        OR  vbdka-name2_we NE vbdpa-name2_we
        OR  vbdka-name3_we NE vbdpa-name3_we
        OR  vbdka-name4_we NE vbdpa-name4_we.
      CHECK vbdpa-name1_we NE space
        OR  vbdpa-name2_we NE space
        OR  vbdpa-name3_we NE space
        OR  vbdpa-name4_we NE space.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'ITEM_CONSIGNEE'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "DIFFERENT_CONSIGNEE
          FORM DIFFERENT_REFERENCE_NO                                   *
          If the reference number in the item is different to the header*
          reference number, it is printed by this routine.              *
    FORM different_reference_no.
      CHECK vbdpa-vbeln_vang NE vbdka-vbeln_vang
        OR  vbdpa-vbtyp_vang NE vbdka-vbtyp_vang.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'ITEM_REFERENCE_NO'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "DIFFERENT_REFERENCE_NO
          FORM DIFFERENT_TERMS                                          *
          If the terms in the item are different to the header terms,   *
          they are printed by this routine.                             *
    FORM different_terms.
      DATA: us_vposn   LIKE vedpa-vposn.
      DATA: us_text(1) TYPE c.             "Flag for Noticetext was printed
      IF vbdpa-zterm NE vbdka-zterm AND
         vbdpa-zterm NE space.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'ITEM_TERMS_OF_PAYMENT'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDIF.
      IF vbdpa-inco1 NE space.
        IF vbdpa-inco1 NE vbdka-inco1 OR
           vbdpa-inco2 NE vbdka-inco2.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_TERMS_OF_DELIVERY'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        ENDIF.
      ENDIF.
    Print different validity-data for the position
      READ TABLE tkomservp WITH KEY vbdpa-posnr.
      IF sy-subrc EQ 0.
        vedpa = tkomservp.
        IF vedpa-vbegdat NE space       AND
           vedpa-venddat NE space       AND
           NOT vedpa-vbegdat IS INITIAL AND
           NOT vedpa-venddat IS INITIAL.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_TERMS_OF_SERV1'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        ELSEIF vedpa-vbegdat NE space AND
               NOT vedpa-vbegdat IS INITIAL.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_TERMS_OF_SERV2'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        ELSE.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_TERMS_OF_SERV3'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        ENDIF.
      ENDIF.
    Notice-rules for the positions.
      MOVE vbdpa-posnr TO us_vposn.
      CLEAR us_text.
      LOOP AT tkomservpn WHERE vposn = us_vposn.
        vedpn = tkomservpn.
        IF us_text IS INITIAL.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_TERMS_OF_NOTTXT'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
          us_text = charx.
        ENDIF.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'ITEM_TERMS_OF_NOTICE'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDLOOP.
      IF NOT us_text IS INITIAL.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'EMPTY_LINE'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDIF.
    ENDFORM.                    "DIFFERENT_TERMS
          FORM END_PRINT                                                *
    FORM end_print.
      PERFORM get_header_prices.
      CALL FUNCTION 'CONTROL_FORM'
        EXPORTING
          command = 'PROTECT'.
      PERFORM header_price_print.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'END_VALUES'.
      CALL FUNCTION 'CONTROL_FORM'
        EXPORTING
          command = 'ENDPROTECT'.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'SUPPLEMENT_TEXT'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "END_PRINT
          FORM FORM_CLOSE                                               *
          End of printing the form                                      *
    FORM form_close.
      CALL FUNCTION 'CLOSE_FORM'
        EXCEPTIONS
          OTHERS = 1.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
        retcode = 1.
      ENDIF.
      SET COUNTRY space.
    ENDFORM.                    "FORM_CLOSE
          FORM FORM_OPEN                                                *
          Start of printing the form                                    *
    -->  US_SCREEN  Output on screen                                   *
                     ' ' = printer                                      *
                     'X' = screen                                       *
    -->  US_COUNTRY County for telecommunication and SET COUNTRY       *
    FORM form_open USING us_screen us_country.
      INCLUDE yzrvadopfo.
    INCLUDE RVADOPFO.
    ENDFORM.                    "FORM_OPEN
          FORM FORM_TITLE_PRINT                                         *
          Printing of the form title depending of the field VBTYP       *
    FORM form_title_print.
      CASE vbdka-vbtyp.
        WHEN 'A'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_A'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'B'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_B'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'C'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_C'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'E'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_E'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'F'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_F'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'G'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_F'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'H'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_H'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'K'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_K'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'L'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_L'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN OTHERS.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_OTHERS'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
      ENDCASE.
      IF repeat NE space.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'REPEAT'
            window  = 'REPEAT'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDIF.
    ENDFORM.                    "FORM_TITLE_PRINT
          FORM GET_DATA                                                 *
          General provision of data for the form                        *
    FORM get_data.
      DATA: us_veda_vbeln     LIKE veda-vbeln.
      DATA: us_veda_posnr_low LIKE veda-vposn.
      CALL FUNCTION 'RV_PRICE_PRINT_REFRESH'
        TABLES
          tkomv = tkomv.
      CLEAR komk.
      CLEAR komp.
      vbco3-mandt = sy-mandt.
      vbco3-spras = nast-spras.
      vbco3-vbeln = nast-objky.
      vbco3-kunde = nast-parnr.
      vbco3-parvw = nast-parvw.
      CALL FUNCTION 'RV_DOCUMENT_PRINT_VIEW'
        EXPORTING
          comwa = vbco3
        IMPORTING
          kopf  = vbdka
        TABLES
          pos   = tvbdpa.
    Fetch servicecontract-data and notice-data for head and position.
      us_veda_vbeln     = vbdka-vbeln.
      us_veda_posnr_low = posnr_low.
      CALL FUNCTION 'SD_VEDA_GET_PRINT_DATA'
        EXPORTING
          i_document_number = us_veda_vbeln
          i_language        = sy-langu
          i_posnr_low       = us_veda_posnr_low
        TABLES
          print_data_pos    = tkomservp
          print_data_head   = tkomservh
          print_notice_pos  = tkomservpn
          print_notice_head = tkomservhn.
      PERFORM get_controll_data.
      PERFORM sender.
      PERFORM check_repeat.
      PERFORM tvbdpau_create.
    ENDFORM.                    "GET_DATA
          FORM GET_ITEM_BILLING_SCHEDULES                               *
          In this routine the billing schedules are fetched from the    *
          database.                                                     *
    FORM get_item_billing_schedules.
      REFRESH tfpltdr.
      CHECK NOT vbdpa-fplnr IS INITIAL.
      CALL FUNCTION 'BILLING_SCHED_PRINTVIEW_READ'
        EXPORTING
          i_fplnr    = vbdpa-fplnr
          i_language = nast-spras
        TABLES
          zfpltdr    = tfpltdr.
    ENDFORM.                    "GET_ITEM_BILLING_SCHEDULES
    *&      Form  ITEM_BILLING_SCHEDULES_PRINT
          This routine prints the billing shedules of a salesdocument    *
          position.                                                      *
    FORM  item_billing_schedules_print.
      DATA: first_line(1) TYPE c.
      first_line = charx.
      LOOP AT tfpltdr.
        fpltdr = tfpltdr.
      Output of the following printlines
        IF NOT fpltdr-perio IS INITIAL.
        periodische Fakturen
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_BILLING_SCHEDULE_PERIODIC'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        bei periodischen nur eine Zeile
          EXIT.
        ELSEIF fpltdr-fareg CA '14'.
        prozentuale Teilfakturierung
          IF NOT first_line IS INITIAL.
            CLEAR first_line.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_BILLING_SCHEDULE_PERCENT_HEADER'
              EXCEPTIONS
                element = 1
                window  = 2.
            IF sy-subrc NE 0.
              PERFORM protocol_update.
            ENDIF.
          ELSE.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_BILLING_SCHEDULE_PERCENT'
              EXCEPTIONS
                element = 1
                window  = 2.
            IF sy-subrc NE 0.
              PERFORM protocol_update.
            ENDIF.
          ENDIF.
        ELSEIF fpltdr-fareg CA '235'.
        wertmäßige  Teilfakturierung
          IF NOT first_line IS INITIAL.
            CLEAR first_line.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_BILLING_SCHEDULE_VALUE_HEADER'
              EXCEPTIONS
                element = 1
                window  = 2.
            IF sy-subrc NE 0.
              PERFORM protocol_update.
            ENDIF.
          ELSE.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_BILLING_SCHEDULE_VALUE'
              EXCEPTIONS
                element = 1
                window  = 2.
            IF sy-subrc NE 0.
              PERFORM protocol_update.
            ENDIF.
          ENDIF.
        ELSEIF fpltdr-fareg CA '3'.
        Schlußrechnung
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "ITEM_BILLING_SCHEDULES_PRINT
    *eject
          FORM GET_ITEM_CHARACTERISTICS                                 *
          In this routine the configuration data item is fetched from   *
          the database.                                                 *
    FORM get_item_characteristics.
      REFRESH tkomcon.
      CHECK NOT vbdpa-cuobj IS INITIAL.
      CALL FUNCTION 'CUD0_GET_CONFIGURATION'                    "#EC EXISTS
        EXPORTING
          instance      = vbdpa-cuobj
          language      = nast-spras
        TABLES
          configuration = tkomcon
        EXCEPTIONS
          OTHERS        = 4.
    ENDFORM.                    "GET_ITEM_CHARACTERISTICS
          FORM GET_ITEM_PRICES                                          *
          In this routine the price data for the item is fetched from   *
          the database.                                                 *
    FORM get_item_prices.
      CLEAR: komp,
             tkomv.
      IF komk-knumv NE vbdka-knumv.
        CLEAR komk.
        komk-mandt = sy-mandt.
        komk-kalsm = vbdka-kalsm.
        komk-kappl = pr_kappl.
        komk-waerk = vbdka-waerk.
        komk-knumv = vbdka-knumv.
        komk-vbtyp = vbdka-vbtyp.
      ENDIF.
      komp-kposn = vbdpa-posnr.
      CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
        EXPORTING
          comm_head_i = komk
          comm_item_i = komp
          language    = nast-spras
        IMPORTING
          comm_head_e = komk
          comm_item_e = komp
        TABLES
          tkomv       = tkomv
          tkomvd      = tkomvd.
    ENDFORM.                    "GET_ITEM_PRICES
          FORM GET_HEADER_PRICES                                        *
          In this routine the price data for the header is fetched from *
          the database.                                                 *
    FORM get_header_prices.
      CALL FUNCTION 'RV_PRICE_PRINT_HEAD'
        EXPORTING
          comm_head_i = komk
          language    = nast-spras
        IMPORTING
          comm_head_e = komk
        TABLES
          tkomv       = tkomv
          tkomvd      = tkomvd.
    ENDFORM.                    "GET_HEADER_PRICES
    *&      Form  HEADER_DATA_PRINT
          Printing of header data like terms, weights ....               *
    FORM header_data_print.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'HEADER_DATA'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                               " HEADER_DATA_PRINT
          FORM HEADER_PRICE_PRINT                                       *
          Printout of the header prices                                 *
    FORM header_price_print.
      LOOP AT tkomvd.
        AT FIRST.
          IF komk-supos NE 0.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_SUM'.
          ELSE.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'UNDER_LINE'
              EXCEPTIONS
                element = 1
                window  = 2.
            IF sy-subrc NE 0.
              PERFORM protocol_update.
            ENDIF.
          ENDIF.
        ENDAT.
        komvd = tkomvd.
        IF komvd-koaid = 'D'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TAX_LINE'.
        ELSE.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'SUM_LINE'.
        ENDIF.
      ENDLOOP.
      DESCRIBE TABLE tkomvd LINES sy-tfill.
      IF sy-tfill = 0.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'UNDER_LINE'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDIF.
    ENDFORM.                    "HEADER_PRICE_PRINT
          FORM HEADER_TEXT_PRINT                                        *
          Printout of the headertexts                                   *
    FORM header_text_print.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'HEADER_TEXT'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "HEADER_TEXT_PRINT
          FORM ITEM_CHARACERISTICS_PRINT                                *
          Printout of the item characteristics -> configuration         *
    FORM item_characteristics_print.
      LOOP AT tkomcon.
        conf_out = tkomcon.
        IF sy-tabix = 1.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_LINE_CONFIGURATION_HEADER'
            EXCEPTIONS
              OTHERS  = 1.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        ELSE.
          CALL FUNCTION 'WRITE_FORM'
            EXPOR

  • Sending 'Dunning Letters' via Email ? - -has anyone succeeded ??

    Hi
    Has anyone had any joy with sending Dunning letters via email at all
    We can get it to work via FAX , but get the following error when trying to send via email
    'connection error on node'
    even tho, there is nothing wrong with the node at all
    via SCOT , we have the default conversion as 'raw text to txt'   which works with everthing else
    If we change to 'raw text' to 'pdf'  we actually get two PDF's - one is blank however
    When viewed via SOST, you cannot open it straight up, you have to open an attachment
    when we queried this with SAP, they say that dunning letters are set up to open as attachments
    The function module is almost identical to that used by statements and remiitances, which works absolutely fine
    I have posted this on a more technical forum as it is not an FI issue, it is a technical problem, which i hope someone has come across and able to resolve for us
    Many thanks
    Tony

    Hi
    Have you see SAP Note 1042992 - Dunning by mail w/ SAPscript: Introductory text w/ attachmnt? Please, check the steps that this note suggests. At a release 46B I did with the enhancement F150D001 (at ECC 5.0 it is too), and you have a demo coding in include LX150F01.
    I hope this helps you
    Regards
    Eduardo
    PD: I forgot, according your coding check what is the email address for the customer, if the customer doesn't have email, then the letter goes to the SPOOL order. Check it in the include ZX* or in the BTE.
    Edited by: E_Hinojosa on Mar 1, 2012 5:22 PM

  • Every time I send a photo via email, I have to type in my password.  I'd like to disable that.

    I can't seem to send a photo via email without having to type in my password.  Can I disable that?

    Hello, olyhank. 
    Thank you for visiting Apple Support Communities.
    Here is an article that will walk you through some troubleshooting steps for this issue.  Start with the attached section in the article below.
    Tip: If you see a sheet or dialog that states 'Enter the password for user "email address'", this indicates that the email service provider is having an issue with the password being sent by Mail, or there is an issue with the email account. Contact the email service provider for support. ChooseWindow > Connection Doctor click "Show Detail" then click "Check Again". The information displayed in the "Show Detail" drawer may include details from the email service provider about what the issue is. Look for headers that start with "[ALERT]".
    OS X Mail: Troubleshooting sending and receiving email messages
    http://support.apple.com/kb/ts3276
    Cheers,
    Jason H.

  • IPhone 5 - Insert picture from email doesn't work, but sending in Photos via email does?

    I have an issue with a user here at my office.  When composing an email and they insert a picture from their phone, it sends the email, but the picture is not attached.
    However, if we go to Photos and send the photo via email, it works fine.
    He had been able to send fine up until yesterday afternoon and then it stopped working, so I believe he's done something, but I have no idea what.  Took a look at his settings and everything seems normal.  Also, rebooted his phone, but the same issue occurs.  And as far as I know, he's the only one having this issue.
    We are running email via Lotus Traveler/Domino, but I've tested my iPhone and everything sends fine, so I don't believe this is a server issue.
    Does anyone have any idea of what to try here?
    PS - user is using ios7.1 (same as mine)

    I have an issue with a user here at my office.  When composing an email and they insert a picture from their phone, it sends the email, but the picture is not attached.
    However, if we go to Photos and send the photo via email, it works fine.
    He had been able to send fine up until yesterday afternoon and then it stopped working, so I believe he's done something, but I have no idea what.  Took a look at his settings and everything seems normal.  Also, rebooted his phone, but the same issue occurs.  And as far as I know, he's the only one having this issue.
    We are running email via Lotus Traveler/Domino, but I've tested my iPhone and everything sends fine, so I don't believe this is a server issue.
    Does anyone have any idea of what to try here?
    PS - user is using ios7.1 (same as mine)

  • Need to send Smart form via email through Driver program

    Hi All,
    We need to send smart form via email through a new driver program (z program). Can you please guide me on this.
    I have used the following code to achieve this. We are getting message saying 'Mail request has created' when executed, but the mail is not sent.
    lvs_comm_type = 'INT'.
    lvs_comm_values-adsmtp-SMTP_ADDR = e_mail.
    lvs_comm_values-adsmtp-R3_USER = 'X'.
    lvs_comm_values-adsmtp-ENCODE = '0'.
    call function 'CONVERT_COMM_TYPE_DATA'
    exporting
    pi_comm_type = lvs_comm_type
    pi_comm_values = lvs_comm_values
    pi_screen = ' '
    pi_newid = 'X'
    importing
    pe_itcpo = lvs_itcpo
    pe_device = lvf_device
    pe_mail_recipient = p_mail_recipient
    pe_mail_sender = p_mail_sender
    exceptions
    comm_type_not_supported = 1
    recipient_creation_failed = 2
    sender_creation_failed = 3
    others = 4.
    if sy-subrc ne 0.
    raise COMMUNICATION_ERROR.
    endif.
    control_parameters-device = 'MAIL'.
    output_options-TDIMMED = 'X'.
    output_options-TDDELETE = 'X'.
    CALL FUNCTION fm_name
    exporting
    CONTROL_PARAMETERS = control_parameters
    MAIL_RECIPIENT = mail_recipient
    MAIL_SENDER = mail_sender
    OUTPUT_OPTIONS = output_options
    USER_SETTINGS = space
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5.
    Thank you

    Hi,
    For sending smartform output into mail you first have to generate spool request and convert it into PDF and then
    only it can be sended into mail, please find the sample code in the mail below:
    http://wiki.sdn.sap.com/wiki/display/sandbox/ConversionofSpoolRequestDataintoPDFandExcelFormatandSenditintoMail
    Mansi
    Edited by: Matt on Jan 29, 2010 8:25 AM - removed code, instead point to wiki that Mansi authored.

  • Auto send of PO via email once approved

    hi Gurus,
    We want to have an automatic sending of PO via email, once approved it is directly send to the vendor email no more t-code going to use. it is possible? what configuration we need to this set-up?
    thanks,
    Marina

    -You need to maintain  e mail i.d in Vendor master.
    -You need to maintain User  email id in t code SU01, from which the mail need to be send.
    Configuration for this.
    - Go to NACE. 
    -Select EF and click on OUTPUT TYPES. 
    -Then select Output Type NEU and click on processing routines . 
    -In that you have to add a new entry - medium 5 - External Send
    - Communication Strategy - CS01. 
    -Then you need to assign a program, form routine and form. 
    -You can use the standard program i.e. SAPFM06P, FORM routine is always ENTRY_NEU and standard MEDRUCK. 
    -Then in PARTNER FUNCTION you need to add a new entry : medium - 5 and function - VN . 
    -For subject of the mail go to Mail Title and Texts. In title give PO No. &EKKO-EBELN& .
    -Under General data -> Replacement of text symbols give program as SAPMM06E and Form Routine as TEXT_SYMBOL_REPLACE.
    -Now while creating a new purchase order , change the medium to External Send . 
    -Then go to Communication Method and select CS01.
    -  Need to Release the P.O in ME29N
    - Go to tcode ME9F . 
    - Execute. 
    - Select the checkbox and click on Output Message. 
    - You will get a message MAII 00000000000001 generated . 
    - Use note no 191470
    You can see the details in transaction code : Scot

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

Maybe you are looking for

  • Print Word File from Oracle Report Builder 6.0

    Dear All I am using Reports 6 , I have a requirement that i have to print a word document (somewhere around 8 to 9 pages) after printing a report is there any way to execute the same. The word file has the details like agreement , etc so each and eve

  • Won't open projects

    I've used my Elements 9 several times before, but not at all in the last couple of months. When I went to use it today, I'm unable to start a new project or load an existing project. When I try to do so, it will be almost all loaded in (the project)

  • Batching TIFFs/PSDs to JPG/PNG (depending on transparency) w/ automatic resize based on filesize

    Hi there, I'm pretty new to all this stuff but I've been doing a LOT of processing of images of late. I'm sure what I want to do can be done with scripts or automation though. My scenario is this: I have a folder with a lot of subfolders, many with a

  • Program Monitor Freezing Every 10 Minutes (Fixed by Force-Quitting - Relaunch)

    When editing in Premiere Pro, everything is fine and responsive for about 10 minutes, then, while previewing my timeline, my program monitor will freeze randomly causing me to stop, save my work, force quit Premiere then re-open to continue editing.

  • Fitting background image size according to link text

    I am using a list for my navigation. I have a background image which is shown on the LI. If the text in the link is longer than the width of the image then the background image is repeated. How can I stretch the width of the image? Does it look like