GET_BUSINESS_SYSTEM_ERROR   :-  (LD_ERROR)

HI All,
when i am trying fetching the data from legacy system in EPR i am getting this error .... GET_BUSINESS_SYSTEM_ERROR An error occurred when determining the business system (LD_ERROR)
middleware is PI 7.1 & ERP 6.0....
SLDCHECK is also working fine.
Thanks in advance.
Regards,
Dilip

Hello,
You could try the following check for this issue
- ensure that the PIAPPLUSER/ XIAPPLUSER is not locked and has the role SAP_XI_APPL_SERV_USER
- ensure that the correct configuration is in place to connect the Business System to PI, this is described in chapter 8 of the Configuration Guide:
  http://service.sap.com/nw04installation
  -> SAP XI
Regards,
Sarah

Similar Messages

  • ABAP Proxy error :  GET_BUSINESS_SYSTEM_ERROR

    Hi All,
    I am working on Proxy to File Scenario. In this, while executing a proxy program in Sender system I get the following error:
    - <CX_AI_SYSTEM_FAULT>
      <CODECONTEXT>Local</CODECONTEXT>
      <CODE>GET_BUSINESS_SYSTEM_ERROR</CODE>
      <ERRORTEXT>An error occurred when determining the business system (LD_ERROR)</ERRORTEXT>
      <LANGUAGE />
      </CX_AI_SYSTEM_FAULT>
      </cls:CX_AI_SYSTEM_FAULT>
    Can anybody please guide me on this.
    Thanks,
    Chandravadan

    Hi Sudharshan,
    <i>>>> First check the RFC Destination SAPSLDAPI in ur application system and check if SLD of XI is running fine.</i>.
    This RFC Destination in Application System is working & SLD of XI is running fine.
    <i>>>>Have u pointed to the SLD of XI in transaction SLDAPICUST of application system. It should point to XI SLD. Make sure that u give the host,port,user,password(XI's) correctly there.</i>
    It is pointing to SLD of XI & the user I am using is XIAPPLUSER.
    <i>>>>Check whether u are executing the proxy in the right client, which is configured as Business system in SLD of XI.</i>
    Yes, I am executing proxy in right client which I have defined in SLD as Business Syetem. I am using ECC 5.0 as Sender system. 
    <i>>>>Also in SXMB_ADM of the application system, check if u have maintained a HTTP Destination to XI and it tests fine.</i>
    Yes, I have maintained HTTP destination in Application system & it is also working fine.
    Thanks,
    Chandravadan

  • BW Error:  GET_BUSINESS_SYSTEM_ERROR

    Hello,
    I am getting the following error
    BW Error 1:  GET_BUSINESS_SYSTEM_ERROR:  An error occured when determining the business sytem NO_BUSINESS_SYSTEM
    BW Error 2: No data returned by XI
    I am getting no errors in sxmb_moni & while doing message monitoring
    The scenario is BW-XI-XMII- (custom database)
    BW is generating ABAP proxy on the outbound interface in XI. The scenario was working perfectly fine in DEV environment. Now when we have moved to QA. The scenario works fine for the XI-XMII-(custom database scenario). BW is getting the above listed errors.
    We ran the transaction sldcheck in BW and it was successful. The basis team had configured business systems in sld when we started the develpment. What could be the reason for the errors.
    Thanks.
    Kiran

    Hi Agasthuri,
    Thanks for your reply!!!
    How can I check whether the Business System points out the DEV one it has to point out the Quality business System ?
    Where can it be checked at the XI end or BW end!!
    We have created 3 business systems
    BWD BWT & BWP for dev, QA and prod environment.
    In QA I created the WSDL using the BWT business system and it is working fine for XI-XMII-custom database part when I test it with data!!
    Truly appreciate your help!!!
    Thanks.
    Kiran

  • GET_BUSINESS_SYSTEM_ERROR for Client Proxy (Without XI)

    I created a client proxy for a web service developed by our Microsoft team.  When I use the proxy, I get a system exception with the following text: 'GET_BUSINESS_SYSTEM_ERROR An error occurred when determining the business system (SLD_API_EXCEPTION)'.  All of the SDN posts or blogs I have read on this error refer to SLD issues within XI-enabled environments; however, I don't have XI installed.  I can successfully call web services provided by other sources, such as www.webserviceX.net.  Any ideas on what the issue could be?  Does some component of SLD still need to be maintained for the local environment?
    Thanks.

    Hi Brad,
    You would not believe it.
    I had the same issue and came to this link, and thanks to your comment I realized that I had not created the Logical Port!
    I love SDN for this!
    Issue resolved and all working now.
    For all others, creation of the Logical port was done through SOAMANAGER (t-code).
    Regards,
    Nelson

  • GET_BUSINESS_SYSTEM_ERROR  , when Test the OB interface from R3  for proxy?

    Hi friends ,
                      In my scenario ABAP Proxy to file. First i have activated the proxy . While i was  trying to <b>Test Interface (F8)</b>  BUTTON .    It is showing the Following Message
               <b> 1. My sm59 's TCP/IP Connection test for LCRSAPRFC is ok
                 2. Test for SAPSLDAPI  connection test is ok</b>
    Message
    <?xml version="1.0" encoding="utf-8" ?>
    - <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    - <asx:values>
      <SYSTEMFAULT href="#o54" />
      </asx:values>
    - <asx:heap xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:abap="http://www.sap.com/abapxml/types/built-in" xmlns:cls="http://www.sap.com/abapxml/classes/global" xmlns:dic="http://www.sap.com/abapxml/types/dictionary">
    - <cls:CX_AI_SYSTEM_FAULT id="o54">
    - <CX_ROOT>
      <TEXTID>F63AFF63DBE4BB4786A7F52CC4167145</TEXTID>
      <PREVIOUS href="#o43" />
      <KERNEL_ERRID />
    - <INTERNAL_SOURCE_POS>
      <PROGID>190</PROGID>
      <CONTID>564</CONTID>
      </INTERNAL_SOURCE_POS>
      </CX_ROOT>
      <CX_STATIC_CHECK />
    - <CX_AI_SYSTEM_FAULT>
      <CODECONTEXT>Local</CODECONTEXT>
      <CODE>GET_BUSINESS_SYSTEM_ERROR</CODE>
      <ERRORTEXT>An error occurred when determining the business system (NO_BUSINESS_SYSTEM)</ERRORTEXT>
      <LANGUAGE />
      </CX_AI_SYSTEM_FAULT>
      </cls:CX_AI_SYSTEM_FAULT>
    - <cls:CX_XMS_SYSERR_PROXY id="o43">
    - <CX_ROOT>
      <TEXTID>A618D069BDF2D7458C8D9FB22F2735F4</TEXTID>
      <PREVIOUS />
      <KERNEL_ERRID />
    - <INTERNAL_SOURCE_POS>
      <PROGID>190</PROGID>
      <CONTID>726</CONTID>
      </INTERNAL_SOURCE_POS>
      </CX_ROOT>
      <CX_STATIC_CHECK />
    - <CX_XMS_SYSTEM_ERROR>
      <ID><b>GET_BUSINESS_SYSTEM_ERROR</b></ID>
      <P1>NO_BUSINESS_SYSTEM</P1>
      <P2 />
      <P3 />
      <P4 />      
      <INFO />
      <CATEGORY>XIProxy</CATEGORY>
      <AREA>ABAP</AREA>
      <RETRY>M</RETRY>
      </CX_XMS_SYSTEM_ERROR>
    - <CX_XMS_SYSERR_PROXY>
      <CO_AREA_ABAP>ABAP</CO_AREA_ABAP>
      </CX_XMS_SYSERR_PROXY>
      </cls:CX_XMS_SYSERR_PROXY>
      </asx:heap>
      </asx:abap>
    I have created the <b>HTTP Connection  Tyep H</b>   , But in <b>Response body</b> type it is showing the follwing<b>messasge</b>
    - <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
      <SOAP:Header />
    - <SOAP:Body>
    - <SOAP:Fault xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
      <faultcode>SOAP:Client</faultcode>
      <faultstring>Empty HTTP request received</faultstring>
      <faultactor>http://sap.com/xi/XI/Message/30</faultactor>
    - <detail>
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIProtocol</SAP:Category>
      <SAP:Code area="MESSAGE">EMPTY_HTTP_REQUEST_RECEIVED</SAP:Code>
      <SAP:P1 />
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>Empty HTTP query received; message processing not possible</SAP:Stack>
      </SAP:Error>
      </detail>
      </SOAP:Fault>
      </SOAP:Body>
      </SOAP:Envelope>
                              Can u please suggest me to solve this issue
    Regards.,
    V.Rangarajan

    Hi sabrish ,
                          Thanks for ur reply.   I am trying small  Abap proxy to file scenario only. I have referred the Ravi's blog.
    In sm59
        1.  for     <b>LCRSAPRFC   </b> technical setting gateway given as
                             host  xidev  and  gawtaway as sapgw12 like that
                   Connectrion succesful
       2.  for    SAPSLDAPI  also same as
                               technical setting gateway given as
                             host  xidev  and  gawtaway as sapgw12 like that
                                 Connectrion succesful
                    I have activated the   proxy But just trying to click the Test Interface button. it has shown that messsage
       Do i need to make any changes , like connection as R3Dev  system's host ?
    Regards.,
    V.Rangarajan
    Message was edited by:
            ranga rajan

  • SLD Communication: LD_ERROR and RWB not connected to SLD

    Hi all,
    I have installed SR2 on MS SQL Server 2005
    I have run the template installer and also rectified the errored out steps
    All RFC destnation are created propely and thr connection checked
    I have three queries
    1) In SLDCHECK the error i get is
             Calling function LCR_LIST_BUSINESS_SYSTEMS
              Retrieving data from the SLD server...
              Function call returned exception code     4
              => Check whether the SLD is running!
    2)In SXI_CHACHE cache is obsolete and there is LD_ERROR
    3)In RWB the component monitoring and other stuff when i try to open give and error
           Communication from SLD failed:500 Internal server Error
    I went throught note 764176
    and did the following
    1. In the SLD editing interface, choose "Administration" -> "Content Maintenance". Select "XI Integration Server" from the drop-down menu, and navigate to the associations of the integration server. Select the "XI Integration Server Logical Identity" association and delete the association by choosing 'Remove'.
    2. Switch to "Home" in the "Technical Landscape" view, and select the "Exchange Infrastructure" technical system type there. Select all domains and XI components for the host and delete these by selecting them and pressing 'Remove'.
    3. Restart the J2EE server. After you restart the server, the XI components log on to the SLD again and create a new entity of class "XI Integration Server".
    But after restart none were registered .. i also tried logging into Rep and Dir but these were not registered
    in "Technical Landscape" ->"Exchange Infrastructure"
    Rgds
    aditya

    I have three queries
    1) In SLDCHECK the error i get is
    Calling function LCR_LIST_BUSINESS_SYSTEMS
    Retrieving data from the SLD server...
    Function call returned exception code 4
    => Check whether the SLD is running!
    2)In SXI_CHACHE cache is obsolete and there is LD_ERROR
    3)In RWB the component monitoring and other stuff when i try to open give and error
    Communication from SLD failed:500 Internal server Error
    Firstly are you installing the PI7.0?
    1) In SLDCHECK the error i get is
    Calling function LCR_LIST_BUSINESS_SYSTEMS
    Retrieving data from the SLD server...
    Function call returned exception code 4
    => Check whether the SLD is running!
    check the SLDAPICUST is pointing to correct SLD,
    check RFC destinations LCR*, SAPSLDAPI (check this names in the Intallation document once) are created and working fine.
    Also make sure your SLD is up and running.....
    You need to cross check the JCO connections created.....
    2)In SXI_CHACHE cache is obsolete and there is LD_ERROR
    check RFC destination integreation_directory_HMI is created and working fine.....

  • GET_BUSINESS_SYSTEM_ERROR

    Hi,
    When i try to activate an intgration model, i am getting following error
    Function/Q/SAPAPO/CIF_LOC_INBOUND
    Text:        GET_BUSINESS_SYSTEM_ERRORAn error occurred when de
    I have selected optoin '2' while activating CIF to create location and BP data. After activating CIF,  only Location and SCUs are created, not BPs. Can anyone please help me understand the error? I am working with ECC6.0 and SCM5.0.
    Thanks in advance!
    Edited by: BANDWM on Aug 16, 2010 3:10 AM

    Hi,
    Please check following SDN thread. There is good discussion.
    ABAP Proxy error :  GET_BUSINESS_SYSTEM_ERROR
    BW Error:  GET_BUSINESS_SYSTEM_ERROR
    Regards
    Datta

  • LCR_GET_OWN_BUSINESS_SYSTEM - LD_ERROR

    HI
    IN SXI_CACHE I AM GETTING THE ERROR
    LCR_GET_OWN_BUSINESS_SYSTEM - LD_ERROR AND NO FILE IS PICKED.
    REGARDS
    VIJU

    Hi,
    try executing.
    SAI_CACHE_REFRESH
    And once that completes..try scheduling ur automatic...sxi_cache
    also check user priveleges for user who does manual sxi_cache and for user who does background..........
    why do you need to run this program......this must run automatically........without being scheduled when any change is made in ir/id.
    Also check at your exchange profile about some error, it is possible that there is some mismatch or some error is coming lets c.
    Regards
    Aashish Sinha
    PS : reward points if helpful

  • ABAP Proxy Class - GET_BUSINESS_SYSTEM_ERROR

    I am using ABAP proxy in R/3 to send data to third party system thro' XI. In our development XI it works fine but in our QA-R/3 I am getting error "An error occurred when determining the business system (NO_BUSINESS_SYSTEM)".
    Does anyone has any idea where should I look to resolve this error. This program worked fine before few days in our QA-R/3 system also.
    Thanks in advance.
    Mrudula

    Hi,
    Run transaction SLDCHECK. If it throws up errors, check the transaction SLDAPICUST, and also the RFC destinations for the integration server in sm59.
    Also, it would't hurt to check the business system settings in the SLD.
    It could also be a user authorisation error.
    Cheers
    Manish

  • LDAP structure member ld_error

    Hi,
    the Networking library manual says (for the ldap_first_attribute(3LDAP) function):
    If an error occurs, NULL is returned and the ld_errno field in the ld parameter is set to indicate the error. See ldap_error(3LDAP) for a description of possible error codes." Nevertheless, the ld_errno member cannot be found in the LDAP structure.
    The structure is opaque so I cannot find the correct field name.
    Can anybody point me to the correct name of this LDAP field, please?
    Thanks,
    Juan

    In any C++ textbook you can read about access protection levels.
    A protected member of class can be accessed from a member of the class, from a member of a class derived publicly from the class, or from a friend of the class.
    The C++ standard says a nested class has no special access to protected or private members of the enclosing class.
    The C++ Committee has agreed in principle to modify that rule to allow access to private and protected class members by a nested class. Under that rule, your code would be valid.
    Our current compiler release, Sun Studio 10 (C++ 5.7) allows this access by default, since most other compilers allow the code in anticipation of a rule change, and since allowing the code does not break existing programs.
    I suggest you upgrade to the current release. You can download a copy to try free for 60 days here:
    http://www.sun.com/software/products/studio/index.xml
    If you just want to fix your code, you will need to make either S1 or S2 public in C1. If S1 is public, you don't have an issue. If S1 is protected and S2 is public, you forward-declare S1 before S2, then make S1 a friend in S2, then define S1.

  • Error while calling MII transaction as web service from ABAP

    Hello Experts,
    I want to call a MII transaction from ABAP program, as a web service.
    Following is output of http://<<server>>:50000/XMII/SOAPRunner/TAG_TRX  (TAG_TRX is name of my transaction).
      <?xml version="1.0" encoding="UTF-8" ?>
    - <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://www.sap.com/xMII" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://www.sap.com/xMII">
    - <!--  Types
      -->
    - <types>
    - <s:schema elementFormDefault="qualified" targetNamespace="http://www.sap.com/xMII">
    - <s:complexType name="InputParams">
    - <s:sequence id="InputSequence">
      <s:element maxOccurs="1" minOccurs="0" name="WEIGHT" type="s:string" />
      <s:element maxOccurs="1" minOccurs="0" name="BATCHID" type="s:string" />
      </s:sequence>
      </s:complexType>
    - <s:element name="XacuteRequest">
    - <s:complexType>
    - <s:sequence>
      <s:element maxOccurs="1" minOccurs="0" name="LoginName" type="s:string" />
      <s:element maxOccurs="1" minOccurs="0" name="LoginPassword" type="s:string" />
      <s:element maxOccurs="1" minOccurs="0" name="InputParams" type="s0:InputParams" />
      </s:sequence>
      </s:complexType>
      </s:element>
    - <s:complexType name="Rowset">
    - <s:sequence>
      <s:element maxOccurs="unbounded" minOccurs="0" name="Row" type="s0:Row" />
      </s:sequence>
      <s:attribute name="Message" type="s:string" />
      </s:complexType>
    - <s:complexType name="Row">
      <s:sequence id="RowSequence" />
      </s:complexType>
    - <s:element name="XacuteResponse">
    - <s:complexType>
    - <s:sequence>
      <s:element maxOccurs="1" minOccurs="0" name="Rowset" type="s0:Rowset" />
      </s:sequence>
      </s:complexType>
      </s:element>
      </s:schema>
      </types>
    - <!--  Messages
      -->
    - <message name="XacuteSoapIn">
      <part element="s0:XacuteRequest" name="parameters" />
      </message>
    - <message name="XacuteSoapOut">
      <part element="s0:XacuteResponse" name="parameters" />
      </message>
    - <!--  Ports
      -->
    - <portType name="XacuteWSSoap">
    - <operation name="Xacute">
      <input message="s0:XacuteSoapIn" />
      <output message="s0:XacuteSoapOut" />
      </operation>
      </portType>
    - <!--  Bindings
      -->
    - <binding name="XacuteWSSoap" type="s0:XacuteWSSoap">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
    - <operation name="Xacute">
      <soap:operation soapAction="http://www.sap.com/xMII" style="document" />
    - <input>
      <soap:body use="literal" />
      </input>
    - <output>
      <soap:body use="literal" />
      </output>
      </operation>
      </binding>
    - <!--  Service mapping
      -->
    - <service name="XacuteWS">
    - <port binding="s0:XacuteWSSoap" name="XacuteWSSoap">
      <soap:address location="http://<<server>>:50000/XMII/SOAPRunner/TAG_TRX" />
      </port>
      </service>
      </definitions>
    Now, when I am using http://<<server>>:50000/XMII/SOAPRunner/TAG_TRX to create a Enterprise Service in SAP (i.e. SE80 transaction-> Create Enterprise Service-> Service Consumer-> URL/HTTP Destination-> URL ... I am getting following error.
    Incorrect value: Entity "<<document>>"(5 /93 ). unexpected symbol: '<'     
    But, whenever I am using the same URL in MII BLS, it does not give any error. It correctly shows all input and output parameters.
    Please help me to resolve this issue.
    Regards
    Neeta.

    Now, I am able to create the Web Service in SAP and it is now showing the respective class, attribute and methods to execute this web service (web service to call MII transaction).
    But when I am calling it from ABAP (a simple Web Dynpro for ABAP method), it is showing me the following error:
    Error (id=GET_BUSINESS_SYSTEM_ERROR): An error occurred when determining the business system (LD_ERROR)
    Thought this error is coming from ABAP program, but I am sure that this is related to some configuration at SAP level. (Let me inform you that there are two different servers for SAP Web Dynpro ABAP and SAP MII.
    Please help.
    Thanks in advance.

  • MII transaction as Web service integration

    Hi MII's transaction can be called as WS but it has its own format. We have a system to integrate and this system should call MII's transaction. However the WS interface of the system is inflexible (it cannot be change, but has a very simple structure). So I just want to know any idea how we could change MII in order to adapt to the data structure .

    Now, I am able to create the Web Service in SAP and it is now showing the respective class, attribute and methods to execute this web service (web service to call MII transaction).
    But when I am calling it from ABAP (a simple Web Dynpro for ABAP method), it is showing me the following error:
    Error (id=GET_BUSINESS_SYSTEM_ERROR): An error occurred when determining the business system (LD_ERROR)
    Thought this error is coming from ABAP program, but I am sure that this is related to some configuration at SAP level. (Let me inform you that there are two different servers for SAP Web Dynpro ABAP and SAP MII.
    Please help.
    Thanks in advance.

  • To add number of senders mail addresses

    in the following code how   there is one sender address how do i make it to  3 senders i mean add the number of senders
    REPORT  ZSPOOL5 NO STANDARD PAGE HEADING.
    PARAMETER: P_EMAIL1 LIKE SOMLRECI1-RECEIVER,
               P_SENDER LIKE SOMLRECI1-RECEIVER,
               P_DELSPL AS CHECKBOX.
    *ranges:
    *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.
    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 SY-BATCH EQ 'X'.
        PERFORM GET_JOB_DETAILS.
        PERFORM OBTAIN_SPOOL_ID.
    Alternative way could be to submit another program and store spool
    id into memory.
    *submit ZSPOOLTOPDF2
           to sap-spool
           spool parameters   %_print
           archive parameters %_print
           without spool dynpro
           and return.
    Get spool id from program called above
    IMPORT w_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.
      ELSE.
        SKIP.
        WRITE:/ 'Program must be executed in background in-order for spool',
                'request to be created.'.
      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.                    "obtain_spool_id
          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.                    "get_job_details
          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.                    "convert_spool_to_pdf
          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.                    "process_email
          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.                    "send_email
          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.                    "delete_spool
    *&      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.                    "send_file_as_email_attachment

    hi ,
    just loop at LD_SENDER_ADDRESS which is there in fm
    'SO_DOCUMENT_SEND_API1'

  • Error in calling a web service

    hi,
    i am facing a problem in calling a web service.
    following are the steps i followed.
    1. created a client proxy object in transaction se80
    2. called that proxy object in my program
    3. executed the program
    problem
    1. an exception 'CX_AI_SYSTEM_FAULT' is caught with error code 'GET_BUSINESS_SYSTEM_ERROR' and error text 'An error occurred when determining the business system (SLD_API_EXCEPTION)'
    some facts abt the system:
    1. we do not have XI server.
    2. i havent created a logical port manually still there exists one entry in table SRT_LP which is as follows-
    PROXYCLASS - CO_CAT_PING
    LP_NAME - CO_CAT_PING
    ACTIVE - A
    DEFAULTPORT - X
    3. i found error messae in transaction 'sldcheck' as 'Summary: Connection to SLD does not work'
    4. i havent created a rfc destination.
    please reply ASAP.
    thanks in advance,
    Sagar

    Got a new file for testing the web service and it executed fine. Closing the thread.
    Regards
    Barada

  • Sending mail with multiple attachment

    hi.
    i want to send mail with multiple attachment.
    i m succeed in sending multiple attachment but the second pdf is not open.
    its given error like "This file is damaged and could not be open.
    pls check my code. and
    give the solution....
    point should be assured...........
    hope all u r understand my problem..
    & tell me where is i m missing something.
    REPORT  YSDPASALE1_MAIL LINE-SIZE 110.
    data : year_month(6) type c.
    data : from_date like sy-datum,to_date like sy-datum.
    INITIALIZATION.
    year_month = sy-datum+0(6).
    CONCATENATE year_month '01' into from_date.
    to_date = sy-datum.
    ranges : temp for mkpf-budat.
    temp-low = from_date.
    temp-high = to_date.
    append temp to temp.
    DATA: P_JOBCNT LIKE TBTCJOB-JOBCOUNT,
           jobname like TBTCJOB-JOBNAME,
           L_RELEASE(1) TYPE c.
    CONSTANTS : l_c_device(4)    VALUE 'LOCL'.
    DATA : t type i value 0.
    DATA : p_email1 like somlreci1-receiver,
            p_sender LIKE somlreci1-receiver.
    Data Declaration
    DATA: gd_recsize TYPE i,gd_recsize1 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.
    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,
          it_mess_att1 LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att2 LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_desc1 TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des,
          gd_mtitle LIKE sodocchgi1-obj_descr.
    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.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    DATA: BEGIN OF mailstr OCCURS 0,
            p_email like somlreci1-receiver,
          END OF mailstr.
    DATA: mailtab like STANDARD TABLE OF mailstr WITH HEADER LINE.
    DATA: ypp18tab like STANDARD TABLE OF mailstr WITH HEADER LINE,
          ymis008tab like STANDARD TABLE OF mailstr WITH HEADER LINE,
          ysd15tab like STANDARD TABLE OF mailstr WITH HEADER LINE,
          ymis10tab like STANDARD TABLE OF mailstr WITH HEADER LINE.
    SUBMIT YSDPASALE1 with bdt in temp
                           to sap-spool
                          with line-size = '255'
                           with KEEP_IN_SPOOL = 'X'
                           with IMMEDIATELY = ' '
                           WITHOUT SPOOL DYNPRO
                           AND RETURN
       NEW-PAGE PRINT ON
       DESTINATION l_c_device
       IMMEDIATELY ' '
       KEEP IN SPOOL 'X'
       NEW LIST IDENTIFICATION 'X'
       NO DIALOG.
       new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
        PERFORM convert_spool_to_pdf.
        select yemail as p_email into CORRESPONDING FIELDS OF TABLE ymis008tab
          from ymail
          where ytcode = 'YMIS008'.
    ELSE.
       SKIP.
       WRITE:/ 'Program must be executed in background in-order for spool & mail sending',
               'request to be created.'.
      ENDIF.
    wait up to 3 seconds.
      submit YSD_MONTHLY_SALES
                                USING SELECTION-SET 'MAIL'
                                to sap-spool
                               with KEEP_IN_SPOOL = 'X'
                               with IMMEDIATELY = ' ' "SPACE
                               WITHOUT SPOOL DYNPRO
                               AND RETURN
       NEW-PAGE PRINT ON
       DESTINATION l_c_device
       IMMEDIATELY ' '
       KEEP IN SPOOL 'X'
       NEW LIST IDENTIFICATION 'X'
       NO DIALOG.
       new-page print off.
        IF sy-batch EQ 'X'.
        gd_attachment_desc1  = 'YMIS10'.
        gd_mtitle = 'Monthly Sales Report'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
        PERFORM convert_spool_to_pdf1.
       loop at it_mess_att.
        move it_mess_att1 to it_mess_att.
        APPEND it_mess_att.
       endloop.
       APPEND LINES OF it_mess_att1 to it_mess_att.
       free it_mess_att1.
        it_mess_att[] = it_mess_att1[].
        insert LINES OF it_mess_att1 into it_mess_att.
        APPEND LINES OF it_mess_att2 to it_mess_att .
         insert LINES OF it_mess_att1 into it_mess_att.
         insert LINES OF it_mess_att2 into it_mess_att.
       loop at ymis008tab into mailstr.
         p_email1 = mailstr-p_email.
          p_email1 = '[email protected]'.
           PERFORM process_email.
       endloop.
           clear mailstr.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
      ELSE.
        SKIP.
      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 convert_spool_to_pdf1.
      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_att1 = gd_buffer.
        APPEND it_mess_att1.
        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.
      DESCRIBE TABLE it_mess_att1 LINES gd_recsize1.
      CHECK gd_recsize > 0 or gd_recsize1 > 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 = gd_attachment_desc1 .
    gd_attachment_desc = 'YPP18 - Daily Highlights'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Dear Sir,'.
      APPEND it_mess_bod.
    it_mess_bod        = ' '.
    APPEND it_mess_bod.
      it_mess_bod        = ' '.
      APPEND it_mess_bod.
      it_mess_bod        = 'kindly find the attached document'.
      APPEND it_mess_bod.
    it_mess_bod        = ' '.
    APPEND it_mess_bod.
    it_mess_bod        = 'Do not reply on this mail, It is generated from SAP'.
    APPEND it_mess_bod.
    it_mess_bod        = ' '.
    APPEND it_mess_bod.
      it_mess_bod        = ' '.
      APPEND it_mess_bod.
      it_mess_bod        = 'Regards,'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Arpit Shah'.
      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
                                          it_mess_att1
                                    using "p_email
                                          gd_mtitle
                                         'Testing mail generated from SAP'
                                         'Daily Highlights Abstract Report - YPP18'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                              it_attach1
                                        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,w_doc_data1 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_data1-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[].
    For 2nd Attachments
    * Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach1 INDEX w_cnt.
      w_doc_data-doc_size = w_doc_data1-doc_size +
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach1 ).
      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.
    APPEND LINES OF it_attach1 to t_attachment.
      t_attachment[] = it_attach1[].
    APPEND LINES OF it_attach1 to t_attachment.
    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   = 0.
      t_packing_list-body_start = 1.
    DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
    DESCRIBE TABLE it_mess_att LINES t_packing_list-body_num.
      DESCRIBE TABLE it_attach LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  'YMIS008'."ld_attdescription.
      t_packing_list-obj_name   =  'YMIS008'."ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
      clear t_packing_list.
    for 2 attachments
      data : a type i,b type i.
       a = t_packing_list-body_num.
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 0.
      t_packing_list-body_start = a + 1. "1
    DESCRIBE TABLE it_mess_att1 LINES t_packing_list-body_num.
      DESCRIBE TABLE it_attach1 LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  'YMIS10'."ld_attdescription.
      t_packing_list-obj_name   =  'YMIS10'."ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    a = t_packing_list-body_num.
    clear 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 = a + 1.
    t_packing_list-body_num = t_packing_list-body_num + 1.
    DESCRIBE TABLE it_mess_att1 LINES t_packing_list-body_num.
    t_packing_list-body_num = a + t_packing_list-body_num .
    t_packing_list-doc_type   =  ld_format.
    t_packing_list-obj_descr  =  'YMIS10'."ld_attdescription.
    t_packing_list-obj_name   =  'YMIS10'."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.
    loop at ymis008tab into mailstr.
      t_receivers-receiver = mailstr-p_email.  "ld_email.
      t_receivers-receiver = p_email1.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'. "X   "Read Acknoledgement
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
    endloop.
       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.
    Rgds.
    Arpit

    Hi Arpit,
    Take a look at the documentation of FM 'SO_DOCUMENT_SEND_API1' for parameter PACKING_LIST. I think you should set t_packing_list-head_num to a different value than 0 for the second attachment.
    Regards,
    John.

Maybe you are looking for

  • Installing Oracle - /etc/init.d/oracle-xe configure command missing?

    I've AMD64 system with Ubuntu 11.04 installed. It's been rough ride for me to install oracle-xe-universal. I've already spent more than 2 days on this. Still unsuccessful. 1) First I downloaded the packages libaio_0.3.104-1_i386.deb and oracle-xe-uni

  • WinRM 0x80338113 error on Windows 2008 R2 using DSC

    Not having any problems with using a Windows 2012 R2 clients against a Windows 2012 R2 DSC pull server.  But for Windows 2008 R2 clients when running Set-LocalDSCConfigurationManager I'm getting: The WInRM client sent a request to an HTTP server and

  • Adhoc Step runtime excution process.

    Hi Friends,     I have a scenario where AdHoc step is being used. As per my knowledge till now this step is used for runtime selection of process (i.e. which work flow we want to continue at run time). And for selecting that wf we have to goto graphi

  • Error in inwarding the consignment Serialised article

    Hi All, When I try to Inward the Serialized article Eg Mobile with IMEI number which is vendor consignment stock from DC to Store, I am getting the following error messages. 1. System status ESTO is active (EQU 10078042) 2. Serial number 359740031641

  • Mainstage can't find Ivory 2

    Hey all, I recently bought Ivory 2 Italian Grand and installed it onto my computer. (Macbook pro 2.8 GHz Intel Core i7 8GB). The standalone application works perfect- however, it does not show up in Mainstage. All the .component files are in place- l