Sending a SAP Office Attachment as a PDF to Internet email Address

We are using SO_NEW_DOCUMENT_ATT_SEND_API1 and SO_DOCUMENT_SEND_API1 to create e-mails with attachments from SAP and sending them to e-mail addresses which are outside of SAP. Today we tell these function modules that the attachments are "RAW" datatype which, somewhere in the process, creates the attachment with a file type of TXT. What I want to do is have that same attachment sent as a PDF file. I can change the file type in the "packing list" of these functions and the get delivered with the PDF file type to the external recipient. However, when you try to open the attached file, Adobe tells you that the file is corrupted or not decoded properly. Any ideas how I can convert the attachment's data properly so it can be read by Adobe on the recipient's side? I know how to convert spool files using CONVERT_ABAPSPOOLJOB_2_PDF but couldn't find any technique for attachments.
Thanks,
Kevin

Hi,
Try out following code:
Convert PDF file into binary format
i_tline comes from your CONVERT_ABAPSPOOLJOB_2_PDF
  LOOP AT i_tline.
    TRANSLATE i_tline USING ' ~'.
    CONCATENATE pdfbuf i_tline INTO pdfbuf.
  ENDLOOP.
  TRANSLATE pdfbuf USING '~ '.
  DO.
    objbin = pdfbuf.
    APPEND objbin.
    SHIFT pdfbuf LEFT BY 255 PLACES.
    IF pdfbuf IS INITIAL.
      EXIT.
    ENDIF.
  ENDDO.
Create the e-mail body
  docdata-obj_name  = 'File_Name'.
  CONCATENATE 'My' 'PDF File' INTO docdata-obj_descr.
  objtxt = 'Here is your file'.
  APPEND objtxt.
Other parameters
  DESCRIBE TABLE objtxt LINES tab_lines.
  READ TABLE objtxt INDEX tab_lines.
  docdata-doc_size = ( tab_lines - 1 ) * 255 + strlen( objtxt ).
  CLEAR objpack-transf_bin.
  objpack-head_start = 1.
  objpack-head_num   = 0.
  objpack-body_start = 1.
  objpack-body_num   = tab_lines.
  objpack-doc_type   = 'RAW'.
  APPEND objpack.
Create e-mail attachment
  DESCRIBE TABLE objbin LINES tab_lines.
  READ TABLE objbin INDEX tab_lines.
  objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
  objpack-transf_bin = 'X'.
  objpack-head_start = 1.
  objpack-head_num   = 0.
  objpack-body_start = 1.
  objpack-body_num   = tab_lines.
  objpack-doc_type   = 'PDF'.
  CONCATENATE 'My' 'File' INTO docdata-obj_name.
  objpack-obj_descr  = 'PDF File'.
  APPEND objpack.
Create the list of recipients
  reclist-receiver = SY-UNAME.
  reclist-rec_type = 'B'.
  reclist-express  = 'X'.
  APPEND reclist.
Send the e-mail
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data                    = docdata
      put_in_outbox                    = 'X'
      commit_work                      = ' '
    TABLES
      packing_list                     = objpack
      contents_bin                     = objbin
      contents_txt                     = objtxt
      receivers                        = reclist
    EXCEPTIONS
      too_many_receivers               = 1
      document_not_sent                = 2
      document_type_not_exist          = 3
      operation_no_authorization       = 4
      parameter_error                  = 5
      x_error                          = 6
      enqueue_error                    = 7
      OTHERS                           = 8.

Similar Messages

  • When i attach a portable pdf to an email, it opens and displays contents.  I want the file to remain closed - help.  thanks

    When I attempt to attach a portable pdf to an email, it automatically opens and displays in the email.  I want the file to be attached not opened.  I am new to MAC and do not understand this portable pdf concept.  Lease help.  all I want is a file to show on the email message which can be opened by the person receiving the email.

    Mail shows any single-page PDF (as well as many other document types) as a preview in an email message rather than the icon, but it is actually being attached as a normal email attachment. Unless the recipient also has Mac OS X Mail, they'll just see the PDF as an attachment unless their mail application also shows PDFs in line.
    There is a third-party product which can suppress this display so that all attachments including single-page documents just show in Mail as an icon. If that's of interest, let me know and I'll post the URL to the product. But it doesn't affect how the document is attached and the email sent, only how it displays on your system.
    Regards.

  • Can i use a 2nd iphone if i install itunes on another user account.when i tried to create a second library i messed up both phones, the second one now has all my contacts and when it sends txts it either says its my other phone or email address

    can i use a 2nd iphone if i install itunes on another user account.when i tried to create a second library i messed up both phones, the second one now has all my contacts and when it sends txts it either says its my other phone or email address. i can cope with the first phone and getting it back on itunes but dont want to syn the 2nd phone until i know it is independant of the other one. Does it matter that both phones use the same itunes store account?

    Deleting the account on your phone only removes if from your phone.  The account and it's data remain intact and doing so will not effect your daughter's phone.
    To do this, first go to Settings>iCloud on your phone and turn any synced data (contacts, calendars, etc.) to Off, and when prompted, choose to keep the data on the phone.  When finished, scroll to the bottom and tap Delete Account.  Then set up a new iCloud account with a different Apple ID and turn any data you want to sync with iCloud (contact, calendars, etc.) back to On.  This will upload your data to your new iCloud account.

  • Send an extra copy of every signed agreement to these email addresses - rules

    I posed a question to support today regarding the feature "Send an extra copy of every signed agreement to these email addresses" because we recently changed the addresses in this field but were not seeing any emails coming through for signed documents.
    If my boss said starting tomorrow I want all signed copies of all documents processed by EchoSign (currently out for signature and new documents) to be copied to email address [email protected]..how would I accomplish this?
    The response I got back from support was that only transactions that were initiated after the edit to this option would be routed to the new email address defined and that previously existing transactions would use whatever address was previously defined for the option.
    So heads up to all your EchoSigners out there that this is how this works because it is not documented anywhere that I could find.
    To the EchoSign design team. Please change this to at least allow for the possibility to apply to in process transactions.
    Just imagine a couple use cases.
    1 all signed docs go to user x because they are a contracts admin. User x changes roles in the company and user y is now the admin. No way, through EchoSign, to redirect docs that were in process at the time of the change to user y.
    2 company x is acquired and the now have a new legal department where all contracts have to go so we add [email protected] to the email addresses. No way, through EchoSign, to accomplish.
    Regards,
    Brad

    Thank you for taking the time to provide us with your feedback.
    We will pass your feedback to the Product Management team for their consideration.
    Thanks

  • Send mail sap office with notification

    Hi experts,
    I send an email in sap office (Business Workplace sbwp). I want send an automatic notification with this email for warning a user
    How can i do?
    Thanks in advance.

    HI,
    You can get a good answer if you would have post the same query in SAP BASIS forum.
    To my knowledge there will a domain difference not more than that.
    Cheers!!
    VENk@

  • Send mail sap office

    hi,
    what difference there is in to send to mail to the sap office or to the outside of the system?
    thk.

    HI,
    You can get a good answer if you would have post the same query in SAP BASIS forum.
    To my knowledge there will a domain difference not more than that.
    Cheers!!
    VENk@

  • How can I attach a form PDF to an email

    In Acrobat 8, you could add a button to a form that would attach the form to an email so you could send it to individual addresses. So I could create a form, and add a employees name and address to it, then send it to that individuals email address for them to complete and return via a submit button.
    That feature seems to have been removed from Acrobat X. Does anyone know how to get around it?

    It was a button option - I haven't got access to Acrobat 8 here at home, but it was something like
    Add menu item
    File - attach to email
    When the button was clicked, the email application would open with a new email and the PDF would be attached, so you could enter the recipients email address and send.

  • Send PDF form to email address user enters in textfield on form.

    I would like to be able to allow the person using the form to choose what email address the PDF form is emailed to. I read this post which sounds like what I want but I keep getting a Submit Cancelled error. The email does get generated and the form is attached as a PDF so that part works okay.
    http://forums.adobe.com/message/4167414#4167414
    This is the code I am using as I only need the To: address populated.
    form1.Page1.Button1::preSubmit:form - (JavaScript, client)
    var strToAddress
    //Capture the values from the form fields.
    strToAddress = txtToAddress.rawValue;
    event.target.submitForm({cURL:"mailto:"+ strToAddress,cSubmitAs:"PDF",cCharset:"utf-8"});

    Hi,
    There is an example here: http://assure.ly/eUR4wJ.
    // Declare the variable
    var vEmail;
    // Check that the email field is not null
    if (txtToAddress.rawValue !== null) {
         vEmail = txtToAddress.rawValue;
    // Send email
    event.target.submitForm({cURL:"mailto: " + vEmail + "?subject=&body=",cSubmitAs:"PDF",cCharset:"utf-8"});
    Niall

  • How do I create a submit button for my form? I would like it to send the completed PDF to an email address

    Hi everyone,
    I recently upgraded to Adobe XI and I can't find a "submit by email" button for my form. I created a button and tried to set up some actions but, I can only get the button to direct the user to a URL. How do I make it send the completed PDF to our designated company email address? I'm not too familiar with JAVASCRIPTS so I haven't tried that plus I heard it may not work with users with adobe reader.
    Any help would be appreciated.
    Thanks,
    Matt

    Thanks for the input. I think you might have a different version of LiveCycle than the copy I have since it looks a little different. However, I found the answer in Adobe help. I had to type "mailto:" before the email address to indicate it's an email and not a URL. See below.
    To collect form data as attachments to email, type mailto: followed by the email address. For example, mailto:[email protected]

  • When I send a text to someone, they receive it from my email address not my ph number, how can I stop this?

    I recently upgraded to iOS 6 and am being told by my contacts that when I send a text they receive it from my email address (in their messaging app) and not from my phone number.
    I have checked the send/receive settings in Settings>Messages>Send & Receive, the phone is set to send/receive default from my phone, yet the email sends it first.
    I have removed and re added the email address, but have had no luck resolving the problem.
    Has anyone else had the same problem? Is there a way I can stop it without turning off iMessage?
    Thanks in advance.

    There is another setting for "Start Conversation from", that needs to be set to phone number.

  • Is there any way to send an event invitation to multiple people, but hide invitees' email addresses from recipients? I need to keep their details private...

    Hi,
    I'm creating a series of events in Lightning, and sending invitations to all my adult class students. Legally, and ethically, I have to keep their personal details private. This includes their email addresses. I can't find a way to send invitations to a dozen people, without them seeing everyone's email addresses. I need something like a bcc option really. Is there a way please? Google calendar seems to be able to do it, but I don't want to use that, I far prefer TB/Lightning - largely because I can then send invitations from my business address instead of Gmail.
    Thanks very much,
    Melanie

    The following is intended as general guidance about changing the to: designation in Thunderbird. I must admit I'm not sure how it works with calendar event invitations. I need to check. Of course, amongst colleagues and in the workplace generally, it's not required to hide addresses, and as that's pretty much the only context I have used automatically generated invitation emails, I hadn't found any need to use bcc:.
    Thunderbird has bcc. Click on to: to change it.
    Tip: change it when you add the first address, then each address you subsequently add will be set to bcc: automatically.
    If you're using a Mailing List, bcc: will apply to each address in the list too.
    And try F9 to see a Contacts Sidebar in the Compose window. This has explicit "Add to..." buttons.

  • Can a submission receipt be set up to send to a file location on server instead of an email address?

    In an effort to control email size, and to coincide with our workflow processes, i was wondering if i could send the email receipts to a file location instead of an email address?

    Hi;
    FormsCentral notifications requires an email address that is has an active FormsCentral account so a file location woudl not work in the setup process. 
    Thanks,
    Josh

  • I can't attach a pdf to an email but can attach a saved pdf to an email?

    So, I can open a new email and click the paperclip and attach a pdf with no problem but when I open a pdf and click file/attach to an email it fails. Why? is three a setting in 9.0 that I need to change? This is using Outlook 2007.
    Thanks,
    Ken

    Fails how?  Is Outlook running when you try the attach?

  • I cannot attach jpg or pdf files to emails in Yahoo mail. Anyone have any ideas how to solve this?

    I am able to attach any file if I use Gmail or other mail services in Firefox. It also works if I use Yahoo Mail with IE. The problem only exists when I use Yahoo Mail in Firefox.

    Hi,
    Please check if this happens in a [https://support.mozilla.org/en-US/kb/Managing-profiles new profile]. If the new profile is okay, you can then [https://support.mozilla.org/en-US/kb/reset-firefox-easily-fix-most-problems Reset Firefox] on the old (previous) profile via '''Help''' ('''Alt''' + '''H''') > '''Troubleshooting Information'''.

  • Can I send only some selected page of a PDF doc. by email??

    If so, how??

    Reader cannot extract pages. You would need Acrobat or some other program that can extract pages.

Maybe you are looking for