URL truncated in PDF attachment

Does anyone have this problem about the URL in PDF attachment.
I generate an order confirmation letter via SapScript and send email to receipient as an attachment in PDF (nacha-medium = 5).  On the confirmation letter I write a URL address.  When I open the attachment via Adobe Reader 7 and click on the URL, it will bring me to the link.  However when the URL is too long, it does not work.  Does any one know how?
If I just create a PDF document within ADOBE then it works fine. 
Example:  I have this URL address in my PDF document attached to the email.
http://www.embassysuites.com/en/es/hotels/index.jhtml;jsessionid=MSJGXFRZDHNYQCSGBIYMVCQKIYFCXUUC?ctyhocn=WASOTES
When I open the attachment and click on the URL, it bring me to the address
http://www.embassysuites.com/en/es/hotels/index.jhtml;
and saying not found.  Look like the link after the word 'jhtml;' is cut off.
But if I create the PDF from Adobe, save it and send email to myself then it works fine.

One thing I noticed is that the PDF attachment created from R/3 via Sapscript then convert to PDF file and email to recipient as an attachment has document property as:
PDF producer: SAP R/3 Release 6.20
PDF version:  1.3 (Acrobat 4.x)
Page size: 8.46 x 10.99
However the PDF document I created from Acrobat Adobe has document property 
PDF producer: Acrobat Distiller 7.0.5 Window
PDF version:  1.4 (Acrobat 5.x)
Page size:  8.5 x 11.0
Does this have anything to do with the error I got when click on the URL address?
Thanks for your input.

Similar Messages

  • Can't open pdf attachment in Yahoo Mail. Worked in 25.0 not 25.0.1. Still works with IE.

    Clicking on a pdf attachment in AT&T/Yahoo Mail results in "a file was downloaded". Used to open the file in Firefox 25.0 and prior. Switching to IE I can click on the attachment and it opens. Seems it could be something in 25.0.1. I cleared my history (cache, cookies) but this did not fix the problem. I disabled the pdf viewed and that didn't help either.

    i'm not sure as to what exactly is going on, but it looks like yahoo has changed something on their server that makes certain old url formats dysfunctional - at least quite a number of other users have reported that... so if you have a bookmark for yahoo mail, change its address to the generic https://mail.yahoo.com/, which should redirect you to the current & working url

  • STO mail : pdf attachment has an error 'file damage' when try to open it

    Dear expert,
    I need to send an e-mail to the vendor with the sto list as attachment at the email.
    I managed to send email to external addresee and made the pdf attachment, BUT somehow when I open the attachment it has an error says "Adobe Reader could not open xx.pdf because it is either not a supported file type or because the file has been damaged(for axample, it was sent as an email attachment and wasn't corectly decoded)."
    Really need your experties to help me. Here is my abap coding to send email and do the pdf attachment at the new ouptput type to send email.
      TYPES: BEGIN OF lty_drad,
              doknr TYPE drad-doknr,
             END OF lty_drad,
             BEGIN OF lty_recpt,
               smtp_addr  TYPE ad_smtpadr,
             END   OF lty_recpt.
      DATA: lt_doc      TYPE STANDARD TABLE OF docs,
            lt_recpt    TYPE STANDARD TABLE OF lty_recpt,
            lt_tline    LIKE tline OCCURS 0 WITH HEADER LINE,
            lt_data     TYPE solix_tab,
            lt_docu     TYPE STANDARD TABLE OF lty_drad,
            lt_docfiles TYPE STANDARD TABLE OF bapi_doc_files2,
            lw_tline    LIKE LINE OF lt_tline,
            lw_docu     LIKE LINE OF lt_docu,
            lw_docfiles LIKE LINE OF lt_docfiles,
            lw_objdes   TYPE tnati-objdes,
            lt_text     TYPE bcsy_text,
            lw_recpt    TYPE adr6-smtp_addr,
            lw_adrnr    TYPE lfa1-adrnr,
            lw_object   TYPE drad-objky,
            lw_doknr    TYPE drad-doknr,
            lw_return   TYPE  bapiret2,
            lw_xcontent TYPE xstring,
            client    TYPE REF TO if_http_client,
             url       TYPE string,
             lw_subrc  TYPE sysubrc,
             response  TYPE REF TO if_http_response,
             lw_message1 TYPE string,
           sent_to_all TYPE os_boolean,
           bin_filesize type i.
      CONSTANTS: lc_dokar_srm TYPE drad-dokar VALUE 'SRM',
                 lc_type      TYPE so_obj_tp  VALUE 'RAW'.
    CLASS-DEFINITIONS
      DATA: send_request       TYPE REF TO cl_bcs.
      DATA: document           TYPE REF TO cl_document_bcs.
      DATA: sender             TYPE REF TO cl_sapuser_bcs.
      DATA: recipient          TYPE REF TO if_recipient_bcs.
      DATA: exception_info     TYPE REF TO if_os_exception_info,
            bcs_exception      TYPE REF TO cx_bcs.
      RANGES: lr_po_pr   FOR  drad-objky.
      DATA:   lw_banfn   TYPE ekpo-banfn,
              lw_bnfpo   TYPE ekpo-bnfpo.
      IF nast-nacha = '5'. "8
    Create recipient and check if exist
       Get email ID
      start commented by sapnislina 21.12.06
       SELECT SINGLE adrnr FROM lfa1 INTO lw_adrnr
                    WHERE lifnr = p_ekko-lifnr.
       IF sy-subrc NE 0.
         PERFORM protocol_update
           USING '303' 'Address of Vendor:' ekko-lifnr 'not found' space
         p_retco = sy-subrc.
         EXIT.
       ENDIF.
      end commented by sapnislina 21.12.06
       SELECT smtp_addr INTO CORRESPONDING FIELDS OF TABLE lt_recpt
            FROM adr6
           WHERE addrnumber = p_ekko-adrnr. "lw_adrnr.
        IF lt_recpt[] IS INITIAL.
          PERFORM protocol_update
            USING '303' 'Email address(es) does not exist for vendor'
            p_ekko-lifnr space space.
          p_retco = sy-subrc.
          EXIT.
        ENDIF.
        CALL FUNCTION 'CONVERT_OTF_2_PDF'
          EXPORTING
            use_otf_mc_cmd         = 'X'
          IMPORTING
            bin_filesize           = bin_filesize
          TABLES
            otf                    = otfdata[]
            doctab_archive         = lt_doc
            lines                  = lt_tline
          EXCEPTIONS
            err_conv_not_possible  = 1
            err_otf_mc_noendmarker = 2
            OTHERS                 = 3.
        IF sy-subrc <> 0.
        PERFORM protocol_update
            USING '303' 'PO Convertion from OTF to PDF failed'
                  space space space.
          p_retco = sy-subrc.
          EXIT.
        ENDIF.
    Get object description from mail title of output types
       SELECT SINGLE objdes INTO lw_objdes
              FROM tnati
              WHERE spras = sy-langu
              AND   kappl = nast-kappl
              AND   kschl = nast-kschl.
       CONCATENATE lw_objdes ekko-ebeln INTO lw_objdes SEPARATED BY
    space
        DATA L_TXT(255) TYPE C.
        DATA L_TXT2(255) TYPE C.
        CONCATENATE 'STO' EKPO-EBELN 'Created for' EKPO-WERKS '/'
    EKPO-LGORT
        'Supply Plant' EKKO-RESWK into l_txt separated by space.
        lw_objdes = l_txt.
        CONCATENATE 'STO' EKKO-EBELN INTO L_TXT2 SEPARATED BY SPACE.
        APPEND L_TXT2 TO LT_TEXT.
       APPEND lw_objdes TO lt_text.
    Instantiate
        CLASS cl_cam_address_bcs DEFINITION LOAD.
        CLASS cl_abap_char_utilities DEFINITION LOAD.
    insert by sapnislina 22.12.06
      DATA : CONTENT_OUT TYPE SOLIX,
             LINE_WIDTH_SRC TYPE I,
             POS_OUT TYPE I,
             POS_IN TYPE I,
             LEN_OUT TYPE I.
      DATA OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
      DATA : BEGIN OF CONTENT_IN,
                LINE TYPE TLINE,
                DUMMY TYPE TLINE,
             END OF CONTENT_IN.
      TYPES PDF_RAW TYPE X LENGTH 268.
      FIELD-SYMBOLS <PDF_BIN> TYPE PDF_RAW.
      DESCRIBE FIELD CONTENT_IN-LINE LENGTH LINE_WIDTH_SRC IN BYTE MODE.
      REFRESH lt_data.
      CLEAR CONTENT_OUT.
      POS_OUT = 0.
      LOOP AT OTFDATA INTO CONTENT_IN-LINE.
        ASSIGN CONTENT_IN TO <PDF_BIN> CASTING.
        MOVE <PDF_BIN> TO CONTENT_OUT-LINE+POS_OUT.
        ADD LINE_WIDTH_SRC TO POS_OUT.
        WHILE POS_OUT >= 255.
          APPEND CONTENT_OUT TO lt_data.
          CLEAR CONTENT_OUT.
          SUBTRACT 255 FROM POS_OUT.
          IF POS_OUT > 0.
            POS_IN = LINE_WIDTH_SRC - POS_OUT.
            MOVE <PDF_BIN>+POS_IN TO CONTENT_OUT-LINE.
          ENDIF.
        ENDWHILE.
      ENDLOOP.
      IF POS_OUT > 0.
      APPEND CONTENT_OUT TO lt_data.
      ENDIF.
    end inserted by sapnislina 22.12.06
    starting to create attachment to mail
        TRY.
           CLEAR send_request .
    Create persistent send request
            send_request = cl_bcs=>create_persistent( ).
    Build the document
            document = cl_document_bcs=>create_document(
                                i_type    = lc_type  "RAW
                                i_text    = lt_text  "def of output type
                                i_length  = '12'
                                i_subject = lw_objdes ).
    Attached the document object
            CALL METHOD document->add_attachment
              EXPORTING
                i_attachment_type    = 'PDF'
                i_attachment_subject = lw_objdes "definition of output
    type
                i_attachment_size    = '12'
                i_att_content_hex    = lt_data.
    completed first part to attached PO (pdf format) as attachment
    Now attach the PO related attachments to the mail..
    .... need to read from table DRAD and get all the attachment per PO
         at run time
         REFRESH: lr_po_pr."lt_return.
            CLEAR:   lr_po_pr,lw_return.
            MOVE  'ICP'  TO  lr_po_pr.
         CLEAR: lw_object.
    completed second part for PO related attachments
    Now prepare to send mail
    Add document to send request
         CALL METHOD send_request->set_document( document ).
    Get sender object
         sender = cl_sapuser_bcs=>create( sy-uname ).
    Add sender
         CALL METHOD send_request->set_sender
           EXPORTING
             i_sender = sender.
         LOOP AT lt_recpt INTO lw_recpt
                          WHERE NOT smtp_addr IS INITIAL.
          recipient = cl_cam_address_bcs=>create_internet_address(
    lw_recpt ).
    Add recipient with its respective attributes to send request
            CALL METHOD send_request->add_recipient
              EXPORTING
                i_recipient = recipient
                i_express   = 'X'.
            CLEAR recipient.
         ENDLOOP.
    Send the document
        CALL METHOD send_request->send
          RECEIVING
            result              = sent_to_all.
    Catch any exception
          CATCH cx_bcs INTO bcs_exception.
              CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
                EXPORTING
                  msg_arbgb = bcs_exception->msgid
                  msg_nr    = bcs_exception->msgno
                  msg_ty    = bcs_exception->msgty
                  msg_v1    = bcs_exception->msgv1
                  msg_v2    = bcs_exception->msgv2
                  msg_v3    = bcs_exception->msgv3
                  msg_v4    = bcs_exception->msgv4
                EXCEPTIONS
                  OTHERS    = 1.
              p_retco = sy-subrc.
        ENDTRY.
      ENDIF.
      IF NOT result-tdfaxid  IS INITIAL OR                      " 422131
         NOT result-tdmailid IS INITIAL.                        " 422131
        CLEAR syst-msgv1.                                       " 422131
        IF NOT result-tdfaxid IS INITIAL.                       " 422131
          syst-msgv1 = result-tdfaxid.                          " 422131
        ELSEIF result-tdmailid IS INITIAL.                      " 422131
          syst-msgv1 = result-tdmailid.                         " 422131
        ENDIF.                                                  " 422131
        CALL FUNCTION 'NAST_PROTOCOL_UPDATE'                    " 422131
             EXPORTING                                          " 422131
                  msg_arbgb = 'VN'                              " 422131
                  msg_nr    = '095'                             " 422131
                  msg_ty    = 'I'                               " 422131
                  msg_v1    = syst-msgv1                        " 422131
             EXCEPTIONS                                         " 422131
                  OTHERS    = 1.                                " 422131
      ENDIF.                                                    " 422131
      IF result-userexit EQ 'C' OR
          result-userexit EQ 'E'.
        p_retco = '9'.
      ENDIF.
    ENDFORM.                               " ENDE
    end inserted
    Regards
    Nislina

    Hi Nislina,
    Could you please let me know how do you solve this issue.
    Code:
    if lt_binary[] is not initial.
    *     add attachment to document
             call method document->add_attachment
               exporting
                 i_attachment_type      = 'PDF'            
                 i_attachment_subject = 'My Attachment'
                 i_att_content_hex      = lt_binary.
      endif.
    Thanks & Regard's
    Sateesh

  • PDF attachment getting cut off

    Hello Experts,
    I'm trying to send a PDF attachment using a PL/SQL procedure. In this procedure Im picking up the PDF file from server and sending it via email attachment. The procedure works fine and sends the PDF but it cuts off the data in the PDF. When I open the PDF file I can only see half of page the rest is just blank. I cant figure out why this is happening, can someone please check the procedure and let me know where im going wrong.
    CREATE OR REPLACE PROCEDURE send_email AS
    v_file_handle UTL_FILE.FILE_TYPE;
    v_email_server VARCHAR2(100) := 'xxxx'; -- replace with SMTP server
    v_conn UTL_SMTP.CONNECTION;
    v_port NUMBER := 25;
    v_reply UTL_SMTP.REPLY;
    v_msg VARCHAR2(32767);
    v_line VARCHAR2(2000);
    v_message VARCHAR2(2000) ;
    b_connected BOOLEAN := FALSE;
    v_sender VARCHAR2(50) := '[email protected]'; -- Sender email address
    CRLF VARCHAR2(2):= CHR(13) || CHR(10);
    RECPT VARCHAR2(255) := '[email protected]'; -- Receptiant email address
    p_stat NUMBER;
    SLP PLS_INTEGER := 300;
    pdirpath VARCHAR2(50) := 'TEST'; -- directory on the server
    pfilename VARCHAR2(50) := 'test01.pdf'; -- pdf file on the server
    BEGIN
    p_stat := 0;
    /***** Check if the file exists ****/
    BEGIN
    v_file_handle := UTL_FILE.FOPEN(pDirPath, pFileName, 'R');
    EXCEPTION
    WHEN UTL_FILE.INVALID_PATH THEN
    p_stat := 01;
    DBMS_OUTPUT.PUT_LINE(SQLERRM ||' '|| p_stat);
    WHEN OTHERS THEN
    p_stat := 02;
    DBMS_OUTPUT.PUT_LINE(SQLERRM ||' '|| p_stat);
    END;
    /***** Try to connect for three times, do sleep in between for 5 minutes *****/
    FOR i IN 1..3 LOOP
    BEGIN
    --open the connection with the smtp server and DO THE handshake
    v_conn:= UTL_SMTP.OPEN_CONNECTION(v_email_server, v_port);
    v_reply :=UTL_SMTP.HELO( v_conn, v_email_server);
    IF 250 = v_reply.code THEN
    b_connected := TRUE;
    EXIT;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_LOCK.SLEEP (SLP);
    END;
    END LOOP;
    IF b_connected = FALSE THEN
    p_stat := 03;
    DBMS_OUTPUT.PUT_LINE(SQLERRM ||' '|| p_stat);
    END IF;
    v_reply := UTL_SMTP.MAIL(v_conn, v_sender);
    IF 250 != v_reply.code THEN
    p_stat := 04;
    DBMS_OUTPUT.PUT_LINE(SQLERRM ||' '|| p_stat);
    END IF;
    v_reply := UTL_SMTP.RCPT(v_conn, RECPT);
    IF 250 != v_reply.code THEN
    p_stat := 05;
    DBMS_OUTPUT.PUT_LINE(SQLERRM ||' '|| p_stat);
    END IF;
    UTL_SMTP.OPEN_DATA ( v_conn);
    v_message := 'Sample Email This is an auto generated mail. Please DO NOT reply TO this mail.'||CHR(10);
    v_msg := 'Date: '|| TO_CHAR( SYSDATE, 'Mon DD yy hh24:mi:ss' )
    || CRLF || 'From: ' || v_sender
    || CRLF || 'Subject: ' || 'Sample file'
    || CRLF || 'To: ' || RECPT
    || CRLF || 'Mime-Version: 1.0'
    || CRLF || 'Content-Type: multipart/mixed; boundary="DMW.Boundary.605592468"' || CRLF ||''
    || CRLF || v_message
    || CRLF ||''
    || CRLF ||'--DMW.Boundary.605592468'
    || CRLF ||'Content-Type: text/plain; NAME="v_message.txt"; charset=US-ASCII'
    || CRLF ||'Content-Disposition: inline; filename="v_message.txt"'
    || CRLF ||'Content-Transfer-Encoding: 7bit' || CRLF || ''
    || CRLF || v_message || CRLF || CRLF || CRLF;
    UTL_SMTP.WRITE_DATA(v_conn,v_msg);
    /***** Prepare the attachment to be sent *****/
    v_Msg := CRLF || '--DMW.Boundary.605592468'
    || CRLF || 'Content-Type: application/octet-stream; NAME="' || pFileName || '"'
    || CRLF || 'Content-Disposition: attachment; filename="' || pFileName || '"'
    || CRLF || 'Content-Transfer-Encoding: 7bit' || CRLF || CRLF;
    UTL_SMTP.WRITE_DATA (v_conn, v_msg);
    LOOP
    BEGIN
    UTL_FILE.GET_LINE(v_file_handle, v_line);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    EXIT;
    END;
    v_msg := '*** truncated ***' || CRLF;
    v_msg := v_line || CRLF;
    UTL_SMTP.WRITE_DATA ( v_conn, v_msg );
    END LOOP;
    UTL_FILE.FCLOSE(v_file_handle);
    v_msg := CRLF;
    UTL_SMTP.WRITE_DATA ( v_conn, v_msg );
    v_msg := CRLF || '--DMW.Boundary.605592468--' || CRLF;
    UTL_SMTP.WRITE_DATA ( v_conn, v_msg );
    UTL_SMTP.CLOSE_DATA( v_conn );
    UTL_SMTP.QUIT( v_conn );
    EXCEPTION
    WHEN OTHERS THEN
    p_stat := 06;
    END;
    I'm not sure why my PDF is getting cut off towards the end, any help would be much appreciated.
    Thank you very much.

    Hi,
    I managed to make it work, I changed the attach_base64 as per your recommendations but made my own slight change :-
    PROCEDURE attach_base64_fromfile
    (conn IN OUT NOCOPY utl_smtp.connection,
                        filename IN VARCHAR2,
    floc IN VARCHAR2,
                   mime_type IN VARCHAR2 DEFAULT 'application/octet',
                        inline IN BOOLEAN DEFAULT TRUE,
                        last IN BOOLEAN DEFAULT FALSE) IS
    i PLS_INTEGER;
    len PLS_INTEGER;
    fh Utl_File.File_Type;
    buf raw(32767);
    BEGIN
    begin_attachment(conn, mime_type, inline, filename, 'base64');
    fh := Utl_File.Fopen (
    location => floc,
    filename => filename,
    open_mode => 'r');
    BEGIN
    Utl_File.Get_Raw (
    file => fh,
    buffer => buf);
    i := 1;
    len := utl_raw.LENGTH(buf);
    WHILE (i < len) LOOP
    IF (i + MAX_BASE64_LINE_WIDTH < len) THEN
    utl_smtp.write_raw_data(conn, utl_encode.base64_encode(buf));
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    END IF;
    i := i + MAX_BASE64_LINE_WIDTH;
    END LOOP;
    EXCEPTION
    WHEN no_data_found THEN NULL;
    END;
    Utl_File.Fclose ( file => fh );
    end_attachment(conn, LAST);
    END;
    and created another procedure to call send_mail.attach_base64_fromfile :-
    CREATE OR REPLACE PROCEDURE send_email_attachment IS
    conn utl_smtp.connection;
    BEGIN
    conn := Send_Mail.begin_mail(
    sender => '[email protected]', -- sender email address
    recipients => '[email protected]', -- recipient email address
    subject => 'Attachment Test',
    mime_type => Send_Mail.MULTIPART_MIME_TYPE);
    send_mail_vv.attach_base64_fromfile(
    conn => conn,
    filename => 'test.pdf', -- file name
    floc => 'TEST', -- file location
    mime_type => 'application/octet',
    inline => TRUE);
    Send_Mail.end_attachment( conn => conn );
    Send_Mail.end_mail( conn => conn );
    END;
    Thanks for all your help.

  • Email with html body and a pdf attachment

    Hi,
    i try to send a email with html body and one attach in pdf
    in release 4.6c using the SO_DOCUMENT_SEND_API1.
    I've put the html in the txt table and the pdf in bin table but i obtain the following situation:
    1) with only the html in the body i see a right email in html
    2) with the html body AND the pdf attach i obtain a empty mail with two attach.
    what can i do ? I's possible to do this.
    Thanks in advance.

    Contact my basis guy is a problem !!
    maybe a need a function similar to SX_OBJECT_CONVERT_RAW_TXT to convert raw (containing html text) into real html ?
    my view V_SXCONV contain:
    ALI     HTM     2     SX_OBJECT_CONVERT_ALI_HTM
    ALI     PS     4     SX_OBJECT_CONVERT_ALI_PRT
    ALI     RAW     1     SX_OBJECT_CONVERT_ALI_RAW
    ALI     TXT     2     SX_OBJECT_CONVERT_ALI_TXT
    ICS     RAW     8     SX_OBJECT_CONVERT_ICS_RAW
    INT     RAW     8     SX_OBJECT_CONVERT_INT_RAW
    OBJ     HTM     2     SX_OBJECT_CONVERT_OBJ_HTM
    OTF     PCL     3     SX_OBJECT_CONVERT_OTF_PRT
    OTF     PDF     1     SX_OBJECT_CONVERT_OTF_PDF
    OTF     PS     2     SX_OBJECT_CONVERT_OTF_PRT
    OTF     RAW     9     SX_OBJECT_CONVERT_OTF_RAW
    RAW     SCR     6     SX_OBJECT_CONVERT_RAW_SCR
    RAW     TXT     7     SX_OBJECT_CONVERT_RAW_TXT
    SCR     OTF     1     SX_OBJECT_CONVERT_SCR_OTF
    TXT     INT     7     SX_OBJECT_CONVERT_TXT_INT
    URL     HTM     2     SX_OBJECT_CONVERT_OBJL_HTM
    thanks a lot.

  • How do I setup an automatic daily email with PDF attachment?

    I would like to setup an automatic daily e-mail (that will send every day around 6 AM), with an PDF attachment retrieved from a web URL.  The web URL is constant (that is the PDF file name never changes).    Any ideas?  I've messed around with automator with poor results at best.  Thanks in advance!
    P.S..... Apologies if this is in the wrong forum!

    Just one specific email addres... myself. 
    There is an online report that is updated every morning at 5:30 AM MST.  The ideal solution would email that document to myself every morning.; thus when I wake up, it's sitting in my inbox (iPhone/Macbook/Gmail, etc.)

  • Facing problem with logo in the PDF attachment when sending mail...

    hi friends,
    i'm facing problem with logo in the PDF attachment to the mail.
    my requirement:
    1. enter spool number and mail id in the selection screen.
    process:
    1. now the program will fetch the spool data and converts it to PDF.
    2. but when i'm trying to send mail with this PDF as attachment.
    when i open the PDF file from the mail, logo is not coming properly (looks disturbed).
    can anyone help me how to resolve this issue...
    thanks in advance, murashali.

    hi dinakar, thanks for your mail...
    logo looks good in spool/script/smartform.
    even it look good when i download this spool to pdf and to the presentation server as pdf file.
    i'm using CONVERT_OTFSPOOLJOB_2_PDF.
    when i used CONVERT_ABAPSPOOLJOB_2_PDF, is gives a msg - 'spool number not found'.
    here i'm using folloing code to pass pdf to the function module: SO_NEW_DOCUMENT_ATT_SEND_API1.
    code:
    Transfer the 132-long strings to 255-long strings
      lt_mtab_pdf[] = pdf[].
      LOOP AT lt_mtab_pdf INTO lwa_mtab_pdf.
        TRANSLATE lwa_mtab_pdf USING ' ~'.
        CONCATENATE lv_gd_buffer lwa_mtab_pdf INTO lv_gd_buffer.
        CLEAR lwa_mtab_pdf.
      ENDLOOP.
      TRANSLATE lv_gd_buffer USING '~ '.
      DO.
        lwa_mess_att = lv_gd_buffer.
        APPEND lwa_mess_att TO lt_mess_att.
        CLEAR lwa_mess_att.
        SHIFT lv_gd_buffer LEFT BY 255 PLACES.
        IF lv_gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    NOTE: problem i believe is with ''.  i'm getting this tilt symbol () in my pdf internal table.  here in the above code the line   TRANSLATE lv_gd_buffer USING '~ ' is changing the existing tilt to space.  so my logo is getting disturbed.
    even i tried with REPLACE this tilt with other char, but it doent work.
    can you give any idea...

  • How can I open a pdf attachment in Mozilla Thunderbird?

    In my Thunderbird email account, I checked a box for MSWord to open all attachments, but I would like to reverse that decision since I got a pdf attachment, and MSWord doesn't open that. How do I change it back to the way it was so the pdf attachment can be opened with adobe?

    Tools > Options > Attachments > Incoming tab
    * in the 'Content Type' column:
    * look for: Microsoft Office Word document
    * then look at the 'Action' for it
    * click on the current Action and select 'use Microsoft Office Word'
    If this is already setup ok then leave alone and do the next step.
    Is there a 'Content type' for Adobe Acrobat Document' ?
    If yes,
    * click on the Action and select 'Use Adobe Acrobat' or 'Adobe Reader'
    * click on OK
    If there is no 'Content type' for Adobe Acrobat Document'
    then click on OK and do the next step below.
    * Locate email with pdf attachment
    * right click on attachment and choose Open
    * select 'Open with' and choose 'Adobe Reader'
    * select 'do this automatically for files like this from now on.'
    * click on OK

  • Want to Send smartform as pdf attachment with a Email to some mail id

    Hi ,
    I want to send a smartform as a PDF attachment with a mail to a mail id. And I can send a mail with the PDF attachment.
    But I am not able to open the PDF. It is throwing some error (Adobe reader could not open u2018fileu2019 because it is either not a supported file type or because the file has been damaged (for example , it was sent as an email attachment and was not correctly decoded)).
    By debugging I come to know that the file which is generating is in some encoding format.
    Please help me regard this. This is very urgent.
    here is the code,
    Main Program :
    REPORT Ztest_report.
    *--Top Include for Global Data Declarations.
    INCLUDE ztest_report_top.
    *--Form Include for Form Routines.
    INCLUDE ztest_report_form.
    START-OF-SELECTION.
    START-OF-SELECTION.
    *--Display data
      Perform display_data.
    END-OF-SELECTION.
    Top declaration :
    Internal table
    DATA :  i_otfdata TYPE tsfotf,          " Smart Forms: Table OTF
            i_tline TYPE TABLE OF tline WITH HEADER LINE,
            i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
            i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    Objects to send mail.
            i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
            w_mailaddr TYPE ppfdmailad,
            w_mailtype TYPE so_escape,
            w_mailrecipient TYPE swotobjid,
            w_control TYPE ssfctrlop,
            w_compop TYPE ssfcompop,
            w_return TYPE ssfcrescl,
            wa_doc_chng TYPE sodocchgi1,
            w_data TYPE sodocchgi1,
            wa_buffer TYPE string, "To convert from 132 to 255
            wa_objhead TYPE soli_tab,
    Variables declarations
            v_form_name TYPE rs38l_fnam,
            v_len_in LIKE sood-objlen,
            v_len_out LIKE sood-objlen,
            v_len_outn TYPE i,
            v_lines_txt TYPE i,
            v_lines_bin TYPE i.
    Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-009.
    PARAMETER:      p_bukrs TYPE bukrs OBLIGATORY,            "Company Code
                    p_belnr TYPE belnr_d OBLIGATORY,          "Document No
                    p_gjahr TYPE gjahr OBLIGATORY,            "document type
                    p_mailid(50) TYPE c OBLIGATORY.
    "Mail Id
    SELECTION-SCREEN END OF BLOCK blk1.
    Form Logic :
    FORM display_data.
    *Local Variable declaration
      DATA: lc_fm TYPE rs38l_fnam,       "local variable to store the
            l_i_document_output_info TYPE ssfcrespd,
            l_i_struc_job_output_info TYPE ssfcrescl,
            l_i_struc_job_output_options TYPE ssfcrescl,
            i_lines TYPE TABLE OF tline WITH HEADER LINE,
            lv_job_output_info      TYPE ssfcrescl,
            lv_document_output_info TYPE ssfcrespd,
            lv_job_output_options   TYPE ssfcresop,
            lv_bin_filesize         LIKE sood-objlen.
    Determine the smartform name
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
           EXPORTING
                formname           = 'ZTEST_SMARTFORM'
           IMPORTING
                fm_name            = lc_fm
           EXCEPTIONS
                no_form            = 1
                no_function_module = 2
                OTHERS             = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      w_control-getotf = 'X'.
      w_control-no_dialog = 'X'.
      w_control-preview = space.
    w_control-device = 'MAIL'.
    Call the smartform and pass the selection screen parameter
      CALL FUNCTION lc_fm
           EXPORTING
                control_parameters = w_control
                output_options     = w_compop
                user_settings      = 'X'
                t_bukrs            = p_bukrs
                t_belnr            = p_belnr
                t_gjahr            = p_gjahr
           IMPORTING
                job_output_info    = l_i_struc_job_output_info
           EXCEPTIONS
                formatting_error   = 1
                internal_error     = 2
                send_error         = 3
                user_canceled      = 4
                OTHERS             = 5.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Moving the Smart Forms: Table OTF into an internal table
      i_otfdata[] = l_i_struc_job_output_info-otfdata[].
    CONVERT TO OTF TO PDF.
      CALL FUNCTION 'CONVERT_OTF'
           EXPORTING
                format                = 'PDF'
                max_linewidth         = 132
           IMPORTING
                bin_filesize          = lv_bin_filesize
           TABLES
                otf                   = i_otfdata
                lines                 = i_lines
           EXCEPTIONS
                err_max_linewidth     = 1
                err_format            = 2
                err_conv_not_possible = 3
                err_bad_otf           = 4
                OTHERS                = 5.
    IF sy-batch EQ l_c_no.
    To directly view the print-preview in PDF format
      CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
           EXPORTING
                i_otf                    = i_otfdata
           EXCEPTIONS
                convert_otf_to_pdf_error = 1
                cntl_error               = 2
                OTHERS                   = 3.
    For Sending the PDF file to a Mail ID.
    LOOP AT i_lines.
       TRANSLATE i_lines USING '~'.
       CONCATENATE wa_buffer i_lines INTO wa_buffer.
    ENDLOOP.
    TRANSLATE wa_buffer USING '~'.
    DO.
       i_record = wa_buffer.
       APPEND i_record.
       SHIFT wa_buffer LEFT BY 255 PLACES.
       IF wa_buffer IS INITIAL.
         EXIT.
       ENDIF.
    ENDDO.
      DATA: BEGIN OF zlines OCCURS 0,
      tline TYPE char255,
      END OF zlines.
    *Change the PDF format from 132 to 255.
      CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
           EXPORTING
                transfer_bin                = 'X'
           TABLES
                content_in                  = i_lines
                content_out                 = zlines
           EXCEPTIONS
                err_line_width_src_too_long = 1
                err_line_width_dst_too_long = 2
                err_conv_failed             = 3
                OTHERS                      = 4.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Attachment
      REFRESH: i_reclist,
      i_objtxt,
      i_objbin,
      i_objpack.
      CLEAR wa_objhead.
      i_objbin[] = zlines[].
    Create Message Body Title and Description
      i_objtxt = 'test with pdf-Attachment!'.
      APPEND i_objtxt.
      DESCRIBE TABLE i_objtxt LINES v_lines_txt.
      READ TABLE i_objtxt INDEX v_lines_txt.
      wa_doc_chng-obj_name = 'smartform'.
      wa_doc_chng-expiry_dat = sy-datum + 10.
      wa_doc_chng-obj_descr = 'smartform'.
      wa_doc_chng-sensitivty = 'F'.
      wa_doc_chng-doc_size = v_lines_txt * 255.
    Main Text
      CLEAR i_objpack-transf_bin.
      i_objpack-head_start = 1.
      i_objpack-head_num = 1.
      i_objpack-body_start = 2.
      i_objpack-body_num = v_lines_txt.
      i_objpack-doc_type = 'RAW'.
      APPEND i_objpack.
    Attachment (pdf-Attachment)
      i_objpack-transf_bin = 'X'.
      i_objpack-head_start = 1.
      i_objpack-head_num = 1.
      i_objpack-body_start = 2.
    I_OBJPACK-DOC_TYPE = 'RAW'.
      DESCRIBE TABLE i_objbin LINES v_lines_bin.
      READ TABLE i_objbin INDEX v_lines_bin.
      i_objpack-doc_size = v_lines_bin * 255 .
      i_objpack-body_num = v_lines_bin.
      i_objpack-doc_type = 'PDF'.
      i_objpack-obj_name = 'smart'.
      i_objpack-obj_descr = 'test'.
      APPEND i_objpack.
      CLEAR i_reclist.
      i_reclist-receiver = p_mailid.
      i_reclist-rec_type = 'U'.
      APPEND i_reclist.
    Send new document with attachments via RFC
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                document_data              = wa_doc_chng
                put_in_outbox              = 'X'
                commit_work                = 'X'
           TABLES
                packing_list               = i_objpack
                object_header              = wa_objhead
                contents_bin               = i_objbin
                contents_txt               = i_objtxt
                receivers                  = i_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.
        WRITE:/ 'Error When Sending the File', sy-subrc.
      ELSE.
        WRITE:/ 'Mail sent'.
      ENDIF.
    ENDFORM.                    " display_data

    hi,
    i wrote a programm.for me it is working.i think it will help for u.
    DATA: t_otfdata TYPE ssfcrescl,
          t_lines LIKE tline OCCURS 0 WITH HEADER LINE,
          t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
          t_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
    Objects to send mail.
    DATA:T_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
    DATA: w_filesize TYPE i,
          w_bin_filesize TYPE i,
          wa_ctrlop TYPE ssfctrlop,
          wa_outopt TYPE ssfcompop,
          WA_BUFFER TYPE STRING,          "To convert from 132 to 255
          WA_OBJHEAD TYPE SOLI_TAB,
          WA_DOC_CHNG TYPE SODOCCHGI1,
          W_DATA TYPE SODOCCHGI1.
    DATA: form_name TYPE rs38l_fnam,
          V_LINES_TXT TYPE I,
          V_LINES_BIN TYPE I,
          nast-spras type sy-langu value 'DE'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = 'ZSR_DEMO1'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
       FM_NAME                  = form_name
    EXCEPTIONS
       NO_FORM                  = 1
       NO_FUNCTION_MODULE       = 2
       OTHERS                   = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    wa_ctrlop-LANGU = nast-spras.
    wa_ctrlop-getotf = 'X'.
    wa_ctrlop-no_dialog = 'X'.
    wa_outopt-tdnoprev = 'X'.
    CALL FUNCTION form_name
      EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       CONTROL_PARAMETERS         = wa_ctrlop
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       OUTPUT_OPTIONS             = wa_outopt
       USER_SETTINGS              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       JOB_OUTPUT_INFO            = t_otfdata
      JOB_OUTPUT_OPTIONS         =
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 4
       OTHERS                     = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    t_otf[] = t_otfdata-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
       FORMAT                      = 'PDF'
       MAX_LINEWIDTH               = 132
      ARCHIVE_INDEX               = ' '
      COPYNUMBER                  = 0
      ASCII_BIDI_VIS2LOG          = ' '
      PDF_DELETE_OTFTAB           = ' '
    IMPORTING
       BIN_FILESIZE                = w_bin_filesize
      BIN_FILE                    =
      TABLES
        OTF                         = t_otf
        LINES                       = t_lines
    EXCEPTIONS
       ERR_MAX_LINEWIDTH           = 1
       ERR_FORMAT                  = 2
       ERR_CONV_NOT_POSSIBLE       = 3
       ERR_BAD_OTF                 = 4
       OTHERS                      = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    loop at t_lines.
    TRANSLATE t_lines USING '~'.
      CONCATENATE WA_BUFFER T_LINES INTO WA_BUFFER.
    ENDLOOP.
    TRANSLATE WA_BUFFER USING '~'.
    DO.
      t_RECORD = WA_BUFFER.
      APPEND t_RECORD.
      SHIFT WA_BUFFER LEFT BY 255 PLACES.
      IF WA_BUFFER IS INITIAL.
        EXIT.
      ENDIF.
    ENDDO.
    Attachment
    REFRESH: T_RECLIST,
    T_OBJTXT,
    T_OBJBIN,
    T_OBJPACK.
    CLEAR WA_OBJHEAD.
    T_OBJBIN[] = T_RECORD[].
    Create Message Body Title and Description
    T_OBJTXT = 'test with pdf-Attachment!'.
    APPEND T_OBJTXT.
    DESCRIBE TABLE T_OBJTXT LINES V_LINES_TXT.
    READ TABLE T_OBJTXT INDEX V_LINES_TXT.
    WA_DOC_CHNG-OBJ_NAME = 'smartform'.
    WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
    WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
    WA_DOC_CHNG-SENSITIVTY = 'F'.
    WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
    Main Text
    CLEAR T_OBJPACK-TRANSF_BIN.
    T_OBJPACK-HEAD_START = 1.
    T_OBJPACK-HEAD_NUM = 0.
    T_OBJPACK-BODY_START = 1.
    T_OBJPACK-BODY_NUM = V_LINES_TXT.
    T_OBJPACK-DOC_TYPE = 'RAW'.
    APPEND T_OBJPACK.
    Attachment (pdf-Attachment)
    T_OBJPACK-TRANSF_BIN = 'X'.
    T_OBJPACK-HEAD_START = 1.
    T_OBJPACK-HEAD_NUM = 0.
    T_OBJPACK-BODY_START = 1.
    DESCRIBE TABLE T_OBJBIN LINES V_LINES_BIN.
    READ TABLE T_OBJBIN INDEX V_LINES_BIN.
    T_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
    T_OBJPACK-BODY_NUM = V_LINES_BIN.
    T_OBJPACK-DOC_TYPE = 'PDF'.
    T_OBJPACK-OBJ_NAME = 'smart'.
    T_OBJPACK-OBJ_DESCR = 'test'.
    APPEND T_OBJPACK.
    CLEAR T_RECLIST.
    T_RECLIST-RECEIVER = 'mail id'.
    T_RECLIST-REC_TYPE = 'U'.
    APPEND T_RECLIST.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        DOCUMENT_DATA              = WA_DOC_CHNG
        PUT_IN_OUTBOX              = 'X'
        COMMIT_WORK                = 'X'
      TABLES
        PACKING_LIST               = T_OBJPACK
        OBJECT_HEADER              = WA_OBJHEAD
        CONTENTS_BIN               = T_OBJBIN
        CONTENTS_TXT               = T_OBJTXT
        RECEIVERS                  = T_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.
      WRITE:/ 'Error When Sending the File', SY-SUBRC.
    ELSE.
      WRITE:/ 'Mail sent'.
    ENDIF.
    please reward me if helpful.

  • Email PDF attachment not opening error

    Hi All,
    I am sending the PDF attachment through email when i get the mail and opening the attachment the PDF says "A drawing error occurred'. Can any one tell me how to solve this problem.
    i am doing otf to pdf conversion and the populate all the field related to the email.
    Is there any specific solution for this error.
    Regards,
    Lakshmikanth

    Hi All,
    I am sending the PDF attachment through email when i get the mail and opening the attachment the PDF says "A drawing error occurred'. Can any one tell me how to solve this problem.
    i am doing otf to pdf conversion and the populate all the field related to the email.
    Is there any specific solution for this error.
    Regards,
    Lakshmikanth

  • Dunning letter (email) PDF attachment or body of email

    Hi experts,
    What is the industry practice for dunning letters when sent via email? Attach them as a pdf to the email, or add all the content of the dunning letter to the body of the email to make it easier for the customer to receive the message?
    Thanks,
    Mario

    Hi Mario,
    It all depends on the functionality that and payment option that are provided.
    If the dunning letters contains and payment/remittance slip(through which customer can make payment in bank, outlet or post office) than the letter should go as PDF attached to mail with body saying that its the reminder for payment being missed,
    But if the payment option is not like as described above than you can send the the letter in html body mail.
    Regards

  • Email Invoices to customer as a PDF attachment

    Hi,
    I have a requirement as follows:-
    SAP will get multiple invoice numbers from an external system. I need to send all the invoices(for a given customer) in one pdf and email it to the customer  as an attachment.
    Please provide your expert and detailed advice.
    Thanks,
    Ani

    Hi Ani,
    Go through this u definetly got ur solution.
    Here is the code to send the Smartform to mail as PDF attachment.
    *& Report ZTEST_NREDDY_PDF_MAIL
    REPORT ZTEST_NREDDY_PDF_MAIL.
    Internal Table declarations
    DATA: I_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,
    I_TLINE TYPE TABLE OF TLINE WITH HEADER LINE,
    I_RECEIVERS TYPE TABLE OF SOMLRECI1 WITH HEADER LINE,
    I_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
    Objects to send mail.
    I_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
    I_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
    I_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
    I_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
    WA_OBJHEAD TYPE SOLI_TAB,
    W_CTRLOP TYPE SSFCTRLOP,
    W_COMPOP TYPE SSFCOMPOP,
    W_RETURN TYPE SSFCRESCL,
    WA_DOC_CHNG TYPE SODOCCHGI1,
    W_DATA TYPE SODOCCHGI1,
    WA_BUFFER TYPE STRING, "To convert from 132 to 255
    Variables declarations
    V_FORM_NAME TYPE RS38L_FNAM,
    V_LEN_IN LIKE SOOD-OBJLEN,
    V_LEN_OUT LIKE SOOD-OBJLEN,
    V_LEN_OUTN TYPE I,
    V_LINES_TXT TYPE I,
    V_LINES_BIN TYPE I.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    FORMNAME = 'ZTEST'
    IMPORTING
    FM_NAME = V_FORM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    W_CTRLOP-GETOTF = 'X'.
    W_CTRLOP-NO_DIALOG = 'X'.
    W_COMPOP-TDNOPREV = 'X'.
    CALL FUNCTION V_FORM_NAME
    EXPORTING
    CONTROL_PARAMETERS = W_CTRLOP
    OUTPUT_OPTIONS = W_COMPOP
    USER_SETTINGS = 'X'
    IMPORTING
    JOB_OUTPUT_INFO = W_RETURN
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    I_OTF[] = W_RETURN-OTFDATA[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    FORMAT = 'PDF'
    MAX_LINEWIDTH = 132
    IMPORTING
    BIN_FILESIZE = V_LEN_IN
    TABLES
    OTF = I_OTF
    LINES = I_TLINE
    EXCEPTIONS
    ERR_MAX_LINEWIDTH = 1
    ERR_FORMAT = 2
    ERR_CONV_NOT_POSSIBLE = 3
    OTHERS = 4.
    IF SY-SUBRC <> 0.
    ENDIF.
    LOOP AT I_TLINE.
    TRANSLATE I_TLINE USING '~'.
    CONCATENATE WA_BUFFER I_TLINE INTO WA_BUFFER.
    ENDLOOP.
    TRANSLATE WA_BUFFER USING '~'.
    DO.
    I_RECORD = WA_BUFFER.
    APPEND I_RECORD.
    SHIFT WA_BUFFER LEFT BY 255 PLACES.
    IF WA_BUFFER IS INITIAL.
    EXIT.
    ENDIF.
    ENDDO.
    Attachment
    REFRESH: I_RECLIST,
    I_OBJTXT,
    I_OBJBIN,
    I_OBJPACK.
    CLEAR WA_OBJHEAD.
    I_OBJBIN[] = I_RECORD[].
    Create Message Body Title and Description
    I_OBJTXT = 'test with pdf-Attachment!'.
    APPEND I_OBJTXT.
    DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
    READ TABLE I_OBJTXT INDEX V_LINES_TXT.
    WA_DOC_CHNG-OBJ_NAME = 'smartform'.
    WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
    WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
    WA_DOC_CHNG-SENSITIVTY = 'F'.
    WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
    Main Text
    CLEAR I_OBJPACK-TRANSF_BIN.
    I_OBJPACK-HEAD_START = 1.
    I_OBJPACK-HEAD_NUM = 0.
    I_OBJPACK-BODY_START = 1.
    I_OBJPACK-BODY_NUM = V_LINES_TXT.
    I_OBJPACK-DOC_TYPE = 'RAW'.
    APPEND I_OBJPACK.
    Attachment (pdf-Attachment)
    I_OBJPACK-TRANSF_BIN = 'X'.
    I_OBJPACK-HEAD_START = 1.
    I_OBJPACK-HEAD_NUM = 0.
    I_OBJPACK-BODY_START = 1.
    DESCRIBE TABLE I_OBJBIN LINES V_LINES_BIN.
    READ TABLE I_OBJBIN INDEX V_LINES_BIN.
    I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
    I_OBJPACK-BODY_NUM = V_LINES_BIN.
    I_OBJPACK-DOC_TYPE = 'PDF'.
    I_OBJPACK-OBJ_NAME = 'smart'.
    I_OBJPACK-OBJ_DESCR = 'test'.
    APPEND I_OBJPACK.
    CLEAR I_RECLIST.
    I_RECLIST-RECEIVER = '[email protected]'.
    I_RECLIST-REC_TYPE = 'U'.
    APPEND I_RECLIST.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    DOCUMENT_DATA = WA_DOC_CHNG
    PUT_IN_OUTBOX = 'X'
    COMMIT_WORK = 'X'
    TABLES
    PACKING_LIST = I_OBJPACK
    OBJECT_HEADER = WA_OBJHEAD
    CONTENTS_BIN = I_OBJBIN
    CONTENTS_TXT = I_OBJTXT
    RECEIVERS = I_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.
    WRITE:/ 'Error When Sending the File', SY-SUBRC.
    ELSE.
    WRITE:/ 'Mail sent'.
    ENDIF.
    If you want to send some text as Body of the Mail then follow this once
    when u r callin the FM'SO_NEW_DOCUMENT_ATT_SEND_API1'.. points to remember
    1.u have to pass the body of content in table CONTENTS_TXT(ia m using I_OBJBIN) (each line a record) then. suppose i have appended 11 records to the table CONTENTS_TXT .
    2.PACKING_LIST(iam usign I_OBJPACK) table u ahve to append a redord as follows
    I_OBJPACK-TRANSF_BIN = ' '.
    I_OBJPACK-HEAD_START = 000000000000001.
    I_OBJPACK-HEAD_NUM = 000000000000001.
    I_OBJPACK-BODY_START = 000000000000002
    I_OBJPACK-BODY_NUM = 000000000000010.
    I_OBJPACK-DOC_TYPE = 'RAW'.
    append I_OBJPACK-.
    by the above code system treat the first line in table I_OBJBIN as header and the 2nd line to 10 lines tread as body.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    DOCUMENT_DATA = WA_DOC_CHNG
    PUT_IN_OUTBOX = 'X'
    TABLES
    PACKING_LIST = I_OBJPACK
    OBJECT_HEADER = WA_OBJHEAD
    CONTENTS_BIN = I_OBJBIN
    CONTENTS_TXT = I_OBJTXT
    RECEIVERS = I_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.
    Reward points if helpful.
    Thanks
    Naveen khan

  • Sending an email of the layout in PDF attachement

    Hello All,
    I have written a program to send the layout in PDF format to send in a mail to the customer.
    The email is going fne with the PDF attachement in the development box, but it is not working in Quality box.
    In the Quality box the email is going but the attachement is not opening.
    I have used CONVERT_OTF function module for converting OTF format to PDF format. As per my analysis it is returning the PDF format properly in Developement box but not the same in Quality. In Quality the the data returning in PDF format is not in proper manner. It is giving some junk data with symbols like traingle, rectange..etc..
    I am using FM SO_OBJECT_SEND for sending an email.
    Can you please suggest me what may be problem?
    Valuable answers will be rewarded.
    Thanks & Regards,
    Satish.

    Hi,
    you need to save the File in PDF format not in the text format.
    check whether the file is saved in pdf format or not.
    Regards,
    Raj.

  • Problem in sending online interactive form in email as PDF attachment

    Hi,
    I am trying to send online intercative forms as PDF attachment once user fills it and click on send button. But this mail i am trying to send from SAP workflow. For this am using one function module which is accepting the pdfsource context attribute of binary type as Xstring. Once i run the webdynpro application i am getting mail in out look but when i open the attachment i am getting error file is damaged.
    Can you pls help me in solving this, Or any other way for doing the same.
    Here is the code i am using for triggering the RFC from WD
    Zsend_Mail_Attachment_Sev_Input mail = new Zsend_Mail_Attachment_Sev_Input();     
              //to capture the outplacement level entered in the form
              mail.setI_Out_Place_Level(wdContext.currentVn_severancedetailsElement().getVa_outplacement_level().getBytes());
         mail.setI_Bin_Data(wdContext.currentContextElement().getPdfSource());
         wdContext.nodeZsend_Mail_Attachment_Sev_Input().bind(mail);
         try
              wdContext.currentZsend_Mail_Attachment_Sev_InputElement().modelObject().execute();
              wdComponentAPI.getMessageManager().reportSuccess("Notification Sent Successfully.");
         catch (WDDynamicRFCExecuteException e)
              // TODO Auto-generated catch block
              wdComponentAPI.getMessageManager().reportSuccess(" This is inside the mail exception!!"+e);
              e.printStackTrace();
    Here is the function module code
    FUNCTION ZSEND_MAIL_ATTACHMENT_SEV.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(I_OUT_PLACE_LEVEL) TYPE  XSTRING OPTIONAL
    *"     VALUE(I_BIN_DATA) TYPE  XSTRING OPTIONAL
    *"  TABLES
    *"      T_V_BIN_DATA STRUCTURE  SOLISTI1
    *"      IT_MESSAGE STRUCTURE  SOLISTI1
    Data Declaration
      DATA: gd_cnt TYPE i,
            gd_sent_all(1) TYPE c,
            gd_error TYPE sy-subrc,
            tab_lines LIKE sy-tabix,
            v_subject(255) VALUE 'HI'.
    Structure Declaration
      DATA : BEGIN OF it_file OCCURS 0,
              row(255),
             END OF it_file.
      DATA : BEGIN OF i_split OCCURS 0,
      row(50),
      END OF i_split.
    DESCRIBE TABLE it_message LINES tab_lines.
    READ TABLE it_message INDEX tab_lines.
    Internal Table Declaration
      data : it_receivers like table of SOMLRECI1 with header line."occurs 0.
      DATA : objbin LIKE SOLIX OCCURS 0 WITH HEADER LINE.
      DATA : it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
      data : wa_receiver like table of SOMLRECI1 with header line.
      data : it_receiver like table of SOMLRECI1 with header line.
      DATA :   gd_doc_data LIKE sodocchgi1 OCCURS 0 WITH HEADER LINE.
      REFRESH : objbin, it_packing_list, it_receivers, wa_receiver.
      CLEAR   : objbin, it_packing_list, wa_receiver, it_receivers.
    gd_doc_data-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( it_message ).
    gd_doc_data-obj_langu = sy-langu.
    gd_doc_data-obj_name = 'SENDFILE'.
    gd_doc_data-obj_descr = v_subject.
    gd_doc_data-sensitivty = 'O'.
    APPEND GD_DOC_DATA.
    Appending The Internal Table it_packing_list
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      it_packing_list-doc_type = 'RAW'.
      it_packing_list-body_num = tab_lines.
      APPEND it_packing_list.
      move i_bin_data to t_v_bin_data.
    ********Add By Anuj
      APPEND t_v_bin_data.
    ********End Add By Anuj
      LOOP AT t_v_bin_data.
        MOVE t_v_bin_data TO objbin-line.
        APPEND objbin.
      ENDLOOP.
      CLEAR it_packing_list.
      DESCRIBE TABLE objbin LINES tab_lines.
      it_packing_list-transf_bin = 'X'.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 1.
      it_packing_list-body_start = 1.
      it_packing_list-doc_type = 'PDF'.
      it_packing_list-body_num = tab_lines.
      it_packing_list-doc_size = tab_lines * 255.
      APPEND it_packing_list.
      wa_receiver-receiver = '[email protected]'.
      wa_receiver-rec_type = 'U'.
      wa_receiver-com_type = 'INT'.
      APPEND wa_receiver.
      move wa_receiver[] to it_receiver[].
      append it_receiver.
    *Appending The Internal Table it_receivers
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    move wa_receiver[] to it_receiver[].
    append it_receiver.
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    move wa_receiver[] to it_receiver[].
    append it_receiver.
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    move wa_receiver[] to it_receiver[].
    append it_receiver.
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    move wa_receiver to it_receiver.
    append it_receiver.
      Move wa_receiver[] to it_receivers[].
    Clear it_receivers.
      if i_OUT_PLACE_LEVEL NE 0.
    loop at it_receivers into wa_receiver.
       loop at it_receivers into wa_receiver.
    *Function Module To Post The Message To Externa Mail
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data              = gd_doc_data
            put_in_outbox              = 'X'
            commit_work                = 'X'
          TABLES
            packing_list               = it_packing_list
            contents_hex               = objbin
            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.
        clear wa_receiver.
       endloop.
      elseif i_OUT_PLACE_LEVEL eq 0.
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data              = gd_doc_data
            put_in_outbox              = 'X'
            commit_work                = 'X'
          TABLES
            packing_list               = it_packing_list
            contents_hex               = objbin
            receivers                  = it_receiver
          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.
        clear wa_receiver.
      endif.
    ENDFUNCTION.
    Regards
    Ravindra

    Hi,
    I am trying to send online intercative forms as PDF attachment once user fills it and click on send button. But this mail i am trying to send from SAP workflow. For this am using one function module which is accepting the pdfsource context attribute of binary type as Xstring. Once i run the webdynpro application i am getting mail in out look but when i open the attachment i am getting error file is damaged.
    Can you pls help me in solving this, Or any other way for doing the same.
    Here is the code i am using for triggering the RFC from WD
    Zsend_Mail_Attachment_Sev_Input mail = new Zsend_Mail_Attachment_Sev_Input();     
              //to capture the outplacement level entered in the form
              mail.setI_Out_Place_Level(wdContext.currentVn_severancedetailsElement().getVa_outplacement_level().getBytes());
         mail.setI_Bin_Data(wdContext.currentContextElement().getPdfSource());
         wdContext.nodeZsend_Mail_Attachment_Sev_Input().bind(mail);
         try
              wdContext.currentZsend_Mail_Attachment_Sev_InputElement().modelObject().execute();
              wdComponentAPI.getMessageManager().reportSuccess("Notification Sent Successfully.");
         catch (WDDynamicRFCExecuteException e)
              // TODO Auto-generated catch block
              wdComponentAPI.getMessageManager().reportSuccess(" This is inside the mail exception!!"+e);
              e.printStackTrace();
    Here is the function module code
    FUNCTION ZSEND_MAIL_ATTACHMENT_SEV.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(I_OUT_PLACE_LEVEL) TYPE  XSTRING OPTIONAL
    *"     VALUE(I_BIN_DATA) TYPE  XSTRING OPTIONAL
    *"  TABLES
    *"      T_V_BIN_DATA STRUCTURE  SOLISTI1
    *"      IT_MESSAGE STRUCTURE  SOLISTI1
    Data Declaration
      DATA: gd_cnt TYPE i,
            gd_sent_all(1) TYPE c,
            gd_error TYPE sy-subrc,
            tab_lines LIKE sy-tabix,
            v_subject(255) VALUE 'HI'.
    Structure Declaration
      DATA : BEGIN OF it_file OCCURS 0,
              row(255),
             END OF it_file.
      DATA : BEGIN OF i_split OCCURS 0,
      row(50),
      END OF i_split.
    DESCRIBE TABLE it_message LINES tab_lines.
    READ TABLE it_message INDEX tab_lines.
    Internal Table Declaration
      data : it_receivers like table of SOMLRECI1 with header line."occurs 0.
      DATA : objbin LIKE SOLIX OCCURS 0 WITH HEADER LINE.
      DATA : it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
      data : wa_receiver like table of SOMLRECI1 with header line.
      data : it_receiver like table of SOMLRECI1 with header line.
      DATA :   gd_doc_data LIKE sodocchgi1 OCCURS 0 WITH HEADER LINE.
      REFRESH : objbin, it_packing_list, it_receivers, wa_receiver.
      CLEAR   : objbin, it_packing_list, wa_receiver, it_receivers.
    gd_doc_data-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( it_message ).
    gd_doc_data-obj_langu = sy-langu.
    gd_doc_data-obj_name = 'SENDFILE'.
    gd_doc_data-obj_descr = v_subject.
    gd_doc_data-sensitivty = 'O'.
    APPEND GD_DOC_DATA.
    Appending The Internal Table it_packing_list
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      it_packing_list-doc_type = 'RAW'.
      it_packing_list-body_num = tab_lines.
      APPEND it_packing_list.
      move i_bin_data to t_v_bin_data.
    ********Add By Anuj
      APPEND t_v_bin_data.
    ********End Add By Anuj
      LOOP AT t_v_bin_data.
        MOVE t_v_bin_data TO objbin-line.
        APPEND objbin.
      ENDLOOP.
      CLEAR it_packing_list.
      DESCRIBE TABLE objbin LINES tab_lines.
      it_packing_list-transf_bin = 'X'.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 1.
      it_packing_list-body_start = 1.
      it_packing_list-doc_type = 'PDF'.
      it_packing_list-body_num = tab_lines.
      it_packing_list-doc_size = tab_lines * 255.
      APPEND it_packing_list.
      wa_receiver-receiver = '[email protected]'.
      wa_receiver-rec_type = 'U'.
      wa_receiver-com_type = 'INT'.
      APPEND wa_receiver.
      move wa_receiver[] to it_receiver[].
      append it_receiver.
    *Appending The Internal Table it_receivers
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    move wa_receiver[] to it_receiver[].
    append it_receiver.
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    move wa_receiver[] to it_receiver[].
    append it_receiver.
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    move wa_receiver[] to it_receiver[].
    append it_receiver.
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    move wa_receiver to it_receiver.
    append it_receiver.
      Move wa_receiver[] to it_receivers[].
    Clear it_receivers.
      if i_OUT_PLACE_LEVEL NE 0.
    loop at it_receivers into wa_receiver.
       loop at it_receivers into wa_receiver.
    *Function Module To Post The Message To Externa Mail
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data              = gd_doc_data
            put_in_outbox              = 'X'
            commit_work                = 'X'
          TABLES
            packing_list               = it_packing_list
            contents_hex               = objbin
            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.
        clear wa_receiver.
       endloop.
      elseif i_OUT_PLACE_LEVEL eq 0.
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data              = gd_doc_data
            put_in_outbox              = 'X'
            commit_work                = 'X'
          TABLES
            packing_list               = it_packing_list
            contents_hex               = objbin
            receivers                  = it_receiver
          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.
        clear wa_receiver.
      endif.
    ENDFUNCTION.
    Regards
    Ravindra

  • Smartform to OTF to PDF attached to an email ERROR

    Hi everyone... I have this problem... I need to send a smartform attached to an email... I'm doing the following:
    - Create the OTF using the smartform function importing job_output_info.
    - Convert the OTF (job_output_info-otfdata) to PDF using CONVERT_OTF_2_PDF.
    - Change the table line's width using SX_TABLE_LINE_WIDTH_CHANGE.
    - Send the email using SO_NEW_DOCUMENT_ATT_SEND_API1.
    Everything seems to be OK. But When I check the PDF file attached in the email and open it, everything there is a mess. The letters are superimposed over each other and the grills are not painted (instead it shows a black block).
    Any ideas how to solve this???
    Thanks a lot!!!

    Try this out..!
    <removed by moderator>
    To convert the script out put to PDF.
    CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF' u201C FOR out put format
          max_linewidth         = 132 u201CFor ASCII format: Number of lines in LINES-TDLINE
        IMPORTING
          bin_filesize          = gv_bin_filesize u201CFile size reference
        TABLES
          otf                   = gt_otf u201CInput table with OTF format
          lines                 = gt_pdf_tab " Output table with target format
    To mail Order in PDF format:
    Data declaration part :
    DATA: gt_reclist TYPE TABLE OF somlreci1, " SAPoffice: Structure of the API Recipient List
           gt_pdf_tab TYPE TABLE OF tline, " SAPscript: Text Lines
           gt_otf TYPE TABLE OF itcoo, " OTF Structure
           gt_objbin TYPE TABLE OF solisti1, " SAPoffice: Single List with Column Length 255
           gt_objpack TYPE TABLE OF sopcklsti1. " SAPoffice: Description of Imported Object Components
    DATA: gv_form_name TYPE rs38l_fnam, " Used to store the function module generated by Smartform
    gv_bin_filesize TYPE i, " Store the file size
    gv_pos TYPE i,
    gv_len TYPE i,
    gv_tab_lines TYPE i.
    DATA : gc_text(11) TYPE c VALUE 'Form Output',
    gc_tst(3) TYPE c VALUE 'TST',
    gc_testing(30) TYPE c VALUE 'Zellar Sales Document'.
    1. Assigning the Description of the object sent in the mail
      CLEAR gs_docdata.
      gs_docdata-obj_name = gc_tst.
      gs_docdata-obj_descr = gc_testing.
    Assigning the email id to Structure of the API Recipient List table
      CLEAR : gt_reclist, gs_reclist. u201C variables used
      gs_reclist-receiver = mail address'. u201CTo whom this mail should go
      GS_RECLIST-REC_TYPE = 'U'.
      APPEND gs_reclist TO gt_reclist. u201C Internal table for storing mail address
    2.Passing the Smart form  text lines to SAP office: Single List with Column Length 255 table ,this logic is used to get all the data into PDF file while you send an attachment through mail..
    CLEAR: gs_objbin, gs_pdf_tab.
      LOOP AT gt_pdf_tab INTO gs_pdf_tab. u201CLoop the content of PDF table
        gv_pos = 255 - gv_len.
        IF gv_pos > 134. "length of pdf_table
          gv_pos = 134.
        ENDIF.
        gs_objbin+gv_len = gs_pdf_tab(gv_pos).
        gv_len = gv_len + gv_pos.
        IF gv_len = 255. "length of out (contents_bin)
          APPEND gs_objbin TO gt_objbin.
          CLEAR: gs_objbin, gv_len.
          IF gv_pos < 134.
            gs_objbin = gs_pdf_tab+gv_pos.
            gv_len = 134 - gv_pos.
          ENDIF.
        ENDIF.
      ENDLOOP.
      IF gv_len > 0.
        APPEND gs_objbin TO gt_objbin. u201CTable contains Single List with Column Length 255 table
      ENDIF.
    3. Filling the details in SAPoffice: Description of Imported Object Components table
    DESCRIBE TABLE gt_objbin LINES gv_tab_lines.
      CLEAR gs_objbin.
      READ TABLE gt_objbin INTO gs_objbin INDEX gv_tab_lines.
      IF sy-subrc = 0.
        gs_objpack-doc_size = ( gv_tab_lines - 1 ) * 255 + STRLEN( gs_objbin ).
        gs_objpack-transf_bin = 'X'.
        gs_objpack-head_start = 1.
        gs_objpack-head_num = 0.
        gs_objpack-body_start = 1.
        gs_objpack-body_num = gv_tab_lines.
        gs_objpack-doc_type = 'PDF'.
        gs_objpack-obj_name = 'ATTACHMENT'.
        gs_objpack-obj_descr = 'test'.
        APPEND gs_objpack TO gt_objpack.
      ENDIF.
    4. Sending the Form Output in the PDF format to email
    data: WK_OBJHEAD TYPE SOLI_TAB.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1' u201Cfunction module used for sending mail
        EXPORTING
          document_data              = gs_docdata u201CAttributes of new document
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = gt_objpack u201CInformation about structure of data tables
          OBJECT_HEADER              = WK_OBJHEAD u201CHeader data for document (spec.header)
          contents_bin               = gt_objbin   u201CData which is to be sent as pdf attachment
          receivers                  = gt_reclist  u201Cmailing list
        EXCEPTIONS                                 u201CException Handling
          too_many_receivers         = 1 
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        WRITE 'Sent Successfully'.
      ENDIF.
    Edited by: Thomas Zloch on Jul 16, 2010 10:38 PM

Maybe you are looking for

  • How to disable Auto Brightness? using windows 8

    Hi,  This auto brightness problem is been bothring me for a long time now, and i can't find any fix for it at all   the display goes:  - Bright  when having on screen a white web page, document, picture   - and it display dims down when having on scr

  • F-44 can't clear special GL

    under vendor 100001, there are two open items, all have special GL indicator:K, amount is the same 300 USD. when I use F-44 to clear vendor 100001, it reports error: Account 1100100 in company code  B100 cannot be directly posted to Message no. F5354

  • IE8 for 11.1.2.2

    While trying to provision groups on shared services on IE8 , The right hand pane which displays the tree or list view does not does not align properly with the selected roles frame on the right. It is so asymmetrical and sometimes becomes really toug

  • Convert Sub-Report to Crystal Command

    I'm attempting to convert a sub-report and a shared variable from the report to a Command. Can someone help with the conversion Here is the part of the Crystal SQL I can't convert This is within last7days >>>  (ORDER_PROC.ORDER_INST>={ts '2014-06-18

  • Trying to access R/3 system in VC , getting error

    Hi all, my project requires me to get materials from r/3 and insert into my application. i have to create a model in VC which does so. I have identified BAPI_MATERIAL_GETLIST and BAPI_MATERIAL_GETDETAIL which would do it for me. now i know to access