Error in opening smartform generated PDF attachments

Hi every one,
    my smartforms generate multiple emails based on the widely used code as shown below.
The emails are successfully being sent to different locations, but the problem is the first PDF file is opening, but the others followed by it are not opening. It's giving an error ' File damaged and cannot be opened!'
Pls see the below code and help me out.
Points would be awarded.
Thanks to all in advance!!
Arnab
REPORT  zvenkat_smartform_via_mai.
*&  Structures and Infotype Internal tables.
TABLES pernr.
INFOTYPES:
  0000,
  0001,
  0002,
  0006,
  0022,
  0023.
INCLUDE dbpnpmac.
*&  Declaration part
Types
TYPES:
   BEGIN OF t_emp_info,
     pernr TYPE pa0001-pernr,
     ename TYPE pa0001-ename,
     bukrs TYPE pa0001-bukrs,
     persk TYPE pa0001-persk,
     stell TYPE pa0001-stell,
     gblnd TYPE pa0002-gblnd,
   END OF t_emp_info,
   BEGIN OF t_mard,
     matnr TYPE mard-matnr,
     werks TYPE mard-werks,
     labst TYPE mard-labst,
     meins TYPE mara-meins,
   END OF t_mard.
Work areas
DATA:
  w_emp_info TYPE t_emp_info.
Internal tables
DATA:
  i_emp_info TYPE STANDARD TABLE OF t_emp_info,
  i_mard     TYPE STANDARD TABLE OF t_mard.
"  Mai related declarations
"Variables
DATA :
     g_sent_to_all   TYPE sonv-flag,
     g_tab_lines     TYPE i.
"Types
TYPES:
     t_document_data  TYPE  sodocchgi1,
     t_packing_list   TYPE  sopcklsti1,
     t_attachment     TYPE  solisti1,
     t_body_msg       TYPE  solisti1,
     t_receivers      TYPE  somlreci1,
     t_pdf            TYPE  tline.
"Workareas
DATA :
     w_document_data  TYPE  t_document_data,
     w_packing_list   TYPE  t_packing_list,
     w_attachment     TYPE  t_attachment,
     w_body_msg       TYPE  t_body_msg,
     w_receivers      TYPE  t_receivers,
     w_pdf            TYPE  t_pdf.
"Internal Tables
DATA :
     i_document_data  TYPE STANDARD TABLE OF t_document_data,
     i_packing_list   TYPE STANDARD TABLE OF t_packing_list,
     i_attachment     TYPE STANDARD TABLE OF t_attachment,
     i_body_msg       TYPE STANDARD TABLE OF t_body_msg,
     i_receivers      TYPE STANDARD TABLE OF t_receivers,
     i_pdf            TYPE STANDARD TABLE OF t_pdf.
PARAMETERS:
           p_mai_id(99) TYPE c.
*& Start-of-selection.
START-OF-SELECTION.
GET pernr.
  PERFORM get_data.
  PERFORM show_smartform.
*& End-of-selection.
END-OF-SELECTION.
*&      Form  get_data
FORM get_data .
  rp-provide-from-last p0000 space pn-begda pn-endda.
  rp-provide-from-last p0001 space pn-begda pn-endda.
  rp-provide-from-last p0002 space pn-begda pn-endda.
  MOVE-CORRESPONDING: p0000 TO w_emp_info,
                      p0001 TO w_emp_info,
                      p0002 TO w_emp_info.
  SELECT matnr werks labst
  FROM mard
  INTO CORRESPONDING FIELDS OF TABLE i_mard.
ENDFORM.                    " get_data
*&      Form  show_smartform
FORM show_smartform .
  DATA :
    l_sform_name TYPE tdsfname,
    l_fm_name    TYPE rs38l_fnam.
  DATA :
        l_sf_control TYPE ssfctrlop,
        l_sf_options TYPE ssfcompop.
  DATA: i_otf LIKE itcoo OCCURS 100 WITH HEADER LINE.
       i_pdf LIKE tline OCCURS 100 WITH HEADER LINE.
  DATA: op_option TYPE ssfctrlop,
        job_output TYPE ssfcrescl.
op_option-getotf = 'X'.
  l_sform_name = 'ZVENKAT_SMARTFORM'.
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = l_sform_name
    IMPORTING
      fm_name            = l_fm_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.
  ELSE.
    CALL FUNCTION l_fm_name
      EXPORTING
        control_parameters = op_option
        output_options     = l_sf_options
        w_emp_info         = w_emp_info
IMPORTING
  DOCUMENT_OUTPUT_INFO       =
   job_output_info            = job_output
      TABLES
        p0006              = p0006
        p0022              = p0022
        p0023              = p0023
        i_mard             = i_mard.
    IF sy-subrc   0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    CALL FUNCTION 'CONVERT_OTF'
      EXPORTING
        format = 'PDF'
      TABLES
        otf    = job_output-otfdata
        lines  = i_pdf.
    IF sy-subrc  0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    PERFORM send_mai.
  ENDIF.
ENDFORM.                    " show_smartform
*&      Form  send_mai
FORM send_mail .
  "Subject of the mai.
  w_document_data-obj_name  = 'MAI_TO_HEAD'.
  w_document_data-obj_descr = 'Regarding Mai Program by SAP ABAP'.
  "Body of the mai
  PERFORM build_body_of_mai
    USING:space,
          'Hi,',
          'I am fine. How are you? How are you doing ? ',
          'This program has been created to send simple mai',
          'with Subject,Body with Address of the sender. ',
          'Regards,',
          'Venkat.O,',
          'SAP HR Technical Consultant.'.
  "Write Packing List for Body
  DESCRIBE TABLE i_body_msg LINES g_tab_lines.
  w_packing_list-head_start = 1.
  w_packing_list-head_num   = 0.
  w_packing_list-body_start = 1.
  w_packing_list-body_num   = g_tab_lines.
  w_packing_list-doc_type   = 'RAW'.
  APPEND w_packing_list TO i_packing_list.
  CLEAR  w_packing_list.
  "Write Packing List for Attachment
  w_packing_list-transf_bin = 'X'.
  w_packing_list-head_start = 1.
  w_packing_list-head_num   = 1.
  w_packing_list-body_start = 1.
  DESCRIBE TABLE i_attachment LINES w_packing_list-body_num.
  w_packing_list-doc_type   = 'PDF'.
  w_packing_list-obj_descr  = 'PDF Attachment'.
  w_packing_list-obj_name   = 'PDF_ATTACHMENT'.
  w_packing_list-doc_size   = w_packing_list-body_num * 255.
  APPEND w_packing_list TO i_packing_list.
  CLEAR  w_packing_list.
  "Fill the document data and get size of attachment
  w_document_data-obj_langu  = sy-langu.
  READ TABLE i_attachment INTO w_attachment INDEX g_tab_lines.
  w_document_data-doc_size = ( g_tab_lines - 1 ) * 255 + STRLEN( w_attachment ).
  "Receivers List.
  w_receivers-rec_type   = 'U'.      "Internet address
  w_receivers-receiver   = p_mai_id. "here mai Id should be given
  w_receivers-com_type   = 'INT'.
  w_receivers-notif_del  = 'X'.
  w_receivers-notif_ndel = 'X'.
  APPEND w_receivers TO i_receivers .
  CLEAR:w_receivers.
  "Function module to send mai to Recipients
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = w_document_data
      put_in_outbox              = 'X'
      commit_work                = 'X'
    IMPORTING
      sent_to_all                = g_sent_to_all
    TABLES
      packing_list               = i_packing_list
      contents_bin               = i_attachment
      contents_txt               = i_body_msg
      receivers                  = i_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.
  IF sy-subrc = 0 .
    MESSAGE i303(me) WITH 'Mai has been Successfully Sent.'.
  ELSE.
    WAIT UP TO 2 SECONDS.
    "This program starts the SAPconnect send process.
    SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
  ENDIF.
ENDFORM.                    " send_mai
*&      Form  build_body_of_mai
      text
     -->L_MESSAGE  text
FORM build_body_of_mai  USING l_message.
  w_body_msg = l_message.
  APPEND w_body_msg TO i_body_msg.
  CLEAR  w_body_msg.
ENDFORM.                    " build_body_of_mai

Hi,
Check the code below
1.converting smartform to PDF
Summury: Converting the smartfrom to PDF is process of 3 simple steps.
• Calling the Smart form, then it returns the OTF data in Return.
• Converting the OTF data into required format using the Function Module CONVERT_OTF_2_PDF.
• Download the File
*& Report ZTEST_NREDDY_PDF
REPORT ZTEST_NREDDY_PDF.
DATA: it_otf TYPE STANDARD TABLE OF itcoo,
it_docs TYPE STANDARD TABLE OF docs,
it_lines TYPE STANDARD TABLE OF tline,
st_job_output_info TYPE ssfcrescl,
st_document_output_info TYPE ssfcrespd,
st_job_output_options TYPE ssfcresop,
st_output_options TYPE ssfcompop,
st_control_parameters TYPE ssfctrlop,
v_len_in TYPE so_obj_len,
v_language TYPE sflangu VALUE 'E',
v_e_devtype TYPE rspoptype,
v_bin_filesize TYPE i,
v_name TYPE string,
v_path TYPE string,
v_fullpath TYPE string,
v_filter TYPE string,
v_uact TYPE i,
v_guiobj TYPE REF TO cl_gui_frontend_services,
v_filename TYPE string,
v_fm_name TYPE rs38l_fnam.
CONSTANTS c_formname TYPE tdsfname VALUE 'ZTEST'.
CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
i_language = v_language
i_application = 'SAPDEFAULT'
IMPORTING
e_devtype = v_e_devtype.
st_output_options-tdprinter = v_e_devtype.
*st_output_options-tdprinter = 'locl'.
st_control_parameters-no_dialog = 'X'.
st_control_parameters-getotf = 'X'.
.................GET SMARTFORM FUNCTION MODULE NAME.................
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = c_formname
IMPORTING
fm_name = v_fm_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.
...........................CALL SMARTFORM............................
CALL FUNCTION v_fm_name
EXPORTING
control_parameters = st_control_parameters
output_options = st_output_options
IMPORTING
document_output_info = st_document_output_info
job_output_info = st_job_output_info
job_output_options = st_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.
ELSE.
.........................CONVERT TO OTF TO PDF.......................
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = v_bin_filesize
TABLES
otf = st_job_output_info-otfdata
doctab_archive = it_docs
lines = it_lines
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 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.
........................GET THE FILE NAME TO STORE....................
CONCATENATE 'smrt' '.pdf' INTO v_name.
CREATE OBJECT v_guiobj.
CALL METHOD v_guiobj->file_save_dialog
EXPORTING
default_extension = 'pdf'
default_file_name = v_name
file_filter = v_filter
CHANGING
filename = v_name
path = v_path
fullpath = v_fullpath
user_action = v_uact.
IF v_uact = v_guiobj->action_cancel.
EXIT.
ENDIF.
..................................DOWNLOAD AS FILE....................
MOVE v_fullpath TO v_filename.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = v_bin_filesize
filename = v_filename
filetype = 'BIN'
TABLES
data_tab = it_lines
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
Regards,
Raj.

Similar Messages

  • Can't open libHaru-generated PDF with Reader, other readers work.

    Our application uses libHaru to export PDF images.  These PDFs can be opened using PDFlite on Windows, Preview on Mac and some other readers.  However, I have tried several versions of Adobe Reader on both platforms and the files fail to open with the message: "There was an error processing a page.  There was a problem reading this document (14)."   So, it seams that Adobe Reader believes that there is problem with this file.  However, from my very limited understanding of PDF structure, I have no idea what might be wrong, so I don't know how to fix it.  The file is written unencrypted.  It is about as simple a PDF as we can generate - a red-filled rectangle.  I would greatly appreciate any suggestions or help.
    Here is a sample PDF:
    %PDF-1.3
    %∑æ≠™
    1 0 obj
    <<
    /Type /Catalog
    /Pages 2 0 R
    >>
    endobj
    2 0 obj
    <<
    /Type /Pages
    /Kids [ 4 0 R ]
    /Count 1
    >>
    endobj
    3 0 obj
    <<
    /Producer (Haru Free PDF Library 2.3.0-dev)
    >>
    endobj
    4 0 obj
    <<
    /Type /Page
    /MediaBox [ 0 0 236 207 ]
    /Contents 5 0 R
    /Resources <<
    /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
    /Pattern <<
    /Type /Pattern
    /PatternType 1
    /PaintType 2
    /TilingType 2
    /BBox [ 0 0 100 100 ]
    /XStep 100
    /YStep 100
    >>
    >>
    /Parent 2 0 R
    >>
    endobj
    5 0 obj
    <<
    /Length 6 0 R
    >>
    stream
    1 0 0 -1 -118 296 cm
    1 w
    0 0 0 RG
    [] 0 d
    1 0.3 0.3 rg
    q
    % Rect
    119.25 90 m
    352.5 90 l
    352.5 294.75 l
    119.25 294.75 l
    119.25 90 l
    h
    B
    Q
    endstream
    endobj
    6 0 obj
    135
    endobj
    xref
    0 7
    0000000000 65535 f
    0000000015 00000 n
    0000000064 00000 n
    0000000123 00000 n
    0000000188 00000 n
    0000000458 00000 n
    0000000647 00000 n
    trailer
    <<
    /Root 1 0 R
    /Info 3 0 R
    /Size 7
    >>
    startxref
    666
    %%EOF

    You would need to post a sample PDF that demonstrates the problem.  All you posted there is text.  (PDF is a BINARY file format)
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Thu, 13 Oct 2011 11:02:42 -0700
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: Can't open libHaru-generated PDF with Reader, other readers work.
    Can't open libHaru-generated PDF with Reader, other readers work.
    created by Fred Snerd<http://forums.adobe.com/people/Fred+Snerd> in PDF Language and Specifications - View the full discussion<http://forums.adobe.com/message/3969828#3969828

  • Reduce smartform generated PDF size

    Hi,
    How to reduce the smartform generated PDF size. I have tried removing few tables,windows, logo(size 10KB) etc.. but the size didnt vary much. I am using new Font 'CorpoS' in my smartstyle and using PT language (has special characters).
    Current size of my PDF is 286KB and i want it to be 20-50KB.
    Please give me valuable suggestions on how to reduce the size.
    Please treat this as urgent.
    Thanks in advance.
    Regards,
    Manjeera.
    Edited by: Manjeera Chinigiri on Jan 30, 2008 11:02 AM

    Hello,
    please check the note 843480.
    Kind regards
    Marcin

  • How to send smartforms as pdf attachments with e mail

    hi experts,
    how to send smartforms as pdf attachments with e mail???
    nitin

    Hi
    In the FORM Interface put proper parameter. Hope this helps.

  • Error while opening report in pdf through OAF.

    This is my first report through OAF and I followed a couple threads discussed on this but I am unable to debug this problem
    Requirement - User clicks the image and is prompted to open/save pdf result file.It doesnt take any user parameters
    Error is : I get prompted to open/save the pdf file . I click on Open or Save it and then Open, it gives me the following error :
    'could not open because it either is not a supported file or because the file has been damaged(for example , it was sent as an email attachement and wasnt correctly decoded)'
    Steps taken so far :
    1. Created VO with query select a,b,c from Table A
    2. Created a simple xml page, with a torch image : Set Action Type and Event property of the Torch Image Item to FireAction and GenerateReport
    3. Wrote the code in CO and AM to get the data in XMLNode.
    4. I did SOPs , copypasted the xml in notepad saved it as xml, loaded in MSWord and created a template.Viewing pdf generates a pdf here on this data
    5. With "XML Publisher Administrator" Responsibility, I created Data Definition and Template Definition.
    6. I deployed all the files on server and ran the report. It prompts me to open the pdf but it seems corrupted. In Jserv.log, xml gets printed through SOPs.
    One thing I noticed is: <?xml version="1.0"?> is missing from xml.
    please assist me , what am I missing here ?
    Thanks a lot.
    My CO code :
    public class EmpCO extends OAControllerImpl
    public static final String RCS_ID="$Header$";
    public static final boolean RCS_ID_RECORDED =
    VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
    private static final String APP_NAME = "AK";
    private static final String TEMPLATE_CODE = "Emp_Template";
    private static final int BUFFER_SIZE = 32000;
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    OAApplicationModuleImpl am= (OAApplicationModuleImpl)pageContext.getApplicationModule(webBean);
    am.invokeMethod("initEmpVO");
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    OAApplicationModuleImpl am= (OAApplicationModuleImpl)pageContext.getApplicationModule(webBean);
    String event = pageContext.getParameter("event");
    if("GenerateReport".equals(event))
    System.out.println("user clicked the pencil");
    // Get the HttpServletResponse object from the PageContext. The report output is written to HttpServletResponse.
    DataObject sessionDictionary = (DataObject)pageContext.getNamedDataObject("_SessionParameters");
    HttpServletResponse response = (HttpServletResponse)sessionDictionary.selectValue(null,"HttpServletResponse");
    try {
    ServletOutputStream os = response.getOutputStream();
    // Set the Output Report File Name and Content Type
    String contentDisposition = "attachment;filename=EmpReport.pdf";
    response.setHeader("Content-Disposition",contentDisposition);
    response.setContentType("application/pdf");
    // Get the Data XML File as the XMLNode
    XMLNode xmlNode = (XMLNode) am.invokeMethod("getEmpDataXML");
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    xmlNode.print(outputStream);
    System.out.println(" xml data");
    System.out.println(outputStream.toString()); //outputs the xml correctly
    ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
    System.out.println("1**");
    ByteArrayOutputStream pdfFile = new ByteArrayOutputStream();
    System.out.println("2**");
    //Generate the PDF Report.
    TemplateHelper.processTemplate(
    ((OADBTransactionImpl)am.getOADBTransaction()).getAppsContext(),// AppsContext
    "AK",// Application short name of the template
    TEMPLATE_CODE,// Template code of the template
    "en", //language code of the template
    "US",//Country Code
    inputStream, //// XML data for the template
    TemplateHelper.OUTPUT_TYPE_PDF,//Output type of processed document
    null, //Properties
    pdfFile); //OutputStream where the processed data goes
    System.out.println("3**"); //doesnt print and goes in catch block
    // Write the PDF Report to the HttpServletResponse object and flush.
    byte[] b = pdfFile.toByteArray();
    System.out.println("4**");
    response.setContentLength(b.length);
    System.out.println("5**");
    os.write(b, 0, b.length);
    System.out.println("6**");
    os.flush();
    System.out.println("7**");
    os.close();
    System.out.println("8**");
    catch(Exception e)
    System.out.println("9**");
    response.setContentType("text/html");
    throw new OAException(e.getMessage(), OAException.ERROR);
    System.out.println("10**");
    pageContext.setDocumentRendered(false);
    System.out.println("11**");
    ///////////////------it prints only 1**, 2** and goes in catch block to print 9**
    AM Code :
    public void initEmpVO()
    EmpVOImpl vo = getEmpVO1();
    if(vo == null)
    {       MessageToken errTokens[] = { new MessageToken("OBJECT_NAME", "EmpVO1")   };
    throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND", errTokens);
    } else
    {        vo.executeQuery();      }
    public XMLNode getEmpDataXML()
    OAViewObject vo = (OAViewObject)findViewObject("EmpVO1");
    XMLNode xmlNode = (XMLNode) vo.writeXML(4, XMLInterface.XML_OPT_ALL_ROWS);
    return xmlNode;
    }

    Hi,
    Basically the reason for this is that your "PDF file" is not populated with the correct pdf structure that Adobe recognizes (i.e. save the file and look at it in notepad, you'll see it's probably in html or a java stack trace). 2 reason's this happens
    1.You do not have the necessary library files attached to your project i.e. for XMLPublisher you will need $JAVA_TOP/oracle/apps/fnd/* and $JAVA_TOP/oracle/apps/xdo/*. Zip these up and add them to your libraries section of your project.
    2. Your XML Publisher properties are not configured correctly. (usually causes a blank file) To change this go to (E-Business Suite>XML Publisher Administrator>Administration>General>Temporary Directory). Depending on what your doing you will need to point this to either a server location or a local location. i.e. when uploading defintion/template and previewing it requires a server-side location to generate a temporary file for the preview, when running a jdeveloper project it will look for a local directory to generate the temporary file. If it cannot find the directory it will throw an error to System.out, and send the HttpServletResponse container a 0bytes file. For local development on a windows box I suggest setting the "Temporary Directory" to something like "C:\oracle" and ensure that folder exists.
    Hope this helps
    Brad

  • Error during Opening Layout on PDF Forms - SFP

    Hi All,
    I am trying to develop a PDF Form and I have succcessfully created interface and when i try to create a form, upon pressing the LAYOUT Tab or Button i get an error message and the trnasaction closes down
    Error Details are:
    ==================================================================================
    Error while opening document
    Message no. SOFFICEINTEGRATION143
    Diagnosis
    An error occurred in the desktop application while opening a document.
    Procedure
    Check first whether you can insert a document from this desktop application as an embedded object in another application. The necessary menu item is usually 'Insert --> Object'. The application then lists all of the OLE document types. Choose the type corresponding to the desktop applciation. If the insertion fails, the error is in the desktop application itself.
    This error has various causes. Often, it is caused by activating certain add-ins. Sometimes, the desktop application is wrongly installed. The error should not recur once you have disabled any add-ins or reinstalled the desktop application.
    Procedure for System Administration
    If you cannot solve the problem as described above, enter a problem message. There are notes relating to how to generate the log file using the program SAPROFFICEINTEGRATIONTRACE.
    ===============================================================================
    I check with the guys who do the SAP GUI installation and he did all he can do with no success. My GUI is 710 version with Patch level 7
    Can anyone help me in identifying what I should be doing to have Layout opened in my system?
    Thanks in advance to all of you,
    Rgds,
    Lakshmi

    Seems to be GUI installation issue and will try re-installing required things.
    Rgds,
    Lakshmi

  • Error during Opening Layout on PDF Forms

    Hi All,
    I am trying to develop a PDF Form and I have succcessfully created interface and when i try to create a form, upon pressing the LAYOUT Tab or Button i get an error message and the trnasaction closes down
    Error Details are:
    ==================================================================================
    Error while opening document
    Message no. SOFFICEINTEGRATION143
    Diagnosis
    An error occurred in the desktop application while opening a document.
    Procedure
    Check first whether you can insert a document from this desktop application as an embedded object in another application. The necessary menu item is usually 'Insert --> Object'. The application then lists all of the OLE document types. Choose the type corresponding to the desktop applciation. If the insertion fails, the error is in the desktop application itself.
    This error has various causes. Often, it is caused by activating certain add-ins. Sometimes, the desktop application is wrongly installed. The error should not recur once you have disabled any add-ins or reinstalled the desktop application.
    Procedure for System Administration
    If you cannot solve the problem as described above, enter a problem message. There are notes relating to how to generate the log file using the program SAPROFFICEINTEGRATIONTRACE.
    ===============================================================================
    I check with the guys who do the SAP GUI installation and he did all he can do with no success. My GUI is 710 version with Patch level 7
    Can anyone help me in identifying what I should be doing to have Layout opened in my system?
    Thanks in advance to all of you,
    Rgds,
    Lakshmi

    Please follow these steps.
    1) uninstall all adobe related stuff
    2) uninstall sap gui also
    3) again install sap gui
    4) Then install all adobe related stuff like ALDsetup.exe, xACF_NW04_SP21.exe
    5) Just open the formdesigner.exe from Designer 7.1 folder from your desktop
    6) Then go to T-code SFP and try to open the layout, it will work fine.
    Take the help of basis if required.

  • Error - While converting Smartform to PDF and send in Email

    HI all,
    I am getting error while opening the PDF file.  i searched in SDN but I am not able to figure out what is the correct issues.
    Please find the piece of code.
    * Assigning the OTFDATA to OTF Structure table
              CLEAR gt_otf.
              gt_otf[] = ls_jobout_info-otfdata[].
    * Convert the OTF DATA to SAP Script Text lines
              CLEAR gt_pdf_tab.
              CALL FUNCTION 'CONVERT_OTF'
                EXPORTING
                  format                = 'PDF'
    **              max_linewidth         = 134
                  max_linewidth         = 132
                IMPORTING
    **              bin_file              = ts_file
                  bin_filesize          = gv_bin_filesize
                TABLES
                  otf                   = gt_otf
                  lines                 = gt_pdf_tab
                EXCEPTIONS
                  err_max_linewidth     = 1
                  err_format            = 2
                  err_conv_not_possible = 3
                  OTHERS                = 4.
    * Passing the SAP Script text lines to SAPoffice: Single List with Column Length 255 table
              DATA:
    *           gv_bin_filesize TYPE i, " Store the file size
              gv_pos TYPE i,
              gv_len TYPE i,
              gv_tab_lines TYPE i.
              CLEAR : gs_objbin, gs_pdf_tab.
              LOOP AT gt_pdf_tab INTO gs_pdf_tab.
                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.
              ENDIF.
    * 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 = l_title.
                gs_objpack-obj_descr = w_output-tdtitle.
                APPEND gs_objpack TO gt_objpack.
              ENDIF.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = p_doc_chng
          put_in_outbox              = 'X'
          sender_address             = p_w_sender
          sender_address_type        = 'INT'
        TABLES
          packing_list                     = p_objpack
    **      object_header                    = p_objhead
          contents_bin                     = p_objbin
    **      contents_txt                     = p_objtxt
    *     CONTENTS_HEX                     =
    *     OBJECT_PARA                      =
    *     OBJECT_PARB                      =
          receivers                        = p_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
    kindly help...email is coming but when i tried to open the PDF file, error saying, " There is error opening a file. thie file is damages and cannot be opened'
    thanks

    HI all,
    I am getting error while opening the PDF file.  i searched in SDN but I am not able to figure out what is the correct issues.
    Please find the piece of code.
    * Assigning the OTFDATA to OTF Structure table
              CLEAR gt_otf.
              gt_otf[] = ls_jobout_info-otfdata[].
    * Convert the OTF DATA to SAP Script Text lines
              CLEAR gt_pdf_tab.
              CALL FUNCTION 'CONVERT_OTF'
                EXPORTING
                  format                = 'PDF'
    **              max_linewidth         = 134
                  max_linewidth         = 132
                IMPORTING
    **              bin_file              = ts_file
                  bin_filesize          = gv_bin_filesize
                TABLES
                  otf                   = gt_otf
                  lines                 = gt_pdf_tab
                EXCEPTIONS
                  err_max_linewidth     = 1
                  err_format            = 2
                  err_conv_not_possible = 3
                  OTHERS                = 4.
    * Passing the SAP Script text lines to SAPoffice: Single List with Column Length 255 table
              DATA:
    *           gv_bin_filesize TYPE i, " Store the file size
              gv_pos TYPE i,
              gv_len TYPE i,
              gv_tab_lines TYPE i.
              CLEAR : gs_objbin, gs_pdf_tab.
              LOOP AT gt_pdf_tab INTO gs_pdf_tab.
                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.
              ENDIF.
    * 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 = l_title.
                gs_objpack-obj_descr = w_output-tdtitle.
                APPEND gs_objpack TO gt_objpack.
              ENDIF.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = p_doc_chng
          put_in_outbox              = 'X'
          sender_address             = p_w_sender
          sender_address_type        = 'INT'
        TABLES
          packing_list                     = p_objpack
    **      object_header                    = p_objhead
          contents_bin                     = p_objbin
    **      contents_txt                     = p_objtxt
    *     CONTENTS_HEX                     =
    *     OBJECT_PARA                      =
    *     OBJECT_PARB                      =
          receivers                        = p_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
    kindly help...email is coming but when i tried to open the PDF file, error saying, " There is error opening a file. thie file is damages and cannot be opened'
    thanks

  • Error while opening reports in PDF

    Hi,
    I have few reports which i open in PDF format. But when i try to open the report i get the following error message.
    Adobe Reader could not open "file name.pdf" becasue 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 wasn't correctly decoded).
    Earlier it was working fine, but today its not working.
    Any help would be really appretiable.
    Thanks,
    -Amit

    Another thing to consider is the data that your report contains. It's possible that the data within the report output contains special characters that are causing problems with the well-formedness of the XML.
    I would look at this closely in a case where the reports were running fine and suddenly they stop. Especially if you have a pretty decent amount of DML traffic in the application.
    Earl

  • ATMLIB.dll error on opening a complex PDF

    I have designed several forms with Javascript code sections for auto-date completion etc.
    In the last 2-3 weeks I cannot open any of them on my development machine.
    Here is a screenshot of the error message.
    http://i.imgur.com/LejE4oO.jpg
    The program then freezes and has to be shut down.
    The error says "not designed to run on Windows". That does not make sense to me.
    I am running Windows 7 Ultimate 64-BIT.
    I have done the following:
    1) Uninstalled ACROBAT X PRO
          Rebooted
          Used Adobe's clean tool
    2) Reinstalled
    ERROR still exists
    1) Uninstalled ACROBAT X
    2) Installed every Acrobat X update up to the latest version in correct sequence
    3) Reboot
    ERROR still exists
    I have now gotten to the point where my workflow has come to a complete halt. I take my work to another compute (client) that has Acrobat Reader and the "complex" files open just fine.
    Its just my dev machine that is FUBAR.
    I have been through like 10 reinstalls with no success.
    My only solution now may be to ditch Adobe and seek a third party PDF creation and editing tool for work which is far from ideal.
    I am NOT reinstalling Windows 7 because I am in no mood to have to reinstall every piece of software plus risk breaking my VB.net coding tools.
    Has anyone seen an ATMLIB.dll error on opening complex documents?
    This is not AMTLIB.dll (I don't know what that is) but ATMLIB.dll.
    ATM appears to stand for Adobe Type Manager but I cannot seem to figure out why this has occured.

    I was able to fix this, and I posted about it on another forum post here
    I had this issue ("Bad Image: C:\Windows\system32\ATMLIB.dll is either not designed to run on Windows or it contains an error") with Adobe Reader X (10.1.12). I tried repairing, and then tried uninstalling and upgrading to Adobe Reader XI (11.0.9), but still had the same trouble. I compared the atmlib.dll files in both directories and noticed that the file in C:\Windows\SysWOW64 did not appear to have any file meta data (giving the appearance that it was corrupted), whereas the file in C:\Windows\system32 reflected a file version 5.1.2.238 and product version "5.1 Build 238". Now, it appears based on being installed to "C:\Program Files (x86)" that the version of Adobe Reader I was using was 32-bit. So, this tells me that while the error references the C:\Windows\system32 file path, it is likely actually the file in C:\Windows\SysWOW64 that is the problem (Windows-on-Windows emulation for 32-bit applications, 32-bit libraries actually reside in C:\Windows\SysWOW64, not C:\Windows\system32). I found the same file in C:\Windows\SysWOW64 with the same product and file version on another 64-bit Windows 7 workstation, and simply copied it to C:\Windows\SysWOW64 on the affected workstation, and that resolved the issue.
    NOTE: To overwrite the file, I had to change file ownership to Administrators security group, otherwise it was immutable.

  • Open a generated pdf file in new window

    Dear all,
    I'm using JDev ADF 11.1.1.4.0
    I use the command button method to generate pdf file with JasperReports and I store it into the public folder /reports/test5.pdf. To open this file I can use goLink or goButton with target frame _blank, but how can I open this file automatically after generation?
    I was reading about fileDownloadActionListener, but it's not what I need, I just want to open the file in new window browser.
    Any help will be appreciated.
    Regards,
    Wojtek.

    try this
    HttpServletResponse response = (HttpServletResponse) FacesContext
                                      .getCurrentInstance().getExternalContext().getResponse();
                       ServletOutputStream servletOutputStream;
                       servletOutputStream = response.getOutputStream();
                       byte[] bytes = null;
                       JasperDesign jasperDesign;
                                try {
                                        jasperDesign = JRXmlLoader.load(ios);
                                        jasperReport = JasperCompileManager.compileReport(jasperDesign);                
                                        JRPdfExporter exporter = new JRPdfExporter();
                                        JasperPrint jasperPrint;
                                        jasperPrint =
                                                JasperFillManager.fillReport( jasperReport, parameters, connection );
                                    } catch (JRException e) {
                                            e.printStackTrace();
                                bytes =
                                JasperRunManager.runReportToPdf(jasperReport,parameters, connection);
                       response.addHeader("Content-disposition", 
                       "attachment;filename=sale.pdf"); 
                       response.setContentType("application/pdf");
                       response.setContentLength(bytes.length);
                       servletOutputStream.write(bytes, 0, bytes.length);
                       servletOutputStream.flush();
                       servletOutputStream.close();
                       context.responseComplete();
                            } catch (IOException e) {
                        e.printStackTrace();
                    } catch (JRException e) {
                         e.printStackTrace();
                    }

  • Error while Open and save pdf using Adobe library

    I m using adobe library to open and save PDF using VC++ MFC .
    as given samples are working for me all are using console application to accomplish this task.
    But when i tried to use same functions to open and save PDF from DOC/VIEW application it gives me an error.
    it is a strange problem that I don't understand. If I compile the following code (Visual C++ 2000 Express Edition) I get an error message: "Unhandled exception at 0x0041183f in test.exe: 0xC0000005: Access violation reading location 0x00000004."
    For your reference when I simply  create one function and one menu and called that function from menu.
    Please see the code is given below.
    The code is given below
    void CPDF_MFCDoc::OnPdfOpen()
        // TODO: Add your command handler code here
        OpenPDF();
    #define PDF_FNAME1  "C:/Test.pdf"
    void OpenPDF()
         PDDoc pdDoc= NULL;
         ASErrorCode errCode = 0;
         DURING
            pdDoc1 = MyPDDocOpen(PDF_FNAME1);
        HANDLER
            errCode = ERRORCODE;
        END_HANDLER
    It gives me an error as.
    Unhandled exception at 0x004075b1 in PDF_MFC.exe: 0xC0000005: Access violation reading location 0x00000024.
    But when same thing I was complied from console ,it works.
    Working code is given below.
    #define PDF_FNAME1  "C:/Test.pdf"
    void MainProc(int argc, char **argv )
         PDDoc pdDoc= NULL,
         ASErrorCode errCode = 0;
         DURING
                 pdDoc1 = MyPDDocOpen(PDF_FNAME1);
         HANDLER
            errCode = ERRORCODE;
        END_HANDLER
    PDDoc MyPDDocOpen(char *fileName)
        ASFileSys asFileSys = ASGetDefaultFileSys();
        volatile ASPathName asPathName    = NULL;
        volatile PDDoc        pdDoc        = NULL;
        DURING
            /* Create asPathName from file.*/
            #if MAC_PLATFORM
            asPathName = GetMacPath(fileName);
            #else
            asPathName = ASFileSysCreatePathName(asFileSys, ASAtomFromString("Cstring"), fileName, 0);
            #endif
            /* Open pdDoc from asPathName.*/
            pdDoc = PDDocOpen(asPathName, NULL, NULL, true);
            fprintf(stdout, "Successfully opened %s\n", fileName);
        HANDLER
            fprintf(stderr, "Unable to open %s\n", fileName);
            pdDoc = NULL;
        END_HANDLER
        /* Release asPathName.*/
        if (asPathName)
            ASFileSysReleasePath(asFileSys, asPathName);
        return pdDoc;

    Yes ,I have it , I think when i tried to open or save any document "ASGetDefaultFileSys()" function not able to get file it raise an error , can you please help me out . where I m wrong.
    Why this "ASGetDefaultFileSys()" function raise as "Access violation error" .
    Please help me.

  • RWI 00236 error while opening report in PDF mode

    Hi All,
    I'm getting the RWI 00236 error while the report is opened in PDF mode.I have searched on this error but couldn't got the answer so far.My report is quite a large one and i wont get any error while running simple reps.If this is something to do with temp files deletion at server side ,pls let me know which temp files needs to be deleted bcoz there quite few temp files at server level.Ofter getting this error msg ,the report browser hangs up and i needs to logout completely from infoview.
    Im using BO X1r2 version and service pack is SP4.

    Hi,
    Are you able to open other reports in PDF Mode or not
    If you are not able to open any report in PDF format then try to follow  below mentioned steps.
    1. Open Adobe Acrobat Reader. Click Edit > Preferences.
    2. Click Internet in the Categories column of the Preferences property sheet.
    3. Choose Display PDF in browser check box as shown below.
    4. Click Ok, Adobe will reconfigure the setting, close Reader.
    5. Now, when we view in pdf format in IE, we might see one  message
    6. So, when IE is launched, go to Tools>Manage Add-ons>Enable or Disable Add-ons and then enable
    "Adobe PDF Reader Link Helper" add-on. Click Ok, restart IE.
    Cheers,
    Suresh Aluri.

  • Opening LiveCycle generated pdf on mobile devices

    We have created numerous documents in LiveCycle ES3 so that the forms can be filled in and saved as a PDF, and so that some sections of the form can expand to accept large text blocks when needed.  The forms work perfectly when opened on a desktop version of Adobe Reader.  They don't open at all when users are attempting to view on a mobile device (Android, I Phone, I pad, etc).  The devices have the most current version of Adobe Reader installed, but still get an error message.
    Is there any way to save the forms so that they can be read from a mobile device with Adobe Reader?  If not, are there any third party apps that will open the forms?  They don't need to be able to fill in.  The mobile users will only be opening the form and reading it.

    Forms designed in LiveCycle Designer ES3 are XFA based forms. They cannot be opened on mobile devices.
    LiveCycle ES4 introduced Mobile Forms module which can render the existing XFA form as HTML5. More info here : http://helpx.adobe.com/livecycle/topics/mobile-forms-dev.html
    -Wasil

  • Error in opening on line PDF document.

    I am trying to open a PDF document on-line.  It gives me an error message that the document may not be displayed correctly, followed by a screen : "Please wait your viewer may not be able to display the document correctly.  Requesting that you install the latest version.  I am using Adobe Reader XI, which is updated. 

    I am trying to open a PDF document on-line.  It gives me an error message that the document may not be displayed correctly, followed by a screen : "Please wait your viewer may not be able to display the document correctly.  Requesting that you install the latest version.  I am using Adobe Reader XI, which is updated. 

Maybe you are looking for