Formated XL attachment in Mail using FM SO_NEW_DOCUMENT_ATT_SEND_API1.

Hi All,
I have a requirement where I need to send formated XL in Email attachment using FM SO_NEW_DOCUMENT_ATT_SEND_API1.
Yes, there are other convinient ways of doing the same task IXML or CL_BCS but I can't use them.
The existing code already uses this FM and user claims that earlier it used to work but its not working now.
The existing code generates an Internal Table for attachment, starting with
<TABLE style='BACKGROUND-COLOR: #XXXXX
and ending with </TABLE>.
The final XL in Email contains this XL file but its not formated, its in the same format as it was in Internal Table.
I also tried increasing the doc_size field, it did not worked..!!
Even I am not sure whether it is possible this way.
I tried searching for some links like,
SO_NEW_DOCUMENT_ATT_SEND_API1 next line Excel
but, no luck..!!
Any input provided by you will certainly help.
Pls post if I am not clear with my requirement.
Thanking You All.

Hi Ankit sharma,
i think we get nearer to point out whats wrong. But still, i dont know what the actuall problem is.
Does the file looks different?
When yes, what is different?
what do you mean by "The final XL in Email contains this XL file but its not formated, its in the same format as it was in Internal Table."
For sure it should look like in the internal table. I guess what you see is the raw data. and what is not working is, that this raw data gets interpreted like you want it to be - as an XL file. But this is not a bug of different SAP versions since the email got created successfully.
It is all a matter of how the attachment gets interpreted. So find the Bug in the File.  Can it be that maybe
some lines are missing in the attchment
space is added to the end of the row
CRLF is added to the file
dont look at SAP Code. Look at the file. Compare it to a file that got created successfully. what is the difference. if you find it, you will find the missing part in the code.
Looking at the FM-Interface tells me that BIN is obsolete - give your data to hex instead....
this makes me think that CRLF sign is added in FILE. since bin-content-table  is same Data-type then TXT-content-table
regards
Stefan Seeburger

Similar Messages

  • Send attachment though mail using FM SO_NEW_DOCUMENT_ATT_SEND_API1

    Hello Gurus,
    Please help me with the mail sending attachment(excel file) using FM SO_NEW_DOCUMENT_ATT_SEND_API1.
    Here is the actual problem.
    I am using the FM SO_NEW_DOCUMENT_ATT_SEND_API1 in my prog.
    My attachment(excel sheet which is taken from internal table) contains the 10 records with one header description and data related to that description.
    I am able to send the attachment but the records in the attachment has more than 255 characters nearly 700 character length.
    So I spilt up each internal table record(with structure type solisti1) into 3 internal table records and populated it.
    It is showing the entire record in the attached file but I am not able to see some fields which are embeded deeply inside the cells.
    And they are not having any proper allignment.
    Please do help me.
    Promise to reward points.
    Mac

    Here is the sample 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.
    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 = '<name>@yahoo.com'.
    RECLIST-REC_TYPE = 'U'.
    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 recipients!'.
           WHEN 2.
             WRITE: / 'document could not be sent to any of the recipient'.
           WHEN 4.
             WRITE: / 'no authorization to send !'.
           WHEN OTHERS.
             WRITE: / 'error occurred during sending !'.
         ENDCASE.
    Regards,
    Pavan.

  • How to send pdf attachment through mail using Webdynpro-Java

    How can i send the Adobe Interactive Form with data involved as a PDF attachment to mail? using Webdynpro-Java.
    Is there any Adobe API or jar file for generating pdf?
    Helpful answer is highly appreciable and rewarded with points.!

    Hi Sankar,
    try [Offline Interactive PDF Form Using E-Mail|/docs/DOC-8061#49]
    Michal

  • Sending Cheque as PDF attachment in Mail using F110.

    Hi all,
    We have a requirement to send the cheque as as PDF attachment in Mail while printing it through transaction F110.Mail has to be triggered when the payment run is done through F110.Is there any config setting to do this without doing any changes to Print program RFFOUS_C.
    Thanks and Regards
    Kiran

    Hi,
    check below link
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/email%2bfrom%2bsap 
    Regards,
    Madhu

  • After sending attachment through mail using ABAP program.....

    Hello Experts,
    I am facing a problem to fulfill a requirement.
    My requirement is....sending the data of the internal table to an external mail with attachment(excel format). I have done with this. But when o am opening the excel sheet(attachment) it is showing a message that 'The file you are trying to open is in different format than specified by the file extension'
    I am using the extension 'XLS' and 'RAW ' in the coding for the file formats.
    You can please suggest your solutions if you know or already faced this type of issues.
    Thank you.
    Regards,
    Anand

    Hi,
    The system does not trust you....
    I have the feeling that the file you are sending is a text file with the extension 'XLS'
    If the file is comma separated values (http://en.wikipedia.org/wiki/Comma-separated_values) then
    use the extension 'CSV' if it is a tab separated then use the extension 'TXT' .
    Regards.
    CSV is also good for tab separated  I just checked by a copy of BCS_EXAMPLE_7 and changing:
            i_attachment_type    = 'CSV'                        "#EC NOTEXT

  • Issue in sending a mail using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    HI Abappers,
         I have contents of the attachmnet to be sent in an internal table. when i pass this table to the FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' , the text attachment shows a slant format. i mean all the contents of the attachment shift to right and has  no proper alignment.
    What can be done.? pLease help...

    Hi,
    You must have skipped some data declaration part which causes this.
    Please refer to the below mentioned code for reference:
    REPORT  zrat NO STANDARD PAGE HEADING.
    *DATA DECLARATION
    DATA : BEGIN OF wa_ccode,
            bukrs TYPE t001-bukrs,
           END OF wa_ccode.
    DATA : itab_ccode LIKE TABLE OF wa_ccode.
    DATA : BEGIN OF wa_emp,
            pernr TYPE pa0001-pernr,
            sachp TYPE pa0001-sachp,
            sname TYPE pa0001-sname,
           END OF wa_emp.
    DATA : itab_emp LIKE TABLE OF wa_emp.
    DATA : BEGIN OF wa_bdate,
            nachn LIKE pa0002-nachn,
            vorna LIKE pa0002-vorna,
            pernr TYPE pa0002-pernr,
            gbdat TYPE pa0002-gbdat,
           END OF wa_bdate.
    DATA : itab_bdate LIKE TABLE OF wa_bdate.
    DATA : new_date LIKE sy-datum.
    DATA : diff TYPE i.
    DATA : years LIKE p0347-scryy,
           months LIKE p0347-scrmm,
           days LIKE p0347-scrdd.
    DATA : sup_code LIKE pa0001-sachp,
           itab_usrid LIKE t526-usrid,
           sup_pernr LIKE pa0105-pernr.
    DATA : BEGIN OF wa_email,
           usrid_long LIKE pa0105-usrid_long,
           END OF wa_email.
    DATA : sup_email LIKE TABLE OF wa_email.
    DATA : gwa_document_data LIKE sodocchgi1,
           gc_name  TYPE so_obj_nam VALUE 'RETIREMENT',
           gc_senst TYPE so_obj_sns VALUE 'P',
           gc_size  TYPE so_doc_siz VALUE '510',
           gi_obj_cnt LIKE TABLE OF solisti1 WITH HEADER LINE,
           gi_recievers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
           gwa_obj_cnt LIKE LINE OF gi_obj_cnt.
    DATA : smtp_addr LIKE adr6-smtp_addr.
    DATA : wa_date LIKE sy-datum,
           entries LIKE sy-tabix,
           name(15),
           line1(18) TYPE c,
           line2(20) TYPE c,
           line3(20) TYPE c,
           line4(23) TYPE c,
           line5(10) TYPE c,
           line6(45) type c,
           date(2) TYPE c,
           month(2) TYPE c,
           year(4) TYPE c.
    *START OF SELECTION
    SELECT bukrs
    FROM t001
    INTO TABLE itab_ccode
    WHERE land1 EQ 'GB'.
    SORT itab_ccode.
    DELETE ADJACENT DUPLICATES FROM itab_ccode.
    SELECT pernr sachp sname
    FROM pa0001
    INTO TABLE itab_emp
    FOR ALL ENTRIES IN itab_ccode
    WHERE bukrs EQ itab_ccode-bukrs AND begda LE sy-datum AND
    endda GE sy-datum and persg eq '1'.
    SELECT nachn vorna pernr gbdat
    FROM pa0002
    INTO TABLE itab_bdate
    FOR ALL ENTRIES IN itab_emp
    WHERE pernr EQ itab_emp-pernr.
    *TO CHECK EMPLOYEES WHOSE AGE IS NEAR 75 YEARS.
    LOOP AT itab_bdate INTO wa_bdate.
      new_date = wa_bdate-gbdat.
    *TO CALCULATE THE AGE TILL DATE
      CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
        EXPORTING
          date1                         = sy-datum
          date2                         = new_date
         output_format                 = '05'
       IMPORTING
         years                         = years
         months                        = months
         days                          = days
      IF sy-subrc <> 0.
      ENDIF.
      IF years EQ 64 AND months EQ 4.
        IF days GE 23 AND days LE 31.
    *FETCH THE DATA IF THE AGE IS NEARING 75 YEARS
          SELECT SINGLE sachp FROM pa0001 INTO sup_code WHERE pernr EQ
          wa_bdate-pernr AND begda LE sy-datum AND endda GE sy-datum.
          SELECT SINGLE usrid FROM t526 INTO itab_usrid WHERE sachx EQ
          sup_code.
          SELECT SINGLE pernr FROM pa0105 INTO sup_pernr WHERE usrid EQ
          itab_usrid AND subty EQ '0001'.
          clear sup_email[].
          SELECT usrid_long FROM pa0105 INTO TABLE sup_email WHERE pernr EQ
          sup_pernr AND subty EQ '0010'.
    *EMAIL ADDRESS OF THE SUPERVISOR TO BE NOTIFIED
          CLEAR gi_obj_cnt.
          CLEAR gi_recievers.
          CLEAR gwa_document_data.
          Loop at sup_email into wa_email.
          write sy-uline+0(5).
          write sy-uline+10(5).
          write sy-uline+20(5).
          write sy-uline+30(5).
          write sy-uline+40(5).
          write sy-uline+50(5).
          write sy-uline+60(5).
          write sy-uline+70(5).
          smtp_addr = wa_email-usrid_long.
          gi_recievers-receiver = smtp_addr.
          gi_recievers-rec_type = 'U'.
          gi_recievers-com_type = 'INT'.
          APPEND gi_recievers.
          Endloop.
          smtp_addr = '[email protected]'.
          gi_recievers-receiver = smtp_addr.
          gi_recievers-rec_type = 'U'.
          gi_recievers-com_type = 'INT'.
          APPEND gi_recievers.
          gwa_document_data-obj_name    = gc_name.
          gwa_document_data-obj_descr   = 'RETIRE'.
          gwa_document_data-sensitivty  = gc_senst.
          gwa_document_data-obj_langu = sy-langu.
    *CONTENT OF THE EMAIL TO BE SENT
          line1 = 'Please note that  '.
          line2 = wa_bdate-vorna.
          line3 = wa_bdate-nachn.
          line4 = ' will be 65 years on  '.
          line50(4) = wa_bdate-gbdat4(4).
          date = line5+2(2).
          month = line5+0(2).
          year = wa_bdate-gbdat+0(4) + 65.
          CONCATENATE date month year INTO line5 SEPARATED BY '.'.
          line6 = '.Please complete the Retirement Procedure.'.
          CONCATENATE line1 line2 line3 line4 line5 line6 INTO gwa_obj_cnt
          SEPARATED BY space.
          APPEND gwa_obj_cnt TO gi_obj_cnt.
          CLEAR gwa_obj_cnt.
          DESCRIBE TABLE gi_obj_cnt LINES entries.
          READ TABLE gi_obj_cnt INDEX entries.
    gwa_document_data-doc_size = ( entries - 1 ) * 255 + STRLEN( gi_obj_cnt
    *FUNCTION MODULE TO SEND THE EMAIL TO THE CONCERNED PERSONS
    CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
      EXPORTING
        document_data                    = gwa_document_data
        document_type                    = 'RAW'
             commit_work                      = 'X'
            TABLES
             object_content                   = gi_obj_cnt
              receivers                        = gi_recievers
      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
    *MESSAGE TO BE DISPLAYED AFTER THE EXECUTION
         endif.
          CASE sy-subrc.
            WHEN 0.
              LOOP AT gi_recievers.
                IF gi_recievers-receiver = space.
                  name = gi_recievers-rec_id.
                ELSE.
                  name = gi_recievers-receiver.
                ENDIF.
                IF gi_recievers-retrn_code = 0.
                  WRITE: / name, ': succesfully sent'.
                ELSE.
                  WRITE: / name, ': error occured'.
                ENDIF.
              ENDLOOP.
            WHEN 1.
              WRITE: / 'Too many receivers specified !'.
            WHEN 2.
              WRITE: / 'No receiver got the document !'.
            WHEN 4.
              WRITE: / 'Missing send authority !'.
            WHEN OTHERS.
              WRITE: / 'Unexpected error occurred !'.
          ENDCASE.
        ENDIF.
      ENDIF.
    ENDLOOP.
    In case you have any further clarifications,do let me know.
    Regards,
    Puneet Jhari.

  • Attach to Mail using FileUpload UI in Web dynpro Java

    Hi,
    I need to send a file from my system as attachment with a mail in a web dynpro java application.
    I am trying to implement it by uploading the file to server using FileUpload UI and then sending the file as attachment
    using java mail api which is not working at the moment.
    Can anyone please suggest possible solution for this. Is there anyother approach to implement this?
    -- Arnab

    I am using the following code to upload the file. Its not showing any error only the mail is sent without the attachment.
        IPrivateFormView.IFileUploadElement element = wdContext.currentFileUploadElement();
        InputStream text = null;
        int temp=0;
        try{
             File file = new File(element.getFilename().getResourceName());
             FileOutputStream out = new FileOutputStream(file);
             if(element.getFilename()!= null){
                  text = element.getFilename().read(false);
                  while((temp = text.read()) != -1){
                       out.write(temp);
             out.flush();
             out.close();
             String filePath = file.getAbsolutePath();
             wdContext.currentContextElement().setAttachFileExtension(filePath);
              msg.reportSuccess("File:" + filePath);
        }catch(Exception e){
    And the following code to attach the file to mail
              MimeBodyPart bodyPart = null;
              Multipart mp =  new MimeMultipart();
              try {
                   bodyPart = new MimeBodyPart();
                   bodyPart.setContent("Attached Mail","text/plain");
                   mp.addBodyPart(bodyPart);
                   //FileDataSource fds = new FileDataSource("http://dcwwdvsaprt02:50000/irj/go/km/docs");
                   MimeBodyPart attachmentBodyPart = new MimeBodyPart();
                   //attachmentBodyPart.setDataHandler(new DataHandler(fds));
                   URL URLattachedFileName = new URL(wdContext.currentContextElement().getAttachFileExtension());
                   attachmentBodyPart.setDataHandler(new DataHandler(URLattachedFileName));
                   attachmentBodyPart.setFileName("Attachment");
                   mp.addBodyPart(attachmentBodyPart);
              } catch (Exception e1) {
                   // TODO Auto-generated catch block
                   e1.printStackTrace();

  • Error Sending Mail Using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    Dear All,
        I am calling the function module 'SO_NEW_DOCUMENT_ATT_SEND_API1' inside the program to send mail to ( i.e [email protected]) either yahoo or gmail or etc.
    After calling this function module i am getting error message ''Document could not be sent to any recipient'' i.e sy-subrc = 2.
    But i am using same function module with SAPUSER ID as a receiver list its working fine.
    Please let me know why this problem comming to send email to extenal.
    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               = g_t_packing
                object_header              = g_t_objheader
                contents_txt               = g_t_objtxt
                receivers                  = g_t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                operation_no_authorization = 4
                OTHERS                     = 99.
      CASE sy-subrc.
        WHEN 0.
            WRITE 'The document was sent'.
        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.

    TABLES
    packing_list = g_t_packing
    object_header = g_t_objheader
    contents_txt = g_t_objtxt
    receivers = g_t_receivers
    where is hte body of the content ?
    i think this is missing .
    <b>contents_bin</b>      =   objbin
    just check the same
    regards,
    vijay

  • Attaching text file using SO_NEW_DOCUMENT_ATT_SEND_API1

    hello guys, i'm a newbie here.
    I'm having trouble attaching an existing text file using function 'SO_NEW_DOCUMENT_ATT_SEND_API1'. It seems i can't find the right combination of parameters that are being passed to this function.
    first, i'm using WS_UPLOAD to upload the text file to an internal table then i'm creating all the neccessary internal tables that will be use by this function..
    By the way, i'm trying to send mail w/ attachments to external mail and SAPids. Below is my code.
    REPORT ZHR_TESTEMAIL .
    TABLES: USR02, PA0105, SOSU, SOUC, RLGRAP, IBIPPARMS, DYNPREAD, RSCSEL.
    DATA: FOLD_YR(2) TYPE C,
          FOLD_TYPE(3) TYPE C,
          G_HEADER LIKE SOOD2,
          G_FOLMAM LIKE SOFM2,
          METHOD1 LIKE SY-UCOMM,
          G_DOCUMENT LIKE SOOD4,
          G_USER LIKE SOUDNAMEI1,
          FOLD_NUMBER(12) TYPE C,
          G_NEW_PARENT LIKE SOODK,
          G_OWNER LIKE SOUD-USRNAM,
          G_REF_DOCUMENT LIKE SOOD4,
          G_USER_DATA LIKE SOUDATAI1,
          G_AUTHORITY LIKE SOFA-USRACC,
          G_OBJCNT LIKE SOLI OCCURS 0 WITH HEADER LINE,
          G_OBJHEAD LIKE SOLI OCCURS 0 WITH HEADER LINE,
          G_OBJPARA LIKE SELC OCCURS 0 WITH HEADER LINE,
          G_OBJPARB LIKE SOOP1 OCCURS 0 WITH HEADER LINE,
          G_RECIPIENTS LIKE SOOS1 OCCURS 0 WITH HEADER LINE,
          G_REFERENCES LIKE SOXRL OCCURS 0 WITH HEADER LINE,
          G_ATTACHMENTS LIKE SOOD5 OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF G_FILES OCCURS 10 ,
          TEXT(4096) TYPE C,
          END OF G_FILES.
    DATA: BEGIN OF IT_WS_FILE OCCURS 0,
          WS_FILE LIKE RLGRAP-FILENAME,
          END OF IT_WS_FILE.
    DATA: BEGIN OF IT_SAPID OCCURS 0,
          SAPID LIKE USR02-BNAME,
          END OF IT_SAPID.
    DATA: BEGIN OF IT_EMAIL OCCURS 0,
          EMAILADD LIKE PA0105-USRID_LONG,
          END OF IT_EMAIL.
    DATA: BEGIN OF IT_TSP01 OCCURS 0.
            INCLUDE STRUCTURE TSP01.
    DATA: END OF IT_TSP01.
    DATA: BEGIN OF TAB2 OCCURS 50,
          TEXT(200) TYPE C,
          END OF TAB2.
    DATA: V_DOCDATA TYPE SODOCCHGI1,
          V_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
          V_OBJHEAD LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          V_OBJTXT  LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          V_OBJBIN  LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          V_OBJHEX  LIKE SOLIX      OCCURS 0 WITH HEADER LINE,
          IT_RECVRS TYPE SOMLRECI1  OCCURS 0 WITH HEADER LINE,
          IT_CONTNT TYPE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          IT_BODY   LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE,
          V_TLIN    TYPE I,
          V_LINE    TYPE I.
    DATA: BEGIN OF IT_TEXTLINE OCCURS 500,
          TEXTLINE(5000),
          END OF IT_TEXTLINE.
    DATA: FYL LIKE RLGRAP-FILENAME,
          GV_SUBNO LIKE SOSU-SUBNO,
          GV_EMAIL LIKE PA0105-USRID_LONG,
          GV_NEXTDAY LIKE SY-DATUM,
          YEAR(4) TYPE C,
          RECFLAG TYPE C.
    SELECTION-SCREEN BEGIN OF BLOCK PARAM WITH FRAME TITLE TEXT-001.
    PARAMETERS: SUBJ(254) TYPE C OBLIGATORY,            "Subject
                DESC(254) TYPE C.                       "Message
    SELECT-OPTIONS: SAPID FOR USR02-BNAME NO INTERVALS. "Recipient's SAP ID
    SELECT-OPTIONS: EMAILADD FOR PA0105-USRID_LONG NO INTERVALS.
    SELECTION-SCREEN END OF BLOCK PARAM.
    SELECTION-SCREEN BEGIN OF BLOCK PARAM2 WITH FRAME TITLE TEXT-002.
    SELECT-OPTIONS: WS_FILE FOR DYNPREAD-FIELDNAME NO INTERVALS.
    SELECTION-SCREEN END OF BLOCK PARAM2.
    SELECTION-SCREEN BEGIN OF BLOCK PARAM3 WITH FRAME TITLE TEXT-003.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RBUT1 RADIOBUTTON GROUP A USER-COMMAND BUT. "Local PC
    SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RBUT2 RADIOBUTTON GROUP A.                  "Server
    SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RBUT3 RADIOBUTTON GROUP A.                  "Spool
    SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT3.
    PARAMETERS: SPOOLNUM LIKE RSPOTYPE-RQNUMBER.            "Spool Number
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK PARAM3.
    SELECTION-SCREEN BEGIN OF BLOCK PROC WITH FRAME TITLE TEXT-004.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETER: BPROC AS CHECKBOX USER-COMMAND BCK. "Background Processing
    SELECTION-SCREEN COMMENT 5(50) FOR FIELD BPROC.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK PROC.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR WS_FILE-LOW.
      DATA: WS_FILE_TEMP TYPE IBIPPARMS-PATH.
      CLEAR: WS_FILE_TEMP.
      CALL FUNCTION 'F4_FILENAME'
           EXPORTING
                PROGRAM_NAME  = SY-REPID
                DYNPRO_NUMBER = SY-DYNNR
                FIELD_NAME    = 'WS_FILE'
           IMPORTING
                FILE_NAME     = WS_FILE_TEMP.
      WS_FILE-LOW = WS_FILE_TEMP.
    AT SELECTION-SCREEN.
      SELECT SAPNAM FROM SOUC
          INTO TABLE IT_SAPID
          WHERE SAPNAM IN SAPID
            AND DELETED = ''.
      GV_NEXTDAY = SY-DATUM + 1.
      LOOP AT EMAILADD.
        IT_EMAIL-EMAILADD = EMAILADD-LOW.
        APPEND IT_EMAIL.
        CLEAR: IT_EMAIL.
      ENDLOOP.
      IF NOT BPROC IS INITIAL.
        CLEAR: RBUT1, RBUT3.
        RBUT2 = 'X'.
      ELSE.
        CLEAR: RBUT2.
      ENDIF.
      IF NOT RBUT3 IS INITIAL.
        REFRESH: WS_FILE.
      ENDIF.
      IF SAPID IS INITIAL AND EMAILADD IS INITIAL.
        MESSAGE E000(ZZ) WITH TEXT-201.
      ELSEIF NOT SAPID IS INITIAL AND EMAILADD IS INITIAL.
        CLEAR IT_SAPID.
        READ TABLE IT_SAPID.
        SELECT SINGLE SUBNO FROM SOSU
          INTO GV_SUBNO
          WHERE USRNO IN ( SELECT USRNO FROM SOUC
                             WHERE SAPNAM = IT_SAPID-SAPID ).
        IF SY-SUBRC NE 0.
          MESSAGE E000(ZZ) WITH TEXT-202.
        ENDIF.
        CLEAR: IT_SAPID.
      ELSEIF NOT SAPID IS INITIAL AND NOT EMAILADD IS INITIAL.
        CLEAR: IT_SAPID, IT_EMAIL.
        READ TABLE IT_SAPID.
        READ TABLE IT_EMAIL.
        SELECT SINGLE SUBNO FROM SOSU
          INTO GV_SUBNO
          WHERE USRNO IN ( SELECT USRNO FROM SOUC
                             WHERE SAPNAM = IT_SAPID-SAPID ).
        IF SY-SUBRC NE 0.
          SUBMIT RSSOADM0 WITH USRNAM EQ IT_SAPID-SAPID
                          WITH NEW_SUBS EQ IT_EMAIL-EMAILADD
                          WITH SUB_ESC EQ 'U'
                          WITH EDAT EQ SY-DATUM
                          WITH BDAT EQ SY-DATUM
                         WITH BDAT EQ GV_NEXTDAY
                         WITH EDAT EQ '99991231'
                          WITH BTIM EQ SY-UZEIT
                          WITH ETIM EQ '240000'
                          WITH FORW_ALL EQ 'X'
                          WITH PSTHR2 EQ ''
                          AND RETURN.
        ENDIF.
        CLEAR: IT_SAPID.
      ELSEIF NOT EMAILADD IS INITIAL AND SAPID IS INITIAL.
        RECFLAG = 'X'.
      ENDIF.
    START-OF-SELECTION.
        PERFORM B_SENDMAIL.
    FORM B_SENDMAIL.
      YEAR = SY-DATUM+0(4).
      LOOP AT WS_FILE.
        CLEAR: FYL.
        FYL = WS_FILE-LOW.
        REFRESH: TAB2.
        CALL FUNCTION 'WS_UPLOAD'
             EXPORTING
                  FILENAME = FYL
                  FILETYPE = 'BIN'
             TABLES
                  DATA_TAB = TAB2.
        IT_TEXTLINE[] = TAB2[].
    DOCUMENT_DATA (SUBJECT OF MAIL)
        V_DOCDATA-OBJ_NAME   = DESC.
        V_DOCDATA-OBJ_DESCR  = SUBJ.
        V_DOCDATA-OBJ_LANGU  = SY-LANGU.
        V_DOCDATA-SENSITIVTY = 'C'.
        V_DOCDATA-OBJ_PRIO   = '1'.
    BODY OF MAIL
        IT_BODY-LINE = 'Collection Report'.
        APPEND IT_BODY.
    CONTENTS_TXT (Attachments)
        IT_CONTNT[] = IT_TEXTLINE[].
        DESCRIBE TABLE IT_CONTNT LINES V_LINE.
        READ TABLE IT_CONTNT INDEX V_LINE.
    PACKING_LIST
        V_OBJPACK-DOC_SIZE = ( V_LINE - 1 ) * 255 + STRLEN( IT_CONTNT ).
        V_OBJPACK-TRANSF_BIN = 'X'.
        V_OBJPACK-HEAD_START = 1.
        V_OBJPACK-HEAD_NUM   = 0.
        V_OBJPACK-BODY_START = 1.
        V_OBJPACK-BODY_NUM   = V_LINE.
        V_OBJPACK-DOC_TYPE   = 'TXT'.
        V_OBJPACK-OBJ_NAME   = 'ATTACHMENT'.
        V_OBJPACK-OBJ_DESCR  = 'Attached Document'.
        APPEND V_OBJPACK.
        CLEAR  V_OBJPACK.
    RECEIVERS of mail
        IF RECFLAG IS INITIAL.
          LOOP AT IT_SAPID.
            IT_RECVRS-RECEIVER   = IT_SAPID-SAPID.
            IT_RECVRS-REC_TYPE   = 'B'.
            IT_RECVRS-COM_TYPE   = ''.
            IT_RECVRS-EXPRESS    = 'X'.
            IT_RECVRS-NO_FORWARD = ''.
            IT_RECVRS-NO_PRINT   = ''.
            APPEND IT_RECVRS.
            CLEAR IT_RECVRS.
          ENDLOOP.
        ELSE.
          LOOP AT EMAILADD.
            IT_RECVRS-RECEIVER   = EMAILADD-LOW.
            IT_RECVRS-REC_TYPE   = 'U'.
            IT_RECVRS-COM_TYPE   = 'INT'.
            IT_RECVRS-EXPRESS    = 'X'.
            APPEND IT_RECVRS.
            CLEAR IT_RECVRS.
          ENDLOOP.
        ENDIF.
    OBJECT_HEADER (Filename)
        CONCATENATE 'Collection Report' '_'
                     SY-DATUM+4(4) YEAR '.TXT'
                     INTO V_OBJHEAD-LINE.
       V_OBJHEAD-LINE = FYL+16(25).
        APPEND V_OBJHEAD.
        CLEAR V_OBJHEAD.
    Function Module For Sending Mail with Attachment
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
             EXPORTING
                  DOCUMENT_DATA              = V_DOCDATA
             TABLES
                  PACKING_LIST               = V_OBJPACK
                  OBJECT_HEADER              = V_OBJHEAD
                  CONTENTS_HEX               = IT_CONTNT
                  CONTENTS_TXT               = IT_BODY
                  RECEIVERS                  = IT_RECVRS
             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 S000(ZZ) WITH TEXT-005.
        ELSE.
          MESSAGE S000(ZZ) WITH TEXT-006.
        ENDIF.
      ENDLOOP.
    end of my code *
    please help me guys... when i run this program,    DOCUMENT_NOT_SENT is what i always get.. 
    waiting for ur reply... thank you vey much and godbless.

    Hi,
    Try this sample code.
    FORM SEND_TO_EMAIL USING zFName.
      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: ctmp(50) TYPE C.
    Creation of the document to be sent
      DOC_CHNG-OBJ_NAME = 'JOURNAL'.
      CONCATENATE 'SAP Payroll Journal file Period' pybegda INTO ctmp
                  SEPARATED BY SPACE.
      DOC_CHNG-OBJ_DESCR = cTmp.
      OBJTXT = 'SAP Payroll Journal'.
      APPEND OBJTXT.
      CONCATENATE 'For Period' pybegda INTO ctmp
                  SEPARATED BY SPACE.
      OBJTXT = ctmp.
      APPEND OBJTXT.
      CONCATENATE 'Attached File :' zFname INTO ctmp
                  SEPARATED BY SPACE.
      OBJTXT = ctmp.
      APPEND OBJTXT.
      OBJTXT = 'Please find the 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
      <b>LOOP AT xMail.
        CONDENSE xMail-aline.
        OBJBIN = xMail-aline.
        APPEND OBJBIN.
        CLEAR OBJBIN.
      ENDLOOP.</b>
      DESCRIBE TABLE OBJBIN LINES TAB_LINES.
      OBJHEAD = zFname. 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 = 'RAW'.
      OBJPACK-OBJ_NAME = 'DATA'.
      OBJPACK-OBJ_DESCR = 'SAP Payroll File'.
      OBJPACK-DOC_SIZE = TAB_LINES * 255.
      APPEND OBJPACK.
    Completing the recipient list
      LOOP AT PENERIMA.
        CONDENSE PENERIMA-PNRM.
        RECLIST-RECEIVER = PENERIMA-PNRM.
        RECLIST-REC_TYPE = 'U'.
        APPEND RECLIST.
      ENDLOOP.
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                DOCUMENT_DATA              = DOC_CHNG
                PUT_IN_OUTBOX              = ' '
           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: / 'Too many receiver'.
        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.
    ENDFORM.

  • 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.

  • Sending attachment in a mail using SO_DOCUMENT_SEND_API1

    Hi,
    I am trying to send an attachment in a mail using the FM SO_DOCUMENT_SEND_API1.
    The contents of the body and the attachement are same.
    The contents of the body are coming in proper format but the attachements are not.
    The body contents are in this way:
    1000013559     0010004994     PBG BROOKF     1000013559     000100     010052000328667000     GA LQ CRE 20OZ 24CS FRT PUN              0.000     CS
    1000013559     0010004994     PBG BROOKF     1000013559     000200     010052000328681000     GA LQ CRE 20OZ 24CS LL              0.000     CS
    But the attachement contents are:
    1000013559     0010004994     PBG BROOKF     1000013559     000100     010052000328667000     GA LQ CRE 20OZ 24CS FRT PUN
             ⸀        䌀匀ഀ਀                                                                                                         u2020
    1000013559     0010004994     PBG BROOKF     1000013559     000200     010052000328681000     GA LQ CRE 20OZ 24CS LL
        ⸀        䌀匀ഀ਀                                                                                                              u2020
    Also the last 2 fields which are quantity and unit fields, are not coming at all in the attachment.
    Please help me solve this issue.
    Thanks,
    Abhishek

    what is the document type of attachment? is it excel?

  • Receiving Mail - Using attachement and adapter attributes

    Hi all,
    I'm trying to solve the following problem:
    - I receive a file via mail adapter as attachment
    - The content of the file is plain text, no csv or XML
    - For mapping, I need a) the content of the file b) metadata like sender of the mail, date/time of mail etc.
    I tried to use mail package and PayloadSwapBean. Now I have the situation, that not everytime the <content>-Tag contains the content of the attachement:
    -If the message text of the mail is empty, <content>-Tag contains the content of the attachment (perfect!)
    -If the message text of the mail is empty, mapping throws exception. I suppose, that pure attachement (not in the mail package format) is input for mapping
    If I try to use adapter-specific attributes, Mail adapter throws error (so message does not reach integration engine). I already updated the mail adapter metadata in the IR (cf. SAP note 936552), as we are on SP16. It seems as if still some tags can not be deserialised by the SOAP-Entry of the integration engine.
    Has someone an idea how to solve the situation?
    Kind regards,
    Torsten
    Message was edited by: Torsten Engel

    Well, the problem seems to be with the IMAP server
    (not postfix).
    I simply don't have an INBOX file were my IMAP server
    seems to deliver the e-mail.
    This seems to be part of our problem communicating. An IMAP server doesn't deliver email. It's what your mailreader contacts to view or deliver mail. You must be using OSX Server, I don't think there's an IMAP server for OSX.
    When mail arrives at your Mac, two basic things happen. We lump them under the label postfix. The first thing is that the SMTP server accepts the mail. The second is that the local process "delivers" the mail. This can be difficult to set up, but the main thing is to put the local delivery path in the alias map file you set in /etc/postfix/main.cf. This is /etc/aliases by default.
    To read mail, your mailreader can simply open the mailbox where the file was delivered. /usr/bin/mail will work fine. Fancier mailreaders like Apple Mail use protocols like POP3 and IMAP4 to retrieve mail from remote servers. But this case is different. IMAP seems like overkill since everything is local. I would try putting the alias to the directory that Mail uses. But then, you never said what your mailreader was, so I don't know.
    I think we can solve this, but we need to get over some confusion first.
    -Phil

  • Send e-mail in HTML-format with attachment

    Does function SO_OBJECT_SEND allow to send e-mail with attachment?
    Does function SO_DOCUMENT_SEND_API1 allow to send e-mail in HTML format?

    Hi SS
    See if you can understand this sample program
    PARAMETERS: po_email TYPE AD_SMTPADR LOWER CASE.
    DATA: li_objcont TYPE STANDARD TABLE OF solisti1,
    li_reclist TYPE STANDARD TABLE OF somlreci1,
    li_objpack TYPE STANDARD TABLE OF sopcklsti1,
    li_objhead TYPE STANDARD TABLE OF solisti1,
    li_content TYPE STANDARD TABLE OF solisti1,
    lwa_objcont TYPE solisti1,
    lwa_reclist TYPE somlreci1,
    lwa_objpack TYPE sopcklsti1,
    lwa_objhead TYPE solisti1,
    lwa_content TYPE solisti1,
    lwa_doc TYPE sodocchgi1,
    l_lines TYPE i.
    REFRESH: li_objcont[], li_reclist[],
    li_objpack[], li_objhead[],
    li_content[].
    CLEAR: lwa_objcont, lwa_reclist,
    lwa_objpack, lwa_objhead,
    lwa_content, lwa_doc.
    MOVE '<body>' TO lwa_objcont.
    APPEND lwa_objcont TO li_objcont.
    MOVE '<p>' TO lwa_objcont.
    APPEND lwa_objcont TO li_objcont.
    MOVE 'This is a sample HTML content from test program' TO lwa_objcont.
    APPEND lwa_objcont TO li_objcont.
    MOVE '</p>' TO lwa_objcont.
    APPEND lwa_objcont TO li_objcont.
    MOVE '</body>' TO lwa_objcont.
    APPEND lwa_objcont TO li_objcont.
    lwa_reclist-receiver = po_email.
    lwa_reclist-rec_type = 'U'.
    APPEND lwa_reclist TO li_reclist.
    lwa_objhead = 'test.htm'.
    APPEND lwa_objhead TO li_objhead.
    lwa_content = 'Please find attached document for more details'.
    APPEND lwa_content TO li_content.
    CLEAR l_lines.
    DESCRIBE TABLE li_content LINES l_lines.
    READ TABLE li_content INTO lwa_content INDEX l_lines.
    lwa_doc-doc_size = ( l_lines - 1 ) * 255 + STRLEN( lwa_content ).
    lwa_doc-obj_langu = 'E'.
    lwa_doc-obj_name = 'Test HTML file'.
    lwa_doc-obj_descr = 'Test HTML file'.
    CLEAR lwa_objpack-transf_bin.
    lwa_objpack-head_start = 1.
    lwa_objpack-head_num = 0.
    lwa_objpack-body_start = 1.
    lwa_objpack-body_num = l_lines.
    lwa_objpack-doc_type = 'RAW'.
    APPEND lwa_objpack TO li_objpack.
    CLEAR: lwa_objpack, l_lines.
    DESCRIBE TABLE li_objcont LINES l_lines.
    READ TABLE li_objcont INTO lwa_objcont INDEX l_lines.
    lwa_objpack-doc_size = ( l_lines - 1 ) * 255 + STRLEN( lwa_objcont ).
    lwa_objpack-transf_bin = 'X'.
    lwa_objpack-head_start = 1.
    lwa_objpack-head_num = 0.
    lwa_objpack-body_start = 1.
    lwa_objpack-body_num = l_lines.
    lwa_objpack-doc_type = 'HTM' .
    lwa_objpack-obj_name = 'Test HTML file'.
    lwa_objpack-obj_descr = 'Test HTML file'.
    APPEND lwa_objpack TO li_objpack.
    *Sending the mail
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = lwa_doc
    put_in_outbox = 'X'
    TABLES
    packing_list = li_objpack
    object_header = li_objhead
    contents_bin = li_objcont
    contents_txt = li_content
    receivers = li_reclist
    EXCEPTIONS
    too_many_receivers = 1
    document_not_sent = 2
    operation_no_authorization = 4
    OTHERS = 99.
    IF sy-subrc NE 0.
    WRITE:/ 'Document sending failed'.
    ELSE.
    WRITE:/ 'Document successfully sent'.
    COMMIT WORK.
    ENDIF.
    This should give you all you need to know to send an HTML file.
    Thanks buddy

  • I would like to send contacts via wireless in vcf format in an e-mail. iPhone doesn't even see the attachment. Is there a special file contact type for iphone?

    I would like to send contacts via wireless in vcf format in an e-mail. iPhone doesn't even see the attachment. Is there a special file contact type for iphone?

    I must be more specific:
    I am attempting to send a vcf from a Windows Computer using Outlook to another Email account that syncs with an iPhone. When I read the e-mail on the iPhone, I can't see the vcf file. But I can see the contact on outlook as a VCF.

  • Error getting while sending the Mails using 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    Hi ALL,
       I HAVE THE REQUIREMENT AS SEND A REPORT AS A MAIL. IAM USING FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' WHILE EXECUTING ITS NOT SHOWING ANY ERROR. BUT IAM NOT GETTING ANY MAIL. I CHECKED IN 'SOST' TCODE. THERE I SEE A MESSAGE LIKE 'CANNOT PROCESS THE MSG TYPE IN SAP SYSTEM'. PLS TELL ME THE WHAT IS THE PROBLE.

    Hi
    Please dont write in Capital letters, it considered as shouting. Hope you are aware of the forum rules.
    You can check if you have made anything wrong in coding by referring wiki link.
    [Sending Mails |http://wiki.sdn.sap.com/wiki/display/ABAP/SendingMails-HomePage]
    Regards
    Abhii

Maybe you are looking for