Issue with attaching pdf in work item

Dear Friends,
  I am trying to attach Adobe form output to a work item and send it in for approval. I have converted the Adobe form output to binary format inside the program using function module 'SCMS_XSTRING_TO_BINARY and passed it to the workflow container while starting the workflow and then inside the workflow i used the below code inside a method convert the binary to xstring format and then attach it to the workitem. But when I open the attachment from business workplace I am getting an error that There was an error opening this document, the file is damaged and could not be repaired.
  I tried to debug the method and found that everything seems to be fine, even I checked the Adobe output by sending it as an email attachment and I am able to open the same Adobe form attachment in the email. So I suspect that I am doing something wrong while converting the same(binary to xstring) in the workflow. Please advise what would be wrong with the below code.
DATA:  wid TYPE swwwihead-wi_id,
            op_len TYPE wsuser-wsuserinstanceno,
           it_solix_tab TYPE solix-line OCCURS 0.
DATA : zswr_att_header TYPE swr_att_header,
           zswr_att_id     TYPE swr_att_id,
           lo_sofm TYPE swc_object,
           zxstring TYPE xstring.
swc_get_element container 'WID' wid.
swc_get_element container 'OP_LEN' op_len.
swc_get_table container 'IT_SOLIX_TAB' it_solix_tab.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
   EXPORTING
     input_length = op_len
   IMPORTING
     buffer       = zxstring
   TABLES
     binary_tab   = it_solix_tab.
zswr_att_header-file_type = 'B'.
zswr_att_header-file_name = 'Attachment.pdf'.
zswr_att_header-file_extension = 'PDF'.
zswr_att_header-language = 'EN'.
BREAK-POINT.
CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'
   EXPORTING
     workitem_id = wid
     att_header  = zswr_att_header
     att_bin     = zxstring
  IMPORTING
    att_id      = zswr_att_id.
swc_create_object lo_sofm 'SOFM' zswr_att_id-doc_id.
swc_set_element container 'SOFM' lo_sofm.

Hi
I feel like this part of teh code might be creating a a problem.
zswr_att_header-file_type = 'B'.
zswr_att_header-file_name = 'Attachment.pdf'.   "<------ Just give the name of the file , no extension needed as .pdf"
zswr_att_header-file_extension = 'PDF'.              " <---- Since here you are already specifying the type of file.
zswr_att_header-language = 'EN'.
Regards
Pavan

Similar Messages

  • I have an issue with some PDF documents   some MS Office documents, notably MS Word when received in eMail as attachments not displaying on iPhones, iPad 2s

    Hi,
    I have an issue with some PDF documents & some MS Office documents, notably MS Word when received in eMail as attachments not displaying properly on iPhones, iPad 2s & new iPads?
    PDF docs - areas of the doc only show as grey splotches regardles of viewer
    MS Word Docs -
    inserted graphics don't display at all,
    tables & lists especially with borders are broken &
    tables & lists missing the borders &
    tables & lists missing the 1st 1-2 lines of the lists/tables.
    This is replicated on iPhone 4s, iPhone 4Ss, iPad 2s, iPad new (x2)
    It certainly happens in iOS 5.1.1 & iOS 5.1
    We believe it all worked aok in iOS 5.0.1(?) & prior
    There is no problems reading/seeing these PDF & Word docs on anything other than iDevices.
    This is rather critical for us & if not quickly fixed/rectified will prevent us from further purchases of these devices
    Rolling back to iOS 5.0.1 or prior I believe isn't possible because of the BaseBand update(?) & isn't much of an option because of the quite noticeable Battery/Charging/WiFi improvements in 5.1 & 5.1.1

    Hi,
    I logged a call with AppleCare & have since had explained why this occurs (some time ago)
    I'll try to explain what was indicated to me.
    iOS has a limited Font Set & this affects what PDFs can display. You need to use iOS supported fonts in your PDFs to see/read them properly  
    These supported fonts are indicated here => http://support.apple.com/kb/HT4980
    Regards MS office docs, iOS doesn't have much of an API to work with MS Office documents at all so is stuck with 3rd Party Apps to try to do it.
    Unfortunately Mail in/on iOS uses the API to attempt to open/use MS Office attachments unless you tell it to use an App to open the attachment.
    I have had success opening & reading MS office docs now with CloudOn, but find it slow & very awkward to use.
    Not too sure if this helps others, but at least it explains why this is occurring

  • Issue with attachment file name

    Hi All,
    This is about an issue with attachment file name:
    we have a scenario wherein we have payload with attachments ...(attachments can be any doc ,pdf) , problem is main document is comming with messageid.sap.com and thats normal but attachments are comming with file names for example something.pdf or something.doc or something.txt ...this is failing in adapter as it expects same name as u have in main document...anybody have any idea to get through this issue...
    Regards
    kiran

    we have a scenario wherein we have payload with attachments ...(attachments can be any doc ,pdf) , problem is main document is comming with messageid.sap.com and thats normal but attachments are comming with file names for example something.pdf or something.doc or something.txt ...this is failing in adapter as it expects same name as u have in main document...anybody have any idea to get through this issue...
    - <SAP:Payload xlink:href="cid:payload-4CED452F17C601BDE10080000A492050---sap.com">
      <SAP:Name>1 .Header1.txt</SAP:Name>
    Error we are getting is
    Cannot cast 'Header' to boolean] in class com.sap.aii.mappingtool.flib7.NodeFunctions method createIf[Header, com.sap.aii.mappingtool.tf7.rt.Context---27a73bfa]
    So we have to change the File name Header1.txt to something which we can cast to creatif....(we cannot tell the sendr to change the file name as its is set already)
    Thanks for interste and assisting
    Regards
    Kiran

  • Issue with attachment in OAF

    Hi All,
    I have a issue with attachment functionality in OAF,
    I have a custom OAF page, in the header part of the page i have one attachment button there i am attaching a file, so i am able to attach the file the issue is.
    when the page loads for the first time it will populate a sequence in one of the field in the page , but when i am clicking the add attachment button i am able to aatched a file but the sequence getting chnaging, but i need the same sequence wht it was displayed during first page loads, so how i can restict page refreshing in attachment functionaly so that i can store the attachment file in the same sequence number what it was populared first time, please help me on this.
    Thnaks

    I could able to solve the issue by using the above code in an if else statement, in process request i kept
    like below:
    if (aFlag.equals("attachment")) {
    am=(OAApplicationModule)pageContext.getSessionValueDirect("xxretainAM");
    else
    rest of my code in process request
    Thnaks

  • Issue with opening .PDF files after recalling from Symantec Enterprise Vault

    Good Morning,
    I am having issues with opening PDF files that have been recalled from Symantec Enterprise Vault and some of the files are anywhere from 3-4 years old.  Some files open, while others return the error: Adobe Reader could not open filename.pdf because it is not a supported file type or might have been damaged.  It is inconsistent as to which files it occurs with.  I am not ready to believe that I have that many corrupt files out there.  I am opening them on a Windows 7 Enterprise SP1 x64 desktop. Adobe 10.1.7. I have already configured the registry setting for bValidateBytesBeforeHeader that I found in another article to no avail.
    The files are on a network share, but I also tried copying them to my local desktop and still received the error.
    I have seen other posts regarding this error, but do not see a definitive solution and am hoping that in recent days someone has come up with a solution.
    Thank You
    Brian Dougherty

    Not supported file type can (but not always) mean the PDF was created with an old enough version of Acrobat, that it isn't comaptible with reader X or XI.
    Might have been damaged is pretty cut and dried in its meaning and interpretation.
    There's a known issue with Mac OS and Safari Browser "breaking" PDFs as they download, but it's not so common for Windows. Since these are files you already had, it would be even less applicable.
    You can try downloading an older version of Reader to check if it's a compatibility issue, but you'd have to uninstall the latest to do it and it'd be a lot of bother if they still don't open. It would also mean they are "broken" and cannot be repaired, that I know of.

  • We want to send a mail with attachment pdf file.

    Hi!!!
    We want to send a mail with attachment pdf file.
    The PDF file this is in the server sap.

    Hi,
    Pls check web logs like
    /people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
    Eddy
    PS.
    Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.
    Spread the wor(l)d!

  • I just started having an issue with my bank website working properly. They have told me it is because of the last safari upgrade. Is this being resolved?

    I just started having an issue with my bank website working properly. They have told me it is because of the last safari upgrade. Is this being resolved?

    You might want to consider "voting with your feet" and taking your business to another bank.  When they tell you the upgrade is the problem, it is really their problem and not yours.  If you don't want to do that, the suggestion that you try another browser is absolutely correct.

  • I have been suggested to down grade to 10.6.6 due to issues with Adobe and Apple working things out. I have downloaded 10.6.6 but wont let me install. Any ideas?

    I have been suggested to down grade to 10.6.6 due to issues with Adobe and Apple working things out. I have downloaded 10.6.6 but wont let me install. Any ideas?

    Yes, simply reinstall from your Snow Leopard installer disc.  The reinstall will not erase the hard drive.  After reinstalling you can upgrade to 10.6.6 with your updater.

  • Hi is it possible to attach PDF as a attachment to the work item

    hi is it possible to attach PDF as a attachment to the work item

    Hi!
    Maybe it help's u:
    <a href="http://searchsap.techtarget.com/loginMembersOnly/1,289498,sid21_gci1076071,00.html?NextURL=http%3A//searchsap.techtarget.com/expert/KnowledgebaseAnswer/0%2C289625%2Csid21_gci1076071_tax299365%2C00.html%3Fbucket%3DETA">Attaching a .pdf file to a work item</a>

  • Adding Field Info in Subject Line of Email with Attached PDF

    Had a question regarding the email submit button. I wanted to know if there was a way to put the information put into a specific text field in the email subject line when the PDF is being sent via email as an attached.
    For Example:
    Question one on the form would be.....
    1). Why are you submitting this email?
    (Answer by User) Website Technical Issue
    I would like to take the text "Website Technical Issue" and add to subject line of the email being sent by the user when they press submit/send at the bottom of the PDF. So it would send an email out of their inbox, with the attached PDF they filled out, and the subject line stating what ever they put in text field 1.
    Any help or a given PDF example would be greatly appreciated! Thanks in advance!

    Hello Everyone,
    I am having the same issue as tlg814 with needing three fields to pull into the subject, and I followed the blue print of the code as well, but I am only getting one field to populate in the subject line.  I am using Acrobat XI. Here is my code:
    Mouse up> Run a JavaScript
    var parts = getField("SR#", "Urgency", "Ship To").value
    this.mailDoc({
    cTo: "[email protected]",
    cCc: "[email protected]",
    cSubject: parts,
    cMsg: "Please create a Parts Request for the items in this email. Thanks"
    Any thoughts as to why it is not pulling all three fields?
    Thanks

  • Couldn't open attachment of a work item in the business  work plance

    Dear Friend,
    Any body so kind to help me resolve the following issue.
    One of our user not open the attachment(Puchase order rejection reason) of a perticular work item in his business workplace(swap). However another user can able to open the attachment for the same work item.
    For your kind information, both of the user have same authorization.
    Regards,
    sp sahu

    Hi All,
    Thanks you all for your kind reply.
    However I am not yet find the solution the the above issue.
    I noticed that the user can able to open the attachment like ALI (ABAP list document). However user not able to open the attachment with class RAW (SAP editor document).
    Any body so kind to reply for this post.
    Your effort should be highly appreciated.
    Regards,
    sp sahu

  • Email with attachment doesn't work

    Hi all,
    I have a form in with i upload a file. On submit i send a mail with attach the file i uploaded. the form has as action a servlet.
    Well it works if i try it on the localhost, when i try it from my computer to the server the mail is sent but without the file attach.
    the code is the following:
    import java.util.Properties;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    import java.io.*;
    import java.util.*;
    /public class SendMail
    String host ="" ;
    String from ="" ;
    String to ="";
    String subject ="";
    String body ="";
    String id ="";
    String filename ="" ;
    boolean add = false;
    boolean tosend = false;
    public SendMail(String h , String f)
         host = h;
         from = f;
    public void setTo(String to)
         this.to = to;
    public void setSubject(String obj)
         this.subject = obj;
    public void setBody(String body)
         if(add)
              this.body += body;
              add = false;
         else
              this.body = body;
    public void addToBody(String body)
         this.body += body;
    public boolean getContinue()
         return add;
    public void setContinue(boolean a)
         add = a;
    public String getBody()
         if(!add)
              return this.body;
         else
              return "";
    public boolean send()
         try
         //Get system properties
         Properties props = System.getProperties();     
         //Setup mail server
         props.put("mail.smtp.host", host);
         // Get session
         Session session = Session.getDefaultInstance(props, null);
         // Define message
         MimeMessage message = new MimeMessage(session);
                   // Set the from address
                   message.setFrom(new InternetAddress(from));
    //               Set the to address
    System.out.println("to = >" + to +"< body = "+ body);
         message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
    //     Set the subject
         message.setSubject(subject);
    //     Set the content
         message.setText(body);
    // Send message
         // Transport.send(message);
    File file = new File(filename);
                   if (file.exists())
                        // create and fill the first message part
                        MimeBodyPart mbp1 = new MimeBodyPart();
                        mbp1.setText(body);
                        // create the second message part
                        MimeBodyPart mbp2 = new MimeBodyPart();
                        // attach the file to the message
                        FileDataSource fds = new FileDataSource(filename);
                        mbp2.setDataHandler(new DataHandler(fds));
                        mbp2.setFileName(fds.getName());
                        // create the Multipart and its parts to it
                        Multipart mp = new MimeMultipart();
                        mp.addBodyPart(mbp1);
                        mp.addBodyPart(mbp2);
                        // add the Multipart to the message
                        message.setContent(mp);
                   // send the message
                   Transport.send(message);
    return true;
    catch (AddressException e)
                   e.printStackTrace();
                   return false;
    catch (MessagingException e)
                   e.printStackTrace();
                   return false;
    catch (Exception e)
                   e.printStackTrace();
                   return false;
    Any help is appreciated.
    Thanks!

    Ok, I have made something similar to which your you want to do.
    Before to send a e-mail you have to upload the file, and later you can attach it into the e-mail.
    To upload the file:
    I made it with a jsp file (has a form) where I call to a java servlet how upload the file:
    package ServletUpload;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.text.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import org.apache.commons.fileupload.*;
    import org.apache.commons.fileupload.disk.DiskFileItemFactory;
    import org.apache.commons.fileupload.servlet.ServletFileUpload;
    public class uploadFichero extends HttpServlet {
        public void init(ServletConfig config) throws ServletException{
            super.init(config);
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            out.println("<html>");
            out.println("<head>");
            out.println("<title>Servlet</title>");
            out.println("</head>");
            out.println("<body>");
            out.println("We began the processing of the file");
            boolean uploaded = false;
            uploaded = procesaFicheros(request,out);
            if (true==uploaded)
                out.println("File uploaded");
            else
                out.println("Error to upload File");
            out.println("</body>");
            out.println("</html>");
            out.close();
        public boolean procesaFicheros(HttpServletRequest req, PrintWriter out ) throws ServletException, IOException {
            try {
                boolean isMultipart = FileUpload.isMultipartContent(req);
                out.println ("<br>Is multipart:"+isMultipart);
                // Create a factory for disk-based file items
                FileItemFactory factory = new DiskFileItemFactory();
                // Create a new file upload handler
                ServletFileUpload upload = new ServletFileUpload(factory);
                // Set overall request size constraint
                upload.setSizeMax(1024*512); //524288 Bytes (512 KB)
                // Parse the request
                List items = upload.parseRequest(req);
                // Process the uploaded items
                Iterator iter = items.iterator();
                while (iter.hasNext()) {
                    FileItem item = (FileItem) iter.next();
                    if (!item.isFormField()) {  //Files to upload
                        String fieldName = item.getFieldName();
                        String fileName = item.getName();
                        String contentType = item.getContentType();
                        boolean isInMemory = item.isInMemory();
                        long sizeInBytes = item.getSize();
                        /* ************* FOR WINDOWS EXPLORER ****************** */
                        /* ************** FOR MOZILLA EXPLORER IS NOT NEED ****************** */
                        /* *********** We extract the name of the file ONLY the name *********** */
                            /*  We have the name into a string, We have the separated folders by the character \  */
                        int numbers=0;
                        for(int i=fileName.length();(i=fileName.lastIndexOf('\\',i-1))>=0;)
                            numbers++;
                            /* WE OBTAIN A STRING FOR EACH DIRECTORY And The FILE */
                        String stringFile[] = fileName.split("\\\\");
                        /* *********** We only extract the name of the file (END) *********** */
                        /* WE CREATED THE FOLDER IN CASE IT DOES NOT EXIST */
                        /* WE VERIFIED IF THE FOLDER EXISTS */
                        String folder = "yourFolderName";
                        String newUserFolder = folder;
                        File createFile = new File("routeOfYourFolder/"+newUserFolder);
                        /*  for example (in unix)
    File createFile = new File("/usr/local/tomcat/webapps/"+newUserFolder);
                        if (!createFile.exists()){ /* IT DOES NOT EXIST, WE CREATE IT */
                            createFile.mkdir();
                        /* WE VERIFIED IF THE FOLDER EXISTS (END) */
                        /* WE WROTE THE FILE (UPLOAD) IN THE CHOSEN FOLDER */
                        fileName = stringFile[numbers];
                        File uploadedFile = new File("routeOfYourFolder/"+newUserFolder+"/"+fileName);
                        item.write(uploadedFile);
                        /* WE WROTE THE FILE (UPLOAD) IN THE CHOSEN FOLDER (END) */
                    } else {        //THAT ARE THE OTHER FIELDS OF THE FORM
                        // s= item.toString();
                        // out.println("<br>isFormField: "+s);
            catch(Exception e) {
                out.println("ERROR IN THE APPLICATION " + e.getMessage());
            return true;
        public void destroy() {
        public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            processRequest(request, response);
        public void doPost(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException {
              doGet(req,res);
    }  //END OF uploadFicheroI hope it helps you. you will tell me.

  • Issue with opening pdf file from web browser

    I have Acrobat Pro ver 6 and Adobe Reader 9.1 on a computer.  when my user tries to open up a pdf from the web he is getting the following error message:
    "The Adobe Acrobat/Reader that is running can not be used to view PDF files in a WEb Browser.  Adbe Acrobat/Reader version 8 or 9 is required.  Please exit and try again."
    What also happens is that Acrobat Pro ver 6 opens up and nothing is there.
    I am not sure why he is getting that message since Reader 9.1 is installed.
    Can any one shed some light on this for me.
    This user needs to have Acrobat and Reader on his system.  I understand that there are issues with having both.
    Also he has it set up so that any PDF is opening using the Reader 9.1.
    Thanks,

    Your PC's default reader configuration for embedded PDFs has become confused, due to multiple Adobe PDF document solutions installed on one PC.
    Solution 1:
    Go to Start > Run
    Type regedit and click OK.
    Browse to the following key: HKEY_CLASSES_ROOT\Software\Adobe\Acrobat\Exe
    Make sure that the correct Default data value is set for the path where Adobe Reader or Acrobat are installed.
    The default installation values are:
    "C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe"
    or
    "C:\Program Files\adobe\acrobat 6.0\acrobat\Acrobat.exe" (not sure about this path.  Check on your PC to be sure)
    depending on whether Adobe Reader or Adobe Acrobat is installed.
    Solution 2:
    Configure the browser to use Acrobat or Adobe Reader as a helper application.
    If you are using Firefox to browse the web, you can change this setting in Firefox by going to:
    Tools > Options
    Click on the "Applications" Tab.
    The first item in the list should be "Adobe Acrobat Document".  Under the Action list, click the drop down arrow and select the application you want to read PDFs within the web browser.  Click OK, and you should be done.
    If you're using Internet Explorer to view PDFs, try the below steps.
    After you configure Acrobat or Adobe Reader as a helper application, the browser starts the helper application in a separate window and displays PDF files within that window. Acrobat and Adobe Reader both include a preference that lets you specify Acrobat or Adobe Reader as the helper application.
    To configure Acrobat or Adobe Reader as a helper application:
    Start Acrobat or Adobe Reader.
    Choose Edit > Preferences.
    Select Internet on the left.
    Deselect Display PDF In Browser Using [Acrobat application], and then click OK.
    Quit Acrobat or Adobe Reader.
    The next time you select a link to a PDF file in the browser, a dialog box asks what you would like to do with the file. If you select Open It, the browser opens the PDF file in Acrobat or Adobe Reader (the helper application); if you select Save It To Disk, the browser saves the PDF file to your hard drive.

  • Issues with attaching an Adobe Story File to a clip in PPCC

    Hi,
    I read through a lot of stuff and watched a couple videos but still have an issue with the attachment.
    What I do is I go into the Metadata and assign my scene number (3.01). I export the script as a .astx. File/right click, attach story file-> select the file go back to metadata and it tells me nothing found. This is really frustrating what's wrong with it?

    Worked this one out, I had the bullet set on file and not staging

  • Issue with opening PDF files from the web Acrobat 8.1.4

    Hello everyone
    I just found out about this problem today, and it manifests in such a manner that when you try to open a PDF document on the web, it hangs for a while, and then the standard message about Adobe Acrobat not being able to open the document comes up, and after you OK away that you get the message that the program shuts down.
    If I download the PDF itself and open it locally it works. Is there any known issue with updates recently that creates this problem?
    The system is running on Windows 7 32-bits, and Adobe Acrobat is a part of the CS3 Master Collection.
    Greetings from Alexander

    Not supported file type can (but not always) mean the PDF was created with an old enough version of Acrobat, that it isn't comaptible with reader X or XI.
    Might have been damaged is pretty cut and dried in its meaning and interpretation.
    There's a known issue with Mac OS and Safari Browser "breaking" PDFs as they download, but it's not so common for Windows. Since these are files you already had, it would be even less applicable.
    You can try downloading an older version of Reader to check if it's a compatibility issue, but you'd have to uninstall the latest to do it and it'd be a lot of bother if they still don't open. It would also mean they are "broken" and cannot be repaired, that I know of.

Maybe you are looking for