Form to send e-mail

Hello!
I wonder if someone could help me with the following.
I am developing a form , and all the data entered in that form will be sent to different people , depending on the information of the form.
The way that I have done it is with an html form (escalationform.html) that will call to a jsp page ( enviocorreo.jsp) which call a JavaBean to send the mail ( SendMailBean.java)
It seems to work fine, but I have problems when I try to send the mail to different people , depending on the option of the SELECT in the form.Since I�m new to JavaBeans, I do not know if I am comparing the values in the correct format.....since it is always sending the mail to the else opetion ( I mean If I choose Tipo1, the e-mail is always sent to Address2@.....
Here you have my code. Hope that somebody can help:
==============================================
escalationform.html
<HTML>
<HEAD>
<TITLE>Test</TITLE>
<FORM NAME="Test" METHOD=POST ACTION="EscalationId.jsp">
Type of Escalation <SELECT NAME="escalationType">
<OPTION VALUE="Tipo1">Tipo 1</OPTION>
<OPTION VALUE="Tipo2">Tipo 2</OPTION>
</SELECT><P>
Sender�s e-mail address <INPUT TYPE="text" NAME="sendermail" SIZE ="30"><P>
Pais<SELECT NAME="Pais">
<OPTION VALUE="Espana">Espania</OPTION>
<OPTION VALUE="Italia">Italia</OPTION>
<OPTION VALUE="India">india</OPTION>
</SELECT><P>
<P><CENTER><INPUT TYPE=submit VALUE="envia"></CENTER>
</B></FONT>
</FORM>
</HEAD>
</HTML>
===============================================
enviocorreo.jsp
<%@ page import="correo.SendMailBean" %>
<HTML>
<HEAD>
<TITLE>Escalation Id</TITLE>
<BODY>
     <jsp:useBean id="mailer" class="correo.SendMailBean">
          <jsp:setProperty name="mailer" property="*"/>
          <% mailer.sendMail(); %>
     </jsp:useBean>
     Your e-mail has been sent successfully.Please check your inbox.
</BODY>
</HEAD>
</HTML>
====================================================
SendMailBean.java
package correo;
import java.io.*;
import java.util.*;
import java.lang.*;
import javax.mail.*;
import javax.mail.event.*;
import javax.mail.internet.*;
import javax.mail.Message.RecipientType.*;
public final class SendMailBean extends Object implements Serializable
     private String sendermail;
     private String escalationType;
     private String Pais;
     private String toAddress;
     public String ccName;
     private String from = null;
     private String subject = null;
     private String message = null;
     public static Properties props = null;
     public static Session session = null;
     static
          /*     Setting Properties for STMP host */
          props = System.getProperties();
          props.put("mail.smtp.host", "my_smtp_server");
          session = Session.getDefaultInstance(props, null);
     public SendMailBean()
          sendermail = null;     
     public void setSendermail (String _SenderMail)
          sendermail = _SenderMail;
     public void setEscalationType (String _EscalationType)
          escalationType = _EscalationType;
     public void setPais (String _Pais)
          Pais = _Pais;
     public void sendMail() throws Exception
          //If the Escalation type is Tipo 1 the to Address is [email protected]
          if ((escalationType == "Tipo1"))
               toAddress = "[email protected]";
               String ccName = "[email protected]";
          //If the Escalation type is Tipo2, the e-mail will go to [email protected]
          else
               toAddress = "[email protected]";
               String ccName = "[email protected]";
          //We prepare the message
          try
               MimeMessage message = new MimeMessage(session);
               //Prepare the To address
               InternetAddress to = new InternetAddress(toAddress);
               message.setRecipient(Message.RecipientType.TO,to);
               //Prepare the CC copy for the sender
               message.addRecipient(Message.RecipientType.CC,
               new InternetAddress(sendermail));
               //We put the from field
               message.setFrom(new InternetAddress("[email protected]"));
               //We call the subject Escalation ID
               message.setSubject("Escalation ID");
               //We prepare the body of the message
               message.setText("Escalation Type: "+escalationType+"\nEscalation responsible: "+ccName+"\nPais: "+Pais);
               //We send the message
               Transport.send(message);
          catch (MessagingException e)
               throw new Exception(e.getMessage());
}

When comparing strings, you should use the .equalsMethod.
You should also check for null in most cases.
if (escalationType != null && escalationType.equals("Tipo1"))
// an equivalent but shorter way of doing this...
if ("Tipo1".equals(escalationType))

Similar Messages

  • Problem with the ALV after sending the mail

    Good Morning Experts
    I have a small issue with the ALV. I have a program, which has to sent email. In My program initially I am displaying basic list in the alv and user can navigate to secondary list also, by clicking on a contract number in the basic list.
    I gave a tool button in the tool bar to the user in the basic list, to send the mail. When the user clicks on the I have to send the mail both the lists, basic list and seconday list in the mail as separate attachments.
    Mail is going fine and later if the user chooses to see any contract in detail(Secondary List), that time ALV giving dump with message type X. And it is stopping some where in the ALV code
    call method cl_gui_cfw=>get_subscriber_by_id
           exporting shellid = p_handle-shellid
           exceptions others = 1.
      if sy-subrc = 0.
        </B>message X007 with p_handle-clsid.<B>
      endif.
    If anybody having an Idea, how to resolve it, please tell me.
    Thanks in Advance
    Praveen

    Please find the code for user_command form and sending the mail. Please look into this advice me if anything wrongly I coded.
    *&      Form  user_command
    FORM user_command USING r_ucomm LIKE sy-ucomm
                                  rs_selfield TYPE slis_selfield.
      IF r_ucomm EQ '&IC1' OR r_ucomm EQ 'SHOW'.
        REFRESH: it_all[],
                 it_fcat1[],
                 it_sort[].
        LOOP AT it_final INTO wa_final WHERE select EQ 'X' OR xblnr EQ rs_selfield-value.
          LOOP AT it_bsid INTO wa_bsid WHERE xblnr EQ wa_final-xblnr AND zuonr IS INITIAL.
            wa_all = wa_bsid.
            wa_all = wa_bsid.
            wa_all-booked = wa_bsid-dmbtr.
            IF wa_bsid-augdt IS NOT INITIAL AND wa_bsid-augbl IS NOT INITIAL.
              wa_all-paid = wa_bsid-dmbtr.
            ENDIF.
            wa_all-amtr = wa_all-booked - wa_all-paid.
            APPEND wa_all TO it_all.
            CLEAR: wa_all,
                   wa_bsid.
          ENDLOOP.
          LOOP AT it_bsad INTO wa_bsad WHERE xblnr EQ wa_final-xblnr AND zuonr IS INITIAL.
            wa_all = wa_bsad.
            wa_all-booked = wa_bsad-dmbtr.
            IF wa_bsad-augdt IS NOT INITIAL AND wa_bsad-augbl IS NOT INITIAL.
              wa_all-paid = wa_bsad-dmbtr.
            ENDIF.
            wa_all-amtr = wa_all-booked - wa_all-paid.
            APPEND wa_all TO it_all.
            CLEAR: wa_all,
                   wa_bsad.
          ENDLOOP.
        ENDLOOP.
        SORT it_all BY xblnr.
        PERFORM fill_fcat2.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
            i_callback_program                = sy-repid
            i_callback_top_of_page            = 'TOP_OF_PAGE'
            i_grid_title                      = 'Report to display selected contracts'
            is_layout                         = wa_layout1
            it_fieldcat                       = it_fcat1[]
       I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
            IT_SORT                           = it_sort[]
            i_default                         = 'X'
            i_save                            = 'A'
            is_variant                        = wa_variant
          TABLES
            t_outtab                          = it_all[]
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
        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.
      CASE r_ucomm.
        WHEN 'BACK1' OR 'EXT1'.
          PERFORM exit IN PROGRAM  saplslvc_fullscreen.
        WHEN '&F12' or 'CANCEL'.
          PERFORM exit IN PROGRAM  saplslvc_fullscreen.
        WHEN 'MAIL'.
           PERFORM prepare_mail.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  prepare_mail
          text
    -->  p1        text
    <--  p2        text
    FORM prepare_mail .
      DATA:
           l_lay    TYPE pri_params-paart,
           l_line  TYPE pri_params-linct,
           l_cols   TYPE pri_params-linsz,
           l_val    TYPE c,
           i_spno   TYPE tsp01-rqident,
           i_lines  TYPE i,
           i_bin    TYPE i,
           i_pack_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
           i_recivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
           i_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
           i_header    LIKE solisti1  OCCURS 0 WITH HEADER LINE,
           i_docdata   LIKE sodocchgi1,
           i_excel     LIKE solisti1 OCCURS 0 WITH HEADER LINE.
      i_pos    type i.
      TYPES:
         t_pripar TYPE pri_params,
         t_arcpar TYPE arc_params.
      "Work areas
      DATA:
         lw_pripar TYPE t_pripar,
         lw_arcpar TYPE t_arcpar,
         w_no_of_bytes TYPE i.
      l_lay   = 'X_65_255'.
      l_line  = 65.
      l_cols  = 255.
      "Read, determine, change spool print parameters and archive parameters
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          in_archive_parameters  = lw_arcpar
          in_parameters          = lw_pripar
          layout                 = l_lay
          line_count             = l_line
          line_size              = l_cols
          no_dialog              = 'X'
        IMPORTING
          out_archive_parameters = lw_arcpar
          out_parameters         = lw_pripar
          valid                  = l_val
        EXCEPTIONS
          archive_info_not_found = 1
          invalid_print_params   = 2
          invalid_archive_params = 3
          OTHERS                 = 4.
    *l_val eq space
      IF  sy-subrc = 0.
        lw_pripar-prrel = space.
        lw_pripar-primm = space.
        NEW-PAGE PRINT ON
          NEW-SECTION
          PARAMETERS lw_pripar
          ARCHIVE PARAMETERS lw_arcpar
          NO DIALOG.
      ENDIF.
      DATA: ls_prnt TYPE slis_print_alv.
      ls_prnt-print = ''.
      ls_prnt-prnt_title = 'X'.
      ls_prnt-no_coverpage = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
          i_callback_program                = sy-repid
          i_callback_top_of_page            = 'TOP_OF_PAGE'
          i_grid_title                      = 'Report to display collection pattern on Clearing Date'
          is_layout                         = wa_layout
          it_fieldcat                       = it_fcat[]
          i_callback_user_command           = 'USER_COMMAND'
          i_callback_pf_status_set          = 'PF_STATUS_SET'
       IT_SORT                           = it_sort[]
          i_default                         = 'X'
          i_save                            = 'A'
          is_variant                        = wa_variant
        TABLES
          t_outtab                          = it_final[]
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    WRITE 'Test program to generate and download as PDF'.
      NEW-PAGE PRINT OFF.
      CALL FUNCTION 'ABAP4_COMMIT_WORK'.
      i_spno = sy-spono.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          src_spoolid   = i_spno
          no_dialog     = 'X'
        IMPORTING
          pdf_bytecount = w_no_of_bytes
         pdf_spoolid   = w_pdf_spoolid
         btc_jobname   = w_jobname
         btc_jobcount  = w_jobcount
        TABLES
          pdf           = it_pdf.
      LOOP AT it_pdf INTO wa_pdf.
        IF w_pos = 34170.
          PERFORM attach.
        ENDIF.
        w_stuff+w_pos(134) = wa_pdf.
        ADD 134 TO w_pos.
      ENDLOOP.
      IF NOT ( w_stuff IS INITIAL ).
        PERFORM attach.
      ENDIF.
      CLEAR wa_pdf.
      PERFORM fill_receivers TABLES i_recivers.
      PERFORM fill_contents TABLES i_contents.
      DESCRIBE TABLE i_contents LINES i_lines.
      READ TABLE i_contents INDEX i_lines.
      CLEAR i_pack_list-transf_bin.
      i_pack_list-head_start = 1.
      i_pack_list-head_num = 1.
      i_pack_list-body_start = 2.
      i_pack_list-body_num = i_lines.
      i_pack_list-doc_type = 'RAW'.
      APPEND i_pack_list.
      CLEAR i_pack_list.
    *u2022  Attachment (pdf-Attachment)
    CONCATENATE p_date6(2) p_date4(2) p_date+0(4) INTO w_date1 SEPARATED BY '.'.
      DESCRIBE TABLE it_att LINES i_lines.
      READ TABLE it_att INTO wa_att INDEX i_lines.
      i_pack_list-transf_bin = 'X'.
      i_pack_list-head_start = '1'.
      i_pack_list-head_num = '0'.
      i_pack_list-body_start = '1'.
      i_pack_list-body_num = i_lines.
      i_pack_list-doc_type = 'PDF'.
      i_pack_list-obj_name = 'Renewal List'.
      CONCATENATE 'Report to display outstanding premium' 'Executed on' w_date1 INTO i_pack_list-obj_descr SEPARATED BY space.
    i_pack_list-obj_descr = 'Exchange Rates uploaded to the database'.
      i_pack_list-obj_langu = 'E'.
      i_pack_list-doc_size = i_lines * 255.
      APPEND i_pack_list.
      CLEAR i_pack_list.
      REFRESH: it_pdf[].
      CLEAR wa_pdf.
      REFRESH: it_all[],
                it_fcat1[],
                it_sort[].
      LOOP AT it_final INTO wa_final.
        LOOP AT it_bsid INTO wa_bsid WHERE xblnr EQ wa_final-xblnr AND zuonr IS INITIAL.
          wa_all = wa_bsid.
          wa_all-booked = wa_bsid-dmbtr.
          IF wa_bsid-augdt IS NOT INITIAL AND wa_bsid-augbl IS NOT INITIAL.
            wa_all-paid = wa_bsid-dmbtr.
          ENDIF.
          wa_all-amtr = wa_all-booked - wa_all-paid.
          APPEND wa_all TO it_all.
          CLEAR: wa_all,
                 wa_bsid.
        ENDLOOP.
        LOOP AT it_bsad INTO wa_bsad WHERE xblnr EQ wa_final-xblnr AND zuonr IS INITIAL.
          wa_all = wa_bsad.
          wa_all-booked = wa_bsad-dmbtr.
          IF wa_bsad-augdt IS NOT INITIAL AND wa_bsad-augbl IS NOT INITIAL.
            wa_all-paid = wa_bsad-dmbtr.
          ENDIF.
          wa_all-amtr = wa_all-booked - wa_all-paid.
          APPEND wa_all TO it_all.
          CLEAR: wa_all,
                 wa_bsad.
        ENDLOOP.
      ENDLOOP.
       NEW-PAGE PRINT ON
          NEW-SECTION
          PARAMETERS lw_pripar
          ARCHIVE PARAMETERS lw_arcpar
          NO DIALOG.
    ENDIF.
      SORT it_all BY xblnr.
      PERFORM fill_fcat2.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
          i_callback_program                = sy-repid
          i_callback_top_of_page            = 'TOP_OF_PAGE'
          i_grid_title                      = 'Report to display selected contracts'
          is_layout                         = wa_layout1
          it_fieldcat                       = it_fcat1[]
       I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
          it_sort                           = it_sort[]
          i_default                         = 'X'
          i_save                            = 'A'
          is_variant                        = wa_variant
        TABLES
          t_outtab                          = it_all[]
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      NEW-PAGE PRINT OFF.
      CALL FUNCTION 'ABAP4_COMMIT_WORK'.
      i_spno = sy-spono.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          src_spoolid   = i_spno
          no_dialog     = 'X'
        IMPORTING
          pdf_bytecount = w_no_of_bytes
         pdf_spoolid   = w_pdf_spoolid
         btc_jobname   = w_jobname
         btc_jobcount  = w_jobcount
        TABLES
          pdf           = it_pdf.
    LOOP AT it_pdf INTO wa_pdf.
        IF w_pos = 34170.
          PERFORM attach1.
        ENDIF.
        w_stuff+w_pos(134) = wa_pdf.
        ADD 134 TO w_pos.
      ENDLOOP.
      IF NOT ( w_stuff IS INITIAL ).
        PERFORM attach1.
      ENDIF.
      CLEAR wa_pdf.
    DESCRIBE TABLE it_att LINES i_lines.
      ADD 1 TO i_lines.
      DESCRIBE TABLE it_att1 LINES i_bin.
      READ TABLE it_att1 INTO wa_att INDEX i_bin.
    DESCRIBE TABLE it_att LINES i_lines.
    READ TABLE it_att INTO wa_att INDEX i_lines.
      i_pack_list-transf_bin = 'X'.
      i_pack_list-head_start = '1'.
      i_pack_list-head_num = '0'.
      i_pack_list-body_start = i_lines.
      i_pack_list-body_num = i_bin.
      i_pack_list-doc_type = 'PDF'.
      i_pack_list-obj_name = 'Renewal List-Details'.
      CONCATENATE 'Outstanding Premium-Details' w_date1 INTO i_pack_list-obj_descr SEPARATED BY space.
    i_pack_list-obj_descr = 'Exchange Rates uploaded to the database'.
      i_pack_list-obj_langu = 'E'.
      i_pack_list-doc_size = i_bin * 255.
      APPEND i_pack_list.
      CLEAR i_pack_list.
      APPEND LINES OF it_att1 to it_att.
      i_docdata-obj_name = 'Renewal List'.
      CONCATENATE 'Oustanding Premium' 'as on' w_date1 INTO i_docdata-obj_descr SEPARATED BY space.
      CONDENSE i_docdata-obj_descr.
      i_docdata-obj_langu = 'E'.
      i_docdata-obj_prio = '1'.
      i_docdata-no_change = 'X'.
      i_docdata-sensitivty = 'F'.
      i_docdata-doc_size = ( i_lines - 1 ) * 255 + STRLEN( wa_att ).
    ***Data for Header
      i_header-line = 'Header'. APPEND i_header.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = i_docdata
          commit_work                = 'X'
        TABLES
          packing_list               = i_pack_list[]
          object_header              = i_header
          contents_bin               = it_att[]
          contents_txt               = i_contents[]
          receivers                  = i_recivers[]
        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.
      IF sy-subrc <> 0.
      ELSE.
        MESSAGE 'Document Sent' TYPE 'S'.
      ENDIF.
    ENDFORM.                    " prepare_mail
    Thanks
    Praveen

  • Why is my php form not sending to my e-mail?

    Here i have the code for my .php document and the code for my html. Why is the form not sending to my e-mail ([email protected])? At one point I had the form sending to my e-mail, but the information that was filled out was not appearing. Now no email is being sent at all. I tried a contact-us.php page with the php email code in the same document and now have the information in seperate documents, but I am getting the same results every which way. I need help I have been checking this over for hours and looking up solutions online but it all is very confusing. PLEASE HELP!
    send.php
    <?php
    if ($_POST['parse_var'] == "contactForm") {
              $emailTitle = 'Scheduele In Home Consultation or General Question';
              $yourEmail = '[email protected]';
              $firstName = $_POST['FirstName'];
              $lastName = $_POST['LastName'];
              $phoneNumber = $_POST['PhoneNumber'];
              $emailAddress = $_POST['EmailAddress'];
              $Message = $_POST['Message'];
              $body = <<<EOD
    <br><hr><br>
              First Name: $firstName <br />
              Last Name: $lastName <br />
              Phone Number: $phoneNumber <br />
              Email Address: $emailAddress <br />
              Message: $Message <br />
    EOD;
              $headers = "From: $emailAddress\r\n";
              $headers .= "Content-type: text/html\r\n";
              $success = mail("$yourEmail", "$emailTitle", "$body", "$headers");
              $sent = "Thank you! Your message has been sent.";
    ?>
    contact-us.html
          <form action="send.php" method="post" name="contactForm" id="contactForm">
            <table width="75%" align="left" cellpadding="5" id="contactustable">
              <tr>
                <td><label for="FirstName"></label>
                  <span id="sprytextfield1">
                  First Name<br>
                  <br>
                  <input type="text" name="FirstName" id="FirstName" value="<?php print "$firstName"; ?>">
                <span class="textfieldRequiredMsg">Please enter your first name.</span></span></td>
              </tr>
              <tr>
                <td> </td>
              </tr>
              <tr>
                <td><label for="LastName"></label>
                  <span id="sprytextfield2">
                  Last Name<br>
                  <br>
                  <input type="text" name="LastName" id="LastName" value="<?php print "$lastName"; ?>">
                <span class="textfieldRequiredMsg">Please enter your last name.</span></span></td>
              </tr>
              <tr>
                <td> </td>
              </tr>
              <tr>
                <td><label for="PhoneNumber"></label>
                  <span id="sprytextfield3">
                  Phone Number<br>
                  <br>
                  <input type="text" name="PhoneNumber" id="PhoneNumber" value="<?php print "$phoneNumber"; ?>">
    <span class="textfieldInvalidFormatMsg">Please enter your phone number.</span></span></td>
              </tr>
              <tr>
                <td> </td>
              </tr>
              <tr>
                <td><label for="EmailAddress"></label>
                  <span id="sprytextfield4">E-mail Address<br>
                  <br>
                  <input type="text" name="EmailAddress" id="EmailAddress" value="<?php print "$emailAddress"; ?>">
                <span class="textfieldRequiredMsg">Please enter your e-mail address.</span><span class="textfieldInvalidFormatMsg">Example: [email protected].</span></span></td>
              </tr>
              <tr>
                <td> </td>
              </tr>
              <tr>
                <td height="255"><label for="Message"></label>
                  <span id="sprytextarea1">
                  Message:<br>
                  <br>
                  <textarea name="Message" cols="85%" rows="12" id="Message"><?php print "$Message"; ?></textarea>
                <span class="textareaRequiredMsg">A value is required.</span></span></td>
              </tr>
              <tr>
                <td> </td>
              </tr>
              <tr>
                <td><input type="submit" name="Reset" id="Reset" value="Reset">
                  <input type="hidden" name="parse_var" id="parse_var">             
                <input type="submit" name="Submit" id="Submit" value="Send Message"></td>
              </tr>
              <tr>
                <td><?php print "$sent"; ?></td>
              </tr>
            </table>
          </form>

    tonyb1117 wrote:
    It works! Thank you very much for pointing that out "bregent" and "osgood_". I have one more small problem though, when signing out my contact form the phone number field does not accept any phone number?
                  <input type="text" name="PhoneNumber" id="PhoneNumber" value="<?php print "$phoneNumber"; ?>">
    <span class="textfieldInvalidFormatMsg">Please enter your phone number.</span></span></td>
    Any solutions?
    I don't know anything about Spry validation of form fields but I think it requires you to set the type of validation, i.e., text, email, number.
    Have you looked in that direction.
    I presume what youre saying is when you hit send you get a red message saying phone number is not valid or something along those lines?

  • Issues with creating form to send via e-mail

    Recently our IT department developed a service evaluation form to send to our users when they have had work done to their computer. The form has a button to click for the user to send it to our e-mail. However, if the user only has Acrobat Reader installed on their PC, it is sent back as an xml file.
    Is there a method to keep it as a pdf file when it is sent back to our mailbox if they do not have an acrobat writer program installed on their PC?

    The easier solution is to simply open the XML in Acrobat (or open the form and import the XML data). If you use FDF, the name of the original file is included and the data will open in that PDF file if you select the FDF file. Thus there is really no need to send the PDF and it gets around the 500 submission limit that you have if the PDF has to be saved to be sent. The latter can be done by using Reader Enabling. Bill

  • Filling up a pdf form which I received as email. I opened it on my adobe reader 11 and filled up the highlighted fields. Yet when I click on the send via mail it says changes will not be included. How do I send the form with changes?

    Filling up a pdf form which I received as email. I opened it on my adobe reader 11 and filled up the highlighted fields. Yet when I click on the send via mail it says changes will not be included. How do I send the form with changes?
    The add annotations field shows as not allowed in the security options. So how do I send this form back with the changes??

    I think you you need to click 'save' first, then it is saved to acrobat, where it will prompt to send.

  • PDF Attachment problem in Adobe form and send mail is not working

    Dear Experts,
                         Recently i'm facing a problem regarding Adobe form PDF attachment and sending an e-mail along with the PDF attachment to customer mail id.But when i execute the RFC Function module, in customer side no mail is comming. And when i check the transaction SBWP then i found that the PDF attachment hold only 1KB of data which is not right.For that i'm sending my code which i was declared in my program.Can anybody please help me to overcome this problem?
    Warm Regards,
    sameek.
    CLASS cl_bcs DEFINITION LOAD.
      DATA:
      lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
      lo_send_request = cl_bcs=>create_persistent( ).
      data: t_att_content_hex type SOLIX_TAB.
      DATA: lx_document_bcs TYPE REF TO cx_document_bcs VALUE IS INITIAL.
      DATA: lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
            l_send type ADR6-SMTP_ADDR value 'Already provided an e-mail address here'.
      DATA: lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.
      DATA: lv_sent_to_all(1) TYPE c VALUE IS INITIAL.
    Message body and subject*
      DATA:
      lt_message_body TYPE bcsy_text VALUE IS INITIAL,
      lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
      APPEND 'Dear,' TO lt_message_body.
      append ' ' to lt_message_body.
      APPEND 'Please fill the attached form and send it back to us.'
      TO lt_message_body.
      append ' ' to lt_message_body.
      APPEND 'Thank You,' TO lt_message_body.
      lo_document = cl_document_bcs=>create_document(
      i_type = 'RAW'
      i_text = lt_message_body
      i_subject = 'Customer Information Form').
      TRY.
          lo_document->add_attachment(
          EXPORTING
          i_attachment_type = 'PDF'
          i_attachment_subject = 'Customer Information Form'
    I_ATTACHMENT_SIZE =*
    I_ATTACHMENT_LANGUAGE = SPACE*
    I_ATT_CONTENT_TEXT =*
    I_ATTACHMENT_HEADER =*
          i_att_content_hex = t_att_content_hex ).
        CATCH cx_document_bcs INTO lx_document_bcs.
      ENDTRY.
    Add attachment*
    Pass the document to send request*
      lo_send_request->set_document( lo_document ).
    Create sender*
      lo_sender = cl_cam_address_bcs=>create_internet_address( l_send ).
    lo_sender = cl_sapuser_bcs=>create( sy-uname ).*
    Set sender*
      lo_send_request->set_sender(
      EXPORTING
      i_sender = lo_sender ).
    Create recipient*
      lo_recipient = cl_sapuser_bcs=>create( sy-uname ).
    lo_recipient = cl_cam_address_bcs=>create_internet_address( l_send ).*
    Set recipient*
      lo_send_request->add_recipient(
      EXPORTING
      i_recipient = lo_recipient
      i_express = 'X' ).
    lo_send_request->add_recipient(*
    EXPORTING*
    i_recipient = lo_recipient*
    i_express = 'X' ).*
    Send email*
      lo_send_request->send(
      EXPORTING
      i_with_error_screen = 'X'
      RECEIVING
      result = lv_sent_to_all ).
      COMMIT WORK.
      message 'The Customer Information form has been emailed to the Employee' type 'I'.

    I am also facing issue with email send .
    apex 4.1.1 oracle 11g
    create or replace procedure email ( p_email  in    varchar2)
    is
        l_workspace_id      number;
        l_subject           varchar2(2000);
        l_body              clob;
        l_body_html         clob;
         l_email varchar2(40);
    begin
        l_workspace_id := apex_util.find_security_group_id (p_workspace => 'xyz');
        apex_util.set_security_group_id (p_security_group_id => l_workspace_id);
    l_email:= p_email;
        l_body := ' ';
        l_subject := 'You have new tasks';
        --if l_email=:P3_CONFIRM_EMAIL_ADDRESS is not null then
       -- email( l_email =>:P3_CONFIRM_EMAIL );
    -- end if;
            l_body_html := '<p />The following tasks have been added.';
         apex_mail.send (
                p_to        => l_email ,
                p_from      => '[email protected]',
                p_body      => l_body,
                p_body_html => l_body_html,
                p_subj      => l_subject );
      APEX_MAIL.PUSH_QUEUE;
    end; I also check the log and queue but both are empty,
    select * from
    apex_mail_queue
    select * from
    apex_mail_log Kindly suggest what to do ?
    I also created a process in apex , which call this procedure and pass the email address entered by user.

  • How can scripts and  smart forms send to mail and pdf?

    HI i want to know how script and smartforms will send to mail and pdf formates>?

    Dear Anees ,
                       Pleas pass on the parameter in itcpo - (getotf  ) structure while calling OPEN_FORM as 'X' .
    I have answered it in detail in your earlier post .
    also giving below sample program for sending SAPSCRIPT as PDFattachment in email  :
    REPORT zsapscript_pdf_via_mail MESSAGE-ID zvele LINE-SIZE 68
    NO STANDARD PAGE HEADING.
    TABLES: itcpo.
    Open your usual sapscript specifying that the output will be OTF
    itcpo-tdgetotf = 'X'.
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
    device = 'PRINTER'
    dialog = ''
    form = '............'
    language = sy-langu
    options = itcpo
    EXCEPTIONS
    canceled = 1
    device = 2
    form = 3
    options = 4
    unclosed = 5
    OTHERS = 6.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    window = '............'
    element = '............'
    EXCEPTIONS
    window = 1
    element = 2.
    DATA: BEGIN OF t_otfdata OCCURS 0.
    INCLUDE STRUCTURE itcoo.
    DATA: END OF t_otfdata.
    Closing the Sapscript, we save data (OTF) in a table
    CALL FUNCTION 'CLOSE_FORM'
    TABLES
    otfdata = t_otfdata
    EXCEPTIONS
    unopened = 1
    bad_pageformat_for_print = 2
    send_error = 3
    spool_error = 4
    OTHERS = 5.
    DATA: len_in LIKE sood-objlen,
    len_out LIKE sood-objlen.
    DATA: BEGIN OF t_pdfdata OCCURS 0.
    INCLUDE STRUCTURE solisti1.
    DATA: END OF t_pdfdata.
    DATA: BEGIN OF t_otfdata2 OCCURS 0.
    INCLUDE STRUCTURE solisti1.
    DATA: END OF t_otfdata2.
    Move OTF data to another table with lenght 255
    LOOP AT t_otfdata.
    CONCATENATE t_otfdata-tdprintcom t_otfdata-tdprintpar INTO t_otfdata2.
    APPEND t_otfdata2.
    ENDLOOP.
    Convert OTF format to PDF
    CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
    EXPORTING
    format_src = 'OTF'
    format_dst = 'PDF'
    devtype = 'PRINTER'
    FUNCPARA =
    len_in = len_in
    IMPORTING
    len_out = len_out
    TABLES
    content_in = t_otfdata2
    content_out = t_pdfdata
    EXCEPTIONS
    err_conv_failed = 1
    OTHERS = 2.
    Download on local directory
    *CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = len_out
    FILENAME = 'c:\test.pdf'
    FILETYPE = 'BIN'
    TABLES
    data_tab = t_pdfdata.
    Mail settings
    DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
    DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
    DATA: objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
    DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
    DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINe.
    DATA: doc_chng LIKE sodocchgi1.
    DATA righe_attachment TYPE i.
    DATA righe_testo TYPE i.
    DATA z_email(80) TYPE c.
    Receivers parameters
    SELECT-OPTIONS: s_email FOR z_email LOWER CASE NO INTERVALS.
    PARAMETERS rec_type LIKE reclist-rec_type
    DEFAULT 'U'. " type of sending address
    CLEAR: reclist, reclist[],
    objhead, objhead[],
    objtxt, objtxt[],
    objbin, objbin[],
    objpack, objpack[].
    Attachment filling
    LOOP AT t_pdfdata.
    objbin-line = t_pdfdata.
    APPEND objbin.
    ENDLOOP.
    DESCRIBE TABLE objbin LINES righe_attachment.
    Text filling
    objtxt = 'Testo della Mail - Riga 1'.APPEND objtxt.
    objtxt = 'Testo della Mail - Riga 2'.APPEND objtxt.
    objtxt = 'Testo della Mail - Riga n'.APPEND objtxt.
    DESCRIBE TABLE objtxt LINES righe_testo.
    Other filling
    doc_chng-obj_name = 'URGENT'.
    doc_chng-expiry_dat = sy-datum + 10.
    doc_chng-obj_descr = 'Prova invio Mail con PDF'.
    doc_chng-sensitivty = 'O'.
    doc_chng-doc_size = righe_testo * 255.
    CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = righe_testo.
    objpack-doc_type = 'RAW'.
    APPEND objpack.
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num = 1.
    objpack-body_start = 1.
    objpack-body_num = righe_attachment.
    objpack-doc_type = 'PDF'.
    objpack-obj_name = 'TEST'.
    objpack-obj_descr = 'File.pdf'.
    objpack-doc_size = righe_attachment * 255.
    APPEND objpack.
    Receivers filling
    LOOP AT s_email WHERE sign = 'I'
    AND option = 'EQ'
    AND NOT ( low IS initial ).
    CLEAR reclist.
    IF sy-tabix > 1.
    reclist-copy = 'X'.
    ENDIF.
    reclist-receiver = s_email-low.
    IF rec_type IS INITIAL.
    reclist-rec_type = 'U'. " Internet e-mail
    ELSE.
    reclist-rec_type = rec_type.
    ENDIF.
    reclist-notif_del = 'X'. " request delivery notification
    reclist-notif_ndel = 'X'. " request not delivered notification
    APPEND reclist.
    ENDLOOP.
    Mail Send
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = doc_chng
    put_in_outbox = 'X'
    IMPORTING
    SENT_TO_ALL =
    NEW_OBJECT_ID =
    TABLES
    packing_list = objpack
    object_header = objhead
    contents_bin = objbin
    contents_txt = objtxt
    OBJECT_PARA =
    OBJECT_PARB =
    receivers = reclist
    CONTENTS_HEX =
    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

  • Sending/receiving  Mail by Online Interactive PDF Forms

    Hai friends,
                 Following screnario is my first Online interactive PDF form.
         1) User has to give the input like Employee Number,Employee Name,Employee Mail id  in the Online PDF form.When user press submit button the detail which he has entered has to be sent to the entered Mail id.
               2) According to that I can transfer the pdf file without the data which i has entered like Employee Number,Employee Name,Employee Mail id i,e with empty content.
           3) But In my Pdf file should contain all the details i have entered.
           4)  I have created my interactive form with the following properties
                Layout type: zcl layout
                Interface type :XML Schema Based Interface.
    I have attached my code here.
    I don't know where the conflict occurs.
    Could you please check it out my code.let me know the conflict.
    DATA: FM_NAME           TYPE RS38L_FNAM,
          FP_DOCPARAMS      TYPE SFPDOCPARAMS,
          lt_att_content_hex type SOLIX_TAB ,
          FP_OUTPUTPARAMS   TYPE SFPOUTPUTPARAMS,
         fp_result TYPE fpformoutput.
         data:wa_empdet type zsat_emp.
           data: input_node1 type ref to if_wd_context_node.
         data:ip_xtr type xString.
           input_node1 = wd_context->get_child_node( 'EMPDET' ).
           input_node1->get_attribute(  EXPORTING name = 'EMP_NO'
                                  IMPORTING value = wa_empdet-EMP_NO ).
           input_node1->get_attribute(  EXPORTING name = 'EMP_NAME'
                                  IMPORTING value = wa_empdet-EMP_NAME ).
           input_node1->get_attribute(  EXPORTING name = 'FEEDBACK'
                                  IMPORTING value = wa_empdet-FEEDBACK ).
          input_node1->get_attribute(  EXPORTING name = 'EMAIL'
                                  IMPORTING value = wa_empdet-EMAIL ).
    Sets the output parameters and opens the spool job
    *CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
       IE_OUTPUTPARAMS = FP_OUTPUTPARAMS
    EXCEPTIONS
       CANCEL          = 1
       USAGE_ERROR     = 2
       SYSTEM_ERROR    = 3
       INTERNAL_ERROR  = 4
       OTHERS          = 5.
    *IF SY-SUBRC <> 0.
    *ENDIF.
    Language and country setting (here US as an example)
    *fp_docparams-langu   = 'E'.
    *fp_docparams-country = 'US'.
    *FP_DOCPARAMS-FILLABLE = 'X'.
      DATA lo_nd_pdf TYPE REF TO if_wd_context_node.
      DATA lo_el_pdf TYPE REF TO if_wd_context_element.
      DATA ls_pdf TYPE wd_this->element_pdf.
      DATA lv_pdfsource LIKE ls_pdf-pdfsource.
    navigate from <CONTEXT> to <PDF> via lead selection
      lo_nd_pdf = wd_context->get_child_node( name = wd_this->wdctx_pdf ).
    get element via lead selection
      lo_el_pdf = lo_nd_pdf->get_element(  ).
    get single attribute
      lo_el_pdf->get_attribute(
        EXPORTING
          name =  `PDFSOURCE`
        IMPORTING
          value = lv_pdfsource ).
    call function 'FP_FUNCTION_MODULE_NAME'
      EXPORTING
        i_name     = 'ZTEMPSAMPLE1'
      IMPORTING
        e_funcname = fm_name.
    CALL FUNCTION fm_name
      EXPORTING
      /1BCDWB/DOCPARAMS        = FP_DOCPARAMS
      /1bcdwb/docxml           = ip_xtr
    IMPORTING
       /1BCDWB/FORMOUTPUT       =  fp_result
    EXCEPTIONS
       USAGE_ERROR              = 1
       SYSTEM_ERROR             = 2
       INTERNAL_ERROR           = 3
       OTHERS                   = 4
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Close the spool job
    *CALL FUNCTION 'FP_JOB_CLOSE'
      IMPORTING
        E_RESULT             =
    EXCEPTIONS
       USAGE_ERROR          = 1
       SYSTEM_ERROR         = 2
       INTERNAL_ERROR       = 3
       OTHERS               = 4.
    *IF SY-SUBRC <> 0.
    *ENDIF.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
         buffer                = lv_pdfsource
         APPEND_TO_TABLE       = 'X'
    IMPORTING
        OUTPUT_LENGTH         =
      tables
        binary_tab            = lt_att_content_hex.
    CLASS cl_bcs DEFINITION LOAD.
    DATA:
    lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
    lo_send_request = cl_bcs=>create_persistent( ).
    Message body and subject
    DATA:
    lt_message_body TYPE bcsy_text VALUE IS INITIAL,
    lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
    APPEND 'Hi,' TO lt_message_body.
    append ' ' to lt_message_body.
    APPEND 'Please fill the attached form and send it back .'
    TO lt_message_body.
    append ' ' to lt_message_body.
    APPEND 'Thank You,' TO lt_message_body.
    lo_document = cl_document_bcs=>create_document(
    i_type = 'RAW'
    i_text = lt_message_body
    i_subject = 'Interactive Form' ).
    DATA: lx_document_bcs TYPE REF TO cx_document_bcs VALUE IS INITIAL.
    TRY.
        lo_document->add_attachment(
        EXPORTING
        i_attachment_type = 'PDF'
        i_attachment_subject = 'Pdf Form'
    I_ATTACHMENT_SIZE =
    I_ATTACHMENT_LANGUAGE = SPACE
    I_ATT_CONTENT_TEXT =
    I_ATTACHMENT_HEADER =
        i_att_content_hex = lt_att_content_hex ).
      CATCH cx_document_bcs INTO lx_document_bcs.
    ENDTRY.
    Add attachment
    Pass the document to send request
    lo_send_request->set_document( lo_document ).
    Create sender
    DATA:
    lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
    lo_sender = cl_cam_address_bcs=>create_internet_address( l_send ).
    *DATA:
    *lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL.
    *lo_sender = cl_sapuser_bcs=>create( sy-uname ).
    Set sender
    lo_send_request->set_sender(
    EXPORTING
    i_sender = lo_sender ).
    Create recipient
    DATA:
    eaddr TYPE ADR6-SMTP_ADDR.
    eaddr = wa_empdet-email.
    Data:
    lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.
    lo_recipient = cl_cam_address_bcs=>create_internet_address( eaddr ).
    *lo_recipient = cl_sapuser_bcs=>create( sy-uname ).
    Set recipient
    lo_send_request->add_recipient(
    EXPORTING
    i_recipient = lo_recipient
    i_express = 'X' ).
    lo_send_request->add_recipient(
    EXPORTING
    i_recipient = lo_recipient
    i_express = 'X' ).
    Send email
    DATA: lv_sent_to_all(1) TYPE c VALUE IS INITIAL.
    lo_send_request->send(
    EXPORTING
    i_with_error_screen = 'X'
    RECEIVING
    result = lv_sent_to_all ).
    COMMIT WORK.
    message 'The form has been emailed to the recipient' type 'I'.
    clear wa_empdet.
    Regards,
    Keerthi.

    Hi,
    If i understand well you success to send the form without value , that's right ?
    Now you are not able to popualte the fields inside your forms with what user set ?
    Regards

  • Sending e-mail through oracle form.

    Hi Guys,
    I am using forms6i to develop forms and have deploy them on web using 9iAS.
    Now in one of my form, i need to send the information on that form to a couple of people through e-mail.
    what is the easiest and the best way to send e-mail?
    Can i use any built-in package of oracle on web?
    If someone can help through code, it will be appriciated as i really have no idea how to do it.
    I just want to add a send button on my form... and the formatted inofrmation will be send on a couple of e-mail address.
    Please help me,
    Imran

    You could send it from the database (depending on what version you are running against), check out the UTL_SMTP package. Or look for some package written on top of it since it's no joy to use if you aren't familiar with the low level stuff. Not sure if it handles attachments, something written against the JavaMail API is probably more flexible for that

  • Sending E-mail Through Oracle Forms

    Hi all
    what i want is as the following:
    1- i would like to convert the report to the PDF file internally using code.
    2- open the outlook.
    3- attcah the PDF automatically to the e-mail.
    4- finally sending the e-mail though outlook
    could i do that in Oracle forms 6i if i could do that can anyone instruct me to do it step by step

    Oh...it's now called ["My Oracle Support"|https://metalink.oracle.com/] .
    There's a note on "My Oracle Support" on this item.
    This is the note:
    Subject:      OLE AUTOMATION: Example Sending a Mail From Forms to Outlook
           Doc ID:      119828.1      Type:      BULLETIN
           Modified Date :      02-SEP-2008      Status:      PUBLISHED
    PURPOSE
    This document contains a sample code how to send an e-mail from Forms to Outlook
    (97-2000). 
    SCOPE & APPLICATION
    It can be used in addition of the whitepaper "Cracking Outlook!", which explains
    the object model of Outlook in detail.
    (Have a look in the Technical Libaries Folder Forms Whitepaper, their you can
    find it)
    OLE: Forms to Outlook
    Object Model
    "Cracking outlook!" explains the Object Model, you can find additional
    information in the Visual Basic Help of Outlook, which must be installed from
    your Office CD-Rom.  Once installed, you can access the help
    by choosing Tools->Macro->Visual Basic Editor and then go to the Help or
    Object Browser (view -> Object Browser)
    Now you can retrieve the Objects, their Methods and Properties. 
    Eg: the 'Application' Object has the Method 'CreateItem'.
    Note this information is also available in MSDN library or if you require more
    information on this Microsoft has to be contacted.
    OLE2, CLIENT_OLE2 Package
    Once you know the Objects, Methods and Properties you can access them with the
    OLE2 package.  This package provides a PL/SQL API for creating, manipulating,
    and accessing attributes of OLE2 automation objects.  When using OLE2 with
    WebForms every call will be executed on the midtier and not on the client. 
    So alternatively, the CLIENT_OLE2 package can be used, that is delivered by
    Webutil, to execute the OLE code on the client.
    Examples
    Once you know the Outlook Object model and you know the functions of the OLE2
    or CLIENT_OLE2 package you can write your own OLE2/CLIENT_OLE2 code to send a
    mail via Outlook.
    Here below are 2 different ways of sending an email using Outlook. 
    Sample 1:
    OLE2 sample: Here a MailItem is created, then the Recepient is explicitely
    added and resolved.  The mailItem is saved before being sent.
    Declare
    /*declaration of the Outlook Object Variables*/
    application ole2.OBJ_TYPE;     
    hMailItem ole2.OBJ_TYPE;
    hRecipients ole2.OBJ_TYPE;
    recipient ole2.OBJ_TYPE;
    nameSpace OLE2.OBJ_TYPE;
    /*declaration of the argument list*/ 
    args OLE2.LIST_TYPE;          
    begin
    /*create the Application Instance*/
    application:=ole2.create_obj('Outlook.Application');          
    /* create namespace and login */
    args:=ole2.create_arglist;
    ole2.add_arg(args,'MAPI');
    nameSpace:=ole2.invoke_obj(application,'getNameSpace',args);
    ole2.destroy_arglist(args);
    ole2.invoke(nameSpace,'Logon');
    /*create a Mail Instance by calling CreateItem Method and giving argument 0 with
    it,
    you can find the item types in the explanation of the CreateItem Method
    (0=olMailItem,1=olAppointmentItem, ?)*/
    args:=ole2.create_arglist;                         
    ole2.add_arg(args,0);
    hMailItem:=ole2.invoke_obj(application,'CreateItem',args);
    ole2.destroy_arglist(args);
    /*Get the Recipients property of the MailItem object: 
    Returns a Recipients collection that represents all the Recipients for the
    Outlook item*/
    args:=ole2.create_arglist;
    hRecipients:=ole2.get_obj_property(hMailItem,'Recipients',args);
    ole2.destroy_arglist(args);
    /*Use the Add method to create a recipients Instance and add it to the
    Recipients collection*/
    args:=ole2.create_arglist;
    ole2.add_arg(args,'[email protected]');
    recipient:=ole2.invoke_obj(hRecipients,'Add',args);
      /* put the property Type of the recipient Instance  to value needed
    (0=Originator,1=To,2=CC,3=BCC)*/
    ole2.set_property(recipient,'Type',1);
    ole2.destroy_arglist(args);
    /*Resolve the Recipients collection*/
    args:=ole2.create_arglist;
    ole2.invoke(hRecipients,'ResolveAll',args);
    /*set the Subject and Body properties*/
    ole2.set_property(hMailItem,'Subject','Test OLE2 to Outlook');
    ole2.set_property(hMailItem,'Body','this is body text');
    /*Save the mail*/
    ole2.invoke(hMailItem,'Save',args);
    ole2.destroy_arglist(args);
    /*Send the mail*/
    args:=ole2.create_arglist;
    ole2.invoke(hMailItem,'Send',args);
    ole2.destroy_arglist(args);
    /*Release all your Instances*/
    release_obj(hMailItem);
    release_obj(recipient);
    release_obj(hRecipients);
    release_obj(nameSpace);
    release_obj(application);
    end;
    Sample 2
    CLIENT_OLE2 sample.  Here a MailItem is created with an attachment and directly
    sent.
    Declare
    objOutlook CLIENT_OLE2.OBJ_TYPE;
    objMail CLIENT_OLE2.OBJ_TYPE;
    objArg CLIENT_OLE2.LIST_TYPE;
    objAttach CLIENT_OLE2.OBJ_TYPE;
    nameSpace CLIENT_OLE2.OBJ_TYPE;
    BEGIN
    objOutlook := CLIENT_OLE2.CREATE_OBJ('Outlook.Application');
    /* create namespace and login */
    args:=client_ole2.create_arglist;
    client_ole2.add_arg(args,'MAPI');
    nameSpace:=ole2.invoke_obj(objOutlook,'getNameSpace',args);
    client_ole2.destroy_arglist(args);
    client_ole2.invoke(nameSpace,'Logon');
    -- Previous example usually used 'mapi.session' but this doesn't work correctly
    --anymore.
    objarg := CLIENT_OLE2.CREATE_ARGLIST;
    CLIENT_OLE2.ADD_ARG(objarg,0);
    objMail := CLIENT_OLE2.INVOKE_OBJ(objOutlook,'CreateItem', objarg);
    CLIENT_OLE2.DESTROY_ARGLIST(objarg);
    objAttach := CLIENT_OLE2.GET_OBJ_PROPERTY(objmail, 'Attachments');
    objarg := CLIENT_OLE2.CREATE_ARGLIST;
    CLIENT_OLE2.ADD_ARG(objarg,'c:\temp\test.txt'); -- filename
    CLIENT_OLE2.SET_PROPERTY(objmail,'To','[email protected]');
    CLIENT_OLE2.SET_PROPERTY(objmail,'Subject','Email sent from Oracle Forms 9i');
    CLIENT_OLE2.SET_PROPERTY(objmail,'Body','This is an email that was sent using
    CLIENT_OLE2 from Oracle forms 9i');
    CLIENT_OLE2.INVOKE(objattach, 'Add', objarg);
    CLIENT_OLE2.INVOKE(objmail,'Send');
    CLIENT_OLE2.RELEASE_OBJ(objmail);
    CLIENT_OLE2.RELEASE_OBJ(nameSpace);
    CLIENT_OLE2.RELEASE_OBJ(objOutlook);
    CLIENT_OLE2.DESTROY_ARGLIST(objarg);
    END;
    Notes:
    These are just 2 different ways of sending a mail by Outlook and using the
    Outlook Object Model.
    The first example can also be used with CLIENT_OLE2, and the second example can
    also be used with OLE2.
    (just replace every OLE2 to CLIENT_OLE2 or every CLIENT_OLE2 call to OLE2).

  • How Sapscript form can be send by mail

    Hello all,
    I want to send a Sapscript form by mail.
    I think it should first be converted to PDF form and than need to be send by mail.
    I have created a z form which is a copy of standard for medruck and also have changed the standard program SAPFM06P. So I need to add functionality in z program so that i can send the sapscript form by mail.
    Can any body let me know the complete process how can i do it?
    Thanks

    Hi,
    Just follow the below code . I am giving the code which starts from OPEN_FORM. After that one submit program is there u can see the code.
    *&      Form  display_layout
          text
    -->  p1        text
    <--  p2        text
    FORM display_layout.
      CALL FUNCTION 'OPEN_FORM'
       EXPORTING
      APPLICATION                       = 'TX'
      ARCHIVE_INDEX                     =
      ARCHIVE_PARAMS                    =
         device                            = 'PRINTER'
      DIALOG                            = 'X'
         form                              = 'YFIL_DUNN_01'
      LANGUAGE                          = SY-LANGU
       options                           = itcpo
      MAIL_SENDER                       =
      MAIL_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
         invalid_fax_number                = 8
         more_params_needed_in_batch       = 9
         spool_error                       = 10
         OTHERS                            = 11
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      LOOP AT i_tab INTO wa_tab.
        CALL FUNCTION 'WRITE_FORM'
         EXPORTING
           element                     = '531'
      FUNCTION                       = 'SET'
      TYPE                           = 'BODY'
           window                      = 'MAIN'
    IMPORTING
       pending_lines                  = wa_tab.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDLOOP.
      CALL FUNCTION 'CLOSE_FORM'
       IMPORTING
         result                         = itcpp
        RDI_RESULT                     =
      TABLES
        OTFDATA                        =
         EXCEPTIONS
           unopened                       = 1
           bad_pageformat_for_print       = 2
           send_error                     = 3
           spool_error                    = 4
           OTHERS                         = 5.
      IF sy-subrc = 0.
        IF ( itcpp-userexit IS INITIAL AND
            NOT itcpp-tdspoolid IS INITIAL ).
          p_spool = itcpp-tdspoolid.
          SUBMIT yfir_mailsend_pdf_attachment WITH p_spool = p_spool
                                              WITH p_kunnr = p_kunnr.
        ENDIF.
      ENDIF.
    ENDFORM.                    " display_layout
    *&      Form  modify_duedate
          text
    -->  p1        text
    <--  p2        text
    FORM modify_duedate.
      SELECT SINGLE mat_rec_no
                    mat_rec_date FROM yfi_matno
                    INTO (v_mat_rec_no, v_mat_rec_date)
                    WHERE vbeln = wa_tab-vbeln.
      CHECK sy-subrc EQ 0.
      SELECT SINGLE zterm
                    FROM vbrk INTO  v_zterm
                    WHERE vbeln EQ wa_tab-vbeln.
      CHECK sy-subrc EQ 0.
      SELECT SINGLE zdays
                    FROM yfi_payment INTO v_zdays
                    WHERE zterm EQ v_zterm.
      IF sy-subrc EQ 0.
        wa_tab-zfbdt_due = ( v_mat_rec_date + v_zdays ).
        wa_tab-due_days = ( sy-datum - wa_tab-zfbdt_due ).
       IF wa_tab-due_days LE 0.
         wa_tab-due_days = 'N/A'.
       ENDIF.
        IF ( wa_tab-umskz = 'A' AND wa_tab-shkzg = 'H' ).
          wa_tab-zfbdt = ' '.
          wa_tab-zfbdt_due = ''.
          wa_tab-due_days = ''.
        ENDIF.
        MODIFY i_tab FROM wa_tab INDEX sy-tabix.
        CLEAR: v_mat_rec_no, v_mat_rec_date, v_zterm, v_zdays.
      ENDIF.
    ENDFORM.                    " modify_duedate
    SUBMIT PROGRAM :
    REPORT yfir_mailsend_pdf_attachment MESSAGE-ID yf.
    *& Program Name   : *
    & Author         :
    *& Creation Date  : *
    *& Program Type   :                                                   *
    *& SAP Release    : *
    *& Description    :     *
    *& Transport No   :                                                   *
    *& Transaction    :                                                   *
    *&  Send document with OTF/ALI attachment from spool to externalreci-
    *&  pient. OTF/ALI document is converted to PDF/HTML format duringthe
    *&  SAPconnect send process.
    *&  This report serves as example documentation for the function
    *&  modules SO_NEW_DOCUMENT_ATT_SEND_API1 and SO_DOCUMENT_SEND_API1.
    *&  Following this example you should be able to develop your own
    *&  report to send documents with all kinds of attachments.
    Creation of the entry for the compressed document
    *& TABLES:
    TABLES : kna1,
            adr6.
    *& INTERNAL TABLES:
    ***********PDF Declaration*******
    DATA: BEGIN OF i_spool OCCURS 0,
            rqident  LIKE tsp01-rqident,
            rqo1name LIKE tsp01-rqo1name,
            rqclient LIKE tsp01-rqclient,
          END   OF i_spool.
    *& VARIABLES :
    DATA: client LIKE tst01-dclient,
          name LIKE tst01-dname,
          objtype LIKE rststype-type,
          type LIKE rststype-type.
    DATA: spoolno LIKE tsp01-rqident,
         download TYPE c VALUE 'X', "AS CHECKBOX DEFAULT 'X',
         p_file LIKE rlgrap-filename
                         VALUE 'C:\Invoice.pdf',               "#EC NOTEXT
          otf LIKE itcoo OCCURS 100 WITH HEADER LINE,
         cancel,
          pdf LIKE tline OCCURS 100 WITH HEADER LINE,
          doctab LIKE docs OCCURS 1 WITH HEADER LINE,
          numbytes TYPE i,
          arc_idx LIKE toa_dara,
          pdfspoolid LIKE tsp01-rqident,
          jobname LIKE tbtcjob-jobname,
          jobcount LIKE tbtcjob-jobcount,
          is_otf.
    Data Declaration
    DATA: docdata    LIKE sodocchgi1,
          objpack    LIKE sopcklsti1 OCCURS  1 WITH HEADER LINE,
          objhead    LIKE solisti1   OCCURS  1 WITH HEADER LINE,
          objtxt     LIKE solisti1   OCCURS 10 WITH HEADER LINE,
          objbin     LIKE solisti1   OCCURS 10 WITH HEADER LINE,
          objhex     LIKE solix      OCCURS 10 WITH HEADER LINE,
          reclist    LIKE somlreci1  OCCURS  1 WITH HEADER LINE.
    *objpack-head_start = 1.
    *objbin = '  |  '. APPEND objbin.
    *DATA: listobject LIKE abaplist   OCCURS  1 WITH HEADER LINE.
    DATA: tab_lines  TYPE i,
          doc_size   TYPE i,
          att_type   LIKE soodk-objtp.
    objpack-head_start = 1.
    *& PARAMETERS:
    PARAMETERS : p_spool LIKE tsp01-rqident NO-DISPLAY,
                 p_kunnr LIKE kna1-kunnr NO-DISPLAY.
    *& M A I N   P R O C E S S
    *& START OF SELECTION.
    START-OF-SELECTION.
      SELECT SINGLE
      adr6~addrnumber
      adr6~smtp_addr
      FROM adr6
      INNER JOIN kna1
      ON kna1~adrnr = adr6~addrnumber
      INTO CORRESPONDING FIELDS OF adr6
      WHERE kna1~kunnr = p_kunnr.
      IF sy-subrc = 0.
    Create receiver list
        reclist-receiver = adr6-smtp_addr. "<-- customer address
        reclist-rec_type = 'U'.
        APPEND reclist.
      ENDIF.
    ***Convert Spool request to PDF
      PERFORM pdf_convert.
      docdata-obj_name  = 'MAIL_AEIW'.
      docdata-obj_descr = 'Dunning'.
      Main Text
      objtxt = 'Hi,'.
      APPEND objtxt.
      objtxt = 'Dunning'.
      APPEND objtxt.
      objtxt = 'Regards'.
      APPEND objtxt.
      Write Packing List (Main)
      DESCRIBE TABLE objtxt LINES tab_lines.
      READ     TABLE objtxt INDEX tab_lines.
      docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
      CLEAR objpack-transf_bin.
      objpack-head_start = 1.
      objpack-head_num   = 0.
      objpack-body_start = 1.
      objpack-body_num   = tab_lines.
      objpack-doc_type   = 'RAW'.
      APPEND objpack.
    Create Message Attachment
      Write Packing List (Attachment)
      att_type = 'PDF'.
      DESCRIBE TABLE objbin LINES tab_lines.
      READ     TABLE objbin INDEX tab_lines.
    *objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
      objpack-doc_size = tab_lines * 255.
      objpack-transf_bin = 'X'.
      objpack-head_start = 1.
      objpack-head_num   = 1.
      objpack-body_start = 1.
      objpack-body_num   = tab_lines.
      objpack-doc_type   = att_type.
      objpack-obj_name   = 'ATTACHMENT'.
      objpack-obj_descr  = 'Attached Document'.
      APPEND objpack.
    *check for not maintaining customer address
      IF reclist IS INITIAL.
        MESSAGE e000 WITH 'Please Maintain Customer e-Mail ID'.
        LEAVE LIST-PROCESSING.
      ELSE.
    Send Message
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data                     = docdata
             put_in_outbox                     = 'X'
        commit_work                       = 'X'     "used from rel.6.10
      IMPORTING
        SENT_TO_ALL                        =
        NEW_OBJECT_ID                     =
          TABLES
            packing_list                      = objpack
            object_header                     = objhead
            contents_bin                      = objbin
            contents_txt                      = objtxt
        CONTENTS_HEX                      = objhex
        OBJECT_PARA                        =
        OBJECT_PARB                        =
            receivers                         = reclist
      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
        IF sy-subrc <> 0.
          MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
                  WITH docdata-obj_name.
        ELSE.
          WRITE 'Mail sent successfully'.
        ENDIF.
      ENDIF.
      WRITE: / 'End of Program'.
    *&      Form  pdf_convert
          text
    -->  p1        text
    <--  p2        text
    FORM pdf_convert.
      DATA: date1   LIKE sy-datum,
            time1   LIKE sy-uzeit,
            period1 LIKE tsp01-rqcretime.
      date1 = sy-datum.
      time1 = sy-uzeit.
      date1 = date1 - 1.
      CONCATENATE date1 time1 INTO period1.
      SELECT rqident
             rqo1name
             rqclient FROM tsp01 INTO TABLE i_spool
                            WHERE rqowner   = sy-uname AND
                                  rqclient  = sy-mandt AND
                                  rqident   = p_spool.
      IF sy-subrc <> 0.
        WRITE: / 'No Spool Request created today'(003)
                COLOR COL_NEGATIVE.
        EXIT.
      ENDIF.
      SORT i_spool DESCENDING BY rqident.
      READ TABLE i_spool INDEX 1.
      CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
             EXPORTING
                authority     = 'SP01'
                client        = i_spool-rqclient
                name          = i_spool-rqo1name
                part          = 1
             IMPORTING
              CHARCO        =
              CREATER       =
              CREDATE       =
              DELDATE       =
              MAX_CREDATE   =
              MAX_DELDATE   =
              NON_UNIQ      =
              NOOF_PARTS    =
              RECTYP        =
              SIZE          =
              STOTYP        =
                  type          = type
                  objtype       = objtype
             EXCEPTIONS
                  fb_error      = 1
                  fb_rsts_other = 2
                  no_object     = 3
                  no_permission = 4.
      CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
          EXPORTING
            src_spoolid                    = i_spool-rqident
            no_dialog                      = ' '
          DST_DEVICE                     =
          PDF_DESTINATION                =
          IMPORTING
            pdf_bytecount                  = numbytes
            pdf_spoolid                    = pdfspoolid
          OTF_PAGECOUNT                  =
            btc_jobname                    = jobname
            btc_jobcount                   = jobcount
          TABLES
            pdf                            = pdf
          EXCEPTIONS
            err_no_otf_spooljob            = 1
            err_no_spooljob                = 2
            err_no_permission              = 3
            err_conv_not_possible          = 4
            err_bad_dstdevice              = 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.
      CASE sy-subrc.
        WHEN 0.
        WHEN 1.
          WRITE: / 'Error On Spool Job'(002)
                COLOR COL_NEGATIVE.
          EXIT.
        WHEN 2.
          WRITE: / 'No Permission'(003)
                COLOR COL_NEGATIVE.
          EXIT.
        WHEN 3.
          WRITE: / 'Conversion Not Possible'(004)
                COLOR COL_NEGATIVE.
          EXIT.
        WHEN OTHERS.
          WRITE: / 'Incorrect Destination Device'(005)
                    COLOR COL_NEGATIVE.
          EXIT.
      ENDCASE.
      CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
           EXPORTING
                line_width_src              = 134
                line_width_dst              = 255
           TABLES
                content_in                  = pdf
                content_out                 = objbin
           EXCEPTIONS
                err_line_width_src_too_long = 1
                err_line_width_dst_too_long = 2
                err_conv_failed             = 3
                OTHERS                      = 4.
    ENDFORM.                    " pdf_convert

  • Sending sapscript form to an external mail

    i need to send sapscript form to an external mail like for example a yahoo mail from SAP. i need an ABAP code that performs this function. its urgent, please

    1) REPORT PROGRAM  - RSTXPDFT4 ,
    FIRST GENERATE SPOOL REQUEST THEN DOWNLOAD SAPSCRIPT TO PDF FILE ON LOCAL PC.
    2) copy this code to send this downloaded form to external mail -
    *& Report  ZGILL_SENDMAIL_PDF                                          *
    REPORT  ZGILL_SENDMAIL_PDF                      .
    INCLUDE ZGILL_INCMAIL.  "SEE BELOW FOR INCLUDE PROGRAM CODE.
    * DATA
    DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
    DATA : file_name TYPE string.
    data : path like PCFILE-PATH.
    data : extension(5) type c.
    data : name(100) type c.
    * SELECTION SCREEN
    PARAMETERS : receiver TYPE somlreci1-receiver lower case DEFAULT '[email protected]'.
    PARAMETERS : p_file LIKE rlgrap-filename
    OBLIGATORY DEFAULT 'C:TEMPSALARY_SLIP1.PDF'.
    * AT SELECTION SCREEN
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CLEAR p_file.
    CALL FUNCTION 'F4_FILENAME'
    IMPORTING
    file_name = p_file.
    * START-OF-SELECTION
    START-OF-SELECTION.
    PERFORM ml_customize USING 'Tst' 'Testing'.
    PERFORM ml_addrecp USING receiver 'U'.
    PERFORM upl.
    PERFORM doconv TABLES itab objbin.
    PERFORM ml_prepare USING 'X' extension name.
    PERFORM ml_dosend.
    SUBMIT rsconn01
    WITH mode EQ 'INT'
    AND RETURN.
    * FORM
    FORM upl.
    file_name = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = file_name
    filetype = 'BIN'
    TABLES
    data_tab = itab
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    OTHERS = 17.
    path = file_name.
    CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
    EXPORTING
    complete_filename = path
    * CHECK_DOS_FORMAT =
    IMPORTING
    * DRIVE =
    EXTENSION = extension
    NAME = name
    * NAME_WITH_EXT =
    * PATH =
    EXCEPTIONS
    INVALID_DRIVE = 1
    INVALID_EXTENSION = 2
    INVALID_NAME = 3
    INVALID_PATH = 4
    OTHERS = 5
    ENDFORM. "upl
    **********************iNCLUDE pROGRAM*********************************************
    *&  Include           ZGILL_INCMAIL                                    *
    * Data
    DATA: docdata LIKE sodocchgi1,
    objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
    objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
    objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objhex LIKE solix OCCURS 10 WITH HEADER LINE,
    reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
    DATA: tab_lines TYPE i,
    doc_size TYPE i,
    att_type LIKE soodk-objtp.
    DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
    * FORM
    FORM ml_customize USING objname objdesc.
    *----------- Clear Variables
    CLEAR docdata.
    REFRESH objpack.
    CLEAR objpack.
    REFRESH objhead.
    REFRESH objtxt.
    CLEAR objtxt.
    REFRESH objbin.
    CLEAR objbin.
    REFRESH objhex.
    CLEAR objhex.
    REFRESH reclist.
    CLEAR reclist.
    REFRESH listobject.
    CLEAR listobject.
    CLEAR tab_lines.
    CLEAR doc_size.
    CLEAR att_type.
    *--------- Set Variables
    docdata-obj_name = objname.
    docdata-obj_descr = objdesc.
    ENDFORM. "ml_customize
    * FORM
    FORM ml_addrecp USING preceiver prec_type.
    CLEAR reclist.
    reclist-receiver = preceiver.
    reclist-rec_type = prec_type.
    APPEND reclist.
    ENDFORM. "ml_customize
    * FORM
    FORM ml_addtxt USING ptxt.
    CLEAR objtxt.
    objtxt = ptxt.
    APPEND objtxt.
    ENDFORM. "ml_customize
    * FORM
    FORM ml_prepare USING bypassmemory whatatt_type whatname.
    IF bypassmemory = ''.
    *--------- Fetch List From Memory
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = listobject
    EXCEPTIONS
    OTHERS = 1.
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'LIST_FROM_MEMORY'.
    ENDIF.
    CALL FUNCTION 'TABLE_COMPRESS'
    * IMPORTING
    * COMPRESSED_SIZE =
    TABLES
    in = listobject
    out = objbin
    EXCEPTIONS
    OTHERS = 1
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'TABLE_COMPRESS'.
    ENDIF.
    ENDIF.
    * Header Data
    * Already Done Thru FM
    * Main Text
    * Already Done Thru FM
    * Packing Info For Text Data
    DESCRIBE TABLE objtxt LINES tab_lines.
    READ TABLE objtxt INDEX tab_lines.
    docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
    CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = 'TXT'.
    APPEND objpack.
    * Packing Info Attachment
    att_type = whatatt_type..
    DESCRIBE TABLE objbin LINES tab_lines.
    READ TABLE objbin INDEX tab_lines.
    objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = att_type.
    objpack-obj_name = 'ATTACHMENT'.
    objpack-obj_descr = whatname.
    APPEND objpack.
    * Receiver List
    * Already done thru fm
    ENDFORM. "ml_prepare
    * FORM
    FORM ml_dosend.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = docdata
    put_in_outbox = 'X'
    commit_work = 'X' "used from rel. 6.10
    * IMPORTING
    * SENT_TO_ALL =
    * NEW_OBJECT_ID =
    TABLES
    packing_list = objpack
    object_header = objhead
    contents_bin = objbin
    contents_txt = objtxt
    * CONTENTS_HEX = objhex
    * OBJECT_PARA =
    * object_parb =
    receivers = reclist
    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
    IF sy-subrc <> 0.
    MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
    WITH docdata-obj_name.
    ENDIF.
    ENDFORM. "ml_customize
    * FORM
    FORM ml_spooltopdf USING whatspoolid.
    DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
    *-------------- Call Function
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
    src_spoolid = whatspoolid
    TABLES
    pdf = pdf
    EXCEPTIONS
    err_no_otf_spooljob = 1
    OTHERS = 12.
    *------------- Convert
    PERFORM doconv TABLES pdf objbin.
    ENDFORM. "ml_spooltopdf
    * FORM
    FORM doconv TABLES
    mypdf STRUCTURE tline
    outbin STRUCTURE solisti1.
    *-------- Data
    DATA : pos TYPE i.
    DATA : len TYPE i.
    *------------ Loop And Put Data
    LOOP AT mypdf.
    pos = 255 - len.
    IF pos > 134. "length of pdf_table
    pos = 134.
    ENDIF.
    outbin+len = mypdf(pos).
    len = len + pos.
    IF len = 255. "length of out (contents_bin)
    APPEND outbin.
    CLEAR: outbin, len.
    IF pos < 134.
    outbin = mypdf+pos.
    len = 134 - pos.
    ENDIF.
    ENDIF.
    ENDLOOP.
    IF len > 0.
    APPEND outbin.
    ENDIF.
    ENDFORM. "doconv
    ***********************INCLUDE END*********************************

  • Send a mail use FM 'so_object_send' with a Script form layout

    Hi,
    I try to send a mail use FM 'so_object_send', is it possible to use a sap script form for the layout?
    Please give more details....

    Hi,
    Did you debug and check this function module 'SO_NEW_DOCUMENT_SEND_API1' ?
    As you said its giving you a sy-subrc = 2, did you check at what stage it is giving you an error ?
    Also, Commit work = 'X' has nothing to do with this as you are getting an error of Sy-subrc = 2.
    Also, while debugging are you getting the email address fetched from database table ? If no, then the sender's email has not been maintained. You will have to maintain the sender's email in the user details in SU02 under Address tab.
    I would recommend you to go for BCS to send emails wherein you specify the sender email address directly in the program rather than adding email address in every user's logon details.
    Regards,
    Danish.
    Edited by: Danish2285 on Mar 5, 2012 3:28 PM

  • H can we send script form to client through mail.

    h can we send script form to client through mail.

    <<removed by moderator>>
    Search SDN for more details on these...
    Thanks,
    Anmol.
    Edited by: kishan P on Apr 6, 2011 11:49 AM

  • Send the mail without opening mail form

    Hello,
    I want to send the report output thro' mail without opening the mail form. This is needed as the report need to be scheduled to execute at particular time. The mailid will be got from the DB.
    I noticed that the mailid needs to be available in the mailer's addressbook. Thenonly report can send the mail.
    Does it mean, all the mailid's available in the DB needs to be part of addressbook? I need help on this.
    thanks in advance,
    Regards,
    Vani.

    Hi,
    It is not necessary to have all the mailid's available in the DB needs to be part of addressbook. If you set desname to mailTo address, that mailid is "TO" address of your mail output.
    Thanks,
    Puvan.

Maybe you are looking for

  • With bootcamp it can not find ntsf drive

    I have been using latest addition of Bootcamp 5 in an effort to install Windows 7 in a partition.  In every attempt it indicates that, even after using Bootcamp 5, it can not load Windows 7 on the "Bootcamp" partition but it always says it needs an N

  • Neopukservicesstub Kde4.8 using 100% CPU Usage

    I have run pacman -Syu and running KDE4.8.4 I have disabled the  Neopuk search module from kde control centre, service manage, startup applications. Still neopukservicesstub starts to run and uses100% CPU usgae following lines are from top. Neopukser

  • Firefox keeps preventing important pages (webmail) from loading fresh contents. How do I quit this function?

    Firefox prevents the refreshing of my webmail site. Very annoying, as there may be new information or mail - or even not. But I want to know it of course. It mustn't be up to Firefox!

  • Checking days in Feb..

    Entered 02-29-2001 as input date and noticed that BC4J converts this date to 2001-03-01. How can I get the entered value (2001-02-29)in EntityImpl set method? I would write a method and check the entered date. Please respond. Thanks in advance!! Appr

  • Generate Outbound IDoc In CRM

    Hello Experts! Upon create and/or update of an Opportunity in CRM, I'd like the system to automatically generate an Outbound IDoc.  I've already configured the following:    1.  Define Logical Systems and Assign Client to Logical System - Transaction