Send mail to non-sap using bapi's

hi friends,
Can any one please help me how to send mail from sap to non-sap systems using bapi's.plesae help me .i want the procedure and code
regards
srikanth.v

Hi,
   Use this sample Code...
REPORT ZSENDMAIL.
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: TAB_LINES LIKE SY-TABIX.
Creation of the document to be sent
File Name
DOC_CHNG-OBJ_NAME = 'SENDFILE'.
Mail Subject
DOC_CHNG-OBJ_DESCR = 'Send External Mail'.
Mail Contents
OBJTXT = 'Minimum bid : $250000'.
APPEND OBJTXT.
OBJTXT = 'A representation of the pictures up for auction'.
APPEND OBJTXT.
OBJTXT = 'was included as attachment.'.
APPEND OBJTXT.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
Creation of the entry for the compressed document
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
Creation of the document attachment
(Assume that the data in OBJBIN is in BMP format)
*OBJBIN = ' \O/ '. APPEND OBJBIN.
*OBJBIN = ' | '. APPEND OBJBIN.
*OBJBIN = ' / \ '. APPEND OBJBIN.
*DESCRIBE TABLE OBJBIN LINES TAB_LINES.
*OBJHEAD = 'PICTURE.BMP'.
*APPEND OBJHEAD.
Creation of the entry for the compressed attachment
*OBJPACK-TRANSF_BIN = 'X'.
*OBJPACK-HEAD_START = 1.
*OBJPACK-HEAD_NUM = 1.
*OBJPACK-BODY_START = 1.
*OBJPACK-BODY_NUM = TAB_LINES.
*OBJPACK-DOC_TYPE = 'BMP'.
*OBJPACK-OBJ_NAME = 'PICTURE'.
*OBJPACK-OBJ_DESCR = 'Representation of object 138'.
*OBJPACK-DOC_SIZE = TAB_LINES * 255.
*APPEND OBJPACK.
Completing the recipient list
RECLIST-RECEIVER = '[email protected]'.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
*RECLIST-RECEIVER = 'SAPUSERNAME'.
*RECLIST-REC_TYPE = 'P'.
*APPEND RECLIST.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
CASE SY-SUBRC.
WHEN 0.
WRITE: / 'Result of the send process:'.
LOOP AT RECLIST.
WRITE: / RECLIST-RECEIVER(48), ':'.
IF RECLIST-RETRN_CODE = 0.
WRITE 'The document was sent'.
ELSE.
WRITE 'The document could not be sent'.
ENDIF.
ENDLOOP.
WHEN 1.
WRITE: / 'No authorization for sending to the specified number',
'of recipients'.
WHEN 2.
WRITE: / 'Document could not be sent to any recipient'.
WHEN 4.
WRITE: / 'No send authorization'.
WHEN OTHERS.
WRITE: / 'Error occurred while sending'.
ENDCASE.
in this code....Internal table IF RECLIST-RETRN_CODE is not 0,then the mail is not send to the recipient, so if you want the undeliverable mail for a perticular recipient then call the same function module SO_NEW_DOCUMENT_ATT_SEND_API1 with undeliverd message to whom want to receive the undeliverd message.
hope this solves your problem

Similar Messages

  • How to send mails to multiple recipents using SO_DOCUMENT_SEND_API

    Hi ,
    I am using the FM "SO_DOCUMENT_SEND_API".
    I am able to send an Excel sheet as attachement, but my requirement is to send multiple mails to the corresponding persons. I tried using coma, colan, semi colan as the separator in the import parameter SENDER_ADDRESS for two different mail id's but it was not useful.
    I need to send mails to multiple recipens using the same FM. (keeping one person in to list and two of the persons in CC.)
    can any on throw some light on this. 
    Thanks
    rewards will be great.....................................

    Hi,
    The code below demonstrates how to send an email to an external email address([email protected]),
    where the data is stored within a .xls attachment.
    Instead of the statement, <b>PARAMETERS: p_email   TYPE somlreci1-receiver
                                      DEFAULT '[email protected]'.</b>,
      use select-options & give the e-mail addresses that you want.
    *& Report  ZEMAIL_ATTACH                                               *
    *& Example of sending external email via SAPCONNECT                    *
    REPORT  ZEMAIL_ATTACH                   .
    TABLES: ekko.
    PARAMETERS: p_email   TYPE somlreci1-receiver
                                      DEFAULT '[email protected]'.
    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.
      CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
                 con_tab TYPE x 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.
        CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
                    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.                    " POPULATE_EMAIL_MESSAGE_BODY
    Hope this helps.
    Reward if helpful.
    Regards,
    Sipra

  • Call rfc sender adapter from non-sap systems

    Hi,
    is ist possible to connect to an rfc sender adapter from non-sap systems? I want to use the the RFC-Connector from http://rfcconnector.com, but in the client connect options there is no way to specify the program id.
    Best regards,
    Daniel

    hi,
    you don't need to use RFC type T (with program ID) - you can use whole connection string - just like in the example:
    http://www.rfcconnector.com/documentation/examples/client/#functioncall
    so just specify: host system number etc.
    it should work like that - but let me know as I don't know this RFC connector
    Regards,
    Michal Krawczyk

  • Encrypt data send from a non-SAP system to ECC.

    Hi,
    We are tryign to encrypt the credit card details send from web (non-sap system) via a xml file to ECC.
    From Basis side, I have exported the public key from the ECC for the web server to encrypt the CC details while sending via xml.
    The external web consultants encrypted the cc detail with the public key and send it via xml but that was not able to decrypt at the ECC side.
    The developers were using the FM 'CCARD_DEVELOPE'at ECC to decrypt the data in the xml file. It was saying SSF error: No data transfered.
    Meanwhile SAP CryptoLib is installed and credit card encryption/decryption is working fine for CC details entered via GUI interface.
    Is there anything I am missing out here to encrypt CC details send from a Non-SAP system to ECC.? Do we need to load the SAP cryptolib in the non-SAP system to ecrypt this data at the senders end. Or is there a alternate solution for this ?
    We are in ECC6.0/RHEL/Oracle10204.
    Appreciate your help.
    Thanks

    Hi Nelis,
    Thanks for your reply.
    This note does not get any information regarding encrypting data from a non-SAP system to SAp system.
    I am looking setup/information for encrypting data from a non-SAP system to SAP system.
    Thanks

  • Sending mail from one sap box to other sap box

    how  to send mail from one sap box to other sap box?

    Hi Pavan,
    To send mail Internally check this sample code.
    *& Report  ZMATURITYREPORT                                             *
    *&   Title - Maturity   report                                         *
    *& Module - FI                                                         *
    REPORT  ZMATURITYREPORT.
    tables: bseg.
    SELECTION SCREEN---------------------------------------------------  *
    parameters: p_email type somlreci1-receiver default
    '<b><email_removed_by_moderator></b>.
    Data: p_email(25) type c value <b><hardcoding_removed_by_moderator></b>.
    END OF SELECTION SCREEN -------------------------------------------  *
    --DATA DECLARATION--
    data: it_message type standard table of solisti1 initial size 0
    with header line.
    data: it_message1 type standard table of solisti1 initial size 0
    with header line.
    data: it_message2(10) type N.
    data: it_message3 type standard table of solisti1 initial size 0
    with header line.
    data: it_message4 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: text(150).
    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.
    data: lv_date type sy-datum.
    data: lv_date1 type sy-datum.
    data: lv_formatdate(10) type c.
    data: lv_formatdate1(10) type c.
    data: var1(4) type c,
    var2(2) type c,
    var3(2) type c.
    data: begin of int_bseg occurs 0,
        BELNR LIKE BSEG-BELNR,
        ZUONR LIKE BSEG-ZUONR,
        GJAHR LIKE BSEG-GJAHR,
        DMBTR LIKE BSEG-DMBTR,
        HKONT LIKE BSEG-HKONT,
    end of int_bseg.
    data: begin of int_SKAT occurs 0,
        TXT50 LIKE SKAT-TXT50,
        SAKNR LIKE SKAT-SAKNR,
        KTOPL LIKE SKAT-KTOPL,
    end of int_SKAT.
    data: begin of int_bkpf occurs 0,
          BELNR LIKE BKPF-BELNR,
          BUKRS LIKE BKPF-BUKRS,
          GJAHR LIKE BKPF-GJAHR,
          BUDAT  LIKE BKPF-BUDAT,
    end of int_BKPF.
    data: 2days_out type sy-datum.
    2days_out = sy-datum + 2.
    data: var4(4) type c,
    var5(2) type c,
    var6(2) type c.
    -- END OF DATA DECLARATION--
    --- CONCATENATING AND ARRANGING DATE -
    lv_date = 2days_out.
    var1 = lv_date+(4).
    var2 = lv_date+4(2).
    var3 = lv_date+6(2).
    concatenate var3 var2 var1 into lv_formatdate separated by '.'.
    --- END OF CONCATENATING AND ARRANGING DATE  -
    --SELECTION FOR BSEG--
    select zuonr belnr bukrs GJAHR DMBTR HKONT from bseg into
    corresponding fields of  table int_bseg
    where bukrs = 'company name' and
          ZUONR = lv_formatdate.
    *--END OF SSELECTION FOR BSEG--
    --SELECTION FOR BKPF--
    select  BUDAT BUKRS BELNR GJAHR  from BKPF into
    corresponding fields of table int_BKPF
    where bukrs = 'company name'.
    append int_BKPF.
    --END OF SELECTION FOR BKPF--
    --SELECTION FOR SKAT--
    select SAKNR TXT50 from SKAT into
    corresponding fields of  table int_SKAT
    where KTOPL = 'company name'.
    *and      SAKNR = INT_BSEG-HKONT.
    APPEND INT_SKAT.
    *--END OF SSELECTION FOR SKAT--
    ----POPULATING EMAIL SUBJECT -
    perform populate_email_message_body.
      perform send_file_as_email_attachment
      tables it_message
      it_attach
      using p_email
      'Maturity after 2 days'
      'XLS'
      'filename'
      changing gd_error
      gd_reciever.
    Instructs mail send program for SAPCONNECT to send email(rsconn01)
      perform initiate_mail_execute_program.
    *endif.
    end-of-selection.
    ----END OF POPULATING EMAIL SUBJECT -
    *& 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.
    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
          object_header              = t_object_header
          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
    *& Form INITIATE_MAIL_EXECUTE_PROGRAM
    Instructs mail send program for SAPCONNECT to send email.
    form initiate_mail_execute_program.
      wait up to 2 seconds.
      if gd_error eq 0.
        submit rsconn01 with mode = 'INT'
                      with output = 'X'
                      and return.
      endif.
    endform.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *& Form POPULATE_EMAIL_MESSAGE_BODY
    Populate message body text
    form populate_email_message_body.
      refresh it_message.
      refresh it_message1.
      refresh it_message3.
       refresh it_message4.
    LOOP FOR BSEG -
      loop at int_BSEG.
    read table int_bKPF WITH KEY BELNR = INT_BSEG-BELNR
            GJAHR = INT_BSEG-GJAHR.
    read table int_SKAT WITH KEY SAKNR = INT_BSEG-HKONT.
    *-CHANGING DATE FORMAT FOR BKPF--
    lv_date1 = int_bkpf-budat.
      var4 = lv_date1+(4).
      var5 = lv_date1+4(2).
      var6 = lv_date1+6(2).
    concatenate var6 var5 var4 into lv_formatdate1 separated by '.'.
    *-END OF CHANGING DATE FORMAT FOR BKPF--
    it_message =  int_bseg-belnr.
    it_message1 =  lv_formatdate1.
    it_message2 = int_bseg-dmbtr.
    it_message3 = int_bseg-hkont.
    IT_MESSAGE4 = INT_SKAT-TXT50.
    SHIFT IT_MESSAGE2 LEFT DELETING LEADING '0'.
    POPULATING EMAIL BODY WITH DATA -
    concatenate 'Maturity After 2Days' 'for'  'G/L account-' it_message3
    '--' IT_MESSAGE4  ',' 'Amount-' it_message2
        into it_message separated by space.
    append it_message.
    append it_message1.
    append it_message3.
      clear it_message.
      clear it_message1.
      clear it_message2.
      clear it_message3.
    endloop.
    END OF LOOP FOR BSEG -
    endform. " POPULATE_EMAIL_MESSAGE_BODY
    To send an mail with external attachment check this one
    first create a Include report with the following coding
    *& Include ZPA1_INCLFOR_MAIL *
    Data
    DATA: docdata LIKE sodocchgi1,
    objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
    objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
    objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objhex LIKE solix OCCURS 10 WITH HEADER LINE,
    reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
    DATA: tab_lines TYPE i,
    doc_size TYPE i,
    att_type LIKE soodk-objtp.
    DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
    FORM
    FORM ml_customize USING objname objdesc.
    Clear Variables
    CLEAR docdata.
    REFRESH objpack.
    CLEAR objpack.
    REFRESH objhead.
    REFRESH objtxt.
    CLEAR objtxt.
    REFRESH objbin.
    CLEAR objbin.
    REFRESH objhex.
    CLEAR objhex.
    REFRESH reclist.
    CLEAR reclist.
    REFRESH listobject.
    CLEAR listobject.
    CLEAR tab_lines.
    CLEAR doc_size.
    CLEAR att_type.
    Set Variables
    docdata-obj_name = objname.
    docdata-obj_descr = objdesc.
    ENDFORM. "ml_customize
    FORM
    FORM ml_addrecp USING preceiver prec_type.
    CLEAR reclist.
    reclist-receiver = preceiver.
    reclist-rec_type = prec_type.
    APPEND reclist.
    ENDFORM. "ml_customize
    FORM
    FORM ml_addtxt USING ptxt.
    CLEAR objtxt.
    objtxt = ptxt.
    APPEND objtxt.
    ENDFORM. "ml_customize
    FORM
    FORM ml_prepare USING bypassmemory whatatt_type whatname.
    IF bypassmemory = ''.
    Fetch List From Memory
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = listobject
    EXCEPTIONS
    OTHERS = 1.
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'LIST_FROM_MEMORY'.
    ENDIF.
    CALL FUNCTION 'TABLE_COMPRESS'
    IMPORTING
    COMPRESSED_SIZE =
    TABLES
    in = listobject
    out = objbin
    EXCEPTIONS
    OTHERS = 1
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'TABLE_COMPRESS'.
    ENDIF.
    ENDIF.
    Header Data
    Already Done Thru FM
    Main Text
    Already Done Thru FM
    Packing Info For Text Data
    DESCRIBE TABLE objtxt LINES tab_lines.
    READ TABLE objtxt INDEX tab_lines.
    docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
    CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = 'TXT'.
    APPEND objpack.
    Packing Info Attachment
    att_type = whatatt_type..
    DESCRIBE TABLE objbin LINES tab_lines.
    READ TABLE objbin INDEX tab_lines.
    objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = att_type.
    objpack-obj_name = 'ATTACHMENT'.
    objpack-obj_descr = whatname.
    APPEND objpack.
    Receiver List
    Already done thru fm
    ENDFORM. "ml_prepare
    FORM
    FORM ml_dosend.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = docdata
    put_in_outbox = 'X'
    commit_work = 'X' "used from rel. 6.10
    IMPORTING
    SENT_TO_ALL =
    NEW_OBJECT_ID =
    TABLES
    packing_list = objpack
    object_header = objhead
    contents_bin = objbin
    contents_txt = objtxt
    CONTENTS_HEX = objhex
    OBJECT_PARA =
    object_parb =
    receivers = reclist
    EXCEPTIONS
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    OTHERS = 8
    IF sy-subrc <> 0.
    MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
    WITH docdata-obj_name.
    ENDIF.
    ENDFORM. "ml_customize
    FORM
    FORM ml_spooltopdf USING whatspoolid.
    DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
    Call Function
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
    src_spoolid = whatspoolid
    TABLES
    pdf = pdf
    EXCEPTIONS
    err_no_otf_spooljob = 1
    OTHERS = 12.
    Convert
    PERFORM doconv TABLES pdf objbin.
    ENDFORM. "ml_spooltopdf
    FORM
    FORM doconv TABLES
    mypdf STRUCTURE tline
    outbin STRUCTURE solisti1.
    Data
    DATA : pos TYPE i.
    DATA : len TYPE i.
    Loop And Put Data
    LOOP AT mypdf.
    pos = 255 - len.
    IF pos > 134. "length of pdf_table
    pos = 134.
    ENDIF.
    outbin+len = mypdf(pos).
    len = len + pos.
    IF len = 255. "length of out (contents_bin)
    APPEND outbin.
    CLEAR: outbin, len.
    IF pos < 134.
    outbin = mypdf+pos.
    len = 134 - pos.
    ENDIF.
    ENDIF.
    ENDLOOP.
    IF len > 0.
    APPEND outbin.
    ENDIF.
    ENDFORM. "doconv
    Then include that report in the following report and copy the same code and paste it there
    *& Report ZPA_TEMP147 *
    REPORT ZPA_TEMP147 .
    INCLUDE zpa1_inclfor_mail.
    DATA
    DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
    DATA : file_name TYPE string.
    data : path like PCFILE-PATH.
    data : extension(5) type c.
    data : name(100) type c.
    SELECTION SCREEN
    PARAMETERS : receiver TYPE somlreci1-receiver lower case.
    PARAMETERS : p_file LIKE rlgrap-filename
    OBLIGATORY.
    AT SELECTION SCREEN
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CLEAR p_file.
    CALL FUNCTION 'F4_FILENAME'
    IMPORTING
    file_name = p_file.
    START-OF-SELECTION
    START-OF-SELECTION.
    PERFORM ml_customize USING 'Tst' 'Testing'.
    PERFORM ml_addrecp USING receiver 'U'.
    PERFORM upl.
    PERFORM doconv TABLES itab objbin.
    PERFORM ml_prepare USING 'X' extension name.
    PERFORM ml_dosend.
    SUBMIT rsconn01
    WITH mode EQ 'INT'
    AND RETURN.
    FORM
    FORM upl.
    file_name = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = file_name
    filetype = 'BIN'
    TABLES
    data_tab = itab
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    OTHERS = 17.
    path = file_name.
    CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
    EXPORTING
    complete_filename = path
    CHECK_DOS_FORMAT =
    IMPORTING
    DRIVE =
    EXTENSION = extension
    NAME = name
    NAME_WITH_EXT =
    PATH =
    EXCEPTIONS
    INVALID_DRIVE = 1
    INVALID_EXTENSION = 2
    INVALID_NAME = 3
    INVALID_PATH = 4
    OTHERS = 5
    ENDFORM. "upl
    These are the FM for sending external email :-
    SO_DOCUMENT_SEND_API1
    SAPoffice: Send new document with attachments via RFC
    SO_NEW_DOCUMENT_ATT_SEND_API1
    (In 4.6C only, You can go to SE37 and click the documentation on how to use it. A sample program is provided there.)
    SAPoffice: Send new document with attachments via RFC
    Note : If you are using FM SO_NEW_DOCUMENT_ATT_SEND_API1 then Export Parameter DOCUMENT_DATA-OBJ_DESCR contains the Subject.
    SO_NEW_DOCUMENT_SEND_API1
    SAPoffice: Send new document
    Check this sample report
    DATA : BEGIN OF ITAB OCCURS 0,
    PERNR LIKE PA0001-PERNR,
    ENAME LIKE PA0001-ENAME,
    END OF ITAB.
    DATA: message_content LIKE soli OCCURS 10 WITH HEADER LINE,
    receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,
    packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,
    listobject LIKE abaplist OCCURS 10,
    compressed_attachment LIKE soli OCCURS 100 WITH HEADER LINE,
    w_object_hd_change LIKE sood1,
    compressed_size LIKE sy-index.
    START-OF-SELECTION.
    SELECT PERNR ENAME
    INTO CORRESPONDING FIELDS OF TABLE ITAB
    FROM PA0001
    WHERE PERNR < 50.
    LOOP AT ITAB.
    WRITE :/02 SY-VLINE , ITAB-PERNR, 15 SY-VLINE , ITAB-ENAME, 50
    SY-VLINE.
    ENDLOOP.
    Receivers
    receiver_list-recextnam = '[email protected]'. "-->
    EMAIL ADDRESS
    RECEIVER_list-RECESC = 'E'. "<-
    RECEIVER_list-SNDART = 'INT'."<-
    RECEIVER_list-SNDPRI = '1'."<-
    APPEND receiver_list.
    General data
    w_object_hd_change-objla = sy-langu.
    w_object_hd_change-objnam = 'Object name'.
    w_object_hd_change-objsns = 'P'.
    Mail subject
    w_object_hd_change-objdes = 'Message subject'.
    Mail body
    APPEND 'Message content' TO message_content.
    Attachment
    CALL FUNCTION 'SAVE_LIST'
    EXPORTING
    list_index = '0'
    TABLES
    listobject = listobject.
    CALL FUNCTION 'TABLE_COMPRESS'
    IMPORTING
    compressed_size = compressed_size
    TABLES
    in = listobject
    out = compressed_attachment.
    DESCRIBE TABLE compressed_attachment.
    CLEAR packing_list.
    packing_list-transf_bin = 'X'.
    packing_list-head_start = 0.
    packing_list-head_num = 0.
    packing_list-body_start = 1.
    packing_list-body_num = sy-tfill.
    packing_list-objtp = 'ALI'.
    packing_list-objnam = 'Object name'.
    packing_list-objdes = 'Attachment description'.
    packing_list-objlen = compressed_size.
    APPEND packing_list.
    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    object_hd_change = w_object_hd_change
    object_type = 'RAW'
    owner = sy-uname
    TABLES
    objcont = message_content
    receivers = receiver_list
    packing_list = packing_list
    att_cont = compressed_attachment.
    Settings for sending mail
    Configuring SAP 4.6x Internet mail Gateway
    SAP can be configured to send and receive emails from different sources.This section explains how to integrate SAPOffice with an external emailsystem. Your Internet email must be configured and running prior to this.Email from SAP is forwarded to the users external email system..
    You can configure inbound and outbound forwarding. Outbound flow forwardsa SAP message (eg: update termination) via UNIX sendmail to the intended recepient. Inbound accepts a message from sendmail and places it in the users SAPOffice inbox. Many companies prefer to configure outbound only.
    Configuring outbound forwarding
    SAP configuration
    1. Create your RFC destination for outbound email using transaction SM59
    RFC Destination : SAP_INTERNET_GATEWAY
    Connection Type : T
    Description : SAP internet mail gateway
    Click on 'Explicit Host' if you wanton demand gateway dameon invocation.
    Program : /sapmnt/SID/exe/mlunxsnd
    Target Host : Enter hostname that runs your central instance.
    Click 'Test Connection' and you should seea successfull message.
    2. Shared Office Settings transaction SO16-> Send -> Settings or
    directly via transaction SCOT- SAPconnect Administation
    Nodes - Create
    Node : IMAIL
    Description : SAP internet mail gateway
    RFC Destination : SAP_INTERNET_GATEWAY
    Tick : Internet
    Address Area : *
    Tick : All formats
    Dev. type : Choose an approciate Printer Device
    Set further addresstype : N
    Maximum waiting timefor repeat send attempt procedure : Blank or decide for yourself
    Tick : Node is ready for use
    Setting
    - DefaultDomain : <your company domain>.com
    - Conversionrule : require if your communication device only support one format.
    e.g. if you email system only support the format RAW (ASCII text format)
    Format To Format Ranking Function module
    ALI RAW 1 SX_OBJECT_CONVERT_ALI_RAW (convert APAP List)
    Referto note 171698 - SAPconnect: Formats, conversion, device type
    UNIX configuration
    1 .. cd /sapmnt/SID/exe
    2 ..csh
    ..mlsomadm mailgw.ini
    System Name [C11] :
    Client [000] :
    Username : MAILADM
    Password : MAILADM
    Language : E
    Load Balancing :
    Hostname : <hostname>
    System number : <instance_number>
    Gateway hostname: <central_instance_hostname>
    Gateway Service : <instance number>
    Use SAP Router :
    Trace level :
    Sendmail Command [/usr/lib/sendmail -i -f<SENDER_ADDRESS>]:
    Codepage [ISO-8859-1] :
    Trace Level (Outbound) [0] :
    Update file sapmailsid.cfg? [Y]
    Testing whether your configuration is successful
    1. Logon to SAP
    2. Execute transaction SO01
    3. Write a message and send it to <your_internet_email_address>
    4. If you don't see the mail in your internet mailbox, go back and review steps 1-12
    Schedule the SAP Internet Mail Gateway Jobs to start every 5 minutes
    1. Create
    2. Position your cursor at INT
    3. Click Schedule and supply the date and time
    4. Click Schedule periodically and tick Minutes and type in 5
    5. Click Create and you are done
    6. Click Show Scheduling to check
    Problems that you might encounter :-
    If you have set up a node in SCOT and it tests out well but recieve the reply.
    "Cannot process message in node, parameterscannot be converted".
    Make sure the RFC connection is working, and that SapConnect has been installed on the Unix Server or the Microsoft Exchange Server. Originally, I had the same error, and found that nothing had been installed on Unixor Exchange, to support SapConnect.
    In SCOT (View -> System Status), your mail remains at the Intransit column.
    Check you sendmail.cf files (e.g.Sun Solaris /etc/mail/sendmail.cf). Try using the sendmail command to send a test file at the Unix level. You must be able to send mail at theUnix level before you can send mail at the SAP level.
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/700b405bacdd5fe10000000a155106/content.htm
    http://www.tamboly.com/SAPEmailConfiguration.html
    Check my previous links
    Mail Send
    sending mails from abap program
    Mail Sending to external email id's
    settings needed for sending emails
    <b><points_request_removed_by_moderator></b>
    Cheers,
    CHAITANYA.

  • How to send mail in PL/SQL using exchange server details.

    Hi Experts,
    Business user has provided us the exchange server details to send mails.How can I send mails thru PL/SQL using exchange server details.

    user595740 wrote:
    Business user has provided us the exchange server details to send mails.How can I send mails thru PL/SQL using exchange server details.Basic answer - not easily.
    Oracle supports the standard application protocol SMTP - it does not support a proprietary protocol like that used by Exchange that only works on the Windows operating system. It however provides you with the flexibility to code this yourself.
    If you for example use Microsoft MAPI (Mail Application Programming Interface), you can integrate it with PL/SQL using the external procedure (extproc) feature of Oracle.
    In a nutshell, extproc enables you to create PL/SQL wrappers for public DLL calls. I posted sample code that demonstrates this in {message:id=2271919}. The sample code is for calling a DLL interface on HP-UX, but the concept is identical on Windows.

  • How to send mail in  HTML  format using SMTP

    I want to send mail in HTML format using SMTP.Can anybody please suggest how to do it.Can anybody send me the code.
    Thnx.

    If you don't know how to send a message using JavaMail see here : http://developer.java.sun.com/developer/onlineTraining/JavaMail/contents.html#JavaMailSending
    To send a html format mail you need to set the content type like this (msg is a javax.mail.internet.MimeMessage) :
    String subject = "An Email 4 U";
    String message = "<HTML><BODY>Here is a link<br><a href='http://javasoft.com'>Java</a></BODY></HTML>";
    msg.setSubject(subject);
    msg.setContent(message, "text/html");p.s This isn't really an advanced topic

  • Sending mail from one Sap system to another

    Hi all,
    plz explain me how can i send mail from one SAP system to other SAP system.
    Thanks in advance
    Venkat

    Hai Venkat
    Go through the following Code
    DATA: OBJPACK   LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
      DATA: OBJHEAD   LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
      DATA: OBJBIN    LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
      DATA: OBJTXT    LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
      DATA: RECLIST   LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
      DATA: DOC_CHNG  LIKE SODOCCHGI1.
      DATA: TAB_LINES LIKE SY-TABIX.
      DATA L_NUM(3).
    Creation of the document to be sent
    File Name
      DOC_CHNG-OBJ_NAME = 'SENDFILE'.
    Mail Subject
      DOC_CHNG-OBJ_DESCR = 'Delivered Mail'.
    Mail Contents
      OBJTXT = 'Object text'.
      APPEND OBJTXT.
      DESCRIBE TABLE OBJTXT LINES TAB_LINES.
      READ TABLE OBJTXT INDEX TAB_LINES.
      DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    Creation of the entry for the compressed document
      CLEAR OBJPACK-TRANSF_BIN.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 0.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TAB_LINES.
      OBJPACK-DOC_TYPE = 'RAW'.
      APPEND OBJPACK.
    Creation of the document attachment
      LOOP AT ITAB_DATA.
        CONCATENATE ITAB_DATA-PRODUCTOR
                    ITAB_DATA-VBELN
                    ITAB_DATA-POSNR
                    ITAB_DATA-MATNR INTO OBJBIN.
        APPEND OBJBIN.
      ENDLOOP.
      DESCRIBE TABLE OBJBIN LINES TAB_LINES.
      OBJHEAD = 'ORDERS'.
      APPEND OBJHEAD.
    Creation of the entry for the compressed attachment
      OBJPACK-TRANSF_BIN = 'X'.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM   = 1.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM   = TAB_LINES.
      OBJPACK-DOC_TYPE   = 'TXT'.
      OBJPACK-OBJ_NAME   = 'WEBSITE'.
      OBJPACK-OBJ_DESCR  = 'ORDERS.TXT'.
      OBJPACK-DOC_SIZE   = TAB_LINES * 255.
      APPEND OBJPACK.
    Completing the recipient list
    target recipent
      clear RECLIST.
      RECLIST-RECEIVER = '[email protected]'.
      RECLIST-EXPRESS  = 'X'.
      RECLIST-REC_TYPE = 'U'.
      APPEND RECLIST.
    copy recipents
      clear RECLIST.
      RECLIST-RECEIVER = '[email protected]'.
      RECLIST-EXPRESS  = 'X'.
      RECLIST-REC_TYPE = 'U'.
      RECLIST-COPY     = 'X'.
      APPEND RECLIST.
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                DOCUMENT_DATA              = DOC_CHNG
           TABLES
                PACKING_LIST               = OBJPACK
                OBJECT_HEADER              = OBJHEAD
                CONTENTS_BIN               = OBJBIN
                CONTENTS_TXT               = OBJTXT
                RECEIVERS                  = RECLIST
           EXCEPTIONS
                TOO_MANY_RECEIVERS         = 1
                DOCUMENT_NOT_SENT          = 2
                OPERATION_NO_AUTHORIZATION = 4
                OTHERS                     = 99.
    Thanks & regards
    Sreenivasulu P

  • Can We send data from SAP to non SAP using ALE !

    In this case what will be the receiver side configuaration !
    What will be our receiver client !

    Hi,
    We can send SAP to Non-SAP system using ALE technology.
    Ex:-
    Business Connector, VB.NET system can be integrated using ALE technology over TCP/IP connection.
    Regards
    Vijayanand Poreddy

  • Sending mails to Internal SAP ID using SO_DOCUMENT_SEND_API1!!

    Hi
    I was trying to send mail using fm SO_DOCUMENT_SEND_API1 but why problem is the internal table that needs to be passed has (contets bin ) has only 255 chars ...
    but my data sets are huge and i need to send all of them in mail..so the remaining data is not getting reflected in the excel file....
    whats the way out?
    CONTENTS_BIN STRUCTURE  SOLISTI1 OPTIONAL
    Points for sure
    Regards
    Gunjan

    Hi,
    *& Report  ZTESTMAIL                                                   *
    REPORT  ZTESTMAIL                               .
    tables: bseg.
    parameters: p_email type somlreci1-receiver default
    '[email protected]'.
    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: begin of int_bseg occurs 0,
           zuonr like bseg-zuonr,
         end of int_bseg.
    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
    'Assignment Date after 2 days'
    '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 zuonr from bseg into corresponding  fields of int_bseg.
    endselect.
    DATA: begin of int_bseg1 occurs 0,
           zuonr1 like bseg-zuonr,
         end of int_bseg1.
    loop at int_bseg.
          int_bseg1-zuonr1 = int_bseg-zuonr.
    endloop.
    endform. " DATA_RETRIEVAL
    *& 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.
    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
    object_header = t_object_header
    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.
      if gd_error eq 0.
          submit rsconn01 with mode = 'INT'
                        with output = 'X'
                        and return.
      endif.
    endform.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *& Form POPULATE_EMAIL_MESSAGE_BODY
    Populate message body text
    form populate_email_message_body.
    refresh it_message.
    it_message = 'Assignment Date is coming After 2 Days Please check doc.'.
    append it_message.
    endform. " POPULATE_EMAIL_MESSAGE_BODY
    Reward if helpfull
    Regards,
    Nandha

  • Need to send cookie to non-SAP backend from URL iView

    Hi,
    I have a backend application which takes a cookie for
    (non-SAP) SSO purposes. I have created an URL iView
    in my EP 6.0 SP2 that correctly displays the content
    of that web page, i. e. the login screen.
    However, even when I have a cookie in my browser, it still
    displays that login screen, i. e. the cookie is either
    not sent or not recognized.
    I then created a simple test servlet on a backend server
    that prints the contents of all the HTTP headers. When
    I connect my browser directly to that page, I can see
    the cookie. When I connect my iView to that URL, I
    do not see the cookie. So apparently the iView does
    not send the cookie.
    As I learned, in EP 6.0 SP3 there is a "Fetch Mode"
    property for URL iViews which allow to define whether
    the URL in the URL iView should be retrieved by the
    server or the client. This seems to indicate that in
    SP2, always the server issues that request, which would
    explain why there is no cookie in the request (since only
    the browser holds these cookies). So I presume if I
    would use SP3 with Fetch-Mode set to Client, this might
    work. But then again, this fetch mode is not really
    encouraged by the documentation and only recommended
    if you are really desparate ...
    So the question basically is:
    - are my assumptions above correct?
    - is there a way to have the EP server send cookies to
      my backend systems with SP2?
    I'm a little puzzled that this doesn't work out of the
    box, since my understanding was that SAP SSO tokens are
    also transported to backend systems using cookies, and
    this is supposed to be on by default for EP. So I was
    expecting to see at least the SAP SSO tokens in all
    HTTP requests to backends. Apparently, the world is
    not that easy.
    Any insights would very much appreciated!
    Thanks,
    Matthias

    Additional thoughts:
    In general your assumptions are correct. When using client side fetch mode then the cookie should be forwarded, and I would not expect problems there. When using server side mode then the cookie domain changes and becomes the portal domain, and as a result the cookie is kept in the browser, but is a little useless. I'm not 100% familiar with how we solve this problem when using SSO2 cookie in server side. Yoav, can you elaborate ?
         The reason the documentation was not in favor of client side is because at the time the idea was to encourage the users to use the portal server cache. However, this seems less relevant now, because only the first request will be cached, but not the inner calls of the html page.
         Bottom line - I don't see any issue with using client side, and actually the default in FP is client side. So I would simply modify the iview to use it.

  • Sender Mail Adapter with SAP Conversion agent

    have some1 used SAP conversion agent on attchment from XI Sender Mail adapter?
    it seems to ignore the attchment of the e-mail
    the sender configuration module tab is as follows :
    1.localejbs/AF_Modules/PayloadSwapBean transform
    2.localejbs/sap.com/com.sap.nw.cm.xi/CMTransformBean CM
    3.sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean mail
    The paramters are
    transform swap.keyName Content-Disposition
    transform swap.keyName Content-Description
    transform swap.keyValue attachment
    transform swap.keyValue codeco
    CM TransformationName ZIM_CODECO_VALIDATIONS
    The Convesion Agnet runs prefectly when using the Conversion Agent engine
    thx,Shai Rosenzweig

    check with tis may helpful for you
    http://help.sap.com/saphelp_nw04/helpdata/en/43/4c38c4cf105f85e10000000a1553f6/frameset.htm
    Regds
    Abhishek

  • Sending IDoc from Non-SAP system to XI

    Dear all,
       We have a non sap system which needs to send IDoc to XI, Please could you answer my following four questions
    1. What should be the values for the following fields in the IDoc control record
    e.g. RCVPRN = <logical system name of XI>
    SNDPOR
    SNDPRT
    SNDPRN
    RCVPRT
    RCVPOR
    2. How does XI decide which port(idx1) to be used when it receives an idoc
    3. The third party system is a non sap one, so it does not have a client no, so I would assume, I need to use another SAP system as a meta data provider, in that case, how would i tell XI to use that port when it receives IDocs from the non-SAP system ?
    4. In what step does XI use the logical system name of the Business system(in SLD)?
    Thanks in advance
    cheers
    danus
    Edited by: Chidambaram Danus on Jan 25, 2008 2:21 PM

    Hi
    there is bit wrong interpretation of the statement
    If the sender system is a non-SAP system, the sender service is identified from the logical system name of the sender port.
    If the sender system is nonSAP it indicates taht the data is coming to XI from non sap systems such as file, database, webservice etc. to XI and from XI it will pass to sap as IDOC inbound.
    For this you need to create the logical system in SAP (receiver) and pass on that value to IDOC header.
    You could maintain it in the Business service used for Sender system (nonSAP). here it will be available in the tabs ---> History.
    note : IDOC is the concept of data container in SAP, you will not be able to have the IDOCs in non sap systems...
    Thanks
    Swarup
    Edited by: Swarup Sawant on Jan 25, 2008 2:54 PM

  • Sending mail from non-BT accounts

    I have email accounts with Apple (mobileMe), my own domain (hosted by Verio) and another of my own domains (hosted by Network Solutions) - as well as the BTinternet.com email account. 
    Until today, all four accounts were set up on my email client (Apple Mail) to use their own respective SMTP servers for outgoing mail, and all four have worked fine in this way for literally years. 
    This morning, I started getting error messages trying to send mail from the domain hosted by Verio ("cannot send message using the server [my own domain's SMTP server]").
    In the end, I followed the steps outlined in a thread on this forum to "add" the account to BTYahoo, verify it, and change the email client settings to use BT's SMTP server. So now it works fine.
    What I don't get is why I had to change this one account, when the other non-BT accounts (Apple and NS SMTP servers) continue to work fine as they are (ie using their own server details for outgoing mail).
    Anyone know the answer?  Obviously it works, so there's no problem (apart from wasting 2 hours this morning trying to figure out what the **bleep** had gone wrong), just curious as to BT's logic here.
    Solved!
    Go to Solution.

    gregch wrote:
    I have email accounts with Apple (mobileMe), my own domain (hosted by Verio) and another of my own domains (hosted by Network Solutions) - as well as the BTinternet.com email account. 
    Until today, all four accounts were set up on my email client (Apple Mail) to use their own respective SMTP servers for outgoing mail, and all four have worked fine in this way for literally years. 
    This morning, I started getting error messages trying to send mail from the domain hosted by Verio ("cannot send message using the server [my own domain's SMTP server]").
    In the end, I followed the steps outlined in a thread on this forum to "add" the account to BTYahoo, verify it, and change the email client settings to use BT's SMTP server. So now it works fine.
    What I don't get is why I had to change this one account, when the other non-BT accounts (Apple and NS SMTP servers) continue to work fine as they are (ie using their own server details for outgoing mail).
    Anyone know the answer?  Obviously it works, so there's no problem (apart from wasting 2 hours this morning trying to figure out what the **bleep** had gone wrong), just curious as to BT's logic here.
    Hi Gregch.
    To be honest, the problem seems to be at the destination smtp service end and nothing to do with BT. You've not really supplied any details of the error message - is there anything else in the received message ?
    You've assumed that it's a BT fault, rather than perhaps investigating the possible error at Verio. As the other accounts work as exists, it really does point at Verio (or indeed something local, perhaps a security package interferring etc).
    http://www.andyweb.co.uk/shortcuts
    http://www.andyweb.co.uk/pictures

  • Send mail to external id using send mail task in workflow

    hello,
    i am trying to send mail using send mail task in workflow for an external email address (yahoo).No pernr here it is associated .
    IN scot, it shows it is transmitted,but i dont find any in my mail box.
    But when i send it from business workplace, i can see the mail in my mail box.
    Can you please help me in this regard.
    Best Regards,
    Saujanya.

    Hi Saujanya,
    When you send it from the workplace you also send it to your Yahoo mail-id? As far as I can see from you replies the problem lies outside of SAP. Maybe a SPAM filter which blocks the message. This could be due to the mail-id which sends the e-mail.
    Regards,
    Martin

Maybe you are looking for

  • Database Link Name

    Hello All I got a problem with making a database link. When I execute this query CREATE PUBLIC DATABASE LINK DBNAME CONNECT TO database IDENTIFIED BY name USING 'DBNAME.europe.company.com'; I am using other names because its private information But w

  • Software Update's Library Folder

    Quick question, where is the Software Update's library folder located? I have several applications that still show up in Software Update that I no longer need, such as printer driver updates despite removing the drivers from my computer some time ago

  • AE still crashing even after 12.1 update

    Hi all, my first post here, I foolishly upgraded to Mavericks without backing-up. I know, don't say it. Anyway, since then AE crashes on opening with this alert: After Effects Alert Last log message was: <4486488848> <DynamicLink> <5> /Applications/A

  • ITunes won't start on my Windows XP PC, no alerts.

    I download iTunesSetup.exe 83.1Mo from Applr.com. I do the installation process without any error or alert message. At the end of the installation I chek the option to start iTune, et click the finish button. Nothing happen. I restart my computer and

  • Loading CS 5.5 on new Mac

    I have updated Creative Suite 2 (Standard) to CS 5.5 on my old Mac. I want to know the procedure for transferring it to my new Mac