SAPConnect problem

Hello all,
I have a problem in SAP Connect when I try to start the send process. My system dumps with the message "Call Function Receive Error" If I debug where the system dumps, I see that is in the call to function module
ABAPLIST_VERSION that is an RFC module. The exporting parameter is VERSION which has a value of 4. Does anybody have an idea how to resolve this issue?

Hi Enrique,
We too faced the similar issue when using sapconnect to send mails to INT Address.There was problem only for request which faced this problem.The problem was actually RCONN01 programs runs with job which send and receives the mails from/to SMTP Node.But during the sending process the Address of the user was not getting replicated in the Lotus notes which is the target.The issue was solved with the help of Lotus notes admin team.
Now the issue stands solved and no jobs are either getting failed or in wait status.
Regards
Ashly Titus
Satyam Computer Services Ltd.

Similar Messages

  • Problems in sent of external MAIL with the service SAPCONNECT

    Hello all
    We configured the service SAPCONNECT in my system quality  for sending the mail and this is not problem, I executed  tests with direction of mail internal and the are sent without any problem.
    But the problems starts is when I sent the mail external and the message that displays is
    Status received for this document:
         System Messages
    Sent on:
         25.01.2011 11:29:07
    Sent by:
         Marco Gerardo Ceballos V.
    Status for Recipient xxxxxxx@aaaaa:
         No delivery to xxxxxx@aaaaa, as recipient unknown
    The request of area of development is send the external mails.
    I review the configuration in the transaction SCOT and I not see a problem.
    ATTE
    Gerardo Ceballos

    Hi,
    Please check the parameter icm/server_port_1, if this parameter is not set, add in TX RZ10 with the value:
    PROT=SMTP,PORT=25
    Restart the instance, then create a service user with the S_A.SCON profile.
    In the SICF, open the SAPCONNECT service and check the configuration:
    Host data: profile parameter = 0 // host configuration= :
    Logon Data: Add the service user that you create
    Handler List: CL_SMTP_EXT_SAPCONNECT
    Save and active
    In the SCOT add the domain in menu settings and add the mailhost and port in the SMTP node, Click the button SET in the internet option and add a * in field address area.
    Go to SMICM --> Go to --> Services and check that the port that you add in the parameter icm/server_port_1 is active
    Go to SBWP and send the message.
    Good Luck
    AG

  • Problems replacing email-subject with SAPConnect

    Hi there,
    I'm sending an order confirmation via SAPConnect as email.
    The order confirmation attaches the email as a *.PDF file.
    Now i'd like to replace the standard subject, that consists in the spool-number and some text from  the message i use.
    So, i went to SPRO, and put 'Your Order: &VBAK-VBELN&' in the mai title. That worked almost properly, because the spool number stayed.
    So, i don't want this spool number output any longer.
    The second point is, that i've tried to replace the standard output of the mail text. I didn't succeed at all.
    So, my question. do you have any ideas to solve my problems?
    Thanks for reply, greetings and happy eastern
    Stefan

    msg.setText("<b>testeeeeeeeeeeeee</b>");R
    eplace that
    bymsg.setContent("<b>testeeeeeeeeeeeee</b>",
    "text/html");
    Thanks DrClap, but that's not exactly the solution I'm looking for, cuz I would have to hard-code that header.
    I have an Email class that I use as a wrapper for the javax.mail API, and I wanna be able to have a setHeader() method that works to enable the users to set the content-type of the text (or HTML) portion of the email, even when there are attachments. How can I achieve this?

  • SAPconnect Internet Mail Status Problem

    I configured BI 7.0 SAPconnect for sending internet email. I receive the mail in outlook just fine. The problem is in the status field. All messages have status of sent. I would like to know what configuration is missing so I can receive status transmitted.
    Thank You in advance

    Martin,
    You can go through the note 1033893 .
    It would help you to resolve the issue

  • Problems with SapConnect

    Hi,
    I'm facing some problems with SAP Connect I'll apreciate if someone that have already had the same problem knows the reason.
    I have a program that sends a mail with an attached PDF document by mail. The program is in development system and quality system. In both systems the mail is send, but in one system the attached PDF is OK, and in the other system the attached PDF cannot be opened. I've checked that when seeing the mail in SOST in the system where we cannot see the attached PDF, it is already with a corrupted format.
    So, as the program is the same, I believe the reason of the attached is corrupted in only one system is caused by any administration task.
    Does anyone have any idea of what may be causing this problem ?
    Please note in SCOT the configuration is equal in both systems.
    Thanks in advance,
    Paulo Sousa

    As you said it may issue with code.
    We have several testing programs to check this.
    I think your version is ECC
    Check & try these
    BCS_TEST05
    BCS_EXAMPLE_5
    BCS_EXAMPLE_6

  • SAPConnect SMTP Problem

    Hi Experts,
    We are using Lotus Domino Server. Can I send mails from SAP using the SMTP or I have to use HTTO method to connect to the server?
    Please share your experiences
    Thanks

    you can use SMTP to send mails. check this weblog for configuration and code for emailing.
    /people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
    Regards
    Raja

  • Line Alignment Problem while sending Fax from SAP Script

    Moderator message: please do not post the same question in different forums
    Hi Experts,
    While sending fax the horizontal lines are not displaying till the end of the page.
    But in the print preview the lines are displying till the end.
    If this is printed using local printer the lines are printing fine but the problem is with the fax.
    Please provide me a solution for this.
    Regards,
    Rajesh.
    Edited by: Matt on Nov 25, 2008 2:51 PM

    Puzzling.
    I've seen where the printed output doesn't match the print preview but not a fax not matching a print.
    Do you use SAPConnect or the older SAPComm method for faxing?
    How do you produce the horizontal lines? BOX commands, ULINE, '-', etc.?

  • SAPConnect to Send Emails to external mail address

    I am trying to send email from SAP to an external email address.
    I've configured in SCOT the mail server and it respective port.
    When I tried to send a test message, the message failed in the queue with the log:
    "Cannot process message in SAP System - No ESMTP Plug-In Is Available for SAPconnect
    Application Server Used by the Send Process:
    S21TDI05
    (Schedule Send Process on App.Server with Plug-In)
    Upon checking the sap documentation, I encounter there's also a SMTP Service in "SMICM" as well. Inside there I can see that the SMTP setting is not activate and no values has been entered.
    Are these 2 connected?
    Advices are welcome.
    Thanks,
    Regards,
    Wooi Chian.

    This error message means that your SMTP plug-in is not active. Go to TR: SMICM -> GOTO -> SERVICES
    Here you must see that the SMTP plug in is active.
    This error usally due to bind error. The port wich had to be used is used by an other service.
    Check if below mentioned parameters are set.
    rdisp/start_icman = true
    icm/server_port_0 = PROT=HTTP,PORT=1080
    icm/server_port_1 = PROT=SMTP,PORT=25$$, TIMEOUT=60, PROCTIMEOUT=300
    icm/server_port_2 = HTTPS,PORT=82$$, TIMEOUT=60, PROCTIMEOUT=300
    and restart ICM . You should see SMTP service on SMICM transaction.
    In my case problem was with the below parameters. PORT=HTTPS was assigned to server_port_1. I swapped the values of both the parameters icm/server_port_1 and icm/server_port_3. Only after that SMTP service started being visible under DISPLAY --> Services.
    icm/server_port_0                           PROT=HTTP,PORT=80$$, TIMEOUT=60, PROCTIMEOUT=300
    icm/server_port_1                           PROT=HTTPS,PORT=82$$, TIMEOUT=60, PROCTIMEOUT=300
    icm/server_port_3                           PROT=SMTP,PORT=25$$, TIMEOUT=60, PROCTIMEOUT=300
    Hope this helps solve the issue.
    /Ravi

  • Problem Please help me.....Let me know the area to look for it I am a DBA..

    Problem Please help me.....Let me know the area to look for it I am a DBA..Thanks in advance to let me know the cause and the area to look and fix it...
    Server Error in '/' Application.
    Problem with SAP/BAPI. SAP.Connector.RfcCommunicationException: Connect to message server failed Connect_PM MSHOST=prddb01.lamrc.com, R3NAME=PRD, GROUP=Prod HR PRD LOCATION CPIC (TCP/IP) on local host ERROR service 'sapmsPRD' unknown TIME Wed May 04 08:59:06 2005 RELEASE 620 COMPONENT NI (network interface) VERSION 36 RC -3 MODULE ninti.c LINE 428 DETAIL NiPServToNo SYSTEM CALL getservbyname COUNTER 1 at SAP.Connector.SAPConnection.ThrowRfcException(RFC_ERROR_INFO_EX rfcerrInfo, Encoding encoding, String languangeCode) at SAP.Connector.SAPConnection.Open() at SAP.Connector.SAPClient.RfcInvoke(String method, Object[] methodParamsIn) at SAP.Connector.SAPClient.SAPInvoke(String method, Object[] methodParamsIn) at SoftwareKeySAPG.SAPProxy1.Z_Bapi_Load_Kpi_Region(ZSOFT_KPI_REGIONS_MTable&amp; Kpi_Regions, ZSOFT_PROD_TYPETable&amp; Prod_Type) at SoftwareKeySAPG.SAPGSK.LoadKPIRegion(DataSet dsProduct)
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.Web.Services.Protocols.SoapException: Problem with SAP/BAPI. SAP.Connector.RfcCommunicationException: Connect to message server failed Connect_PM MSHOST=prddb01.lamrc.com, R3NAME=PRD, GROUP=Prod HR PRD LOCATION CPIC (TCP/IP) on local host ERROR service 'sapmsPRD' unknown TIME Wed May 04 08:59:06 2005 RELEASE 620 COMPONENT NI (network interface) VERSION 36 RC -3 MODULE ninti.c LINE 428 DETAIL NiPServToNo SYSTEM CALL getservbyname COUNTER 1 at SAP.Connector.SAPConnection.ThrowRfcException(RFC_ERROR_INFO_EX rfcerrInfo, Encoding encoding, String languangeCode) at SAP.Connector.SAPConnection.Open() at SAP.Connector.SAPClient.RfcInvoke(String method, Object[] methodParamsIn) at SAP.Connector.SAPClient.SAPInvoke(String method, Object[] methodParamsIn) at SoftwareKeySAPG.SAPProxy1.Z_Bapi_Load_Kpi_Region(ZSOFT_KPI_REGIONS_MTable&amp; Kpi_Regions, ZSOFT_PROD_TYPETable&amp; Prod_Type) at SoftwareKeySAPG.SAPGSK.LoadKPIRegion(DataSet dsProduct)
    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 
    Stack Trace:
    [SoapException: Problem with SAP/BAPI.
    SAP.Connector.RfcCommunicationException: Connect to message server failed
    Connect_PM  MSHOST=prddb01.lamrc.com, R3NAME=PRD, GROUP=Prod HR PRD
    LOCATION    CPIC (TCP/IP) on local host
    ERROR       service 'sapmsPRD' unknown
    TIME        Wed May 04 08:59:06 2005
    RELEASE     620
    COMPONENT   NI (network interface)
    VERSION     36
    RC          -3
    MODULE      ninti.c
    LINE        428
    DETAIL      NiPServToNo
    SYSTEM CALL getservbyname
    COUNTER     1
       at SAP.Connector.SAPConnection.ThrowRfcException(RFC_ERROR_INFO_EX rfcerrInfo, Encoding encoding, String languangeCode)
       at SAP.Connector.SAPConnection.Open()
       at SAP.Connector.SAPClient.RfcInvoke(String method, Object[] methodParamsIn)
       at SAP.Connector.SAPClient.SAPInvoke(String method, Object[] methodParamsIn)
       at SoftwareKeySAPG.SAPProxy1.Z_Bapi_Load_Kpi_Region(ZSOFT_KPI_REGIONS_MTable&amp; Kpi_Regions, ZSOFT_PROD_TYPETable&amp; Prod_Type)
       at SoftwareKeySAPG.SAPGSK.LoadKPIRegion(DataSet dsProduct)]
       System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +1503
       System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +218
       SoftwareKeyUI.InstalledBaseDataWS.InstalledBaseData.LoadKPIRegionMulti(DataSet products)
       SoftwareKeyUI.InstalledBaseDataAccess.LoadKPIRegionMulti(DataSet products)
       SoftwareKeyUI.InstalledBase.GetRegionDetails(Int32 userId, String product, String regionType)
       SoftwareKeyUI.FilteredAccess.GetRegionDetails(Int32 userId, String product, String regionType)
       SoftwareKeyUI.search.LoadRegionDetails()
       SoftwareKeyUI.search.regionType_SelectedIndexChanged(Object sender, EventArgs e)
       System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e) +108
       System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +26
       System.Web.UI.Page.RaiseChangedEvents() +115
       System.Web.UI.Page.ProcessRequestMain() +1099

    The error is a very basic one - the sapmsPRD service is not known. You will have to go to <NT_ROOT>\system32\drivers\etc and add the entry sapmsPRD 3600 to this file.
    This is basically telling the requester at what port to look for the message server.
    C

  • Problem Please help me.....Let me know the area to look for it

    Problem Please help me.....Let me know the area to look for it I am a DBA..Thanks in advance to let me know the cause and the area to look and fix it...
    Server Error in '/' Application.
    Problem with SAP/BAPI. SAP.Connector.RfcCommunicationException: Connect to message server failed Connect_PM MSHOST=prddb01.lamrc.com, R3NAME=PRD, GROUP=Prod HR PRD LOCATION CPIC (TCP/IP) on local host ERROR service 'sapmsPRD' unknown TIME Wed May 04 08:59:06 2005 RELEASE 620 COMPONENT NI (network interface) VERSION 36 RC -3 MODULE ninti.c LINE 428 DETAIL NiPServToNo SYSTEM CALL getservbyname COUNTER 1 at SAP.Connector.SAPConnection.ThrowRfcException(RFC_ERROR_INFO_EX rfcerrInfo, Encoding encoding, String languangeCode) at SAP.Connector.SAPConnection.Open() at SAP.Connector.SAPClient.RfcInvoke(String method, Object[] methodParamsIn) at SAP.Connector.SAPClient.SAPInvoke(String method, Object[] methodParamsIn) at SoftwareKeySAPG.SAPProxy1.Z_Bapi_Load_Kpi_Region(ZSOFT_KPI_REGIONS_MTable&amp; Kpi_Regions, ZSOFT_PROD_TYPETable&amp; Prod_Type) at SoftwareKeySAPG.SAPGSK.LoadKPIRegion(DataSet dsProduct)
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.Web.Services.Protocols.SoapException: Problem with SAP/BAPI. SAP.Connector.RfcCommunicationException: Connect to message server failed Connect_PM MSHOST=prddb01.lamrc.com, R3NAME=PRD, GROUP=Prod HR PRD LOCATION CPIC (TCP/IP) on local host ERROR service 'sapmsPRD' unknown TIME Wed May 04 08:59:06 2005 RELEASE 620 COMPONENT NI (network interface) VERSION 36 RC -3 MODULE ninti.c LINE 428 DETAIL NiPServToNo SYSTEM CALL getservbyname COUNTER 1 at SAP.Connector.SAPConnection.ThrowRfcException(RFC_ERROR_INFO_EX rfcerrInfo, Encoding encoding, String languangeCode) at SAP.Connector.SAPConnection.Open() at SAP.Connector.SAPClient.RfcInvoke(String method, Object[] methodParamsIn) at SAP.Connector.SAPClient.SAPInvoke(String method, Object[] methodParamsIn) at SoftwareKeySAPG.SAPProxy1.Z_Bapi_Load_Kpi_Region(ZSOFT_KPI_REGIONS_MTable&amp; Kpi_Regions, ZSOFT_PROD_TYPETable&amp; Prod_Type) at SoftwareKeySAPG.SAPGSK.LoadKPIRegion(DataSet dsProduct)
    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    Stack Trace:
    [SoapException: Problem with SAP/BAPI.
    SAP.Connector.RfcCommunicationException: Connect to message server failed
    Connect_PM MSHOST=prddb01.lamrc.com, R3NAME=PRD, GROUP=Prod HR PRD
    LOCATION CPIC (TCP/IP) on local host
    ERROR service 'sapmsPRD' unknown
    TIME Wed May 04 08:59:06 2005
    RELEASE 620
    COMPONENT NI (network interface)
    VERSION 36
    RC -3
    MODULE ninti.c
    LINE 428
    DETAIL NiPServToNo
    SYSTEM CALL getservbyname
    COUNTER 1
    at SAP.Connector.SAPConnection.ThrowRfcException(RFC_ERROR_INFO_EX rfcerrInfo, Encoding encoding, String languangeCode)
    at SAP.Connector.SAPConnection.Open()
    at SAP.Connector.SAPClient.RfcInvoke(String method, Object[] methodParamsIn)
    at SAP.Connector.SAPClient.SAPInvoke(String method, Object[] methodParamsIn)
    at SoftwareKeySAPG.SAPProxy1.Z_Bapi_Load_Kpi_Region(ZSOFT_KPI_REGIONS_MTable&amp; Kpi_Regions, ZSOFT_PROD_TYPETable&amp; Prod_Type)
    at SoftwareKeySAPG.SAPGSK.LoadKPIRegion(DataSet dsProduct)]
    System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +1503
    System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +218
    SoftwareKeyUI.InstalledBaseDataWS.InstalledBaseData.LoadKPIRegionMulti(DataSet products)
    SoftwareKeyUI.InstalledBaseDataAccess.LoadKPIRegionMulti(DataSet products)
    SoftwareKeyUI.InstalledBase.GetRegionDetails(Int32 userId, String product, String regionType)
    SoftwareKeyUI.FilteredAccess.GetRegionDetails(Int32 userId, String product, String regionType)
    SoftwareKeyUI.search.LoadRegionDetails()
    SoftwareKeyUI.search.regionType_SelectedIndexChanged(Object sender, EventArgs e)
    System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e) +108
    System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +26
    System.Web.UI.Page.RaiseChangedEvents() +115
    System.Web.UI.Page.ProcessRequestMain() +1099

    Hi
    You should make a mapping for the service sapmsPRD in your /etc/services file (On Windows: C:WINDOWSSYSTEM32DRIVERSETCservices). If your instance number is 00 you will have to add the following entry:
    sapmsPRD      3600/tcp
    Good luck!
    René van Es

  • SAPConnect text email

    Hi there,
    I'm sending an order confirmation via SAPConnect as email.
    The order confirmation attaches the email as a *.PDF file.
    I've tried to replace the standard output of the mail text. I didn't succeed at all.
    So i went to the customizing of the message and replaced the text for the email. The result was the SAP standard text.
    So, my question. do you have any ideas to solve my problems?
    Thanks for reply,
    Stefan

    hi sirkanth,
    thanks for reply.
    The email attaches an order confirmation as PDF. I can replace the email subjet with some text and variables from the print job, that is customized in spro, but not the text of the email.
    Every documentation says, that's possible!
    Do you have any idea?
    Thanks, Stefan

  • Trouble with SAPconnect / sending email in ABAP-code

    Hi,
    with the code below I try to send an email from ABAP outside
    to an mail-account in the internet.
    I'll get no error/exceptions but the mail will be not send
    to the internet-mail-account.
    In Transaktion SCOT I checked the SAPconnect-Node "INT"-"SMTP".
    There is a mailserver with the right IP und the right Port. So I don't understand
    what could be the problem!?
    Can anybody help me and say me why the code below doesn't works?
    Best wishes!
    * For API
    data: maildata type sodocchgi1.
    data: mailtxt  type table of solisti1 with header line.
    data: mailrec  type table of somlrec90 with header line.
    start-of-selection.
      clear:    maildata, mailtxt,  mailrec.
      refresh:  mailtxt, mailrec.
      maildata-obj_name = 'TEST'.
      maildata-obj_descr = 'Test'.
      maildata-obj_langu = sy-langu.
      mailtxt-line = 'This is a test'.
      append mailtxt.
      mailrec-receiver = '[email protected]'.
      mailrec-rec_type  = 'U'.
      append mailrec.
        call function 'SO_NEW_DOCUMENT_SEND_API1'
             exporting
                  document_data              = maildata
                  document_type              = 'RAW'
                  put_in_outbox              = 'X'
             tables
                  object_header              = mailtxt
                  object_content             = mailtxt
                  receivers                  = mailrec
             exceptions
                  too_many_receivers         = 1
                  document_not_sent          = 2
                  document_type_not_exist    = 3
                  operation_no_authorization = 4
                  parameter_error            = 5
                  x_error                    = 6
                  enqueue_error              = 7
                  others                     = 8.
        if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
    * Start the send process using the following statement
    submit rsconn01 with mode = 'int' and return.
    Message was edited by:
            sebastian eckes

    SAP is a robust system, which gives many facilities in the form of Function Modules (FMs) for connecting to external systems or for use within the system. With a clever use of these FMs we can achieve a lot of things through ABAP code.
    This article focuses on ways to send E-mails and SAP Mails using ABAP code.
    Firstly SAP Mail
    A SAP mail is a mail internal to the SAP system. It is a very good forum to exchange information with other users. Using a SAP mail in ABAP code facilitates exchange of automatic messages at various stages of the business process. It is easy to use and saves many hassles involved in using workflows for exchanging messages.
    The ABAP code to send a sap mail is built around the FM SO_OBJECT_SEND which has the following pattern.
    call function 'SO_OBJECT_SEND'
    exporting
    EXTERN_ADDRESS = ' '
    FOLDER_ID = ' '
    FORWARDER = ' '
    OBJECT_FL_CHANGE = ' '
    OBJECT_HD_CHANGE = ' '
    OBJECT_ID = ' '
    OBJECT_TYPE = ' '
    OUTBOX_FLAG = ' '
    OWNER = ' '
    STORE_FLAG = ' '
    DELETE_FLAG = ' '
    SENDER = ' '
    CHECK_ALREADY_SENT = ' '
    importing
    object_id_new =
    sent_to_all =
    tables
    OBJCONT =
    OBJHEAD =
    OBJPARA =
    OBJPARB =
    receivers =
    PACKING_LIST =
    ATT_CONT =
    ATT_HEAD =
    NOTE_TEXT =
    exceptions
    active_user_not_exist = 1
    communication_failure = 2
    component_not_available = 3
    folder_not_exist = 4
    folder_no_authorization = 5
    forwarder_not_exist = 6
    note_not_exist = 7
    object_not_exist = 8
    object_not_sent = 9
    object_no_authorization = 10
    object_type_not_exist = 11
    operation_no_authorization = 12
    owner_not_exist = 13
    parameter_error = 14
    substitute_not_active = 15
    substitute_not_defined = 16
    system_failure = 17
    too_much_receivers = 18
    user_not_exist = 19
    x_error = 20
    others = 21.
    In the next article we will understand the main parameters and table interfaces of the FM.
    Import Parameters Name and Description     Field name     Field function
    Object_hd_change (structure) Contains the process to be done when SAP mail is marked for execution.When the Execute Icon in the SAP mail is clicked the corresponding object is executed     vmtyp     ‘D’ for dialog module ‘F’ for function module‘R’ for report‘T’ for transaction‘U’ for transaction with export
         Acnam     Name of the object which is to be executed, like name of transaction/report
         Skips     ‘X’ to execute first screen in background
         Objsns     Indicates sensitivity of the object. ‘P’ for private object‘F’ for functional object‘O’ for confidential object‘C’ for company confidential objectSensitivity level is restricted to ‘O’ for documents in shared folders
         Objla     Language of the document ‘E’ for Englishsy-langu for system language
         Objnam     Name of the document
         Objdes     Short description (Title) of the document
         Objsrt     Name of the sort field. This is used to group documents based on certain criteria
    Object_type Type of document to be sent with mail           ‘RAW’ for raw text (default) ‘DOC’ for word file ‘XLS’ for excel fileAll classes can be used except for folders (‘FOL’) and distribution lists (‘DLI’)
    Outbox_flag           ‘X’ to indicate that mail should also be stored in outbox of the user after sending (default ‘ ‘)
    Owner           Sap login of the user responsible for transmission
    Table Parameters Name and Description     Field Name     Field function
    Objcont Table to hold the body of the mail     Line     Text lines up to 255 characters
    Objhead Table to hold number of lines in the body of the mail, i.e size of the table in lines     Line     Text lines up to 255 characters
    Objpara Table to hold the set/get parameters to be transferred to the processing element     Name     Name of the parameter. Only first three characters are used
         Option     Not used
         Low     Value of the parameter in name
         High     Not used
    Objparb Table to hold information for mails to which a certain processing type is assigned. For a report or transaction with transfer of values to global memory, the table has to contain the parameters with relevant values. The memory id is taken from the first row. For a FM or dialog module, data in table will be transferred as table parameter msgdial     Name     For report or transaction with transfer of values to global memory, the field for first row should hold the name of the memory id used for export and the other rows should hold the parameter names. For FM or dialog module this field should hold the values as per the usage of the module
         Value     For report or transaction with transfer of values to global memory, the field for first row should remain empty and the other rows should hold values of the parameters. For FM or dialog module this field should hold the values as per the usage of the module
    Receivers Table to hold recipient details     Recnam     SAP login of the recipient. Append all the recipients to this table
         Sndcp     X for sending mail as a copy
         Sndex     X for sending as express document. This will prompt a logged on recipient saying that he or she has received an express mail
         Recesc     ‘B’ for SAP user ‘E’ for external email address‘U’ for unix address
    Export Parameters Name and Description     Field name     Field function
    Object_id_new Contains object id of document created during send process            
    Sent_to_all X indicates that document was sent to all recipients. Flag is not activated if sending fails in one or more cases           
    Main Exceptions Name and Description     Description
    Too_much_receivers      Number of recipients is greater than number for which sender is authorised to send
    Object_not_sent     Document was not delivered to any of the recipients
    Object_not_exist     Document class specified does not exist or cannot be sent
    Object_no_authorisation     Document could not be sent as one of the required authorisations does not exist
    Parameter_error     Invalid combination of parameter values transferred to FM
    X_error     Internal error occurred
    Once all the parameters and table interfaces are properly filled, call the function module to send the SAP mail to the recipient inbox.
    Care should be taken to report the status of execution of the function module to the user using one of the exceptions defined (refer function module pattern above)
    Though SAP mail is a very robust method of interacting with users within SAP system, it is always good to receive email in Microsoft inbox. This also works like an additional notification to users in case they do not check SAP mail regularly. The next article covers sending E-mails using ABAP.
    Sending Email to a non-SAP system:
    Though SAP mail is a very robust method of interacting with users within SAP system, it is always good to receive email in Microsoft inbox. This also works like an additional notification to users in case they do not check SAP mail regularly.
    Sending an email to the Microsoft Inbox is a way of interacting with a non SAP system through ABAP code and hence is very interesting. A fair knowledge of UNIX shell scripting is assumed here.
    The ABAP code to send an email to Microsoft inbox revolves around following UNIX script
    Echo "From:" "<"$1">" > <unix file path name>
    Echo "To:" "<"$2">" >> <unix file path name>
    Echo "Subject:" "<"$3">" >> <unix file path name>
    Cat $4 >> <unix file path name>
    Uuencode $5 $6 >> <unix file path name>
    Cat <unix file path name> | /usr/sbin/sendmail –f $fraddr $toaddr
    (Note : the commands in the above script can be case sensitive. Check the actual case on the unix installation in question)
    Let us understand the various parts of the above script.
    $1 = Sender email address
    $2 = Recipient email address
    $3 = Subject of the email
    $4 = Path of unix server file having email body
    Form email body as an internal table in ABAP program, download it to a unix server file
    $5 = Path of unix server file to be sent as email attachment
    $6 = Name to be given to the attachment (like test1.doc, test1.xls). The corresponding Microsoft icon
    will be shown in the email for the type of file attached ( Word document, excel document etc)
    The script builds a temporary file and pipes the file to the sendmail command to achieve the mission.
    This script can be invoked from SAP to send the mail to the intended recipient. Store this small script on the unix server. (Assume script name is sndmail )
    To do this we should define a link in the SAP system between a customized command and this unix script.
    The FM to define a customized command in SAP system has the following pattern.
    call function 'SXPG_CALL_SYSTEM'
    exporting
    commandname =
    PARAMETERS = ' '
    importing
    status =
    tables
    exec_protocol =
    exceptions
    no_permission = 1
    command_not_found = 2
    parameters_too_long = 3
    security_risk = 4
    wrong_check_call_interface = 5
    program_start_error = 6
    program_termination_error = 7
    x_error = 8
    parameter_expected = 9
    too_many_parameters = 10
    illegal_command = 11
    others = 12.
    In the next article we will understand the main parameters and table interfaces of the FM.
    Import Parameters Name and Description     Field name     Field function
    Commandname Name of unix shell script or command to be executed by SAP           Name of unix shell script to be invoked
    Parameters           The parameters to be sent to unix shell script ($1, $2 etc). Send parameters as a concatenated string separated by space and length not exceeding 128 characters For eg in UNIX environment the above shell script would be executed as Sndmail [email protected] [email protected] Trial /home/test.doc testmail.We will be simulating this command using the FM from SAP system
    Table Parameters Name and Description     Field Name     Field function
    Exec_protocol (structure) Table to get messages from unix server after shell script is executed     Length     Length of the message from external program i.e unix
         Message     Log message from external program i.e unix
    Export Parameters Name and Description     Field name     Field function
    Status Contains the status of execution of external program            Scheduling status of external program i.e unix
    Once the above FM is invoked with the necessary parameters the unix program sendmail will send a mail to the inbox of the recipient in Microsoft.
    The restriction on the parameter string length of 128 characters can be removed to make way for very long email addresses and subjects. Build the parameters into an internal table and download it as a file on the unix server. Instead of passing each parameter individually, pass the unix server path of this file as the parameter to the unix shell script (sndmail mentioned above). Modify the shell script to read every line of this parameter file as variables to be used in the shell script.
    In the next article we will see an example of the ABAP code you can use to send SAP Mails.
    REPORT ZTSAPMAIL.
    DATA: X_OBJECT_TYPE LIKE SOOD-OBJTP.
    DATA: BEGIN OF X_OBJECT_HD_CHANGE.
    INCLUDE STRUCTURE SOOD1.
    DATA: END OF X_OBJECT_HD_CHANGE.
    DATA: BEGIN OF X_OBJCONT OCCURS 10.
    INCLUDE STRUCTURE SOLI.
    DATA: END OF X_OBJCONT.
    DATA: BEGIN OF X_OBJHEAD OCCURS 0.
    INCLUDE STRUCTURE SOLI.
    DATA: END OF X_OBJHEAD.
    DATA: BEGIN OF RAW_HEAD.
    INCLUDE STRUCTURE SORH.
    DATA: END OF RAW_HEAD.
    DATA: BEGIN OF X_RECEIVERS OCCURS 0.
    INCLUDE STRUCTURE SOOS1.
    DATA: END OF X_RECEIVERS.
    PARAMETERS: RECEIVER LIKE X_RECEIVERS-RECNAM. " Name
    *BUILD MESSAGE HEADER
    MOVE 'Sort field goes here' TO X_OBJECT_HD_CHANGE-OBJSRT. " Sort field
    MOVE 'Name of the object goes here' TO X_OBJECT_HD_CHANGE-OBJNAM. " Name
    MOVE 'Document title goes here' TO X_OBJECT_HD_CHANGE-OBJDES. " Title
    MOVE 'F' TO X_OBJECT_HD_CHANGE-OBJSNS. " Functional OBJECT
    MOVE 'E' TO X_OBJECT_HD_CHANGE-OBJLA. " Language
    Object type of the new document
    MOVE 'RAW' TO X_OBJECT_TYPE.
    CLEAR X_OBJCONT.
    MOVE 'Contents of mail' TO X_OBJCONT-LINE.
    APPEND X_OBJCONT.
    CLEAR X_OBJCONT-LINE. APPEND X_OBJCONT.
    MOVE 'More contents' TO X_OBJCONT-LINE.
    APPEND X_OBJCONT.
    MOVE 'Still more contents'
    to x_objcont-line.
    APPEND X_OBJCONT.
    MOVE ' ' TO X_OBJCONT-LINE.
    APPEND X_OBJCONT.
    Specific header (Dependent on the object type, here RAW)
    REFRESH X_OBJHEAD.
    DESCRIBE TABLE X_OBJCONT LINES RAW_HEAD-RAWSIZ.
    MOVE RAW_HEAD TO X_OBJHEAD.
    APPEND X_OBJHEAD.
    *RECEIVERS table
    CLEAR X_RECEIVERS.
    REFRESH X_RECEIVERS.
    MOVE RECEIVER TO X_RECEIVERS-RECNAM. " Name
    MOVE 'B' TO X_RECEIVERS-RECESC. " Receiver type
    MOVE 'X' TO X_RECEIVERS-SNDCP. " Send as a copy
    MOVE 'X' TO X_RECEIVERS-SNDEX. " EXPRESS DOCUMENT
    APPEND X_RECEIVERS.
    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    folder_id = 'OUTBOX'
    forwarder = x_forwarder
    object_fl_change = x_object_fl_change
    OBJECT_HD_CHANGE = X_OBJECT_HD_CHANGE
    object_id = x_object_id
    OBJECT_TYPE = X_OBJECT_TYPE
    OUTBOX_FLAG = 'X'
    OWNER = SY-UNAME
    store_flag = x_store_flag
    importing
    object_id_new = x_object_id_new
    sent_to_all = x_sent_to_all "May need to use
    TABLES
    OBJCONT = X_OBJCONT
    OBJHEAD = X_OBJHEAD
    objpara = x_objpara
    objparb = x_objparb
    RECEIVERS = X_RECEIVERS.
    REPORT ZTUNIXMAIL.
    DATA : TO_ADDRESS LIKE SY_LISEL,
    FROM_ADDRESS LIKE SY-LISEL,
    SUBJECT LIKE SY-LISEL,
    ATTACHMENT_NAME LIKE SY_LISEL,
    DATA_FILE_PATH LIKE SXPGCOLIST-PARAMETERS,
    BODY_FILE_PATH LIKE SXPGCOLIST-PARAMETERS.
    DATA : BEGIN OF INT_EMAIL_ATTACH OCCURS 0,
    TXTLINE CHAR(255),
    END OF INT_EMAIL_ATTACH.
    DATA : BEGIN OF INT_EMAIL_BODY OCCURS 0,
    TXTLINE CHAR(255),
    END OF INT_EMAIL_BODY.
    CLEAR : INT_EXEC_PROTOCOL,INT_EMAIL_ATTACH,INT_EMAIL_BODY.
    REFRESH : INT_EXEC_PROTOCOL,INT_EMAIL_ATTACH,INT_EMAIL_BODY.
    INT_EMAIL_ATTACH-TXTLINE = 'Put all attachment text in this table'.
    APPEND INT_EMAIL_ATTACH. CLEAR INT_EMAIL_ATTACH.
    INT_EMAIL_BODY-TXTLINE = 'Put all attachment text in this table'.
    APPEND INT_EMAIL_BODY. CLEAR INT_EMAIL_BODY.
    CONCATENATE TO_ADDRESS
    FROM_ADDRESS
    SUBJECT
    BODY_FILE_PATH
    DATA_FILE_PATH
    ATTACHMENT_NAME
    INTO V_PARAMETERS.
    IF NOT INT_EMAIL_ATTACH[] IS INITIAL.
    OPEN DATASET DATA_FILE_PATH FOR OUTPUT IN TEXT MODE.
    LOOP AT INT_EMAIL_ATTACH.
    TRANSFER INT_EMAIL_ATTACH-TXTLINE TO DATA_FILE_PATH.
    ENDLOOP.
    CLOSE DATASET DATA_FILE_PATH.
    ENDIF.
    IF NOT INT_EMAIL_BODY[] IS INITIAL.
    OPEN DATASET BODY_FILE_PATH FOR OUTPUT IN TEXT MODE.
    LOOP AT INT_EMAIL_BODY.
    TRANSFER INT_EMAIL_BODY-TXTLINE TO BODY_FILE_PATH.
    ENDLOOP.
    CLOSE DATASET BODY_FILE_PATH.
    ENDIF.
    CALL FUNCTION 'SXPG_CALL_SYSTEM'
    EXPORTING
    COMMANDNAME = 'Z_EMAIL' - Command calling unix script
    PARAMETERS = V_PARAMETERS
    importing
    status = ''
    TABLES
    EXEC_PROTOCOL = INT_EXEC_PROTOCOL
    EXCEPTIONS
    NO_PERMISSION = 1
    COMMAND_NOT_FOUND = 2
    PARAMETERS_TOO_LONG = 3
    SECURITY_RISK = 4
    WRONG_CHECK_CALL_INTERFACE = 5
    PROGRAM_START_ERROR = 6
    PROGRAM_TERMINATION_ERROR = 7
    X_ERROR = 8
    PARAMETER_EXPECTED = 9
    TOO_MANY_PARAMETERS = 10
    ILLEGAL_COMMAND = 11
    OTHERS = 12.
    regards,
    srinivas
    <b>*Reward points for useful answers*</b>

  • Problem passing a table parameter in rfc call using the function control

    I try to pass a Table as parameter to a Function Module using the SAP.Functions library (part of SAP frontend controls) from a Visual Basic (VBA) program.
    The function module has been verified to work when invoked from SAP FrontEnd Function Builder.
    The SAP RFC Control is created with
    Set sapFunctions=CreateObject("SAP.Functions")
    Following code snippet shows how I attempt to set exports and add a table row before calling the function module:
    sapFunctions.Connection = sapConnection
    Set sapMaterialUpd = sapFunctions.Add("Z_SD_BAPI_SALES_DATA_UPD")
    With sapMaterialUpd
    <i>'set exports</i>
         .Exports("PA_GLPUPDLEVEL") = "S"
         .Exports("PA_VKORG") = "FI14"
    <i>'append table row</i>
         .Tables("IT_SALES_DATA_UPD").AppendRow
         .Tables("IT_SALES_DATA_UPD")(1, "VKORG") = "FI14"
         .Tables("IT_SALES_DATA_UPD")(1, "MATNR") = "W_3100"
         .Tables("IT_SALES_DATA_UPD")(1, "DATBI") = "99991231"
         .Tables("IT_SALES_DATA_UPD")(1, "DATAB") = "20041231"
         .Tables("IT_SALES_DATA_UPD")(1, "KBETR") = "2222"
         .Tables("IT_SALES_DATA_UPD")(1, "KONWA") = "EUR"
    End With
    <i>'call the function module</i>
    If sapMaterialUpd.Call() = True Then
        <i>'do something with the return tables here...</i>Else
        Debug.Print sapMaterialUpd.Exception
    End If
    The Call() returns <b>FALSE</b> and the exception is <b>"SYSTEM_FAILURE"</b>. The connection also resets.
    The local logfile that the control generates shows that an exception occurs at the point of the call:
    <i>10.02.2005  17:54:20.766 Packing Parameters for Z_SD_BAPI_SALES_DATA_UPD
    Packing Parameter PA_GLPUPDLEVEL.
    Packing Parameter PA_VKORG.
    Packing Table 0.
    Packing Table 1.
      10.02.2005  17:54:20.766 *** Calling  RFC Function 'Z_SD_BAPI_SALES_DATA_UPD'
      10.02.2005  17:54:20.986 RFC CALL status = RFC_SYS_EXCEPTION
      10.02.2005  17:54:20.986 RFC Error: RFC_IO27
      -Status:CODE=CM_DEALLOCATED_NORMAL STATUS=CM_NO_STATUS_RECEIVED DATA=CM_COMPLETE_DATA_RECEIVED ID=69415076
      -Message:connection closed
      -Internal Status:IO HANDLE=23 DRV=EXT LINE=1420 CODE=27 : GET ID=ffff LINE=861 CODE=7
      10.02.2005  17:54:20.986 Function call finished.</i>
    Seen next code snippet. If the Table object is not touched, the function call goes through without any problems:
    sapFunctions.Connection = sapConnection
    Set sapMaterialUpd = sapFunctions.Add("Z_SD_BAPI_SALES_DATA_UPD")
    With sapMaterialUpd
    'set exports
        .Exports("PA_GLPUPDLEVEL") = "S"
        .Exports("PA_VKORG") = "FI14"
        'do <b>not</b> append a table row, for testing only ;-)</b>
    End With
    <i>'call the function module</i>
    If sapMaterialUpd.Call() = True Then
    <i>    'do something with the return tables here...</i>
    Else
        Debug.Print sapMaterialUpd.Exception
    End If
    This code works perfectly when calling the function. It returns TRUE and behaves normally. The function module returns descriptive response text in a table telling that the table was empty, according to the BAPI implementation.
    So is there something special needed here <i>after</i> appending the table row and <i>before</i> making the Call to properly attach the table as a parameter for the function module?
    Can this be a bug in the SAP RFC Control? The version of the wdtfuncs.ocx is 6206.6.45.54.
    Any hints are welcome!

    hi All partner,
    who solved this problem , I meet it too and
    can't clear it.
    SAPfunc := sapfunctions1.Add('z_get_sfcs_dn_mo');    
    SAPitab := sapfunc.tables.item ('I_DNMO');
    SAPitab.appendrow;                                       SAPitab.value(1,'MANDT') := '220'; 
    SAPitab.Value(1,'VBELN') := '2150000001';
    SAPitab.Value(1,'POSNR') := '50';
    SAPitab.value(1,'MATNR') := '19-99999-00'; 
    SAPitab.value(1,'AUFNR') := '921241512001';
    SAPitab.value(1,'DEDAT') := '2005/09/09';
    SAPitab.value(1,'LFIMG') := '100';  
    IF  SAPfunc.call = true then
      begin
      end
    else
        begin
        showmessage('call fail!!') ;
        end;
    end;
    RFC source code as below
    FUNCTION z_get_sfcs_dn_mo.
    ""Local interface:
    *"  TABLES
    *"      I_DNMO STRUCTURE  ZDN_MO
      data: wa type zdn_mo.
      LOOP AT i_dnmo.
        wa-mandt = i_dnmo-mandt.
        wa-vbeln = i_dnmo-vbeln.
        wa-posnr = i_dnmo-posnr.
        wa-matnr = i_dnmo-matnr.
        wa-aufnr = i_dnmo-aufnr.
        wa-dedat = i_dnmo-dedat.
        wa-lfimg = i_dnmo-lfimg.
       modify  zdn_mo from wa.
        insert into zdn_mo values wa.  --dump at here
        commit work.
      ENDLOOP.
    T/C: ST22 error message say at
      insert into zdn_mo values wa. ---dump at here
    the sapfunc.call returns fail.
    Message was edited by: jorry wang

  • IISproxy problem: Edit locally - check in

    Hi all EP freaks,
    I have with succes implemented th IISproxy filter so I now can access the portal through the IIS(version 5.0).
    I have som excel files that are being edited with the "Edit locally" function. This works fine (excel opens up and I can edit the data locally) but when I afterworth will "Check In" the modified documents the system "hangs". On the client the normal "copy file windows window" showing "Copyied 140% and still not finished... This wil go on for ever so I click cancel and the modified excelfile is'nt updated through the portal.
    THIS WORK FINE BEFORE I IMPLEMENTED THE IISproxy module...
    In the IISproxy log file i have:
    18:02:47   4400 Proxy    | POST http://server01.domain.local:50100/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fTEST!2fManager!2fTESTMAPPE!2fDocuments!2fcom.sap.km.AdminExplorer_2/dok | HTTP/1.1 200 OK | 0.000 | 0.078
    18:02:48   4400 Proxy    | GET http://server01.domain.local:50100/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/etc/docservice/docservice.cab | HTTP/1.1 304 Not Modified | 0.000 | 0.046
    18:02:49   4400 SAP    E NiRawOutStream::RawWrite(): NiRawWrite( NI-1 ) failed: -6 (NIECONN_BROKEN)
    18:02:49   4400 Proxy  E ProxyImpl::ProcessBody(): IOException: NiRawOutStream::RawWrite(): NiRawWrite( NI-1 ) failed: -6 (NIECONN_BROKEN)
         at SapConnection.cpp:331
    18:02:49   4400 Proxy  E Failed to send request body.
    Please help me
    Best regards
    Lars Bregnedal

    Please try also the following settings:
    use-continue=false
    keep-alive=false
    close-socket=true
    These were reported by SAP support as the recommended settings for customer having problems with Local Editing and IIS Proxy.
    ActiveX is for Windows only, Java Applet can be used also on other platforms. To use the Java Applet uncheck ActiveX, select "Java Applet" and set the version to "1.3" even if running 1.4 (again a recommendation from SAP support).
    If it still doesn't work, you should check that your Java Plug-In actually works. Here is a link I always use to check that the Java Plug-In works:
    http://www.java.com/en/download/help/testvm.jsp

  • Capturing line items in the routine-mail order sending problem

    Hi
    I am sending Sales Order Output to the Email.
    I have configured the output type Using Option 'External Send' Option.
    But the Problem is Whenever there are blocks for Sales Order Email Should not be send.
    1.    When there is a block in Sales Order Header, then no email should be sent.
    2.    Similary when there is a block Sales Order Item , then no email should be sent.
    There is some standard routine attached to Outputtype Procedures .
    First Condition we can met using routine, in the routine if the block is there , then no output will
    be triggered.
    But in the same routine we couldn't able to capture item level data to validate the second condition.
    If anybody is having the idea to validate second condition, Please help me.
    Thanks&Regards
    (YUGANDHAR.P)

    hi check this simple example which is sending the sales order email........
    TABLES: ekko.
    PARAMETERS: p_email   TYPE somlreci1-receiver .
    TYPES: BEGIN OF t_ekpo,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
    END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
          wa_ekpo TYPE t_ekpo.
    TYPES: BEGIN OF t_charekpo,
      ebeln(10) TYPE c,
      ebelp(5)  TYPE c,
      aedat(8)  TYPE c,
      matnr(18) TYPE c,
    END OF t_charekpo.
    DATA: wa_charekpo TYPE t_charekpo.
    DATA:   it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    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,
            gd_error    TYPE sy-subrc,
            gd_reciever TYPE sy-subrc.
    *START_OF_SELECTION
    START-OF-SELECTION.
      Retrieve sample data from table ekpo
      PERFORM data_retrieval.
      Populate table with detaisl to be entered into .xls file
      PERFORM build_xls_data_table.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Populate message body text
      perform populate_email_message_body.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_message
                                          it_attach
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'XLS'
                                          'filename'
                                 changing gd_error
                                          gd_reciever.
      Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM initiate_mail_execute_program.
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp aedat matnr
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekpo.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  BUILD_XLS_DATA_TABLE
          Build data table for .xls document
    FORM build_xls_data_table.
      data: ld_store(50) type c.  "Leading zeros
      CONSTANTS: con_cret(5) TYPE c VALUE '0D',  "OK for non Unicode
                 con_tab(5) TYPE c VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
       con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
       con_cret type c value cl_abap_char_utilities=>CR_LF.
      CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR' INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
      LOOP AT it_ekpo INTO wa_charekpo.
    *Modification to retain leading zeros
      inserts code for excell REPLACE command into ld_store
      =REPLACE("00100",1,5,"00100")
        concatenate '=REPLACE("' wa_charekpo-ebelp '",1,5,"'
                                 wa_charekpo-ebelp '")' into ld_store .
      concatenate ld_store into .xls file instead of actual value(ebelp)
        CONCATENATE wa_charekpo-ebeln ld_store  wa_charekpo-aedat wa_charekpo-matnr  INTO it_attach SEPARATED BY con_tab.
        CONCATENATE con_cret it_attach  INTO it_attach.
        APPEND  it_attach.
      ENDLOOP.
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables pit_message
                                              pit_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.
      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[] = pit_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.
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    FORM initiate_mail_execute_program.
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
           Populate message body text
    form populate_email_message_body.
      REFRESH it_message.
      it_message = 'Please find attached a list test ekpo records'.
      APPEND it_message.
    endform.           
    regards,
    venkat

Maybe you are looking for