How do u send the SOAP request to Siebel On Demand from Siebel on premise?

Hi,
I am trying to integrate my on premise Seibel with Siebel on Demand. The session id is generated properly after logging in. A SOAP request is generated as follows
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAPSDK2="urn:/crmondemand/xml/lead" xmlns:SOAPSDK1="urn:crmondemand/ws/lead/10/2004" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Body><SOAPSDK1:LeadWS_LeadQueryPage_Input><PageSize>10</PageSize><StartRowNum>0</StartRowNum><SOAPSDK2:ListOfLead><Lead><AccountExternalSystemId></AccountExternalSystemId><AnnualRevenues></AnnualRevenues><IntegrationId></IntegrationId><JobTitle></JobTitle><LastUpdated>LIKE '*'</LastUpdated><LeadEmail></LeadEmail><LeadFirstName></LeadFirstName><LeadId></LeadId><LeadLastName></LeadLastName><NumberEmployees></NumberEmployees></Lead></SOAPSDK2:ListOfLead></SOAPSDK1:LeadWS_LeadQueryPage_Input></SOAP-ENV:Body></SOAP-ENV:Envelope>
However when i try to send this SOAP request using HTTP transport i get the gollowing error
Error invoking service 'abc', method 'Service' at step 'EAI HTTP'.(SBL-BPR-00162)
HTTP Request error during 'Submitting Data SendHTTP request': 'Status code - 400'(SBL-EAI-04117)
Edited by: user10259353 on Nov 4, 2008 3:28 AM

Check for the pod value in the URL eg:https://secure-ausomxxxx.crmondemand.com/Services/Integration
This value changes depending on the pod value assigned to you

Similar Messages

  • Sending the SOAP request back in the SOAP response

    Hi,
    I have a requirement in which I need to update a database from the information I receive in a SOAP request. Now my database will respond back with the number of records that are updated. Now I need to send back a SOAP response which should have the details that I received in the SOAP request.
    Can anyone help me on how to send the SOAP request details back in the SOAP response again? I don't want to use a BPM to do this. Also I know that I can use a select statement to get the records that are updated in my response mapping program. Any options other than these?
    - Ram

    Hi Stish,
      I do have exactly the same need, just with the difference that I'm sendind data from JDBC as sender and RFC as receiver, the RFC receive an ID fot example and return some data as a response and I want to update the DB with that response but I dont know how to merge the ID from the request and the data from the response in order to send it back and update the DB. I'm willing to do it with BPM but I don't know how to keep the request and the response and then merge them into the new message that will be sent to the JDBC, can you give me some specific steps?
    Thanks in advance.
    Gustavo Balboa.

  • Invalid Response Code: (401) Unauthorized sending the SOAP request to XI

    Hi all,
    I am getting following error when i try to send the SOAP request to XI.
    Can any one please tell me what could be the problem.
    Kind Regards,
    Kiran

    Hi,
    Check out the user permission and role.
    I think this link help you the most
    /people/krishna.moorthyp/blog/2006/07/23/http-errors-in-xi
    Check these links :
    http://www.w3.org/2000/xp/Group/1/10/11/soap12-part2.xml
    http://help.sap.com/saphelp_nw04/helpdata/en/bf/27fd3b651f6a1ce10000000a11402f/content.htm
    Testing XI SOAP scenario via XMLSpy
    Re: SOAP Sender ADAPTER 401 No Authorisation
    Re: XI Web Service - Code: (401) Unauthorized.
    Try soap client https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9b16d790-0201-0010-4e9b-baa5f42830d8
    Regards
    Aashish Sinha
    PS : reward points if helpful

  • How to get the soap request for the particular operations in CRM

    Hi friends,
    We got the wsdl files of different modules from the crm(Oracle CRM on demand). We converted the wsdl files to java classes using axis1.4 wsdl2java tool.Now all create,update,download,lookup operations are implemented in java using the generated classes and they are working properly with the client stub.Now the problem is how can we get the soap request and response of particular operations that we submitted to CRM .The request and response should get by using java code.We are looking no tool for the soap request/response. We are working in Eclipse IDE.
    thanks in advance...

    Refer the link. It might tellsa about attaching to transport request but using the way you can find also -
    Re: How To Transport STANDARD TEXTS??
    Regards,
    Amit
    Reward all helpful replies

  • XML Spy Error while testing the SOAP request

    Hi,
    I have generated a webservice from an XI scenario, I am trying to test the webservice through XML Spy.
    I am getting the following error when I am sending the SOAP request.
    Where do we specify the authentication information (user/pwd) in XML Spy.
    It is not even poping any screen to enter username and password.
    <b><i>HTTP Error: Could not post the file.</i></b>
    http://banglore:50100/XISOAPAdapter/MessageServlet?Version=3.0&Channel=:New_BP:New_BPFileSender&version=3.0&Sender.Service=New_BP&Interface=http%3A%2F%2Fgemsconsult.com%2Ffile2rfc%5EZBP_OUTPUT
    Appreciate your quick response
    Srini

    Hi,
    Try using SOAP client
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9b16d790-0201-0010-4e9b-baa5f42830d8
    Thanks,
    Prakash

  • How can I send an XML request to the server using servlets

    How can I send an XML request to the server using servlets

    http://forum.java.sun.com/thread.jspa?threadID=5158333
    http://forum.java.sun.com/thread.jspa?threadID=5158705
    Crossposting is lame.

  • Reg: Sending a Soap Request

    Hi,
    I am doing a Soap to RFC Scenario. I created a webservice in WebDynPro using NWDS and deployed that in local machine. I would like to send a soap request. How can I send it, if I have only NWDS??

    Hi,
    >>> I created a webservice in WebDynPro using NWDS and deployed that in local machine
    There are 2 ways while dealing with a webservice (same with any other adapters)
    a. Webservice at the sender side.
    b. Calling (invoking) the serivce of an existing webservice.
    If you want to create a scenario as in option <b>a</b>
    In this case, the sender is not actually a webservice, rather it is a client (webservice client) that invokes the webservice. The actual webservice in this case is your XI server. But again XI server is not a webservice. All XI does is understands the webservice client request and converts it to a XI message and does the operation.
    If you wish to do such a scenario, there are guides available in SDN, (How to expose your outbund interface as webservice, How to Soap Adapters). Follow them.
    Best Regards,
    Jai Shankar

  • Sending a SOAP request with binary attachment

    hi all,
    I am sending a SOAP request from a SOAP client SOAP UI  with a binary attachment ( image file as an attachment )  and creating a file on the receiver side with attachment.
    But how do i see this attachment in XI and do i have to specify some additional configuration in my receiver or sender adapter modules.
    Regards ,
    Loveena.

    creating a file on the receiver side with attachment.
    Is this working? Receiver file adapter does not support attachment.
    But how do i see this attachment in XI
    In the pipeline steps, under payload, you will find two entries, one for payload and other for attachment.
    Regards,
    Prateek

  • Error while sending a soap request from XML SPY to a webservice in XI

    Hi ,
    I published a webservice om the XI end and testing it with consuming the WSDL file in XML SPY and sending a soap request from there.
    I am getting the following error .
    <b>com.sap.aii.af.mp.module.ModuleException: either no channelID specified or no channel found for the specified party, service, and channel name</b>, MessageServlet(Version $Id: //tc/xi/645_VAL_REL/src/_adapters/_soap/java/com/sap/aii/af/mp/soap/web/MessageServlet.java#4 $)
         at com.sap.aii.af.mp.soap.web.MessageServlet.doPost(MessageServlet.java:380)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Is this error due to the user authentication or due to some other issue .
    Please do let me know soon .
    Thanks a lot
    Nikhil

    Hi Ricardo ,
    I have the correct port now.
    the url looks like
    http://<host>:50000/XISOAPAdapter/MessageServlet?channel=:SIEBEL_DEV:SOAP_CUST
    when I am testing it in the XML spy. and send a soap server request. I am getting the popup for user authentication . once i put my user id it gives me a error saying
    <b>HTTP operation 'POST' could not be performed on URL
    '/XISOAPAdapter/MessageServlet?channel=:SIEBEL_DEV:SOAP_CUST&amp;version=3.0&amp;Sender.Service=SIEBEL_DEV&amp;Interface=http%3A%2F%2FOFCOM%2FUNIFY%2FCustomerMaster%5EMI_CUST'  due to an error :
    The connection to the server was terminated abnormally</b>
    Any Idea as to why is such a error is coming
    Thanks for the help
    Nikhil

  • Unable to open PWA in browser and MSP on application server in project server 2007. ERROR: Sending the Soap message failed or no recognizable response was received.

    Hi All,
    I am using project server 2007 and WSS 3.0. 
    I have been facing a strange issue for couple of days. I am unable to open PWA in browser and MS Project Pro on application server.
    Everything is correct whether it is URL or MS Project profile account on MSP.  This is strange because i can open same PWA/MSP from other computers (Database server / Client PCs) but not locally on server.
    When i try to connect to MSP on App server, i get the following errors in event viewer.
    Event Type: Error
    Event Source: MSSOAP
    Event ID: 16
    User: N/A
    Computer: APP-Server-Name
    Description:
    Soap error: Connection time out..
    Event Type: Error
    Event Source: MSSOAP
    Event Category: Client 
    Event ID: 16
    User: N/A
    Computer: APP-Server-Name
    Description:
    Soap error: An unanticipated error occurred during the processing of this request..
    Event Type: Error
    Event Source: MSSOAP
    Event Category: Client 
    Event ID: 16
    User: N/A
    Computer: APP-Server-Name
    Description: Soap error: Sending the Soap message failed or no recognizable response was received.
    Event Type: Error
    Event Source: MSSOAP
    Event Category: Client 
    Event ID: 16
    User: N/A
    Computer: APP-Server-Name
    Description:
    Soap error: Unspecified client error..
    One more issue i am facing and i guess that is related to above issue. The Issue is, when i am creating a new project, It's workspace gets created but doesn't get linked to the project and i can't link it manually because it already exists for the project.
    sandeep

    Hi Paul ,
    Thanks for reply. The project server URL was already added to the Trusted
    Sites/Local Intranet areas in IE. 
    sandeep

  • ERROR while building the SOAP Request in OAM

    Hi all,
    In a brief step what my requirement is.
    Need to build an SOAP request using java objects generated from XSD files comes with installation directory by setting all the required values.
    What i have done?
    ---- To generate Java objects from given XSD files i am using Castor tool.
    ---- Coming to my requirement i have to create a user through create workflow for this i created objects for workflowSaveCreateProfile.xsd using castor framework and i am trying to marshal (building the SOAP Request). but it's giving me an error telling that required field is needed as below.
    Caused by: ValidationException: The following exception occured while validating field: _attributeName of class: com.trewport.oblix.ObTicketAttr: The following exception
    occured while validating field: obDisplay of class: com.trewport.oblix.AttributeName: The field 'obDisplayChoice' is a required field of class 'com.trewport.oblix.ObDis
    play;
    - location of error: XPATH: /ObTicketAttr
    The following exception occured while validating field: obDisplay of class: com.trewport.oblix.AttributeName: The field 'obDisplayChoice' is a required field of class '
    com.trewport.oblix.ObDisplay
    at org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:278)
    at org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescriptorImpl.java:1065)
    at org.exolab.castor.xml.Validator.validate(Validator.java:135)
    at org.exolab.castor.xml.FieldValidator.validateInstance(FieldValidator.java:326)
    at org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:271)
    ... 19 more
    I am not getting how to set the values in that generated java objects.
    Please help me out.
    Note: For compiling and running the java objects i have to use java 1.4.
    Please let me know your thoughts.
    Thanks & Regards,
    Siva Pokuri.

    This error occurs due to the following customisaton, Please
    check this :
    Please can you check if the Pernr used
    has correct information like It0105 etc, also the rules are
    correctly defined.
    Webmo feature is activated or no?
    For the Employee, First of all check the Period Work Schedule also
    the Quotas of the pernr needs to maintained in 2006, Please do
    this customisation and it should solve the issue.
    Maintain the absence quota in the IT2006 and then try once.
    Also make sure that the Settings in Webmo and PTARQ etc all is done
    The pernr belongs to the a Rule and have absences defined for him.

  • Error while sending the SOAP

    Hi All,
    We recently had SP upgrades fro sp09 to SP 17.
    From then we are getting an error as below when tring to send the soap message and the SOAP adapter went to inactive state .Several restarts dint help.
    Source: SAPIntegrationAdapter
    Message: <?xml version='1.0'?>
    <!-- see the documentation -->
    <SOAP:Envelope xmlns:SOAP='http://schemas.xmlsoap.org/soap/envelope/'>
      <SOAP:Body>
        <SOAP:Fault>
          <faultcode>SOAP:Server</faultcode>
          <faultstring>Server Error</faultstring>
          <detail>
            <s:SystemError xmlns:s='http://sap.com/xi/WebService/xi2.0'>
              <context>XIAdapter</context>
              <code>ADAPTER.JAVA_EXCEPTION</code>
              <text><![CDATA[
    com.sap.aii.af.mp.module.ModuleException: either no channelID specified or no channel found for the specified party, service, and channel name, MessageServlet(Version $Id: //tc/xi/NW04S_17_REL/src/_adapters/_soap/java/com/sap/aii/af/mp/soap/web/MessageServlet.java#2 $)
                    at com.sap.aii.af.mp.soap.web.MessageServlet.doPost(MessageServlet.java:421)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
                    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
                    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
                    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
                    at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
                    at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
                    at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
                    at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
                    at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
                    at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
                    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
                    at java.security.AccessController.doPrivileged(Native Method)
                    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102)
                    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
              ]]></text>
            </s:SystemError>
          </detail>
        </SOAP:Fault>
      </SOAP:Body>
    </SOAP:Envelope>
    any clues would be helpful.
    Thanks,
    Srinivasa

    1. it clearly states that it is not able to find the sender channel name..
       what i would suggest is create the WSDL again and send it to the sender system..
    2. also acivate the SOAP adapter and start and stop the SOAP adapter.
    Also if this doesnot help you can restart your java enjine

  • How to create a standard SOAP request message from a given WSDL file?

    Hello,
    If I have a WSDL file (either from a .net web service or from the famous Amazon web services), what is the best way to generate a SOAP compliant request message?
    I am having trouble understanding the role of WSDL file in a given web service.
    Question 1:
    If I have a web service that is implemented using jaxm, how do I create/publish a WSDL file that describes the web service?
    Assuming I can generate a wsdl file, can I recreate the SOAP request message from the WSDL file automatically (that matches the original request, which is hand build by me?)
    Question 2:
    If I have a web service that is implemented using JAX-RPC, based on the WSDL file, can I simply generate a valid SOAP message (by some JAVA api) and get the response message directly?
    thanks...

    I have the same question ("Assuming I can generate a wsdl file, can I recreate the SOAP request message from the WSDL file automatically (that matches the original request, which is hand build by me?)")
    Have you already found an answer to this?

  • Flex sending corrupt SOAP request

    I've created a PHP5 SOAP webservice and am trying to call a
    method from flex. I get a fault from the Flex app that says
    faultString="HTTP request error"
    faultCode="Server.Error.Request"
    The SOAP request received by the server is as follows (which
    I think explains why the server responded with an error):
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="
    http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="
    http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="
    http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Body/>
    </SOAP-ENV:Envelope>
    It is missing all the body parameters. What could cause an
    empty request like this?
    The relevant AS:
    public var _webServiceLoaded:Boolean = false; // flag noting
    when wsdl has been loaded
    public var _myService:WebService = new WebService();
    public function initWS():void {
    _myService.wsdl = "
    http://foreignserver.com/seminar_service.wsdl";
    _myService.loadWSDL();
    _myService.echoArgs.addEventListener("result",
    echoResultHandler);
    _myService.addEventListener("fault", faultHandler);
    _myService.addEventListener('load',WSLoad);
    public function send_attendee_email():void {
    _myService.echoo("qwerty"); // should just return the same
    string we send; echoo spelled with extra o
    And my wsdl:
    <?xml version="1.0"?>
    <definitions
    xmlns="
    http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="
    http://www.w3.org/2001/XMLSchema"
    xmlns:tns="
    http://foreignserver.com/seminar_service.php"
    xmlns:soap="
    http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:wsdl="
    http://schemas.xmlsoap.org/wsdl/"
    xmlns:soapenc="
    http://schemas.xmlsoap.org/soap/encoding/"
    targetNamespace="
    http://foreignserver.com/seminar_service.php">
    <message name="echooInput">
    <part name="echo" type="xsd:string"/>
    </message>
    <message name="send_attendee_emailInput">
    <part name="sem_date" type="xsd:string"/>
    <part name="sem_first" type="xsd:string"/>
    <part name="sem_last" type="xsd:string"/>
    <part name="sem_title" type="xsd:string"/>
    <part name="sem_company" type="xsd:string"/>
    <part name="sem_phone" type="xsd:string"/>
    <part name="sem_email" type="xsd:string"/>
    <part name="pdf_filename" type="xsd:string"/>
    </message>
    <message name="echooOutput">
    <part name="return" type="xsd:string"/>
    </message>
    <message name="send_attendee_emailOutput">
    <part name="return" type="xsd:string"/>
    </message>
    <portType name="seminarPortType">
    <operation name="echoo">
    <input message="tns:echooInput"/>
    <output message="tns:echooOutput"/>
    </operation>
    <operation name="send_attendee_email">
    <input message="tns:send_attendee_emailInput"/>
    <output message="tns:send_attendee_emailOutput"/>
    </operation>
    </portType>
    <binding name="seminarBinding"
    type="tns:seminarPortType">
    <soap:binding xmlns="
    http://schemas.xmlsoap.org/wsdl/soap/"
    style="rpc" transport="
    http://schemas.xmlsoap.org/soap/http"/>
    <operation xmlns:default="
    http://schemas.xmlsoap.org/wsdl/soap/"
    name="echoo">
    <input xmlns:default="
    http://schemas.xmlsoap.org/wsdl/soap/">
    <soap:body xmlns="
    http://schemas.xmlsoap.org/wsdl/soap/"
    use="encoded" encodingStyle="
    http://schemas.xmlsoap.org/soap/encoding/"/>
    </input>
    <output xmlns:default="
    http://schemas.xmlsoap.org/wsdl/soap/">
    <soap:body xmlns="
    http://schemas.xmlsoap.org/wsdl/soap/"
    use="encoded" encodingStyle="
    http://schemas.xmlsoap.org/soap/encoding/"/>
    </output>
    </operation>
    <operation xmlns:default="
    http://schemas.xmlsoap.org/wsdl/soap/"
    name="send_attendee_email">
    <input xmlns:default="
    http://schemas.xmlsoap.org/wsdl/soap/">
    <soap:body xmlns="
    http://schemas.xmlsoap.org/wsdl/soap/"
    use="encoded" encodingStyle="
    http://schemas.xmlsoap.org/soap/encoding/"/>
    </input>
    <output xmlns:default="
    http://schemas.xmlsoap.org/wsdl/soap/">
    <soap:body xmlns="
    http://schemas.xmlsoap.org/wsdl/soap/"
    use="encoded" encodingStyle="
    http://schemas.xmlsoap.org/soap/encoding/"/>
    </output>
    </operation>
    </binding>
    <service name="seminarService">
    <port xmlns:default="
    http://schemas.xmlsoap.org/wsdl/soap/"
    name="seminarPort" binding="tns:seminarBinding">
    <soap:address xmlns="
    http://schemas.xmlsoap.org/wsdl/soap/"
    location="
    http://foreignserver.com/seminar_service.php"/>
    </port>
    </service>
    </definitions>

    This behavior (empty SOAP request sent to server) stemmed
    somehow from my wsdl file. I'm uncertain what the specific problem
    was, but when I rebuilt the wsdl from scratch using a different
    model, the SOAP request from Flex was properly formed.

  • How can we send the smartform output to mail.

    Dear Friends,
    My query is how can we send the smart form output to mail.
    In my company,payslip are given to the employee in printed format.instead of that we need to send payslip in mail.how can i do..plz help me.
    [email protected]

    The code below demonstrates how to retrieve a spool request and email it as a PDF document. Please note to process a spool request the program can be executed in background or foreground. Because of the additional functionality to allow this to work in both background and foreground it has made it a little more confusing soyou might want to start by looking at the background only program. Also see transaction SCOT for SAPConnect administration.
    *& Report  ZSPOOLTOPDF2                                                *
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& This program can be run in background or online and a spool request *
    *& will still be created                                               *
    REPORT  zspooltopdf2.
    PARAMETER: p_email1 LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_sender LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_delspl  AS CHECKBOX,
               p_online no-display.
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i,
           w_spool_nr like sy-spono.
          %_print LIKE pri_params.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Write statement to represent report output. Spool request is created
    if write statement is executed in background. This could also be an
    ALV grid which would be converted to PDF without any extra effort
      WRITE 'Hello World'.
      new-page.
      commit work.
      new-page print off.
      If p_online = 'X'.
      Processing performed when program calls itself when run online
        gd_spool_nr = sy-spono.
        EXPORT gd_spool_nr TO MEMORY ID 'SPOOLTOPDF'.
        EXIT.
      endif.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
      ELSE.
        gd_spool_nr = sy-spono.
    If executed online, it submits a program to perform the write statements
    instructing it to create a spool request, this could be another program
    which just performs the write statements and then exports sy-spono
    to memory. But in this example it calls itself passing X to parameter
    p_online, which takes it down an alternative procesing path.
        submit ZSPOOLTOPDF2
               with p_online = 'X'
               to sap-spool
               spool parameters   %_print
              archive parameters %_print
               without spool dynpro
               and return.
      ENDIF.
    Get spool id from program called above
      IMPORT gd_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
      PERFORM convert_spool_to_pdf.
      PERFORM process_email.
      if p_delspl EQ 'X'.
        PERFORM delete_spool.
      endif.
      IF sy-sysid = c_dev.
        wait up to 5 seconds.
        SUBMIT rsconn01 WITH mode   = 'INT'
                        WITH output = 'X'
                        AND RETURN.
      ENDIF.
          FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
          FORM get_job_details                                          *
    FORM get_job_details.
    Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
          FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
          FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    perform send_email using p_email2.
    ENDFORM.
          FORM send_email                                               *
    -->  p_email                                                       *
    FORM send_email USING p_email.
      CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
          FORM delete_spool                                             *
    FORM delete_spool.
      DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
      ld_spool_nr = gd_spool_nr.
      CHECK p_delspl <> c_no.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                spoolid = ld_spool_nr.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    Regards,
    Shakti Barath

Maybe you are looking for

  • Anomalous conversion chart IGS from GIF to BMP

    I created a graph using the class CL_IGS_CHART and I converted the format to GIF to BMP through the class CL_IGS_IMAGE_CONVERTER: the operation is successful but the background color is turned into purple I think because it is seen as a transparent c

  • Displaying a text item (6 digit number) as a barcode

    Hi. I'm interested if there is a was to display a 6-digit number on my form as a simple barcode in Forms6i? I want to query this 6 digit number to the form canvas and display it to the user as a barcode. Or perhaps it might be possible to pass the 6

  • Java.lang.ClassCastException:java.lang.Double

    I am trying to troubleshoot this error but I am not sure what to look for, where to find it, and what to change it to. Error: 500 Location:/jserv/Purchase/Frame6_CreditCardPayment_Step3.jsp Internal Servlet Error: javax.servlet.ServletException: java

  • L_TO_CREATE_TR Usage

    Hello experts, We are using the function module L_TO_CREATE_TR in a SAP R/3 4.6C. Then we fill the field T_LTAP_VB-NLENR with a destination SU, but the system genaretes a new internal SU in the TO. We have external and internal range number for SU, b

  • XML and Flash Data Retrieval

    I am new to flash's dynamic data uses - I have a 100 responses to 23 question form which I wish to display using flash in a presentation - I wish to sort the info only by either individuals forms or question/answers. Once created i do not need to ame