Using SO_NEW_DOCUMENT_ATT_SEND_API1 to send .xls attachment.

Hi,
I'm using the FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send xls attachements.
All works fine, the only issue is that in the requirements the attachemnt should have fixed width columns.
I think that is not possible, everyone have done that?
If not there an alternative to the SO_NEW_DOCUMENT_ATT_SEND_API1?
Thanks for answers.

Hello,
You can have the fixed width of the colums in excel (No additional spaces in the column) is you use, the seperator between the fields.
For eg : If you are displaying 3 fields in the excel file, say MATNR, WERKS and QUANTITY.
Then you need to
Concatenate  matnr
                      werks
                      quantity
into                ls_contents_bin-line
separated by lc_tab.
append ls_contents_bin to lt_contents_bin.
Here lc_tab is the tab seperator to be declared as follows : -
CONSTANTS : lc_tab         TYPE char01     VALUE  cl_abap_char_utilities=>horizontal_tab.
The internal table lt_contents_bin is then passed to the table parameters contents_bin of the FM SO_NEW_DOCUMENT_ATT_SEND_API1.
Thanks.
Regards,
Rinkesh Doshi

Similar Messages

  • Is it possible to send xls attach in mail in background ?

    is it possible to send xls attach in mail in background ?
    i build/copy program to send attach file in xls format  ,
    its work fine in foreground but do nothing in background  ,
    What can be the reason?
    the section of the sending  :
      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.

    Try this example, not sure where I got this, but it works.
    report zmail_excel.
    parameters: p_email   type somlreci1-receiver
                                   default '[email protected]'.
    data: begin of it001 occurs 0,
          bukrs type t001-bukrs,
          butxt type t001-butxt,
          end of it001.
    data:   imessage type standard table of solisti1 with header line,
            iattach type standard table of solisti1 with header line,
            ipacking_list like sopcklsti1 occurs 0 with header line,
            ireceivers like somlreci1 occurs 0 with header line,
            iattachment like solisti1 occurs 0 with header line.
    start-of-selection.
      select bukrs butxt into table it001 from t001.
    *   Populate table with detaisl to be entered into .xls file
      perform build_xls_data .
    * Populate message body text
      clear imessage.   refresh imessage.
      imessage = 'Please find attached excel file'.
      append imessage.
    * Send file by email as .xls speadsheet
      perform send_email_with_xls tables imessage
                                          iattach
                                    using p_email
                                          'Example Excel Attachment'
                                          'XLS'
                                          'TestFileName'
                                          'CompanyCodes'.
    *      Form  BUILD_XLS_DATA
    form build_xls_data .
      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 'BUKRS' 'BUTXT'
             into iattach separated by con_tab.
      concatenate con_cret iattach into iattach.
      append  iattach.
      loop at it001.
        concatenate it001-bukrs it001-butxt
               into iattach separated by con_tab.
        concatenate con_cret iattach  into iattach.
        append  iattach.
      endloop.
    endform.
    *      Form  SEND_EMAIL_WITH_XLS
    form send_email_with_xls tables pit_message
                                              pit_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription.
      data: xdocdata like sodocchgi1,
            xcnt type i.
    * Fill the document data.
      xdocdata-doc_size = 1.
    * Populate the subject/generic message attributes
      xdocdata-obj_langu = sy-langu.
      xdocdata-obj_name  = 'SAPRPT'.
      xdocdata-obj_descr = p_mtitle .
    * Fill the document data and get size of attachment
      clear xdocdata.
      read table iattach index xcnt.
      xdocdata-doc_size =
         ( xcnt - 1 ) * 255 + strlen( iattach ).
      xdocdata-obj_langu  = sy-langu.
      xdocdata-obj_name   = 'SAPRPT'.
      xdocdata-obj_descr  = p_mtitle.
      clear iattachment.  refresh iattachment.
      iattachment[] = pit_attach[].
    * Describe the body of the message
      clear ipacking_list.  refresh ipacking_list.
      ipacking_list-transf_bin = space.
      ipacking_list-head_start = 1.
      ipacking_list-head_num = 0.
      ipacking_list-body_start = 1.
      describe table imessage lines ipacking_list-body_num.
      ipacking_list-doc_type = 'RAW'.
      append ipacking_list.
    * Create attachment notification
      ipacking_list-transf_bin = 'X'.
      ipacking_list-head_start = 1.
      ipacking_list-head_num   = 1.
      ipacking_list-body_start = 1.
      describe table iattachment lines ipacking_list-body_num.
      ipacking_list-doc_type   =  p_format.
      ipacking_list-obj_descr  =  p_attdescription.
      ipacking_list-obj_name   =  p_filename.
      ipacking_list-doc_size   =  ipacking_list-body_num * 255.
      append ipacking_list.
    * Add the recipients email address
      clear ireceivers.  refresh ireceivers.
      ireceivers-receiver = p_email.
      ireceivers-rec_type = 'U'.
      ireceivers-com_type = 'INT'.
      ireceivers-notif_del = 'X'.
      ireceivers-notif_ndel = 'X'.
      append ireceivers.
      call function 'SO_DOCUMENT_SEND_API1'
           exporting
                document_data              = xdocdata
                put_in_outbox              = 'X'
                commit_work                = 'X'
           tables
                packing_list               = ipacking_list
                contents_bin               = iattachment
                contents_txt               = imessage
                receivers                  = ireceivers
           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.
    endform.
    Regards,
    Rich Heilman

  • Error while sending .XLS attachment

    Hello,
    I'm trynig to send an email with an .XML attachment. I use FM SO_NEW_DOCUMENT_ATT_SEND_API1 to do it. When I use this code:
      DESCRIBE TABLE lt_objbin LINES l_records.
      lt_objpack-transf_bin = 'X'.
      lt_objpack-head_start = 1.
      lt_objpack-head_num   = 1.
      lt_objpack-body_start = 1.
      lt_objpack-body_num   = l_records.
      lt_objpack-obj_name   = ls_doc_chng-obj_name.
      lt_objpack-obj_descr  = ls_doc_chng-obj_name.
      lt_objpack-doc_type   = 'XLS'.
      lt_objpack-doc_size   = l_records * 255.
      APPEND lt_objpack.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                document_data              = ls_doc_chng
           TABLES
                packing_list               = lt_objpack
                object_header              = lt_objhead
                contents_bin               = lt_objbin
                contents_txt               = lt_objtxt
                receivers                  = lt_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.
    I get such an error: "Message cannot be processed as it cannot be converted".
    When I change lt_objpack-doc_type to 'RAW' everything is OK, but I get attachment that has 'TXT' extension. If I change it manually to ".xls" Excel opens the file without any problems. I looked at <a href="http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm">http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm</a>
    and it seems like there is nothing wrong with my program.
    Can anyone help?
    Thanks in advance,
    Rafal

    hi
    try this:
    DESCRIBE TABLE lt_objbin LINES l_records.
    lt_objpack-transf_bin = 'X'.
    lt_objpack-head_start = 1.
    lt_objpack-head_num = 1.
    lt_objpack-body_start = 1.
    lt_objpack-body_num = l_records.
    lt_objpack-obj_name = ls_doc_chng-obj_name.
    <b>lt_objpack-obj_descr =  'Test.XLS'.</b>
    lt_objpack-doc_type = 'XLS'.
    lt_objpack-doc_size = l_records * 255.
    APPEND lt_objpack.
    regards,
    madhu

  • About using SO_NEW_DOCUMENT_ATT_SEND_API1 to send mail to external!

    hi
    i using the function to send mail from sap to external!
    the coding as follow: but i will get sy-subrc = 2:document could not be sent to any of the recipients
    if i want to send mail from SAP
    and how to solved it !
    thank you very much!
    *& Report  ZJOHN_STUDY1
    REPORT  ZJOHN_STUDY1.
    *REPORT  ZSSO_DOCUMENT_SEND_API1.
    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.
    * Creating the document to be sent
    DOC_CHNG-OBJ_NAME = 'OFFER'.
    DOC_CHNG-OBJ_DESCR = 'Auction of a Picasso jr'.
    OBJTXT = 'Reserve price : $250000'.
    APPEND OBJTXT.
    OBJTXT = 'A reproduction of the painting to be auctioned'.
    APPEND OBJTXT.
    OBJTXT = 'is enclosed as an 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 ).
    * Creating 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.
    * Creating the document attachment
    * (Assume the data in OBJBIN are given in BMP format)
    OBJBIN = ' \O/ '. APPEND OBJBIN.
    OBJBIN = '  |  '. APPEND OBJBIN.
    OBJBIN = ' / \ '. APPEND OBJBIN.
    DESCRIBE TABLE OBJBIN LINES TAB_LINES.
    OBJHEAD = 'picasso.bmp'. APPEND OBJHEAD.
    * Creating 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   = 'ATTACHMENT'.
    OBJPACK-OBJ_DESCR = 'Reproduction object 138'.
    OBJPACK-DOC_SIZE   = TAB_LINES * 255.
    APPEND OBJPACK..
    * Entering names in the distribution list
    RECLIST-RECEIVER = "'test  @   test   . com". "is external mail
    RECLIST-REC_TYPE = 'U'.
    RECLIST-com_type = 'INT'.
    RECLIST-notif_del = 'X'.
    RECLIST-notif_ndel = 'X'.
    APPEND RECLIST.
    *RECLIST-RECEIVER = 'DLI-NEUREICH'.
    *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'
        COMMIT_WORK                = '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 'sent successfully'.
          ELSE.
            WRITE 'not sent'.
          ENDIF.
        ENDLOOP.
      WHEN 1.
        WRITE: /
        'no authorization to send to the specified number of recipients!'.
      WHEN 2.
        WRITE: / 'document could not be sent to any of the recipients!'.
      WHEN 4.
        WRITE: / 'no authorization to send !'.
      WHEN OTHERS.
        WRITE: / 'error occurred during sending !'.
    ENDCASE.
    Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 12:36 PM

    when sy-subrc = 0 for above f.m then write below coding...
    if sy-subrc = 0.
    SUBMIT RSCONN01 WITH MODE = 'INT'. ----> *to run scot t.code*
    endif.
    as below..
          CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
          document_data = doc_chng
          put_in_outbox = 'X'
          commit_work = 'X'
          TABLES
          packing_list = objpack
          contents_txt = objtxt[]
          contents_bin = so_ali[]
    *contents_hex = so_ali[]
          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 'Mail sent successfully' TYPE 'S'.
    *SUBMIT RSCONN01 WITH MODE = MODE.*
          ENDIF.
    Edited by: shan palani on Jan 7, 2009 4:10 PM
    Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 12:36 PM

  • How to send pdf attachment SO_NEW_DOCUMENT_ATT_SEND_API1?

    Dear All,
    I am using SO_NEW_DOCUMENT_ATT_SEND_API1 to send PDF attachment with some text in the body.
    How to di it plz help me.
    Regards,
    Raj...

    Hi,
    Refer below link
    http://http://scn.sap.com/thread/3160549
    http://http://scn.sap.com/community/abap/blog/2014/05/09/sending-email-with-pdf-attachment

  • Can you send encrypted e-mails using SO_NEW_DOCUMENT_ATT_SEND_API1

    We use SO_NEW_DOCUMENT_ATT_SEND_API1 to send e-mails to employees for various notifications.  The e-mails go out through SCOT and are sent to our lotus notes.
    We have a project being implemented, where the data we are sending in the note is kind of sensitive, so we'd like to see if we could send the e-mail as encrypted.   Does anyone know if there is some parameter we can set upon sending that would encrypt the text in the e-mail for sending?

    FORM pssword_prot_encryptpdf .
      DATA: BEGIN OF command_list OCCURS 0.
              INCLUDE STRUCTURE sxpgcolist.
      DATA: END OF command_list .
      DATA: BEGIN OF exec_protocol OCCURS 0.
              INCLUDE STRUCTURE btcxpm.
      DATA: END OF exec_protocol.
      DATA: status LIKE btcxp3-exitstat,
      commandname LIKE sxpgcolist-name VALUE 'ZTEST',
      sel_no LIKE sy-tabix.
    * GET LIST OF EXTERNAL COMMANDS
      CALL FUNCTION 'SXPG_COMMAND_LIST_GET'
        EXPORTING
          commandname     = commandname
          operatingsystem = sy-opsys
        TABLES
          command_list    = command_list
        EXCEPTIONS
          OTHERS          = 1.
      CALL FUNCTION 'SXPG_COMMAND_CHECK'
        EXPORTING
          commandname                = command_list-name
          operatingsystem            = sy-opsys
        EXCEPTIONS
          no_permission              = 1
          command_not_found          = 2
          parameters_too_long        = 3
          security_risk              = 4
          wrong_check_call_interface = 5
          x_error                    = 6
          too_many_parameters        = 7
          parameter_expected         = 8
          illegal_command            = 9
          communication_failure      = 10
          system_failure             = 11
          OTHERS                     = 12.
      CLEAR command_list.
      REFRESH command_list.
      DATA: v_dir_input      TYPE sxpgcolist-parameters.
      DATA: v_dir_input1      TYPE sxpgcolist-parameters.
      break developer.
      command_list-name = 'ZTEST'.
      command_list-opsystem = 'Windows NT'.
      CONCATENATE   'd:\pdf\' main_dtl-vbeln '.PDF' INTO name.
      CONCATENATE 'cmd /c d:\pdf\encryptpdf.exe' '-i' name  '-o ' name  '-u'  hdr-password INTO v_dir_input SEPARATED BY space .
      READ TABLE command_list INDEX sel_no.
      break developer.
      CONCATENATE command_list-opcommand v_dir_input INTO command_list-opcommand SEPARATED BY space.
    * CHECK AUTHORIZATION
      command_list-addpar = 'X'.
      APPEND command_list.
      CONSTANTS: c_extcom    TYPE sxpgcolist-name VALUE 'ZTEST',
                 c_oper      TYPE syopsys VALUE 'Windows NT'.
      DATA: t_result         TYPE STANDARD TABLE OF btcxpm.
      v_dir_input  =  command_list-opcommand.
      CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
        EXPORTING
          commandname                   = c_extcom
          additional_parameters         = v_dir_input
          operatingsystem               = c_oper
        TABLES
          exec_protocol                 = t_result
        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
          wrong_asynchronous_parameters = 12
          cant_enq_tbtco_entry          = 13
          jobcount_generation_error     = 14
          OTHERS                        = 15.
    ENDFORM.                    " PSSWORD_PROT

  • Sending Carbon Copy using SO_NEW_DOCUMENT_ATT_SEND_API1

    Hello,
    I am using SO_NEW_DOCUMENT_ATT_SEND_API1' to send out email letting people know a direct deposit has been posted to their bank.  My problem is that the Acct department wants a carbon copy sent to their email address for each email that is sent.  Looking at this function, there is a line called
    RECEIVERS = IT_RECLIST.  When I take this thru debug, I see IT_RECLIST  defined as TYPE TABLE OF SOMLRECI1.  When I see the fields in IT_RECLIST, there is a field called copy, I assume I set this flag = 'X' to let the function know I want a carbon copy, correct?  Also, I am confused as to where the carbon copy email address would go, because all I see is a field called RECEIVER that is holding the recipients email.  Can you guys set me straight here?

    u can't send a carbon copy...instead while sending the email, the same can be sent to 2 or more people at a time. Add the email address to the existing list and it will trigger same email to the department.

  • Extra emails using SO_NEW_DOCUMENT_ATT_SEND_API1.

    Hello,
    I have a requirement to send Purchase order email to a group of people besides the vendor.
    I set the configuration to send the first email to the vendor and it is working fine.
    I would like to use SO_NEW_DOCUMENT_ATT_SEND_API1 to send the SAME EMAIL to a group of persons but I am not sure where to read the information of the already generated email to populate the FM.
    I saw some code in the forum to read the form and send it with SO_NEW_DOCUMENT_ATT_SEND_API1, but I could not find where you enter the Purchase Order number to generate the form in base of it.
    Could anybody help me to understand how to populate SO_NEW_DOCUMENT_ATT_SEND_API1 with the information of the already generated email?
    Thank you.
    Monica.

    Hi Chandra,
    Thank you for your answer.
    I did a little more research and realized that the email sent is not stored.  This takes me to the option of emailing a SAPscript form with my PO.
    I found some code in the forum to email a SAPscript  but I do see where you enter the PO number or the reference to it.
    Do you know?
    Monica.

  • Word 2010 Send As Attachment does not send a HTML formatted mail

    Hi!
    I'm using Word 2010 to send a document by clicking File->Save & Send->Send Using E-mail->Send as Attachment.
    In the Outlook 2010  new message window I click the ribbon tab Format Text and then I select HTML as the message format.
    I continue to happily compose the HTML body and send it. On the recipient side (also Outlook 2010) the message body comes in Plain text format even tough the source email in the Sent folder is in HTML format.
    Is this a bug or am I missing something obvious?

    Hi,
    It's not a bug as I can tell, the recipient may have configured Outlook to Read all standard mail in plain text, please let the recipient check the following setting:
    Start Outlook 2010.
    Click the File tab in the Ribbon, and then click Options on the menu.
    Click Trust Center on the Options menu.
    Click the Trust Center Settings tab.
    Click E-mail Security.
    Under Read as Plain Text, check if the check box of Read all standard mail in plain text has been selected, untick it and click
    OK to save the setting.
    Send the email again to test, hopefully the recipient can receive the email as the original format.
    Good luck.
    Regards,
    Melon Chen
    TechNet Community Support

  • Send excel attachment using FM SO_NEW_DOCUMENT_ATT_SEND_API1

    Hi ABAPers,
    I managed to send excel attachment using FM SO_NEW_DOCUMENT_ATT_SEND_API1.
    Let say I send it to my own email account.
    But, when try to open the excel document, from lotus notes, there is warning message produced by the microsoft excel saying:
    "The file is not in a recognizable format.
    and so on....."
    Anyway, when I click button 'OK', excel sheet will be opened and no information lost.
    How can we code the abap program so that the message will not come each time I open the attachment from my lotus notes?
    Or this is just the tab delimited issue?
    Thank you.
    Regards,
    Edward.

    Hi Shan,
    Thank you for replying.
    I have the same as follows:
      DESCRIBE TABLE lt_contents_hex LINES lv_lines.
      lt_packing_list-transf_bin = 'X'.
      lt_packing_list-head_start = 1.
      lt_packing_list-head_num   = 1.
      lt_packing_list-body_start = 1.
      lt_packing_list-body_num   = lv_lines.
      lt_packing_list-doc_type   = 'XLS'.
      lt_packing_list-obj_name   = 'ATTACHMENT'.
      lt_packing_list-obj_descr  = 'Attachment'.
      lt_packing_list-doc_size   = lv_lines * 255.
      APPEND lt_packing_list.
    I'm using lt_contents_hex instead of lt_contents_bin.
    Still the problem is there.
    Is there any other way to calculate the doc size correctly?
    Regards,
    Edward.

  • Multiple attachment using SO_NEW_DOCUMENT_ATT_SEND_API1

    HI geeks,
              Can anyone pls tell me how to attach multiple files using function module SO_NEW_DOCUMENT_ATT_SEND_API1.
              I have seen example of multiple attachments using same file type.I mean 1 or more files are same type like PDF or Excel.
              But my requirement is i have to send multiple attachment,1 file as PDF and other three excel file.
              Can anyone pls let me know,if anyone done this already,
    Thanks in advance
    Srini.

    Hi Srinivasn,
    Please see the below code u need to follow.  In the object pack table u might specified the number of lines per each attachement.  At the same time u need to specify the document type as  PDF  or XLS.  Please see the below code which is wrote for two attachments as xls.  In your case one attachment should be PDF.  This can be specified in the field
    LT_OBJPACK-DOC_TYPE = 'PDF'.
    IF NOT LT_ATT_TAB[] IS INITIAL AND
        NOT GV_ERR_REC IS INITIAL.        
        DESCRIBE TABLE LT_OBJBIN LINES LV_TAB_LINES.
        LV_TAB_LINES = LV_TAB_LINES - GV_SUC_REC.
        READ TABLE LT_OBJBIN INDEX LV_TAB_LINES.
        LT_OBJPACK-DOC_SIZE =
       ( LV_TAB_LINES - 1 ) * 255 + STRLEN( LT_OBJBIN ).
        LT_OBJPACK-TRANSF_BIN = 'X'.
        LT_OBJPACK-HEAD_START = 1.
        LT_OBJPACK-HEAD_NUM = 0.
        LT_OBJPACK-BODY_START = 1.
        LT_OBJPACK-BODY_NUM = LV_TAB_LINES.
        LT_OBJPACK-DOC_TYPE = LC_XLS.
        LT_OBJPACK-OBJ_NAME = 'ATTACHMENT'.
        LT_OBJPACK-OBJ_DESCR = LV_ATTACH_NAME2(50).
        APPEND LT_OBJPACK.
      ENDIF.                               " IF NOT lt_att_tab[] IS ...
    File2 attachment for processed records.
      IF NOT LT_ATT_TAB[] IS INITIAL AND
         NOT GV_SUC_REC IS INITIAL.
        CLEAR LT_OBJPACK.
        DESCRIBE TABLE LT_OBJBIN LINES LV_TAB_LINES.
        LV_TAB_LINES = LV_TAB_LINES - GV_ERR_REC.
        GV_ERR_REC = GV_ERR_REC + 1.
        READ TABLE LT_OBJBIN INDEX LV_TAB_LINES.
        LT_OBJPACK-DOC_SIZE =
       ( LV_TAB_LINES - 1 ) * 255 + STRLEN( LT_OBJBIN ).
        LT_OBJPACK-TRANSF_BIN = 'X'.
        LT_OBJPACK-HEAD_START = GV_ERR_REC.
        LT_OBJPACK-HEAD_NUM   = 0.
        LT_OBJPACK-BODY_START = GV_ERR_REC.
        LT_OBJPACK-BODY_NUM   = LV_TAB_LINES.
        LT_OBJPACK-DOC_TYPE   = LC_XLS.
        LT_OBJPACK-OBJ_NAME   = 'ATTACHMENT'(009).
        LT_OBJPACK-OBJ_DESCR  = LV_ATTACH_NAME(50).
        APPEND LT_OBJPACK.
      ENDIF.                               " IF NOT lt_att_tab[] IS ...
    Thanks
    IF NOT LT_ATT_TAB[] IS INITIAL AND
        NOT GV_ERR_REC IS INITIAL.        
        DESCRIBE TABLE LT_OBJBIN LINES LV_TAB_LINES.
        LV_TAB_LINES = LV_TAB_LINES - GV_SUC_REC.
        READ TABLE LT_OBJBIN INDEX LV_TAB_LINES.
        LT_OBJPACK-DOC_SIZE =
       ( LV_TAB_LINES - 1 ) * 255 + STRLEN( LT_OBJBIN ).
        LT_OBJPACK-TRANSF_BIN = 'X'.
        LT_OBJPACK-HEAD_START = 1.
        LT_OBJPACK-HEAD_NUM = 0.
        LT_OBJPACK-BODY_START = 1.
        LT_OBJPACK-BODY_NUM = LV_TAB_LINES.
        LT_OBJPACK-DOC_TYPE = LC_XLS.
        LT_OBJPACK-OBJ_NAME = 'ATTACHMENT'.
        LT_OBJPACK-OBJ_DESCR = LV_ATTACH_NAME2(50).
        APPEND LT_OBJPACK.
      ENDIF.                               " IF NOT lt_att_tab[] IS ...
    File2 attachment for processed records.
      IF NOT LT_ATT_TAB[] IS INITIAL AND
         NOT GV_SUC_REC IS INITIAL.
        CLEAR LT_OBJPACK.
        DESCRIBE TABLE LT_OBJBIN LINES LV_TAB_LINES.
        LV_TAB_LINES = LV_TAB_LINES - GV_ERR_REC.
        GV_ERR_REC = GV_ERR_REC + 1.
        READ TABLE LT_OBJBIN INDEX LV_TAB_LINES.
        LT_OBJPACK-DOC_SIZE =
       ( LV_TAB_LINES - 1 ) * 255 + STRLEN( LT_OBJBIN ).
        LT_OBJPACK-TRANSF_BIN = 'X'.
        LT_OBJPACK-HEAD_START = GV_ERR_REC.
        LT_OBJPACK-HEAD_NUM   = 0.
        LT_OBJPACK-BODY_START = GV_ERR_REC.
        LT_OBJPACK-BODY_NUM   = LV_TAB_LINES.
        LT_OBJPACK-DOC_TYPE   = LC_XLS.
        LT_OBJPACK-OBJ_NAME   = 'ATTACHMENT'(009).
        LT_OBJPACK-OBJ_DESCR  = LV_ATTACH_NAME(50).
        APPEND LT_OBJPACK.
      ENDIF.                               " IF NOT lt_att_tab[] IS ...
    Venkat

  • Regarding Sending an email by using SO_NEW_DOCUMENT_ATT_SEND_API1

    Hi Experts,
    I have tow internal tables like ...ITAB1 AND ITAB2.
    Is it possible to send an email with these two internal tables as attachments..like Attachment1...Itab1 and Attachment2...Itab2..
    Is it possible by using the FM SO_NEW_DOCUMENT_ATT_SEND_API1??
    Rgds,
    Sruthi.

    Hi Shruthi,
    You can use FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send internal tables as attachment in mail.
    Plz check this link:
    https://wiki.sdn.sap.com/wiki/display/ABAP/Tosend2inttablesdataastwoattachmentstomailidoutsidesapsystem
    It will guide you in solving your problem.
    Thanks & regards,
    Sarita Singh

  • Mail Send Functionality using SO_NEW_DOCUMENT_ATT_SEND_API1

    hi,
    i m using Fn Module "SO_NEW_DOCUMENT_ATT_SEND_API1" to send email with attachment.
    I have written  a program which will fetch data in excel format . this excel should be sent as attachment to specified receiver. however i m having difficulties adding attachment to function module.
    I specified under parameter "contents_bin" but its giving some error message related wth structure.
    I chkd SDN and wasnt able to find any resolution yet.
    Any suggestion or idea which can be useful on this.
    Thanks.

    REPORT  zsendemail                    .
    PARAMETERS: psubject(40) type c default  'Hello',
                p_email(40)   type c default 'write email address' .
    data:   it_packing_list like sopcklsti1 occurs 0 with header line,
            it_contents like solisti1 occurs 0 with header line,
            it_receivers like somlreci1 occurs 0 with header line,
            it_attachment like solisti1 occurs 0 with header line,
            gd_cnt type i,
            gd_sent_all(1) type c,
            gd_doc_data like sodocchgi1,
            gd_error type sy-subrc.
    data:   it_message type standard table of SOLISTI1 initial size 0
                    with header line.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Perform populate_message_table.
    *Send email message, although is not sent from SAP until mail send
    *program has been executed(rsconn01)
    PERFORM send_email_message.
    *Instructs mail send program for SAPCONNECT to send email(rsconn01)
    perform initiate_mail_execute_program.
    *&      Form  POPULATE_MESSAGE_TABLE
          Adds text to email text table
    form populate_message_table.
      Append 'Email line 1' to it_message.
      Append 'Email line 2' to it_message.
      Append 'Email line 3' to it_message.
      Append 'Email line 4' to it_message.
    endform.                    " POPULATE_MESSAGE_TABLE
    *&      Form  SEND_EMAIL_MESSAGE
          Send email message
    form send_email_message.
    Fill the document data.
      gd_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      gd_doc_data-obj_langu = sy-langu.
      gd_doc_data-obj_name  = 'SAPRPT'.
      gd_doc_data-obj_descr = psubject.
      gd_doc_data-sensitivty = 'F'.
    Describe the body of the message
      clear it_packing_list.
      refresh it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      describe table it_message lines it_packing_list-body_num.
      it_packing_list-doc_type = 'RAW'.
      append it_packing_list.
    Add the recipients email address
      clear it_receivers.
      refresh it_receivers.
      it_receivers-receiver = p_email.
      it_receivers-rec_type = 'U'.
      it_receivers-com_type = 'INT'.
      it_receivers-notif_del = 'X'.
      it_receivers-notif_ndel = 'X'.
      append it_receivers.
    Call the FM to post the message to SAPMAIL
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           exporting
                document_data              = gd_doc_data
                put_in_outbox              = 'X'
           importing
                sent_to_all                = gd_sent_all
           tables
                packing_list               = it_packing_list
                contents_txt               = it_message
                receivers                  = it_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.
    Store function module return code
      gd_error = sy-subrc.
    Get it_receivers return code
      loop at it_receivers.
      endloop.
    endform.                    " SEND_EMAIL_MESSAGE
    *&      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

  • Problem with attachment using SO_NEW_DOCUMENT_ATT_SEND_API1

    Hi,
    I'm using function module SO_NEW_DOCUMENT_ATT_SEND_API1 to send emails from SAP (to Outlook - but the problem can already be observed when checking the email attachment in transaction SOST) with attachments.
    My attachment is a tab delimited file (so that I can open with MS Excel) with a line size of approx. 1600 characters. I mean, concatenating all fields of the output table into a 1600 character field, separated by tabstops (cl_abap_char_utilities=>horizontal_tab)
    I am using function module SCMS_STRING_TO_FTEXT to convert the internal table that I want to send to the line size as accepted by function module SO_NEW_DOCUMENT_ATT_SEND_API1, tables parameter contents_bin. Due to function module SCMS_STRING_TO_FTEXT this happens line by line, using a string variable. I make sure to remove any exess blanks that appear in the process due to not completey filled character fields. And for all rows bar the first the string is prefixed with (cl_abap_char_utilities=>cr_lf). I believe that's required so that SAP knows to put the lines back together. So far so good.
    When checking the email's attachment via SOST (and the same happens in Outlook) there are extra blanks in certain fields. Like:
    Annual Base
    92,928.         00
    or
    Email
    First L ast
    In debugging it appears that these excess spaces (sometimes 1, sometimes several) appear where the 1600 character data line is split into the 255 character pieces in 'contents_bin'. But then it happens quite randomly and cannot be observed in all data rows.
    Is there a better way of splitting my internal table into 255 character chunks so that what is one field will never get split up into two rows. For the above example, the two fields would show like this in contents_bin
    ....  92,928.        
    00
    and
    First_L
    ast
    Or where else lies the problem?
    Thanks in advance!
    Philipp

    Ron,
    Thank you for the suggestion. Just tried but issue remains exactly the same. The function module you have suggested builds the table in the same way.
    But, after a few more rounds of debugging and scratching my head it occured to me that my problem is self inflicted. I was using the condense statement in an attempt to get rid of the trailing blanks at the end of a row causing the last column to be filled with lots of spaces at the end. But it wasn't working anyway and I have since inserted a dummy column at the end to take all those trailing blanks. What this condense statement did though was creating trailing blanks in some of those rows with 255 characters fixed length and those trailing blanks then showed up as additional blanks in some columns in the attachment that the emailing function module created by putting those lines back to it's original length of close to 1600 characters.
    Problem solved!
    Regards,
    Philipp

  • I have a scenario. Import IDOC into PI and PI transform IDOC to Excel. Using mail adapter attach that Excel using pi and send to customer. Can you please help me on the same?

    HI Experts,
    I have a scenario. Import IDOC into PI and PI transform IDOC to Excel. Using mail adapter attach that Excel using pi and send to vendor. Can you please help me on the same?
    Thanks
    SaiSreevastav

    Hi Sai,
    you can use XSLT or java mapping or adapter module to convert IDOC xml to XLS. Please refer the below blog
    Convert incoming XML to Excel or Excel XML – Part 1 - XSLT Way
    Convert incoming XML to Excel Sheet Part 2 – Adapter Module way
    Convert incoming XML to Excel Sheet
    then after converting to Excel, you can use the payloadswap bean in mail adapter
    XI: Sender mail adapter - PayloadSwapBean - Step by step
    regards,
    Harish

Maybe you are looking for

  • How to set a trail file as completed?

    I am using GoldenGate to do an initial load, using parameters like: EXTFILE /tmp/aa, MAXFILES 1000, MEGABYTES 2000 I don't understand why all the files except the last one are marked as completed. In my use case, I need all the generated files to be

  • Can Firefox (which apparently has antivirus protection) be used on a computer with a Norton antivirus program already installed?

    I've been told I can only have 1 antivirus program on my computer at a time. Since firefox has antivirus capabilities, can I install it on a computer which already has a Norton antivirus program? == User Agent == Mozilla/4.0 (compatible; MSIE 8.0; Wi

  • Need a transparent background in InDesign

    I am creating a window cling and need the background to be transparent. I drew a rectangle and left the stroke at 100 percent and reduced the fill to 0 percent, effectively making the inside to be transparent. It does not show on the InDesign documen

  • New Folder on Desktop - Open It and It Shows Everything on Desktop

    All of a sudden, if I create a new folder on my desktop, and click it, I do not get an empty folder, but rather I get my desktop and anything on it - like I'm looking at the desktop from the sidebar except its the folder content - which includes the

  • Sent messages not appearing/sent box

    I too am finding at times and it seems to be when the message doesn't go out immediately, that it think it goes but doesn't appear in the SENT box although some do receive the message. I really don't want to BCC myself in everything I send. Mac mail