Send a vector with axis

Hi!
I want to receive a Vector using Axis. My client looks like this
        try{
            Service service = new Service();
            Call call = (Call) service.createCall();
            call.setTargetEndpointAddress(new java.net.URL(url));
            call.setOperationName("prozesua");
            call.addParameter("analisia", XMLType.XSD_STRING, ParameterMode.IN);
            call.setReturnType(XMLType.SOAP_VECTOR);
           Vector emaitzaMWgabe = (Vector)call.invoke(new Object[] {sarrera});
        catch (Exception ex) {
            ex.printStackTrace();
        }And here is the server's .wsdl file:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://zerbitzuak" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://zerbitzuak" xmlns:intf="http://zerbitzuak" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.2beta3
Built on Aug 01, 2004 (05:59:22 PDT)-->
<wsdl:types>
  <schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://zerbitzuak"/>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="Vector">
    <sequence>
     <element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:anyType"/>
    </sequence>
   </complexType>
  </schema>
  <schema targetNamespace="http://zerbitzuak" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://xml.apache.org/xml-soap"/>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="ArrayOf_xsd_string">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
     </restriction>
    </complexContent>
   </complexType>
  </schema>
</wsdl:types>
   <wsdl:message name="mainRequest">
      <wsdl:part name="args" type="impl:ArrayOf_xsd_string"/>
   </wsdl:message>
   <wsdl:message name="prozesuaResponse">
      <wsdl:part name="prozesuaReturn" type="apachesoap:Vector"/>
   </wsdl:message>
   <wsdl:message name="mainResponse">
   </wsdl:message>
   <wsdl:message name="prozesuaRequest">
      <wsdl:part name="analisia" type="xsd:string"/>
   </wsdl:message>
   <wsdl:portType name="GalderaTokenizatu">
      <wsdl:operation name="prozesua" parameterOrder="analisia">
         <wsdl:input message="impl:prozesuaRequest" name="prozesuaRequest"/>
         <wsdl:output message="impl:prozesuaResponse" name="prozesuaResponse"/>
      </wsdl:operation>
      <wsdl:operation name="main" parameterOrder="args">
         <wsdl:input message="impl:mainRequest" name="mainRequest"/>
         <wsdl:output message="impl:mainResponse" name="mainResponse"/>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="GalderaTokenizatuSoapBinding" type="impl:GalderaTokenizatu">
      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="prozesua">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="prozesuaRequest">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://zerbitzuak" use="encoded"/>
         </wsdl:input>
         <wsdl:output name="prozesuaResponse">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://zerbitzuak" use="encoded"/>
         </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="main">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="mainRequest">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://zerbitzuak" use="encoded"/>
         </wsdl:input>
         <wsdl:output name="mainResponse">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://zerbitzuak" use="encoded"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="GalderaTokenizatuService">
      <wsdl:port binding="impl:GalderaTokenizatuSoapBinding" name="GalderaTokenizatu">
         <wsdlsoap:address location="http://localhost:8080/Ihardetsi_Arantxa/services/GalderaTokenizatu"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>When I run the client I receive the "Premature end of file" exception.
Does anybody know why?
Thanks

Hi!
I want to receive a Vector using Axis. My client looks like this
        try{
            Service service = new Service();
            Call call = (Call) service.createCall();
            call.setTargetEndpointAddress(new java.net.URL(url));
            call.setOperationName("prozesua");
            call.addParameter("analisia", XMLType.XSD_STRING, ParameterMode.IN);
            call.setReturnType(XMLType.SOAP_VECTOR);
           Vector emaitzaMWgabe = (Vector)call.invoke(new Object[] {sarrera});
        catch (Exception ex) {
            ex.printStackTrace();
        }And here is the server's .wsdl file:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://zerbitzuak" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://zerbitzuak" xmlns:intf="http://zerbitzuak" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.2beta3
Built on Aug 01, 2004 (05:59:22 PDT)-->
<wsdl:types>
  <schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://zerbitzuak"/>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="Vector">
    <sequence>
     <element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:anyType"/>
    </sequence>
   </complexType>
  </schema>
  <schema targetNamespace="http://zerbitzuak" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://xml.apache.org/xml-soap"/>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="ArrayOf_xsd_string">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
     </restriction>
    </complexContent>
   </complexType>
  </schema>
</wsdl:types>
   <wsdl:message name="mainRequest">
      <wsdl:part name="args" type="impl:ArrayOf_xsd_string"/>
   </wsdl:message>
   <wsdl:message name="prozesuaResponse">
      <wsdl:part name="prozesuaReturn" type="apachesoap:Vector"/>
   </wsdl:message>
   <wsdl:message name="mainResponse">
   </wsdl:message>
   <wsdl:message name="prozesuaRequest">
      <wsdl:part name="analisia" type="xsd:string"/>
   </wsdl:message>
   <wsdl:portType name="GalderaTokenizatu">
      <wsdl:operation name="prozesua" parameterOrder="analisia">
         <wsdl:input message="impl:prozesuaRequest" name="prozesuaRequest"/>
         <wsdl:output message="impl:prozesuaResponse" name="prozesuaResponse"/>
      </wsdl:operation>
      <wsdl:operation name="main" parameterOrder="args">
         <wsdl:input message="impl:mainRequest" name="mainRequest"/>
         <wsdl:output message="impl:mainResponse" name="mainResponse"/>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="GalderaTokenizatuSoapBinding" type="impl:GalderaTokenizatu">
      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="prozesua">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="prozesuaRequest">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://zerbitzuak" use="encoded"/>
         </wsdl:input>
         <wsdl:output name="prozesuaResponse">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://zerbitzuak" use="encoded"/>
         </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="main">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="mainRequest">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://zerbitzuak" use="encoded"/>
         </wsdl:input>
         <wsdl:output name="mainResponse">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://zerbitzuak" use="encoded"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="GalderaTokenizatuService">
      <wsdl:port binding="impl:GalderaTokenizatuSoapBinding" name="GalderaTokenizatu">
         <wsdlsoap:address location="http://localhost:8080/Ihardetsi_Arantxa/services/GalderaTokenizatu"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>When I run the client I receive the "Premature end of file" exception.
Does anybody know why?
Thanks

Similar Messages

  • Iam unable to send multiple attachments with a mail using JavaMail?

    Hai to all,
    Iam unable to send multiple attachments with a email,see
    iam have succeeded in sending one attachment with a email.
    when iam tring to add two or more attachments to a mail,
    it is giving a Exception like this:
    javax.mail.MessagingException: IOException while sending message;
    nested exception is:
    java.io.IOException: No content
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:577)
    at javax.mail.Transport.send0(Transport.java:151)
    at javax.mail.Transport.send(Transport.java:80)
    at AttachFilesModified.sendMail(AttachFilesModified.java:185)
    at AttachFilesModified.main(AttachFilesModified.java:43)
    this is my code snipnet:
    BodyPart messageBodyPart = new MimeBodyPart();
    Multipart multipart = new MimeMultipart();
    if(body != null)
    messageBodyPart.setText(body);
    multipart.addBodyPart(messageBodyPart);
    /*if(attachments != null)
    for(int i = 0; i < attachments.length; i++)
    String filename="D:\\nagaraju\\apachi\\axis-bin-1_3.zip";
         //String s[]=filename.split("\\");
         //System.out.println(s);     
              //String s1=s[1];
              //String filename1=s[s.length-1];
    messageBodyPart = new MimeBodyPart();
    DataSource source = new FileDataSource(filename);
         messageBodyPart.setDataHandler(new DataHandler(source));
    messageBodyPart.setFileName(filename);
    multipart.addBodyPart(messageBodyPart);
         //second file attaching
         /*String filename1="C:\\nagadoc.txt";
         BodyPart messageBodyPart1=new MimeBodyPart();
         DataSource source1=new FileDataSource(filename1);
         messageBodyPart.setDataHandler(new DataHandler(source1));
         messageBodyPart.setFileName(filename1);
         multipart.addBodyPart(messageBodyPart1);
    mess.setContent(multipart);
    Address[] allRecips = mess.getAllRecipients();
    if(toStdOut)
    System.out.println("done.");
    //System.out.println("Sending message (\"" + mess.getSubject().substring(0,10) + "...\") to :");
    System.out.println("Sending message................");
    for(int i = 0; i < allRecips.length; i++)
    System.out.print(allRecips[i] + ";");
    System.out.println("...");
    Transport.send(mess);
    if(toStdOut)
    System.out.println("done.");
    return 0;
    What's wrng with that code snipnet?
    Nagaraju G.

    This works fine with me, try it or compare it if you want.
    public void sendEmail( String from, String to,
    String subject, String body) {
    fMailServerConfig.put("mail.smtp.host", " <<mail server>>");
    Session session = Session.getDefaultInstance( fMailServerConfig, null );
    MimeMessage message = new MimeMessage( session );
    try {
    message.setFrom(new InternetAddress(from));
    message.setRecipient(Message.RecipientType.TO,
    new InternetAddress(to));
    message.setSubject( subject);
    message.setText( body);
    //Adds Attechment:
    Multipart multipart = new MimeMultipart();
    BodyPart messageBodyPart = new MimeBodyPart();
    messageBodyPart.setText("Here are my attachments");
    multipart.addBodyPart(messageBodyPart);
    messageBodyPart = new MimeBodyPart();
    //first attachment
    DataSource source = new FileDataSource("C:\\img1.jpg");
    messageBodyPart.setDataHandler(new DataHandler(source));
    messageBodyPart.setFileName("C:\\Telnor1.jpg");
    multipart.addBodyPart(messageBodyPart);
    //Second attachment
    DataSource source2 = new FileDataSource("C:\\img2.jpg");
    messageBodyPart.setDataHandler(new DataHandler(source2));
    messageBodyPart.setFileName("C:\\Telnor2.jpg");
    multipart.addBodyPart(messageBodyPart);
    //etc...
    message.setContent(multipart);
    Transport.send( message );
    }catch (MessagingException e){
    System.err.println("Cant send mail. " + e);
    The error on your code might be:
    BodyPart messageBodyPart1=new MimeBodyPart();
    DataSource source1=new FileDataSource(filename1);
    messageBodyPart.setDataHandler(new DataHandler(source1));
    messageBodyPart.setFileName(filename1);
    multipart.addBodyPart(messageBodyPart1);
    You don't need to create a new BodyPart, and apart from that you'r seting values on "messageBodyPart" but adding "messageBodyPart1" to your multipart :P
    Well see u and have a good one!
    p.s. i know it's a little late from the day you posted, but at least it might help somebody else :D .

  • JMS protocol with AXIS Adapter

    Hi,
    I need to configure the sender AXIS adapter to access SonicMQ JMS queues via Open LDAP. I looked at the AXIS Adapter documentation and no examples are provided to access SonicMQ via OpenLdap.
    I do see the documentation to access the JMS providers directly by specifying the URL as "jms://ABCD"
    but what i am looking for is to access the JMS objects via LDAP. The standard SAP JMS Adapter has the functionality to access JMS via LDAP. but i need to use AXIS adapter for WS-Security
    Any help is greatly appreciated
    Thanks
    Chandra

    Hi Chandra,
    As far as I know, this is not directly supported via SOAP Axis Adapter. But one question which I would like to ask is are you trying to configure WS Security using Axis Handlers or you are trying to use the WS Security provided by SAP PI i.e. configuring Security Profile in the Sender Channel?
    If you are trying to do it with Axis Handlers may be you can try using the Adapter modules specified in this link which can be used tto call Axis Handlers. <http://help.sap.com/saphelp_nwpi71/helpdata/EN/45/a4f8bbdfdc0d36e10000000a114a6b/content.htm>. Although documentation says that this is supported for SOAP adapter but you can still try as the message returned is still a valid AF message.
    Best Regards,
    Pratik

  • Sending a vector to a servlet

    i want to send a vector to a servlet via an applet. i think i have done this properly.
    but i then want to write the information in this vector to a file and i'm wondering why its not working
    i've read postings about how if everything i store in it implements Serializable, i can just serialize it to file.
    i don't completely understand how to do this.
    i'm putting strings into the vector before i send it to the servlet....will this cause a problem?
    are strings serializable?
    thanks
    Andy

    i'm not getting an error, but it appears like the POST isn't working...i think there must be something wrong with how i try to call the servlet
    i think it might have something to do with my setRequestProperty...
    here's my code....
    /************applet************/
    public void sendVector(Vector sendingVector)
    URL baseURL = getCodeBase();
    String protocol = baseURL.getProtocol();
    String host = baseURL.getHost();
    int port = 808;
    try
    String urlSuffix = "/servlet/contactlist.WriteToServlet";
    URL servletURL = new URL(protocol, host, port, urlSuffix);
    URLConnection conn = servletURL.openConnection();
    // inform the connection that we will send output and accept input
    conn.setDoInput(true);
    conn.setDoOutput(true);
    // Don't use a cached version of URL connection.
    conn.setUseCaches (false);
    conn.setDefaultUseCaches (false);
    // Specify the content type that we will send binary data
    conn.setRequestProperty ("Content-Type", "application/octet-stream");
    // send the student object to the servlet using serialization
    ObjectOutputStream outputToServlet = new ObjectOutputStream(conn.getOutputStream());
    // serialize the object
    outputToServlet.writeObject( sendingVector );
    outputToServlet.flush();
    outputToServlet.close();
    } catch (IOException io) { io.printStackTrace(); }
    } // end sendVector
    /*********servlet*************/
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    try
    // get an input stream from the applet
    ObjectInputStream inputFromApplet = new ObjectInputStream(request.getInputStream());
    // read the serialized student data from applet
    Vector passInfo = (Vector)inputFromApplet.readObject();
    inputFromApplet.close();
    for(int i =0; i < passInfo.size(); i++) System.out.println(passInfo.get(i));
    // make this so that the vector filename has no spaces
    FileWriter writer = new FileWriter("G:\\Intranet\\wwwroot\\Contact\\contactlist\\Departments\\" + getFileTitle(passInfo.get(1).toString()) + ".htm");
    // prints information to the file
    int a;
    for(a = 0; a < (passInfo.size()-1); a++)
    {  writer.write(passInfo.get(a) + "\n");
    writer.write(passInfo.get(a).toString());
    writer.flush();
    writer.close();
    catch(Exception e) { e.printStackTrace(); }
    public void doPut(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    doGet(request, response);
    } // end doPut

  • How to send multiple files with it's original name over HTTPS using one CC?

    I am working on a File to HTTPs scenario. It is in production and working fine. Currently we send only one file and I have hard coded the name in the communication channel in the header fields. Now we have to send more files with different names and I want to use only one receiver channel instead of many. We need to send the files with their original names.
    I used the ASMA in the sender File Adapter and I see the FileName in the dynamic configuration under http://sap.com/xi/XI/System/File name="FileName".
    I know we can use a UDF in message mapping and get the value and put it in HEADERFIELDONE. But we don't want to use mapping as the files are huge and we don't want to insert XML tags in the payload.
    So how do I put the Filename from the DynamicConfiguration to the HTTP header field as FileName without using mapping? Are there any settings?
    Can I put something in the PROLOG or can I use any other module in the File Sender Adapter or is there any other option?
    Any help is appreciated.
    Thanks
    Sai

    See my blog:
    /people/stefan.grube/blog/2009/06/19/unknown-use-case-of-dynamicconfigurationbean-store-file-name-to-jms-header-without-mapping
    You have to put the configuration in sender channel, as HTTP adapter does not allow modules.
    For the second module, put values related to HTTP adapter.

  • LG Ally - sending text message with pic AND audio *2 attachments on one message*

    I can send an audio file via text message... I can send a picture via text message but for the life of me I CANNOT figure out how to send a pic with audio via text message and it's driving me crazy!
    Does anyone know how to do this?

    It order to send a picture and sound in the same message, once you have entered the Create Message step, you choose Insert Slideshow instead of Picture. When you insert a slideshow, you will have the ability to add both a picture and sound file in the same message. 
    Hope this helps! 

  • Hi I just got a new macbook pro i7 processor and i am trying to send a email with  iPhoto and it comes back with The Email sever didn't recognise your username /password combination I'm with btyahoo  thats my I S P

    hi i just got a apple macbook pro on sat... it is the i7 processor 13inch.. the thing is i have been trying to send a picture with iphoto but it just comes back with the sever didn't recognise my Email/password combination

    Go to the Mac App Store main page and click on Support under Quick Links.
    (82704)

  • CRM ONLINE 2013: On Approval Of Quotation, Run Report, Generate PDF and Send an Email With PDF as attachment

    Hi,
    I am using CRM ONLINE 2013.
    How to automate below process?
    1. On Approval Of Quotation, Run Report.
    2. Generate PDF.
    3. Send an Email With PDF as attachment.
    As i have gone through many forums for this topic, but creating a plugin code for generating Report PDF is not possible in CRM ONLINE.
    So, What is the alternate way to do this..?
    Thanks.

    This is my entire code mentioned below:-
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
        <script type="text/javascript">
            if (typeof (SDK) == "undefined")
            { SDK = { __namespace: true }; }
            SDK.JScriptRESTDataOperations = {
                _context: function () {
                    if (typeof GetGlobalContext != "undefined")
                    { return GetGlobalContext(); }
                    else {
                        if (typeof Xrm != "undefined") {
                            return Xrm.Page.context;
                        else { return new Error("Context is not available."); }
                _getServerUrl: function () {
                    var serverUrl = this._context().getServerUrl()
                    if (serverUrl.match(/\/$/)) {
                        serverUrl = serverUrl.substring(0, serverUrl.length - 1);
                    return serverUrl;
                _ODataPath: function () {
                    return this._getServerUrl() + "/XRMServices/2011/OrganizationData.svc/";
                _errorHandler: function (req) {
                    return new Error("Error : " +
      req.status + ": " +
      req.statusText + ": " +
      JSON.parse(req.responseText).error.message.value);
                _dateReviver: function (key, value) {
                    var a;
                    if (typeof value === 'string') {
                        a = /Date\(([-+]?\d+)\)/.exec(value);
                        if (a) {
                            return new Date(parseInt(value.replace("/Date(", "").replace(")/", ""), 10));
                    return value;
                Create: function (object, type, successCallback, errorCallback) {
                    var req = new XMLHttpRequest();
                    req.open("POST", this._ODataPath() + type + "Set", true);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
                    req.onreadystatechange = function () {
                        if (this.readyState == 4 /* complete */) {
                            if (this.status == 201) {
                                successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d);
                            else {
                                errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
                    req.send(JSON.stringify(object));
                Retrieve: function (id, type, successCallback, errorCallback) {
                    var req = new XMLHttpRequest();
                    req.open("GET", this._ODataPath() + type + "Set(guid'" + id + "')", true);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
                    req.onreadystatechange = function () {
                        if (this.readyState == 4 /* complete */) {
                            if (this.status == 200) {
                                successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d);
                            else {
                                errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
                    req.send();
                Update: function (id, object, type, successCallback, errorCallback) {
                    var req = new XMLHttpRequest();
                    req.open("POST", this._ODataPath() + type + "Set(guid'" + id + "')", true);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
                    req.setRequestHeader("X-HTTP-Method", "MERGE");
                    req.onreadystatechange = function () {
                        if (this.readyState == 4 /* complete */) {
                            if (this.status == 204 || this.status == 1223) {
                                successCallback();
                            else {
                                errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
                    req.send(JSON.stringify(object));
                Delete: function (id, type, successCallback, errorCallback) {
                    var req = new XMLHttpRequest();
                    req.open("POST", this._ODataPath() + type + "Set(guid'" + id + "')", true);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
                    req.setRequestHeader("X-HTTP-Method", "DELETE");
                    req.onreadystatechange = function () {
                        if (this.readyState == 4 /* complete */) {
                            if (this.status == 204 || this.status == 1223) {
                                successCallback();
                            else {
                                errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
                    req.send();
                RetrieveMultiple: function (type, filter, successCallback, errorCallback) {
                    if (filter != null) {
                        filter = "?" + filter;
                    else { filter = ""; }
                    var req = new XMLHttpRequest();
                    req.open("GET", this._ODataPath() + type + "Set" + filter, true);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
                    req.onreadystatechange = function () {
                        if (this.readyState == 4 /* complete */) {
                            if (this.status == 200) {
                                successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d.results);
                            else {
                                errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
                    req.send();
                __namespace: true
        </script>
        <script type="text/javascript">
            //Create Email and link it with Order as Regarding field
            var Xrm;
            var email = new Object();
            var ownerID = "";
            var CustomerId = "";
            if (window.opener) { Xrm = window.opener.Xrm; }
            else if (window.parent) { Xrm = window.parent.Xrm; }
            //Get ownerid who send email of quotation to customer
            function GetOwnerID() {
                var owner = Xrm.Page.getAttribute("ownerid").getValue();
                ownerID = owner[0].id;
                var ownerName = owner[0].name;
                var entityType = owner[0].entityType;
                GetToEmailGUID();
            //Get customerid who receive email of quotation from owner
            function GetToEmailGUID() {
                var Customer = Xrm.Page.getAttribute('customerid').getValue();
                CustomerId = Customer[0].id;
                var CustomerName = Customer[0].name;
                var entityType = Customer[0].entityType;
                //if CustomerId is type of "Account" then get Primary Contact id of that account
                if (entityType == "account") {
                    var contact = Xrm.Page.getAttribute("customerid").getValue();
                    if (contact === null) return;
                    var serverUrl = Xrm.Page.context.getClientUrl();
                    var oDataSelect = serverUrl + "/XRMServices/2011/OrganizationData.svc/AccountSet(guid'" + contact[0].id + "')?$select=PrimaryContactId";
                    var req = new XMLHttpRequest();
                    req.open("GET", oDataSelect, false);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json;charset=utf-8");
                    req.onreadystatechange = function () {
                        if (req.readyState === 4) {
                            if (req.status === 200) {
                                var retrieved = JSON.parse(req.responseText).d;
                                CustomerId = retrieved.PrimaryContactId.Id;
                            else {
                                alert(this.statusText);
                    req.send();
            function CreateEmail() {
                GetOwnerID();
                email.Subject = "Email with Report Attachment";
                //Set The current order as the Regarding object
                email.RegardingObjectId = {
                    Id: Xrm.Page.data.entity.getId(),    //Get the current entity Id , here OrderId
                    LogicalName: Xrm.Page.data.entity.getEntityName()//Get the current entity name, here it will be “salesOrder”
                //Create Email Activity
                SDK.JScriptRESTDataOperations.Create(email, "Email", EmailCallBack, function (error) { alert(error.message); });
            // Email Call Back function
            function EmailCallBack(result) {
                email = result; // Set the email to result to use it later in email attachment for retrieving activity Id
                var activityPartyFrom = new Object();
                // Set the From party of the ActivityParty to relate an entity with Email From field
                activityPartyFrom.PartyId = {
                    Id: CustomerId, //"79EBDD26-FDBE-E311-8986-D89D6765B238",  // id of entity you want to associate this activity with.        
                    LogicalName: "contact"
                // Set the "activity" of the ActivityParty
                activityPartyFrom.ActivityId = {
                    Id: result.ActivityId,
                    LogicalName: "email"
                // Now set the participation type that describes the role of the party on the activity).
                activityPartyFrom.ParticipationTypeMask = { Value: 2 }; // 2 means ToRecipients
                // Create the from ActivityParty for the email
                SDK.JScriptRESTDataOperations.Create(activityPartyFrom, "ActivityParty", ActivityPartyFromCallBack, function (error) { alert(error.message); });
                var activityPartyTo = new Object();
                // Set the From party of the ActivityParty to relate an entity with Email From field
                activityPartyTo.PartyId = {
                    Id: ownerID, //"79EBDD26-FDBE-E311-8986-D89D6765B238",  // id of entity you want to associate this activity with.        
                    LogicalName: "systemuser"
                // Set the "activity" of the ActivityParty  
                activityPartyTo.ActivityId = {
                    Id: result.ActivityId,
                    LogicalName: "email"
                // Now set the participation type that describes the role of the party on the activity).    
                activityPartyTo.ParticipationTypeMask = { Value: 1 }; // 1 means Sender
                // Create the from ActivityParty
                SDK.JScriptRESTDataOperations.Create(activityPartyTo, "ActivityParty", ActivityPartyToCallBack, function (error) { alert(error.message); });
            //ActivityParty From Callback
            function ActivityPartyFromCallBack(result) {
            //ActivityParty To Callback
            function ActivityPartyToCallBack(result) {
                GetReportId('ABM_Infotech_SalesQuote');
            //Create attachment for the created email
            function CreateEmailAttachment() {
                //get reporting session and use the params to convert a report in PDF
                var params = getReportingSession();
                //Email attachment parameters
                var activitymimeattachment = Object();
                activitymimeattachment.ObjectId = Object();
                activitymimeattachment.ObjectId.LogicalName = "email";
                activitymimeattachment.ObjectId.Id = email.ActivityId;
                activitymimeattachment.ObjectTypeCode = "email",
                    activitymimeattachment.Subject = "File Attachment";
                activitymimeattachment.Body = encodePdf(params);
                activitymimeattachment.FileName = "Report1.pdf";
                activitymimeattachment.MimeType = "application/pdf";
                //Attachment call
                SDK.JScriptRESTDataOperations.Create(activitymimeattachment, "ActivityMimeAttachment", ActivityMimeAttachmentCallBack, function (error) { alert(error.message); });
            //ActivityMimeAttachment CallBack function
            function ActivityMimeAttachmentCallBack(result) {
                var features = "location=no,menubar=no,status=no,toolbar=no,resizable=yes";
                var width = "800px";
                var height = "600px";
                window.open(Xrm.Page.context.getServerUrl() + "main.aspx?etc=" + 4202 + "&pagetype=entityrecord&id=" + email.ActivityId, "_blank", features);
                // To open window which works in outlook and IE both
                //openStdWin(Xrm.Page.context.getServerUrl() + "main.aspx?etc=" + 4202 + "&pagetype=entityrecord&id=" + email.ActivityId, "_blank", width,
    height, features);
            //This method will get the reportId based on a report name that will be used in            getReportingSession() function
            function GetReportId(reportName) {
                var oDataSetName = "ReportSet";
                var columns = "ReportId";
                var filter = "Name eq '" + reportName + "'";
                retrieveMultiple(oDataSetName, columns, filter, onSuccess);
            function retrieveMultiple(odataSetName, select, filter, successCallback) {
                var serverUrl = Xrm.Page.context.getServerUrl();
                var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";
                var odataUri = serverUrl + ODATA_ENDPOINT + "/" + odataSetName + "?";
                if (select) {
                    odataUri += "$select=" + select + "&";
                if (filter) {
                    odataUri += "$filter=" + filter;
                $.ajax({
                    type: "GET",
                    contentType: "application/json; charset=utf-8",
                    datatype: "json",
                    url: odataUri,
                    beforeSend: function (XMLHttpRequest) {
                        XMLHttpRequest.setRequestHeader("Accept", "application/json");
                    success: function (data) {
                        if (successCallback) {
                            if (data && data.d && data.d.results) {
                                successCallback(data.d.results);
                            else if (data && data.d) {
                                successCallback(data.d);
                            else {
                                successCallback(data);
                    error: function (XmlHttpRequest, errorThrown) {
                        if (XmlHttpRequest && XmlHttpRequest.responseText) {
                            alert("Error while retrieval ; Error – " + XmlHttpRequest.responseText);
            function onSuccess(data) {
                reportId = data[0].ReportId.replace('{', ").replace('}', ");
                CreateEmailAttachment(); // Create Email Attachment
            //Gets the report contents
            function getReportingSession() {
                var pth = Xrm.Page.context.getServerUrl() + "/CRMReports/rsviewer/reportviewer.aspx";
                var retrieveEntityReq = new XMLHttpRequest();
                var Id = Xrm.Page.data.entity.getId();
                var quotationGUID = Id.replace('{', ""); //set this to selected quotation GUID
                quotationGUID = quotationGUID.replace('}', "");
                var reportName = "ABM_Infotech_SalesQuote"; //set this to the report you are trying to download
                var reportID = "751089AA-74B8-E211-B52F-D8D3855B253B"; //set this to the guid of the report you are trying to download
                var rptPathString = ""; //set this to the CRMF_Filtered parameter
                var strParameterXML = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'><entity name='quote'><all-attributes /><filter type='and'><condition
    attribute='quoteid' operator='eq' uitype='quote' value='" + quotationGUID + "' /> </filter></entity></fetch>";
                retrieveEntityReq.open("POST", pth, false);
                retrieveEntityReq.setRequestHeader("Accept", "*/*");
                retrieveEntityReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                rptPathString = "id=%7B" + reportID + "%7D&uniquename=" + Xrm.Page.context.getOrgUniqueName() + "&iscustomreport=true&reportnameonsrs=&reportName="
    +
                                reportName + "&isScheduledReport=false&p:ABMFilteredQuote=" + strParameterXML;
                //remove the part starting from &p:salesorderid if your report has no parameters
                retrieveEntityReq.send(rptPathString);
                var x = retrieveEntityReq.responseText.indexOf("ReportSession=");
                var ret = new Array();
                ret[0] = retrieveEntityReq.responseText.substr(x + 14, retrieveEntityReq.responseText.indexOf("&", x) - x - 14); //the session id
                x = retrieveEntityReq.responseText.indexOf("ControlID=");
                ret[1] = retrieveEntityReq.responseText.substr(x + 10, retrieveEntityReq.responseText.indexOf("&", x) - x - 10); //the control id
                return ret;
            var bdy = new Array();
            var bdyLen = 0;
            function concat2Bdy(x) {
                bdy[bdyLen] = x;
                bdyLen++;
            function encodePdf(params) {
                bdy = new Array();
                bdyLen = 0;
                var retrieveEntityReq = new XMLHttpRequest();
                var pth = Xrm.Page.context.getServerUrl() + "/Reserved.ReportViewerWebControl.axd?ReportSession=" + params[0] +
                "&Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1&ControlID=" + params[1] +
                "&OpType=Export&FileName=Public&ContentDisposition=OnlyHtmlInline&Format=PDF";
                retrieveEntityReq.open("GET", pth, false);
                retrieveEntityReq.setRequestHeader("Accept", "*/*");
                retrieveEntityReq.send();
                BinaryToArray(retrieveEntityReq.responseBody);
                return encode64(bdy);
            var StringMaker = function () {
                this.parts = [];
                this.length = 0;
                this.append = function (s) {
                    this.parts.push(s);
                    this.length += s.length;
                this.prepend = function (s) {
                    this.parts.unshift(s);
                    this.length += s.length;
                this.toString = function () {
                    return this.parts.join('');
            var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
            function encode64(input) {
                var output = new StringMaker();
                var chr1, chr2, chr3;
                var enc1, enc2, enc3, enc4;
                var i = 0;
                while (i < input.length) {
                    chr1 = input[i++];
                    chr2 = input[i++];
                    chr3 = input[i++];
                    enc1 = chr1 >> 2;
                    enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
                    enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
                    enc4 = chr3 & 63;
                    if (isNaN(chr2)) {
                        enc3 = enc4 = 64;
                    } else if (isNaN(chr3)) {
                        enc4 = 64;
                    output.append(keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4));
                return output.toString();
        </script>
        <script type="text/vbscript">
        Function BinaryToArray(Binary)
               Dim i
               ReDim byteArray(LenB(Binary))
               For i = 1 To LenB(Binary)
                     byteArray(i-1) = AscB(MidB(Binary, i, 1))
                     concat2Bdy(AscB(MidB(Binary, i, 1)))
             Next
              BinaryToArray = byteArray
       End Function     
        </script>
    </head>
    <body>
        <input type="button" onclick="CreateEmail();" value="Attach Report" />
    </body>
    </html>

  • Problem by  Sending an Email with attached Adobe Interactive Form (Code)

    Thanks. I have written Programm, but it does not work as i want it to do. I will send an Email with attached Adobe Interactive Firm to [email protected]. I tried it with "*lo_recipient = cl_sapuser_bcs=>create( sy-uname )" at the marked(bold, fat) position. It worked but the Email was send to my SAP-Account, but i want to send to [email protected], so I tried this (see at code in bold, fat):
    lo_rec TYPE adr6-smtp_addr VALUE '[email protected]'. " Empfänger Receiver
    lo_recipient = cl_cam_address_bcs=>create_internet_address( lo_rec ).
    But it doens`t send the email.
    Can anybody help me please???
    Kevin
    Here my Code:
    Report FP_EXAMPLE_01
    Printing of documents using PDF based forms
    REPORT z_example_02.
    Data declaration
    DATA: carr_id TYPE sbook-carrid,
    customer TYPE scustom,
    bookings TYPE ty_bookings,
    connections TYPE ty_connections,
    fm_name TYPE rs38l_fnam,
    fp_docparams TYPE sfpdocparams,
    fp_outputparams TYPE sfpoutputparams,
    error_string TYPE string,
    l_booking TYPE sbook,
    t_sums TYPE TABLE OF sbook,
    l_sums LIKE LINE OF t_sums,
    fp_formoutput TYPE fpformoutput.
    PARAMETER: p_custid TYPE scustom-id DEFAULT 38.
    SELECT-OPTIONS: s_carrid FOR carr_id DEFAULT 'AA' TO 'ZZ'.
    PARAMETER: p_form TYPE tdsfname DEFAULT 'FP_EXAMPLE_01'.
    PARAMETER: language TYPE sfpdocparams-langu DEFAULT 'E'.
    PARAMETER: country TYPE sfpdocparams-country DEFAULT 'US'.
    Get data from the following tables: scustom(Flight customer)
    sbook (Single flight reservation)
    spfli (Flight plan)
    SELECT SINGLE * FROM scustom INTO customer WHERE id = p_custid.
    CHECK sy-subrc = 0.
    SELECT * FROM sbook INTO TABLE bookings
    WHERE customid = p_custid
    AND carrid IN s_carrid
    ORDER BY PRIMARY KEY.
    SELECT * FROM spfli INTO TABLE connections
    FOR ALL ENTRIES IN bookings
    WHERE carrid = bookings-carrid
    AND connid = bookings-connid
    ORDER BY PRIMARY KEY.
    Print data:
    First get name of the generated function module
    CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
    EXPORTING
    i_name = p_form
    IMPORTING
    e_funcname = fm_name.
    IF sy-subrc <> 0.
    MESSAGE e001(fp_example).
    ENDIF.
    Set output parameters and open spool job
    fp_outputparams-nodialog = 'X'. " suppress printer dialog popup
    fp_outputparams-getpdf = 'X'. " launch print preview
    CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
    ie_outputparams = fp_outputparams
    EXCEPTIONS
    cancel = 1
    usage_error = 2
    system_error = 3
    internal_error = 4
    OTHERS = 5.
    Set form language and country (->form locale)
    fp_docparams-langu = language.
    fp_docparams-country = country.
    *fp_docparams-fillable = 'X'.
    *fp_docparams-langu = 'E'. "wird jetzt automatisch gesetzt, bzw. kann dynamisch verändert werden
    *fp_docparams-country = 'GB'. "wird jetzt automatisch gesetzt, bzw. kann dynamisch verändert werden
    currency key dependant summing
    LOOP AT bookings INTO l_booking.
    l_sums-forcuram = l_booking-forcuram.
    l_sums-forcurkey = l_booking-forcurkey.
    COLLECT l_sums INTO t_sums.
    ENDLOOP.
    Now call the generated function module
    CALL FUNCTION fm_name
    EXPORTING
    /1bcdwb/docparams = fp_docparams
    customer = customer
    bookings = bookings
    connections = connections
    t_sums = t_sums
    IMPORTING
    /1bcdwb/formoutput = fp_formoutput
    EXCEPTIONS
    usage_error = 1
    system_error = 2
    internal_error = 3
    OTHERS = 4.
    IF sy-subrc <> 0.
    CALL FUNCTION 'FP_GET_LAST_ADS_ERRSTR'
    IMPORTING
    e_adserrstr = error_string.
    IF NOT error_string IS INITIAL.
    we received a detailed error description
    WRITE:/ error_string.
    EXIT.
    ELSE.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDIF.
    Close spool job
    CALL FUNCTION 'FP_JOB_CLOSE'
    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.
    *********************Send the form*******************
    *********************to the Customer*****************
    *********************via Email***********************
    *IF i_down = abap_true.
    DATA: filename TYPE string,
    path TYPE string,
    fullpath TYPE string,
    default_extension TYPE string VALUE 'PDF'.
    Data:
    lt_att_content_hex TYPE solix_tab.
    *DATA: data_tab TYPE TABLE OF x255.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
    EXPORTING
    buffer = fp_formoutput-pdf
    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( ).
    DATA:
    lt_message_body TYPE bcsy_text VALUE IS INITIAL.
    DATA: lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
    APPEND 'Dear Vendor,' 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 = 'Vendor Payment 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 = 'Vendor Payment Form'
    i_att_content_hex = lt_att_content_hex ).
    CATCH cx_document_bcs INTO lx_document_bcs.
    ENDTRY.
    lo_send_request->set_document( lo_document ).
    DATA:
    lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
    lo_send TYPE adr6-smtp_addr VALUE '[email protected]'. "Absender SENDER
    lo_sender = cl_cam_address_bcs=>create_internet_address( lo_send ).
    Set sender
    lo_send_request->set_sender(
    EXPORTING
    i_sender = lo_sender ).
    Create recipient
    DATA:
    lo_recipient type ref to if_recipient_bcs value is initial.
    Data:
    lo_rec TYPE adr6-smtp_addr VALUE '[email protected]'. " Empfänger Receiver
    lo_recipient = cl_cam_address_bcs=>create_internet_address( lo_rec ).
    *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 payment form has been emailed to the Vendor' TYPE 'I'.

    Hi Kevin,
    Please try this code to send your mail, i wrote it and works well in many system.
    Take care if in your profile you got an e-mail adress define .
    Take care also of trnasaction SCOT customizing, are you able to send mail to e-mail adress ?
    Let me know if it's works.
    Best regards.
    <i>**----
    CLASS-DEFINITIONS
    DATA: send_request       TYPE REF TO cl_bcs.
    DATA: document           TYPE REF TO cl_document_bcs.
    DATA: sender             TYPE REF TO cl_sapuser_bcs.
    DATA: recipient          TYPE REF TO if_recipient_bcs.
    INTERNAL TABLES
    DATA: l_mailtext TYPE soli_tab.
    DATA: iaddsmtp   TYPE TABLE OF bapiadsmtp.
    DATA: ireturn    TYPE TABLE OF bapiret2.
    VARIABLES
    DATA: mail_line  LIKE LINE OF l_mailtext.
    DATA: bapiadsmtp         TYPE bapiadsmtp.
    DATA: subject    TYPE so_obj_des.
    DATA : att_subject TYPE so_obj_des.
    DATA : w_except TYPE REF TO cx_root .
    CONSTANTS : c_defmail TYPE ad_smtpadr VALUE
                     '[email protected]' .
    FIELD-SYMBOLS : <smtp> TYPE bapiadsmtp.
    *Convert the pdf given by function module into Binary .
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer     = output-pdf "PDF file from function module
      TABLES
        binary_tab = hexa.
    *Set subject of the mail
    subject = 'Exemple de PDF interactif'.
    Set text of the mail
    mail_line = 'Merci de remplir le formulaire et nous le retourner'.
    APPEND mail_line TO l_mailtext .
    Set the name of the attached document
    att_subject = 'Template du PDF'.
    TRY.
    Create persistent send request
        send_request = cl_bcs=>create_persistent( ).
    Get sender object
        sender = cl_sapuser_bcs=>create( sy-uname ).
    Add sender
        CALL METHOD send_request->set_sender
          EXPORTING
            i_sender = sender.
    Read the E-Mail address for the user
        CALL FUNCTION 'BAPI_USER_GET_DETAIL'
          EXPORTING
            username = sy-uname
          TABLES
            return   = ireturn
            addsmtp  = iaddsmtp.
        LOOP AT iaddsmtp ASSIGNING <smtp> WHERE std_no = 'X'.
          CLEAR bapiadsmtp.
          MOVE <smtp> TO bapiadsmtp.
        ENDLOOP.
        CASE bapiadsmtp-e_mail.
          WHEN space.
    No adress main for user, so send it to the default mail adress
            recipient =
         cl_cam_address_bcs=>create_internet_address( c_defmail ).
          WHEN OTHERS.
            recipient =
         cl_cam_address_bcs=>create_internet_address( bapiadsmtp-e_mail ).
        ENDCASE.
    Add recipient with its respective attributes to send request
        CALL METHOD send_request->add_recipient
          EXPORTING
            i_recipient  = recipient
            i_express    = 'X'
            i_copy       = space
            i_blind_copy = space
            i_no_forward = space.
    Set that you don't need a Return Status E-mail
        CALL METHOD send_request->set_status_attributes
          EXPORTING
            i_requested_status = 'E'
            i_status_mail      = 'E'.
    set send immediately flag
        send_request->set_send_immediately( 'X' ).
    *Build Document
        document = cl_document_bcs=>create_document(
                            i_type    = 'RAW'
                            i_text    = l_mailtext
                            i_subject = subject ).
        add attachment to document
        CALL METHOD document->add_attachment
          EXPORTING
            i_attachment_type    = 'PDF'
            i_attachment_subject = att_subject
            i_att_content_hex    = hexa.
    Add document to send request
        CALL METHOD send_request->set_document( document ).
    Send document
        CALL METHOD send_request->send( ).
        COMMIT WORK.
      CATCH cx_send_req_bcs INTO w_except.
      CATCH cx_address_bcs INTO w_except.
      CATCH cx_document_bcs INTO w_except.
    ENDTRY.</i>

  • Send a mail with the class CL_HTTP_CLIENT

    hi,
    i use this program and i would send a mail with a attachment file PDF. I try to use the function module SO_NEW_DOCUMENT_ATT_SEND_API1 but i dont know to translate the data XSTRING to internal table.
    Thank you.
    *& Report  ZYTEST_TRANSFER_URL2                                        *
    REPORT  zytest_transfer_url2                    .
    *- begin of internal data
    TYPE-POOLS: swfxc, icon.
    DATA: l_http_client TYPE REF TO if_http_client.
    DATA: l_url TYPE string.
    DATA: l_code TYPE sy-subrc.
    DATA: l_code_string TYPE string.
    DATA: l_message_string TYPE string.
    DATA: lt_http_fields TYPE tihttpnvp.
    DATA: l_http_field_wa TYPE ihttpnvp.
    DATA: l_char_header(40) TYPE c.
    DATA: l_body_string TYPE string.
    DATA : line TYPE string.
    DATA: result_tab TYPE TABLE OF string,
    result_str TYPE string.
    *- end of internal data
    DATA: lv_contents TYPE string.
    DATA: lv_location TYPE string.
    *- begin of parameters
    PARAMETERS: url TYPE swc_value.
    PARAMETERS : receiver TYPE somlreci1-receiver LOWER CASE.
    *- end of parameters
    START-OF-SELECTION.
      PERFORM main.
    *& Form main
    text
    FORM main.
    PERFORM get_contents USING lv_contents.
    *- Create the HTTP-Client
      l_url = url.
    l_proxy_host =
    l_proxy_service =
      CALL METHOD cl_http_client=>create_by_url
      EXPORTING
      url = l_url
    proxy_host = l_proxy_host
    proxy_service = l_proxy_service
      IMPORTING
      client = l_http_client
      EXCEPTIONS
      argument_not_found = 1
      plugin_not_active = 2
      internal_error = 3
      OTHERS = 4.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    *- send the http post
      CALL METHOD l_http_client->send
        EXCEPTIONS
          http_communication_failure = 1
          http_invalid_state         = 2.
      IF sy-subrc <> 0.
        WRITE: / icon_red_light AS ICON.
        CALL METHOD l_http_client->get_last_error
          IMPORTING
            code    = l_code
            MESSAGE = l_message_string.
        CALL METHOD l_http_client->close.
        l_code_string = l_code.
        CONCATENATE 'HTTP-Send: RC=' l_code_string              "#EC NOTEXT
        INTO l_code_string .
        CONCATENATE l_code_string l_message_string
        INTO l_message_string SEPARATED BY space.
        PERFORM print_string USING l_message_string.
        EXIT.
      ENDIF.
    *- receive the result of http post
      CALL METHOD l_http_client->receive
        EXCEPTIONS
          http_communication_failure = 1
          http_invalid_state         = 2.
      IF sy-subrc <> 0.
        WRITE: / icon_red_light AS ICON.
        CALL METHOD l_http_client->get_last_error
          IMPORTING
            code    = l_code
            MESSAGE = l_message_string.
        CALL METHOD l_http_client->close.
        l_code_string = l_code.
        CONCATENATE 'HTTP-Receive: RC=' l_code_string           "#EC NOTEXT
        INTO l_code_string .
        CONCATENATE l_code_string l_message_string
        INTO l_message_string SEPARATED BY space.
        PERFORM print_string USING l_message_string.
        EXIT.
      ENDIF.
    *- print the results
      CALL METHOD l_http_client->response->get_status
        IMPORTING
          code = l_code.
      IF l_code < 300.
    HTTP-codes: 100 - 199 = informations
    HTTP-codes: 200 - 299 = client-request successful (200 = OK)
        WRITE: / icon_green_light AS ICON.
      ELSE.
    HTTP-codes: 300 - 399 = redirected; further actions required
    HTTP-codes: 400 - 499 = client-request incomplete
    HTTP-codes: 500 - 599 = server errors
        WRITE: / icon_red_light AS ICON.
      ENDIF.
    *-- get the http header fields
      CALL METHOD l_http_client->response->get_header_fields
        CHANGING
          fields = lt_http_fields.
      LOOP AT lt_http_fields INTO l_http_field_wa.
        l_char_header = l_http_field_wa-name.
        WRITE: / l_char_header.
        l_char_header = l_http_field_wa-value.
        WRITE: l_char_header.
      ENDLOOP.
      WRITE: / sy-uline.
    *- get the body
      DATA: lv_bin_contents TYPE xstring.
      lv_bin_contents = l_http_client->response->get_data( ).
      PERFORM save_file USING lv_bin_contents.
    ENDFORM. "main
    *& Form print_string
    FORM print_string USING p_string TYPE string.
      REFRESH result_tab.
      SPLIT p_string AT cl_abap_char_utilities=>cr_lf INTO TABLE result_tab.
      LOOP AT result_tab INTO result_str.
        WRITE:/ result_str.
      ENDLOOP.
    ENDFORM. " print_string
    *& Form save_file
    text
    FORM save_file USING lv_bin_contents.
      DATA: save_file(1000) TYPE c VALUE '/tmp/test3.pdf'.
      DATA: lv_file TYPE localfile.
      DATA : g_file(80).
      g_file = url.
      DO.
        SHIFT g_file LEFT UP TO '/'.
        IF sy-subrc NE 0.
          EXIT.
        ENDIF.
        SHIFT g_file LEFT.
      ENDDO.
      SHIFT g_file RIGHT UP TO '.'.
      SHIFT g_file RIGHT.
      lv_file = save_file.
      OPEN DATASET lv_file FOR OUTPUT IN BINARY MODE.
      IF sy-subrc NE 0.
        WRITE:'SY-SUBRC :',sy-subrc.
    MESSAGE i000 WITH text-014. "'File Directory not found'.
        EXIT.
      ENDIF.
      TRANSFER lv_bin_contents TO lv_file.
      CLOSE DATASET lv_file.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      IF sy-subrc EQ 0.
    MESSAGE i000 WITH text-012."'Successfully downloaded to Application
    server'.
        EXIT.
      ENDIF.
    ENDFORM. "save_file

    hi,
    i use this program and i would send a mail with a attachment file PDF. I try to use the function module SO_NEW_DOCUMENT_ATT_SEND_API1 but i dont know to translate the data XSTRING to internal table.
    Thank you.
    *& Report  ZYTEST_TRANSFER_URL2                                        *
    REPORT  zytest_transfer_url2                    .
    *- begin of internal data
    TYPE-POOLS: swfxc, icon.
    DATA: l_http_client TYPE REF TO if_http_client.
    DATA: l_url TYPE string.
    DATA: l_code TYPE sy-subrc.
    DATA: l_code_string TYPE string.
    DATA: l_message_string TYPE string.
    DATA: lt_http_fields TYPE tihttpnvp.
    DATA: l_http_field_wa TYPE ihttpnvp.
    DATA: l_char_header(40) TYPE c.
    DATA: l_body_string TYPE string.
    DATA : line TYPE string.
    DATA: result_tab TYPE TABLE OF string,
    result_str TYPE string.
    *- end of internal data
    DATA: lv_contents TYPE string.
    DATA: lv_location TYPE string.
    *- begin of parameters
    PARAMETERS: url TYPE swc_value.
    PARAMETERS : receiver TYPE somlreci1-receiver LOWER CASE.
    *- end of parameters
    START-OF-SELECTION.
      PERFORM main.
    *& Form main
    text
    FORM main.
    PERFORM get_contents USING lv_contents.
    *- Create the HTTP-Client
      l_url = url.
    l_proxy_host =
    l_proxy_service =
      CALL METHOD cl_http_client=>create_by_url
      EXPORTING
      url = l_url
    proxy_host = l_proxy_host
    proxy_service = l_proxy_service
      IMPORTING
      client = l_http_client
      EXCEPTIONS
      argument_not_found = 1
      plugin_not_active = 2
      internal_error = 3
      OTHERS = 4.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    *- send the http post
      CALL METHOD l_http_client->send
        EXCEPTIONS
          http_communication_failure = 1
          http_invalid_state         = 2.
      IF sy-subrc <> 0.
        WRITE: / icon_red_light AS ICON.
        CALL METHOD l_http_client->get_last_error
          IMPORTING
            code    = l_code
            MESSAGE = l_message_string.
        CALL METHOD l_http_client->close.
        l_code_string = l_code.
        CONCATENATE 'HTTP-Send: RC=' l_code_string              "#EC NOTEXT
        INTO l_code_string .
        CONCATENATE l_code_string l_message_string
        INTO l_message_string SEPARATED BY space.
        PERFORM print_string USING l_message_string.
        EXIT.
      ENDIF.
    *- receive the result of http post
      CALL METHOD l_http_client->receive
        EXCEPTIONS
          http_communication_failure = 1
          http_invalid_state         = 2.
      IF sy-subrc <> 0.
        WRITE: / icon_red_light AS ICON.
        CALL METHOD l_http_client->get_last_error
          IMPORTING
            code    = l_code
            MESSAGE = l_message_string.
        CALL METHOD l_http_client->close.
        l_code_string = l_code.
        CONCATENATE 'HTTP-Receive: RC=' l_code_string           "#EC NOTEXT
        INTO l_code_string .
        CONCATENATE l_code_string l_message_string
        INTO l_message_string SEPARATED BY space.
        PERFORM print_string USING l_message_string.
        EXIT.
      ENDIF.
    *- print the results
      CALL METHOD l_http_client->response->get_status
        IMPORTING
          code = l_code.
      IF l_code < 300.
    HTTP-codes: 100 - 199 = informations
    HTTP-codes: 200 - 299 = client-request successful (200 = OK)
        WRITE: / icon_green_light AS ICON.
      ELSE.
    HTTP-codes: 300 - 399 = redirected; further actions required
    HTTP-codes: 400 - 499 = client-request incomplete
    HTTP-codes: 500 - 599 = server errors
        WRITE: / icon_red_light AS ICON.
      ENDIF.
    *-- get the http header fields
      CALL METHOD l_http_client->response->get_header_fields
        CHANGING
          fields = lt_http_fields.
      LOOP AT lt_http_fields INTO l_http_field_wa.
        l_char_header = l_http_field_wa-name.
        WRITE: / l_char_header.
        l_char_header = l_http_field_wa-value.
        WRITE: l_char_header.
      ENDLOOP.
      WRITE: / sy-uline.
    *- get the body
      DATA: lv_bin_contents TYPE xstring.
      lv_bin_contents = l_http_client->response->get_data( ).
      PERFORM save_file USING lv_bin_contents.
    ENDFORM. "main
    *& Form print_string
    FORM print_string USING p_string TYPE string.
      REFRESH result_tab.
      SPLIT p_string AT cl_abap_char_utilities=>cr_lf INTO TABLE result_tab.
      LOOP AT result_tab INTO result_str.
        WRITE:/ result_str.
      ENDLOOP.
    ENDFORM. " print_string
    *& Form save_file
    text
    FORM save_file USING lv_bin_contents.
      DATA: save_file(1000) TYPE c VALUE '/tmp/test3.pdf'.
      DATA: lv_file TYPE localfile.
      DATA : g_file(80).
      g_file = url.
      DO.
        SHIFT g_file LEFT UP TO '/'.
        IF sy-subrc NE 0.
          EXIT.
        ENDIF.
        SHIFT g_file LEFT.
      ENDDO.
      SHIFT g_file RIGHT UP TO '.'.
      SHIFT g_file RIGHT.
      lv_file = save_file.
      OPEN DATASET lv_file FOR OUTPUT IN BINARY MODE.
      IF sy-subrc NE 0.
        WRITE:'SY-SUBRC :',sy-subrc.
    MESSAGE i000 WITH text-014. "'File Directory not found'.
        EXIT.
      ENDIF.
      TRANSFER lv_bin_contents TO lv_file.
      CLOSE DATASET lv_file.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      IF sy-subrc EQ 0.
    MESSAGE i000 WITH text-012."'Successfully downloaded to Application
    server'.
        EXIT.
      ENDIF.
    ENDFORM. "save_file

  • I have a new iPhone 6 plus and all is OK. But the mail shows more than 400 'unread' messages whereas there are none in the mailbox or trash or anywhere else I have looked. I can send and receive with no problem. I'm sure I have no unread messages.

    I have a new iPhone 6 plus and all is OK. But the mail shows more than 400 'unread' messages whereas there are none in the mailbox or trash or anywhere else I have looked. I can send and receive with no problem. I'm sure I have no unread messages.

        jsavage9621,
    It pains me to hear about your experience with the Home Phone Connect.  This device usually works seamlessly and is a great alternative to a landline phone.  It sounds like we've done our fair share of work on your account here.  I'm going to go ahead and send you a Private Message so that we can access your account and review any open tickets for you.  I look forward to speaking with you.
    TrevorC_VZW
    Follow us on Twitter @VZWSupport

  • How can I send a text with a picture attachment on my new iPhone5c?

    How can I send a text with a picture attachment on my new iPhone5c? It won't send or recieve!!.

    Does your carrier support it?
    Follow the steps in this guide.
    http://www.imore.com/how-send-photo-using-imessage

  • Is there a way to send a message with a photo attached using imessages. I am not able to send a photo to one of my contacts because I am sending the contact a message text messages. I don't want to send contacts text messages. I want to send them iMe

    Is there a way to send a message with a photo attached using imessages. I am not able to send a photo to one of my contacts because I am sending the contact a message text messages. I don't want to send contacts text messages. I want to send them iMessages.

    Kolyei, sorry for the late reply.
    Have your brother create a contact in his phone for himself. Inside his own contact, have him add his phone number and his iCloud address.
    Settings > Messages > Send & Receive Have your brother select both his phone number and email addresses where he would like to receive iMessages.

  • Why can I not attach a document to an email? Every time I want to send an email with a document attached to it, an error notice pops out. It tell me that the file is being used even when  it is not. How can I fix this issue?

    Why can I not attach a document to an email? Every time I want to send an email with a document attached to it, an error notice pops out. It tells me that the file is being used even when  iall other programs are closed. How can I fix this issue?

    Thanks Jeff, I was not aware that a template could be multi-page.  (All the existing templates were 1 page)
    But it worked, saving me some steps.  When I was finished I renamed the document, and locked it.
    Then tried to save it but  could not because it was locked.  I closed it, went to my Spread Sheet Folder ,
    to find it, it was not there.  The Finder could not find it either.
    So I start over again.
    I opened up Numbers and it showed my personal Numbers template folder, it contained both my new 
    original 4 page template and the vanished saved document!
    I tried to delete the template containing these document data and could not - I had to go to the Library/Application Support/Numbers to physically remove it from this folder. Then I started over again.  I Finally found out how to make it work: I can now "save as", and then lock, and it will go to place where I want it to be saved and locked.
    The secret is: Click on the document title in the menu bar, and it opens up  "Save as...", which works the same as in OS 10.4.11, and you can pick the place you want for saving.  Once done that, you can then lock the document in the same pull down menu, and then close it.
    I also found later that I can delete a template from its folder, by letting Numbers open the templates,
    clicking on the one I want to remove, then go to the "Numbers Menu/File/Move to...", select "Desktop"
    and from there the selected template can then be thrown into the Trash from there.
    It appears now that the real fault of the Numbers software is that the "Save as" command is not available in the "Edit" or "File" pull-down menus, but hidden behind the title of the document.

  • On my imac, All of a sudden I am unable to send original emails with any attachments.  I can attach the file but when I try to send it, it won't send.  Also, if I am emailing back and forth as it gets longer, it no longer transmits

    On my imax, all of a sudden I am unable to send original emails with attachments of any size.  I can attached the file but when I try to transmit, it will not go.
    Also, if I am emailing back and forth, once there gets to be several threads, it will no longer transmit.  Any suggestions. I am using gmail in the apple mail system

    Mike,
    Are any of your other applications going wonky, or is it just Logic?
    I'm afraid I've never heard of this particular problem before, but if it were happening to me the first thing I would do is delete my "com.apple.logic.express.plist" file in Library>Preferences, then repair permissions in Disc Utility, and finally restart my computer.  Then I would launch Logic and see if the problem has been corrected.  It's amazing how much these two steps can accomplish.
    If that doesn't resolve the issue I would launch Logic and go to Preferences>Audio Units Manager to see if all my plug-ins are properly validated.

Maybe you are looking for

  • Currency in form fields

    I have a report where some of the data contains currency infomation. When the user clicks "Edit", the user is taken to another page where they edit the data. Is there a way within the edit mode where I can display data right aligned and with a curren

  • MBP won't pick up network after being turned off

    Good morning. My new MBP is working great and I love it. The only thing that I having some problems with is getting it to remember my network connection when it is turned off and back on. Here's what I have set up. I have a wireless network in my hom

  • Data files of Nokia Maps

    Hi Nokia Folks I found that two copies of complete map data (0.1.29.100) for Nokia Maps v3.04 got different file sizes in total under the "cities" folder, though the two sets of map data are for the exact same (all) countries listed by Nokia Suite. T

  • What's the background of making Adobe Audition?

    It's a rhetorical question. As I can see, Adobe Audition is a poser software, not for doing things efficiently, but just to pose with Adobe family. This family is too big and no one is a outstanding. Maybe Premiere, but that's another story. I was a

  • Can I download my files from Creative Cloud?

    Hello, An Indesign file was uploaded onto our creative cloud from another computer. I need to access and edit that file. Am I able to download it? Thanks