PDF email

Hi Gurus
I have to send output of report as pdf attachment of the email.
I have used Fm CONVERT_ABAPSPOOLJOB_2_PDF to convet spool request to pdf format.
and SO_DOCUMENT_SEND_API1 Fm to send email. Its working Fine.
But Now i need to send email by using Methods,My code is as below
DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.
DATA: it_pdf_output2 type SOLIX_TAB occurs 0.
DATA: BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF it_pdf_output.
DATA:
*it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att_wa TYPE solisti1,
gti_documents TYPE zsti_email_documents,
g_documents_wa TYPE LINE OF zsti_email_documents,
gti_recipients TYPE zsti_email_recipients,
g_recipients_wa TYPE LINE OF zsti_email_recipients,
gti_contents_hex TYPE solix_tab,
gti_contents_text TYPE soli_tab.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
<b>it_pdf_output is to be converted into gti_contents_hex.</b>
LOOP AT it_pdf_output INTO mess_att_wa.
MOVE mess_att_wa-line TO contents_hex_wa-line.
APPEND contents_hex_wa TO gti_contents_hex.
ENDLOOP.
g_documents_wa-type = 'RAW'.
g_documents_wa-subject = 'KUMAR TEST '.
g_documents_wa-content_hex = xcontent_hex.
APPEND g_documents_wa TO gti_documents.
DATA:email TYPE so_name.
email = '[email protected]'.
g_recipients_wa-uname = 'KUMAR'.
g_recipients_wa-c_address = email.
APPEND g_recipients_wa TO gti_recipients.
TRY.
-------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).
APPEND 'hello world' TO text.
APPEND '20/09/2007' TO text.
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = text
i_length = '12'
i_subject = 'subject' ).
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = 'PDF'
i_attachment_subject = gd_subject
<b>i_att_content_hex = gti_contents_hex.</b>
add document to send request
CALL METHOD send_request->set_document( document ).
--------- set sender -------------------------------------------
note: this is necessary only if you want to set the sender
different from actual user (SY-UNAME). Otherwise sender is
set automatically with actual user.
sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
--------- add recipient (e-mail address) -----------------------
create recipient - please replace e-mail address !!!
recipient = cl_cam_address_bcs=>create_internet_address( email ).
add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
set send immediately flag
send_request->set_send_immediately( 'X' ).
---------- send document ----------------------------------
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = sent_to_all ).
COMMIT WORK.
exception handling
CATCH cx_bcs INTO bcs_exception.
WRITE: bcs_exception->error_type.
EXIT.
ENDTRY.
MY problem is:
Iam receiving 'hello world' and '20/09/2007' as a pdf file in mail.But the actual data
from CONVERT_ABAPSPOOLJOB_2_PDF (it_pdf_output) is not getting in the pdf file.
Iam receiving the email properly with pdf attached, but no data in pdf.
Can any one please help me,its very ugrent
The Bold line above is the problem here ,the data from Fm it_pdf_output is of type tline and the method takes data as HEX. How to convert ?

Hi,
after  calling the FM .U HAVE TO CALL ONE peform.In order to get the PDF. ..please check the below code.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
Declaration of local variables
  DATA : lv_bytecount  TYPE i,
         lv_cancel(1)  TYPE c,
         lv_filename1  LIKE rlgrap-filename.    "File name
Declaration of local constants
  CONSTANTS: lc_pdf(4) TYPE c VALUE '.PDF'.
  CONCATENATE c_c
              sy-repid
              lc_pdf
      INTO lv_filename1.
To  Download to PDF format
    PERFORM download_w_ext(rstxpdft) TABLES i_pdf
                                      USING lv_filename1
                                            lc_pdf
                                            'BIN'
                                            lv_bytecount
                                            lv_cancel.
Regards,
Nagaraj

Similar Messages

  • PDF is changing all my pdf documents into a word document - My boss sent me a pdf email through outlook and when I try to open it changes to a word document

    PDF is changing all my pdf documents into a word document - My boss sent me a pdf email through outlook and when I try to open it changes to a word document Help this is so frustrating

    Hi tinam74565130,
    That does sound frustrating! It sounds as though the filename associations have become confused on your computer. You should be able to reset that easily. Here are some instructions:
    Change which programs Windows uses by default - Windows Help
    How to change the default application for a file type | Macworld
    Please let us know how it goes.
    Best,
    Sara

  • How to print a pdf email attachment in android system

    How to print a PDF email attachment

    You need
    - an application server JAVA with Adobe Document Service installed
    - you need to configure the connection between that Java instance and your ERP system
    https://www.sdn.sap.com/irj/sdn/adobe
    Markus

  • Error in SAPscript pdf email attachment

    Hi All,
             I have implemented the functionality in ABAP where I can send SAPscript output to user via pdf-email in its inbox.The functionality is working fine in Dev n Test system with no issues.As the form is moved into Prod system, the user is complaining that after opening the mail of pdf, a mail is sent to unknown, unexisting email id indicating that user opened the mail.As the email id is unexisting, the user receives back the mail of Delivery failure.
    Please help in this.Rest is working fine.

    Hi Neeraj_C ,
      I have also a same requirement . i don't know much about Script.Can you please send me the procedure how do u achieve this scenario . If u give the sample code of this scenario it will be very helpful for me.
    Thanks & Regards,
    Kumaran Duraiswamy.

  • .pdf email attachments open in photoshop.  How do I get them to open in Reader?

    Hey,
    .pdf email attachments open in photoshop.  How do I get them to open in Reader?
    thx

    You need to change your file association to open .pdf files with Adobe Reader.
    See http://windows.microsoft.com/en-us/windows/change-file-open-program#1TC=windows-7

  • Problem pdf email attachment

    Hi Friends,
    I need expertise help in pdf email attachment. I have data in internal table which has to be sent as pdf mail attachment. I need help in converting the data to pdf format. After conversion I can use SO_NEW_DOCUMENT_ATT_SEND_API1 to send the mail.
    Expect earliest reply.
    Thanks,
    Nidhya

    Dear Friends,
    Thanks for your reply, but I need help in converting the data in internal table to pdf.
    Pls find my code below: With this code, I get email send with PDF attach, but the data inside the file is not in correct format.
    Pls help me to correct.
    DATA : mailrec    LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
           mailbin    LIKE solisti1 OCCURS 0 WITH HEADER LINE,
           mailbin1   LIKE solisti1 OCCURS 0 WITH HEADER LINE,
           mailtxt    LIKE solisti1 OCCURS 0 WITH HEADER LINE,
           mailhead   LIKE solisti1 OCCURS 0 WITH HEADER LINE,
           i_otf      LIKE solisti1 OCCURS 0 WITH HEADER LINE,
           i_pdf      LIKE solisti1 OCCURS 0 WITH HEADER LINE,
           mailstruc  LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
           maildata   LIKE sodocchgi1 OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF i_sotf OCCURS 0.
           INCLUDE STRUCTURE itcoo.
    DATA : END OF i_sotf.
    DATA : i_itcpo LIKE itcpo,
           i_itcpp LIKE itcpp.
    DATA : v_tlines   TYPE i,
           v_len_in   LIKE  sood-objlen,
           v_len_out  LIKE sood-objlen.
    maildata-obj_name = 'Document'.
    maildata-obj_descr = 'Transfer Details'.
    maildata-obj_prio = 1.
    maildata-doc_size = strlen( mailtxt ).
    mailstruc-head_start = 1.
    mailstruc-head_num = 0.
    mailstruc-body_start = 1.
    mailstruc-body_num = 1.
    mailstruc-obj_name = 'transfer'.
    mailstruc-doc_type = 'RAW'.
    APPEND mailstruc.
    mailrec-receiver = '[email protected]'.
    mailrec-rec_type = 'U'.
    APPEND mailrec.
    CLEAR i_itcpo.
    i_itcpo-tdgetotf = 'X'.
    REFRESH mailbin.CLEAR mailbin.
    WRITE 'Report Title:' TO mailbin-line+3.
    WRITE sy-repid         TO mailbin-line+18.
    APPEND mailbin. CLEAR mailbin.
    WRITE  'User : ' TO mailbin-line.
    WRITE  sy-uname TO mailbin-line+11.
    APPEND mailbin. CLEAR mailbin.
    WRITE  'Date of Report : ' TO mailbin-line+3.
    WRITE sy-datum USING EDIT MASK mask MM/DD/YYYY TO mailbin-line+21.
    APPEND mailbin. CLEAR mailbin.
    WRITE  'Time of Report : ' TO mailbin-line+3.
    WRITE  sy-uzeit TO mailbin-line+21.
    APPEND mailbin. CLEAR mailbin.
    APPEND mailbin.
    WRITE  'Transfer ' to mailbin-line+3.
    APPEND mailbin. CLEAR mailbin.
    APPEND mailbin.
    WRITE  sy-uline TO mailbin-line+3.
    APPEND mailbin. CLEAR mailbin.
    LOOP AT i_disp.
    SHIFT i_disp-index LEFT DELETING LEADING '0'.
    WRITE i_disp-index TO mailbin+3.
    WRITE i_disp-pernr TO mailbin+6.
    WRITE i_disp-ename TO mailbin+16.
    WRITE i_disp-persk TO mailbin+57.
    WRITE i_disp-btrtl TO mailbin+60.
    APPEND mailbin. CLEAR mailbin.
    ENDLOOP.
    CALL FUNCTION 'SX_OBJECT_CONVERT_SCR_OTF'
      EXPORTING
        FORMAT_SRC            = 'RAW'
        FORMAT_DST            = 'OTF'
        DEVTYPE               = 'POSTSCPT'
        FUNCPARA              = ''
        LEN_IN                = v_len_in
    IMPORTING
       LEN_OUT               = v_len_out
      TABLES
        CONTENT_IN            = mailbin
        CONTENT_OUT           = mailbin1
    EXCEPTIONS
       ERR_CONV_FAILED       = 1
       OTHERS                = 2 .
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    REFRESH mailbin.
    CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
      EXPORTING
        FORMAT_SRC            = 'OTF'
        FORMAT_DST            = 'PDF'
        DEVTYPE               = 'POSTSCPT'
      FUNCPARA              =
        LEN_IN                = v_len_in
    IMPORTING
       LEN_OUT               = v_len_out
      TABLES
        CONTENT_IN            = mailbin1
        CONTENT_OUT           = mailbin
    EXCEPTIONS
       ERR_CONV_FAILED       = 1
       OTHERS                = 2 .
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    REFRESH mailbin1.
    DESCRIBE TABLE mailbin LINES v_tlines.
    mailstruc-head_start = 1.
    mailstruc-head_num = 0.
    mailstruc-body_start = 1.
    mailstruc-body_num = v_tlines.
    mailstruc-transf_bin = 'X'.
    mailstruc-doc_type = 'PDF'.
    mailstruc-obj_name = 'Mid-month transfer'.
    mailstruc-doc_size = v_tlines * 255.
    APPEND mailstruc.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        DOCUMENT_DATA                    = maildata
       PUT_IN_OUTBOX                    = 'X'
      TABLES
        PACKING_LIST                     = mailstruc
       OBJECT_HEADER                    = mailhead
       CONTENTS_BIN                     = mailbin
        RECEIVERS                        = mailrec
    EXCEPTIONS
       TOO_MANY_RECEIVERS               = 1
       DOCUMENT_NOT_SENT                = 2
       DOCUMENT_TYPE_NOT_EXIST          = 3
       OPERATION_NO_AUTHORIZATION       = 4
       PARAMETER_ERROR                  = 5
       X_ERROR                          = 6
       ENQUEUE_ERROR                    = 7
       OTHERS                           = 8 .
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    But i dont get the result in expected format. I am not getting first 2 characers of the line. instead of report, date, time in separate line I get everything in a single line as follows :
    Report Title: ZHRPY0003
    er : VACNIDHYA Date of Report : 02.05.2007 Time of Report
    : 10:31:27 Mid-month Inter-Company Transfer
    --- 1 00002609 Carla Pineda FT
    2010
    - 1 -

  • Interactive PDF / Email marketing

    I have a 20 page newsletter that I'm sending out through an eblast. I have several paragraphs in the eblast summarizing exciting points in the newsletter. What I'm trying to do is where it says "read more on page 14" in the eblast, have a link that takes the viewer directly to page 20 instead of just opening the generic PDF. I'm also trying to make it so in the PDF version where it says "story continued on page 4" the reader can click that and it will take them to page 4 instead of having to scroll through the newsletter manually. Our newsletters are hosted on our website so we usually link to the website like: www.website.org/newsletters/fall2009 and the newsletter opens from there.
    Does anyone know how to make this happen? I've never done it before and haven't worked with this type of PDF/email marketing so I'm at a loss. If you have any suggestions please send links to detailed instructions and be detailed so I can figure it out!

    You will have to set up bookmarks and links to those bookmarks. Several folks should be around tomorrow who are good at this type of action, so please be patient.

  • Opening PDF Email Attachments

    My PDF email attachments open in Microsoft Word and can't be read. How can I open PDF attachments in Adobe without first having to do a 'Save As'? I have Adobe on my laptop.

    nyrozzie wrote:
    My PDF email attachments open in Microsoft Word and can't be read. How can I open PDF attachments in Adobe without first having to do a 'Save As'? I have Adobe on my laptop.
    The problem is a file association. 
    If you are using Verizon's webmail then you need to fix the file association in your web browser.
    If you are using an email client (Outlook, Outlook Express, Thunderbird, etc.) you need to fix the file association in your computer (varies as to how based on OS and client).
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.

  • PDF email archives: How to selectively re-export to new archive/.pst?

    A while back, I made PDF email archives of a variety of Outlook folders, and eventually deleted the Outlook messages in question.
    Now, unfortunately, I am wishing I had not.  So, a few "save the day" type of questions:
    1) Can I convert an entire PDF email archive, or portions of an archive, back into Outlook format?  How?  (If you know the answer to this, ignore the rest!)
    2) Can I selectively search a PDF email archive, and then group-export the messages displayed in the search results into a separate PDF email archive? How?  I can manage to use the filters to select a group of messages, but I can't manage to re-export them to a new archive or a PDF portfolio.
    thanks,
    Erik

    It cannot be done in InDesign, but, as you surmised in Acrobat.
    You'll need to ask in the Acrobat forums. I don't know of any changes like that in Acrobat DC but because I don't program in JavaScript, I might have overlooked it. Try one of these forums:
                                 Creating, Editing & Exporting PDFs                        
                                 Rich Media & 3D                        

  • PDF Email Creation for Clients

    Hi, I would like to create a PDF email form that I can then hand over to a client that only has the free acrobat reader. If I create a form with his email address, will he be able to view, save and print the completed/submitted forms?
    I seem to be going back and forth on whether or not to scrap this idea and build him an HTML form on my website and then just add a PDF download link for the people that want to print and snail-mail.

    I guess I just answered my own question. My solution will be to Enable Usage Rights and delete the "submit by email" button. Then my client will instruct them to save the file and return it in a reply email.

  • Pdf email attachments won't open

    After upgrading to IOS 7 the pdf email attachments are not opening...just says "loading" and never loads.

    Hi DVFFTI,
    I'm not sure from your description if you're having the same problem I was having.
    In my case, PDF attachments would only display as a single image of the first page of the PDF.
    The only option I had was to Copy or Save the image. I couldn't open a preview of the full PDF in Mail or tap to 'Open in...' a different app.
    Turns out that I had too many apps on my iPhone that can read PDFs, for example, Dropbox, Evernote, iBooks, Kindle, etc. even a Canon app for remote printing.
    Removing one of them fixed the issue for me.
    I remember this happening before and seeing other threads about this, so I don't think it's specific to iOS 7.
    Give it a go and see if it fixes your problem. Hope it helps.

  • Why cant i read PDF email toake copies why is my pdf turned off or stop working

    why cant I read PDF email to make copies  why is my PDF turned off or stoppd working [email address removed]

    You really need to provide some information if you expect anybody to help you.

  • Problem opening  Microsoft Office & PDF Email attachments

    Just got a Motorola Razr.  Having a problem opening Microsoft Office (e.g. Work, Excel) and PDF Email attachments.   Receive message "winmail.dat Unsupported file type".   Can open jpg files.  I have Quick Office, which is suppose to enable you to do this, but does not seem to make a difference.   Wonder if it is an Android 2.3.5 issue.  I used to have a Blackberry and this was not an issue.  This is a showstopper for me and I will return the phone if I can't read Microsoft Office and PDF files attached to emails.  My email server / client is Verizon.
    I would appreciate any recommendations.

    Hope this is one of those "better late than never" scenarios.
    The problem sounded familiar, and it's one that's been around for a long, long time.  I don't think it's a Razr problem, or a Droid problem, but it is about email clients.  I've had similar issues with email on computers.
    The problem starts with Outlook's RTF format.  It saves the document's formatting info (bold, underline, etc.) and other info in the winmail.dat file, and some email clients simply can't decode it. 
    The sender can change the format of what they're sending, though, and I believe that the most recent versions of Outlook can change those format setttings on a person-by-person basis (don't want to start a rumor here because I could be wrong about that).
    Just copy and paste the error message into Google (or your preferred search engine, and you'll see some info that might be helpful.

  • How can I move PDF email attachments into ibooks?

    How can I move PDF email attachments into iBooks?

    When you tap on the PDF to open it, a curved arrow icon will appear in the upper right corner. Tap that icon and the option to "Open In" appears. Select that option - tap open in - and you can select iBooks from there.

  • New document: How to avoid known PDF email attachment problems

    Have you ever had problems with PDF attachments sent from Adobe Reader for iOS using Share > E-mail Document?
    You may find this document useful to avoid the problems.
    How to avoid known PDF email attachment problems
    Please let us know if you have encountered different types of problems with PDF attachments.  We can look for solutions or workarounds for you.

    Unfortunately, we (Adobe Reader mobile team) do not know if/when Apple will fix the attachment problems (software defects) in Apple Mail.
    In particular, the attachment problem with Microsoft Outlook (See Problem #2 in How to avoid known PDF email attachment problems) appears to be a long-standing defect that has been known for years.  However, Apple has not provided any fix for Apple Mail yet.
    Adobe Reader for iOS merely launches Apple Mail (the default mail app on iOS) to send a PDF document as an attachment.  Adobe Reader has no control over whether or not to embed a preview image of an attachment in the body of an email message, which is known to cause the problem with Microsoft Outlook (on the receiving side).  The same problem happens when you send a single-page PDF document as an attachment along with an email signature from Apple iBooks on iOS.
    For now, all iPad/iPhone users can do is to avoid the problems by using the workarounds that are described in How to avoid known PDF email attachment problems.
    When new and different problems with PDF attachments are reported by Adobe Reader for iOS users, we will update the document above.
    Sorry for the inconvenience.

  • Acrobat can not open pdf email attachment

    Acrobat 8 Professional.<br /><br />A user gets this error message when he tries to open up a pdf email attachment:<br /><br />"Acrobat could not open <File Name> because it is either not a supported file type or because the file has been corrupted (for example, it was sent as an email attachment and wasn't correctly decoded)."<br /><br />I can open up the attachment without any issues.<br /><br />Anybody else have this issue?

    Yes, Ron Green here at the NYS Insurance Department. I now have two clients and counting that have somewhat of an identical problem.
    Client #1 has Adobe 8 Professional installed on his pc which is running Widnows XP Professsional. Files are scanned using a XEROX MFP network scanner and client is able to open those scanned documents within adobe and then saves them to a network share. Problem arises whenever he attempts to attach the saved document to another application. Once he attempts viewing the scanned document at that point Adobe blows up with the same error message stating the file is corrupt.
    Client #2 has Adobe 9 Reader but is still able to follow the same network scanning scenario aforementioned but encounters the exact same problem when attempting to attach the scanned PDF documents.
    Is there any type of fix out there for this???

Maybe you are looking for