Error in SO_NEW_DOCUMENT_ATT_SEND_API1. Unable to open the pdf attachment

Hi all,
I'm currently using SO_NEW_DOCUMENT_ATT_SEND_API1 to send out the email and together with a pdf attachment. However when I tried to open the attachment, it has the decoded incorrectly error.
What am I missing?
Thanks.
Below is the code, this is just testing purposes. I apologized for the messy code.
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS  2 WITH HEADER LINE.
DATA: OBJHEAD LIKE SOLISTI1   OCCURS  1 WITH HEADER LINE.
DATA: OBJBIN  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE.
DATA: OBJTXT  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE.
DATA: RECLIST LIKE SOMLRECI1  OCCURS  5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: TAB_LINES LIKE SY-TABIX.
DATA: l_functionmodule TYPE rs38l_fnam.
    DATA: l_spoolid              TYPE  rspoid,
          l_control_parameters   TYPE  ssfctrlop,
          l_output_options       TYPE  ssfcompop,
          l_user_settings        TYPE  tdbool VALUE ' ',
          l_document_output_info TYPE  ssfcrespd,
          l_job_output_info      TYPE  ssfcrescl,
          l_job_output_options   TYPE  ssfcresop,
          l_spoolid_del          TYPE  rqident,
          l_status               TYPE  sysubrc,
          li_table01             TYPE TABLE OF YGLXX_PDF_S_TABLE,
          lw_table01             LIKE YGLXX_PDF_S_TABLE,
          bin                    TYPE xstring.
    DATA: i_otfdata   TYPE STANDARD TABLE OF itcoo INITIAL SIZE 0.
    DATA: l_otfdata   TYPE                   itcoo.
    DATA: lv_bytes    TYPE                   p,
          lv_bin_file TYPE                   xstring,
          gt_pdfdata  TYPE STANDARD TABLE OF tline INITIAL SIZE 0,
          CONTENT_OUT TYPE TABLE OF SOLISTI1.
data: begin of itab occurs 0,
        line(255) type c,
      end of itab.
Creating the document to be sent
DOC_CHNG-OBJ_NAME = 'OFFER'.
DOC_CHNG-OBJ_DESCR = 'Auction of a Picasso jr'.
OBJTXT = 'Reserve price : $250000'.
APPEND OBJTXT.
OBJTXT = 'A reproduction of the painting to be auctioned'.
APPEND OBJTXT.
OBJTXT = 'is enclosed as an attachment.'.
APPEND OBJTXT.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
Creating the entry for the compressed document
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.
Creating the document attachment (PDF)
Get Function Module of Smartform
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        formname                 = 'YGLPA_IDR'
     IMPORTING
       fm_name                  = l_functionmodule
     EXCEPTIONS
       no_form                  = 1
       no_function_module       = 2
       OTHERS                   = 3.
  Set Print Parameters
    l_control_parameters-langu = 'EN'.
    l_control_parameters-no_dialog = 'X'.
    l_control_parameters-getotf = 'X'.
    l_output_options-tddest = 'LOCL'.
    LOOP AT li_table01 INTO lw_table01.
      lw_table01-line = '0002'.
      APPEND lw_table01 TO li_table01.
    ENDLOOP.
  Call Smartform Function Module
      CALL FUNCTION l_functionmodule
        EXPORTING
          control_parameters       = l_control_parameters
          output_options           = l_output_options
          user_settings            = l_user_settings
          pernr                    = '20'
          begda                    = sy-datum
          endda                    = '99991231'
          langu                    = sy-langu
          audience                 = ''
          data01                   = ''
          data02                   = ''
          data03                   = ''
          data04                   = ''
          data05                   = ''
       IMPORTING
         document_output_info      = l_document_output_info
         job_output_info           = l_job_output_info
         job_output_options        = l_job_output_options
       TABLES
         table01                   = li_table01
       EXCEPTIONS
         formatting_error          = 1
         internal_error            = 2
         send_error                = 3
         user_canceled             = 4
         OTHERS                    = 5.
    Populate OTF data table
      LOOP AT l_job_output_info-otfdata INTO l_otfdata.
        APPEND l_otfdata TO i_otfdata.
        CLEAR l_otfdata.
      ENDLOOP.                           " LOOP AT t_outtab-otfdata
  Convert OTF into PDF
    CALL FUNCTION 'CONVERT_OTF'
         EXPORTING
              format                = 'PDF'
         IMPORTING
              bin_filesize          = lv_bytes
              bin_file              = bin
         TABLES
              otf                   = i_otfdata
              lines                 = gt_pdfdata
         EXCEPTIONS
              err_max_linewidth     = 1
              err_format            = 2
              err_conv_not_possible = 3
              OTHERS                = 4.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
  EXPORTING
    BUFFER                = bin
  TABLES
    BINARY_TAB            = itab
objbin = itab.
APPEND objbin.
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
*OBJHEAD = 'attach.pdf'. APPEND OBJHEAD.
Creating the entry for the compressed attachment
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM   = 1.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM   = TAB_LINES.
OBJPACK-DOC_TYPE   = 'PDF'.
OBJPACK-OBJ_NAME   = 'ATTACHMENT'.
OBJPACK-OBJ_DESCR = 'Attachment'.
OBJPACK-DOC_SIZE   = TAB_LINES * 255.
APPEND OBJPACK..
Entering names in the distribution list
RECLIST-RECEIVER = '<emailadd>'.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
RECLIST-RECEIVER = 'DLI-NEUREICH'.
RECLIST-REC_TYPE = 'P'.
APPEND RECLIST.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
     EXPORTING
          DOCUMENT_DATA = DOC_CHNG
          PUT_IN_OUTBOX = 'X'
          COMMIT_WORK   = 'X'
     TABLES
          PACKING_LIST  = OBJPACK
          OBJECT_HEADER = OBJHEAD
          CONTENTS_BIN  = OBJBIN
          CONTENTS_TXT  = OBJTXT
         CONTENTS_HEX = itab
          RECEIVERS     = RECLIST
     EXCEPTIONS
          TOO_MANY_RECEIVERS = 1
          DOCUMENT_NOT_SENT  = 2
          OPERATION_NO_AUTHORIZATION = 4
          OTHERS = 99.
CASE SY-SUBRC.
  WHEN 0.
    WRITE: / 'Result of the send process:'.
    LOOP AT RECLIST.
      WRITE: / RECLIST-RECEIVER(48), ':'.
      IF RECLIST-RETRN_CODE = 0.
        WRITE 'sent successfully'.
      ELSE.
        WRITE 'not sent'.
      ENDIF.
    ENDLOOP.
  WHEN 1.
    WRITE: / 'no authorization to send to the specified number of recipients!'.
  WHEN 2.
    WRITE: / 'document could not be sent to any of the recipients!'.
  WHEN 4.
    WRITE: / 'no authorization to send !'.
  WHEN OTHERS.
    WRITE: / 'error occurred during sending !'.
ENDCASE.

Hi all,
I'm currently using SO_NEW_DOCUMENT_ATT_SEND_API1 to send out the email and together with a pdf attachment. However when I tried to open the attachment, it has the decoded incorrectly error.
What am I missing?
Thanks.
Below is the code, this is just testing purposes. I apologized for the messy code.
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS  2 WITH HEADER LINE.
DATA: OBJHEAD LIKE SOLISTI1   OCCURS  1 WITH HEADER LINE.
DATA: OBJBIN  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE.
DATA: OBJTXT  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE.
DATA: RECLIST LIKE SOMLRECI1  OCCURS  5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: TAB_LINES LIKE SY-TABIX.
DATA: l_functionmodule TYPE rs38l_fnam.
    DATA: l_spoolid              TYPE  rspoid,
          l_control_parameters   TYPE  ssfctrlop,
          l_output_options       TYPE  ssfcompop,
          l_user_settings        TYPE  tdbool VALUE ' ',
          l_document_output_info TYPE  ssfcrespd,
          l_job_output_info      TYPE  ssfcrescl,
          l_job_output_options   TYPE  ssfcresop,
          l_spoolid_del          TYPE  rqident,
          l_status               TYPE  sysubrc,
          li_table01             TYPE TABLE OF YGLXX_PDF_S_TABLE,
          lw_table01             LIKE YGLXX_PDF_S_TABLE,
          bin                    TYPE xstring.
    DATA: i_otfdata   TYPE STANDARD TABLE OF itcoo INITIAL SIZE 0.
    DATA: l_otfdata   TYPE                   itcoo.
    DATA: lv_bytes    TYPE                   p,
          lv_bin_file TYPE                   xstring,
          gt_pdfdata  TYPE STANDARD TABLE OF tline INITIAL SIZE 0,
          CONTENT_OUT TYPE TABLE OF SOLISTI1.
data: begin of itab occurs 0,
        line(255) type c,
      end of itab.
Creating the document to be sent
DOC_CHNG-OBJ_NAME = 'OFFER'.
DOC_CHNG-OBJ_DESCR = 'Auction of a Picasso jr'.
OBJTXT = 'Reserve price : $250000'.
APPEND OBJTXT.
OBJTXT = 'A reproduction of the painting to be auctioned'.
APPEND OBJTXT.
OBJTXT = 'is enclosed as an attachment.'.
APPEND OBJTXT.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
Creating the entry for the compressed document
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.
Creating the document attachment (PDF)
Get Function Module of Smartform
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        formname                 = 'YGLPA_IDR'
     IMPORTING
       fm_name                  = l_functionmodule
     EXCEPTIONS
       no_form                  = 1
       no_function_module       = 2
       OTHERS                   = 3.
  Set Print Parameters
    l_control_parameters-langu = 'EN'.
    l_control_parameters-no_dialog = 'X'.
    l_control_parameters-getotf = 'X'.
    l_output_options-tddest = 'LOCL'.
    LOOP AT li_table01 INTO lw_table01.
      lw_table01-line = '0002'.
      APPEND lw_table01 TO li_table01.
    ENDLOOP.
  Call Smartform Function Module
      CALL FUNCTION l_functionmodule
        EXPORTING
          control_parameters       = l_control_parameters
          output_options           = l_output_options
          user_settings            = l_user_settings
          pernr                    = '20'
          begda                    = sy-datum
          endda                    = '99991231'
          langu                    = sy-langu
          audience                 = ''
          data01                   = ''
          data02                   = ''
          data03                   = ''
          data04                   = ''
          data05                   = ''
       IMPORTING
         document_output_info      = l_document_output_info
         job_output_info           = l_job_output_info
         job_output_options        = l_job_output_options
       TABLES
         table01                   = li_table01
       EXCEPTIONS
         formatting_error          = 1
         internal_error            = 2
         send_error                = 3
         user_canceled             = 4
         OTHERS                    = 5.
    Populate OTF data table
      LOOP AT l_job_output_info-otfdata INTO l_otfdata.
        APPEND l_otfdata TO i_otfdata.
        CLEAR l_otfdata.
      ENDLOOP.                           " LOOP AT t_outtab-otfdata
  Convert OTF into PDF
    CALL FUNCTION 'CONVERT_OTF'
         EXPORTING
              format                = 'PDF'
         IMPORTING
              bin_filesize          = lv_bytes
              bin_file              = bin
         TABLES
              otf                   = i_otfdata
              lines                 = gt_pdfdata
         EXCEPTIONS
              err_max_linewidth     = 1
              err_format            = 2
              err_conv_not_possible = 3
              OTHERS                = 4.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
  EXPORTING
    BUFFER                = bin
  TABLES
    BINARY_TAB            = itab
objbin = itab.
APPEND objbin.
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
*OBJHEAD = 'attach.pdf'. APPEND OBJHEAD.
Creating the entry for the compressed attachment
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM   = 1.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM   = TAB_LINES.
OBJPACK-DOC_TYPE   = 'PDF'.
OBJPACK-OBJ_NAME   = 'ATTACHMENT'.
OBJPACK-OBJ_DESCR = 'Attachment'.
OBJPACK-DOC_SIZE   = TAB_LINES * 255.
APPEND OBJPACK..
Entering names in the distribution list
RECLIST-RECEIVER = '<emailadd>'.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
RECLIST-RECEIVER = 'DLI-NEUREICH'.
RECLIST-REC_TYPE = 'P'.
APPEND RECLIST.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
     EXPORTING
          DOCUMENT_DATA = DOC_CHNG
          PUT_IN_OUTBOX = 'X'
          COMMIT_WORK   = 'X'
     TABLES
          PACKING_LIST  = OBJPACK
          OBJECT_HEADER = OBJHEAD
          CONTENTS_BIN  = OBJBIN
          CONTENTS_TXT  = OBJTXT
         CONTENTS_HEX = itab
          RECEIVERS     = RECLIST
     EXCEPTIONS
          TOO_MANY_RECEIVERS = 1
          DOCUMENT_NOT_SENT  = 2
          OPERATION_NO_AUTHORIZATION = 4
          OTHERS = 99.
CASE SY-SUBRC.
  WHEN 0.
    WRITE: / 'Result of the send process:'.
    LOOP AT RECLIST.
      WRITE: / RECLIST-RECEIVER(48), ':'.
      IF RECLIST-RETRN_CODE = 0.
        WRITE 'sent successfully'.
      ELSE.
        WRITE 'not sent'.
      ENDIF.
    ENDLOOP.
  WHEN 1.
    WRITE: / 'no authorization to send to the specified number of recipients!'.
  WHEN 2.
    WRITE: / 'document could not be sent to any of the recipients!'.
  WHEN 4.
    WRITE: / 'no authorization to send !'.
  WHEN OTHERS.
    WRITE: / 'error occurred during sending !'.
ENDCASE.

Similar Messages

  • Error when opening the PDF attachment

    Hi,
    We are able to successfully send the PDF attachment to external email id  from SAP SCRIPT:
    but when we are opening the PDF attachment we are getting the following error:
    "Adobe Reader could not open because it is not either a supported file type or the file has been damaged ..etc.."
    Is any logic need to write for the above or any parameters are missing .
    Can any one help...
    Thanks in advance.

    Hi Ramana,
                Just try below given example code.....In which I have just different function Module to convert from OFT to PDF....
       AT END OF VSTEL.
          IF R_EMAIL = 'X'.
    *--Opening Layout set for Printing
            PERFORM CLOSE_FORM.
           SELECT SINGLE SMTP_ADDR INTO V_EMAIL
           FROM ADR6
           WHERE ADDRNUMBER = T_ADRC-ADDRNUMBER.
            CLEAR T_LIPS.
            READ TABLE T_LIPS WITH KEY VBELN = T_LIKP-VBELN.
            CLEAR T_VBAK.
            READ TABLE T_VBAK WITH KEY VBELN = T_LIPS-VGBEL.
            CLEAR V_ADRNR.
            SELECT SINGLE ADRNR
            INTO V_ADRNR
            FROM T001
            WHERE  BUKRS = T_VBAK-BUKRS_VF.
            REFRESH T_CC_EMAIL.
            CLEAR T_CC_EMAIL.
            SELECT  SMTP_ADDR INTO TABLE T_CC_EMAIL
            FROM ADR6
            WHERE ADDRNUMBER = V_ADRNR.
         SELECT SINGLE smtp_addr
         INTO cc_email
         FROM adr6
         WHERE addrnumber = v_adrnr.
            IF T_TO_EMAIL[] IS INITIAL.
              CLEAR T_CC_EMAIL.
              REFRESH T_CC_EMAIL.
            ENDIF.
            PERFORM BUILD_PDF_DATA_TABLE.
    Populate message body text
            PERFORM POPULATE_EMAIL_MESSAGE_BODY.
            CONCATENATE  T_LIKP-VSTEL '-' 'Warehouse Release' INTO V_SUBJECT SEPARATED BY SPACE.
    Send file by email as .xls speadsheet
            PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
                                         TABLES IT_MESSAGE
                                                PT_CONTENTS_BIN       "LINES    "it_attach
                                          USING V_EMAIL
                                                V_SUBJECT
                                                'PDF'
                                                'Delivery'
                                                'Deliveries'
                                       CHANGING GD_ERROR
                                                GD_RECIEVER.
      Instructs mail send program for SAPCONNECT to send email(rsconn01)
            PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
          ENDIF.
        ENDAT.
    ***---/End by sagun
      ENDLOOP. "loop at t_likp.
    ***---/added by sagun 25.05.2007
      IF R_EMAIL = 'X'.
        WRITE /01 SY-ULINE(180).
        WRITE :/55 'End of Report'.
      ENDIF.
    ***---/end by sagun
    ENDFORM.                    " PRINT_DELIVERY
    *&      Form  close_form
          text
    -->  p1        text
    <--  p2        text
    FORM CLOSE_FORM .
      IF R_PRINT = 'X'.                   " added by sagun 24.05.2007
        CALL FUNCTION 'CLOSE_FORM'
    IMPORTING
      RESULT                         =
      RDI_RESULT                     =
    TABLES
      OTFDATA                        =
         EXCEPTIONS
           UNOPENED                       = 1
           BAD_PAGEFORMAT_FOR_PRINT       = 2
           SEND_ERROR                     = 3
           SPOOL_ERROR                    = 4
           CODEPAGE                       = 5
           OTHERS                         = 6
        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.                             " added by sagun 24.05.2007
      IF R_EMAIL = 'X'.
    *otf_table  like itcoo occurs 0 with header line
        CALL FUNCTION 'CLOSE_FORM'
         IMPORTING
           RESULT   = .
             TABLES
               OTFDATA  = HOTFDATA
             EXCEPTIONS
               UNOPENED = 3.
      ENDIF.
    ENDFORM.                    " close_form
    *&      Form  BUILD_PDF_DATA_TABLE
          text
    -->  p1        text
    <--  p2        text
    FORM BUILD_PDF_DATA_TABLE .
      DATA :  LC_FORMAT(3) TYPE C VALUE 'PDF'.
    DATA: lt_tline TYPE tp_tline_standard_table,
      DATA :  L_BIN_FILESIZE TYPE I,
              PC_CONTENTS_BIN_LINES TYPE I.
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          FORMAT                = LC_FORMAT
        IMPORTING
          BIN_FILESIZE          = L_BIN_FILESIZE
        TABLES
          OTF                   = HOTFDATA
          LINES                 = LINES
        EXCEPTIONS
          ERR_MAX_LINEWIDTH     = 1
          ERR_FORMAT            = 2
          ERR_CONV_NOT_POSSIBLE = 3
          OTHERS                = 4.
      IF SY-SUBRC = 0.
        CALL FUNCTION 'QCE1_CONVERT'
          TABLES
            T_SOURCE_TAB         = LINES
            T_TARGET_TAB         = PT_CONTENTS_BIN
          EXCEPTIONS
            CONVERT_NOT_POSSIBLE = 1
            OTHERS               = 2.
        IF SY-SUBRC = 0.
          DESCRIBE TABLE PT_CONTENTS_BIN LINES PC_CONTENTS_BIN_LINES.
        ELSE.
    ... -->
        ENDIF.
      ELSE.
    An OTF conversion error occured
    -->
      ENDIF.
    ENDFORM.                    " BUILD_PDF_DATA_TABLE
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
          text
    -->  p1        text
    <--  p2        text
    FORM POPULATE_EMAIL_MESSAGE_BODY .
      REFRESH IT_MESSAGE.
      IT_MESSAGE = 'Please find enclosed here with our Warehouse Release Document(s)'.
      APPEND IT_MESSAGE.
      CLEAR IT_MESSAGE.
      APPEND IT_MESSAGE.
      APPEND IT_MESSAGE.
      APPEND IT_MESSAGE.
      APPEND IT_MESSAGE.
      IT_MESSAGE = 'For United Phosphorous Inc.'.
      APPEND IT_MESSAGE.
      CLEAR IT_MESSAGE.
    APPEND it_message.
    APPEND it_message.
    APPEND it_message.
      IT_MESSAGE = 'TEST EMAIL from 520 clinet please ignore it'.
      APPEND IT_MESSAGE.
    ENDFORM.                    " POPULATE_EMAIL_MESSAGE_BODY
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          text
         -->PIT_MESSAGE  text
         -->PIT_ATTACH  text
         -->P_EMAIL  text
         -->P_MTITLE  text
         -->P_FORMAT   text
         -->P_FILENAME   text
         -->P_ATTDESCRIPTION   text
         -->P_SENDER_ADDRESS   text
         -->P_SENDER_ADDRES_TYPE   text
         <--P_ERROR  text
         <--P_RECIEVER  text
    FORM SEND_FILE_AS_EMAIL_ATTACHMENT  TABLES    PIT_MESSAGE
                                                  PIT_ATTACH
                                            USING P_EMAIL
                                                  P_MTITLE
                                                  P_FORMAT
                                                  P_FILENAME
                                                  P_ATTDESCRIPTION
                                                  P_SENDER_ADDRESS
                                                  P_SENDER_ADDRES_TYPE
                                         CHANGING P_ERROR
                                                  P_RECIEVER.
      DATA: LD_ERROR    TYPE SY-SUBRC,
           ld_reciever TYPE sy-subrc,...
             LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
             LD_EMAIL LIKE  SOMLRECI1-RECEIVER,
             LD_FORMAT TYPE  SO_OBJ_TP ,
             LD_ATTDESCRIPTION TYPE  SO_OBJ_NAM ,
             LD_ATTFILENAME TYPE  SO_OBJ_DES ,
             LD_SENDER_ADDRESS LIKE  SOEXTRECI1-RECEIVER,
             LD_SENDER_ADDRESS_TYPE LIKE  SOEXTRECI1-ADR_TYP,
             LD_RECEIVER LIKE  SY-SUBRC.
    p_filename  = 'INVOICE'.
      LD_EMAIL   = P_EMAIL.
      LD_MTITLE = P_MTITLE.
      LD_FORMAT              = P_FORMAT.
      LD_ATTDESCRIPTION      = P_ATTDESCRIPTION.
      LD_ATTFILENAME         = P_FILENAME.
      LD_SENDER_ADDRESS      = P_SENDER_ADDRESS.
      LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
    Fill the document data.
      W_DOC_DATA-DOC_SIZE = 1.
    Populate the subject/generic message attributes
      W_DOC_DATA-OBJ_LANGU = SY-LANGU.
      W_DOC_DATA-OBJ_NAME  = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
      W_DOC_DATA-SENSITIVTY = 'F'.
    Fill the document data and get size of attachment
      CLEAR W_DOC_DATA.
      READ TABLE PIT_ATTACH INDEX W_CNT.
      W_DOC_DATA-DOC_SIZE =
         ( W_CNT - 1 ) * 255 + STRLEN( PIT_ATTACH ).
      W_DOC_DATA-OBJ_LANGU  = SY-LANGU.
      W_DOC_DATA-OBJ_NAME   = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR  = LD_MTITLE.
      W_DOC_DATA-SENSITIVTY = 'F'.
      CLEAR T_ATTACHMENT.
      REFRESH T_ATTACHMENT.
      T_ATTACHMENT[] = PIT_ATTACH[].
    Describe the body of the message
      CLEAR T_PACKING_LIST.
      REFRESH T_PACKING_LIST.
      T_PACKING_LIST-TRANSF_BIN = SPACE.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM = 0.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE = 'RAW'.
      APPEND T_PACKING_LIST.
    Create attachment notification
      T_PACKING_LIST-TRANSF_BIN = 'X'.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM   = 1.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE   =  LD_FORMAT.
      T_PACKING_LIST-OBJ_DESCR  =  LD_ATTDESCRIPTION.
      T_PACKING_LIST-OBJ_NAME   =  LD_ATTFILENAME.
      T_PACKING_LIST-DOC_SIZE   =  T_PACKING_LIST-BODY_NUM * 255.
      APPEND T_PACKING_LIST.
    Add the recipients email address
      CLEAR T_RECEIVERS.
      REFRESH T_RECEIVERS.
      LOOP AT T_TO_EMAIL WHERE EMAIL <> SPACE.
        CLEAR T_RECEIVERS.
        T_RECEIVERS-RECEIVER = T_TO_EMAIL-EMAIL.
        T_RECEIVERS-REC_TYPE = 'U'.
        T_RECEIVERS-COM_TYPE = 'INT'.
        T_RECEIVERS-NOTIF_DEL = 'X'.
        T_RECEIVERS-NOTIF_NDEL = 'X'.
        APPEND T_RECEIVERS.
        CLEAR T_RECEIVERS.
      ENDLOOP.
    copy email address
      CLEAR T_RECEIVERS.
      IF NOT T_RECEIVERS[] IS INITIAL.
        LOOP AT T_CC_EMAIL.
          T_RECEIVERS-RECEIVER = T_CC_EMAIL-EMAIL.
          T_RECEIVERS-REC_TYPE = 'U'.
          T_RECEIVERS-COM_TYPE = 'INT'.
    t_receivers-notif_del = 'X'.
    t_receivers-notif_ndel = 'X'.
          T_RECEIVERS-COPY       = 'X'.
          APPEND T_RECEIVERS.
          CLEAR T_RECEIVERS.
        ENDLOOP.
      ENDIF.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA              = W_DOC_DATA
          PUT_IN_OUTBOX              = 'X'
          SENDER_ADDRESS             = LD_SENDER_ADDRESS
          SENDER_ADDRESS_TYPE        = LD_SENDER_ADDRESS_TYPE
          COMMIT_WORK                = 'X'
        IMPORTING
          SENT_TO_ALL                = W_SENT_ALL
        TABLES
          PACKING_LIST               = T_PACKING_LIST
          CONTENTS_BIN               = T_ATTACHMENT
          CONTENTS_TXT               = IT_MESSAGE
          RECEIVERS                  = T_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.
    Populate zerror return code
      LD_ERROR = SY-SUBRC.
    Populate zreceiver return code
    LOOP AT t_receivers.
       ld_receiver = t_receivers-retrn_code.
    ENDLOOP.
      IF SY-SUBRC = 0.
        FORMAT COLOR COL_NORMAL ON.
        LOOP AT T_LOG.
          WRITE :/03 T_LOG-VBELN,
                  19 SY-VLINE,
                  20 T_LOG-KUNNR,
                  34 SY-VLINE,
                  35 T_LOG-NAME1,
                  76 SY-VLINE,
                  77 T_LOG-EMAIL,
                  110 SY-VLINE,
                  111 'Email Sent Successfuly',
                  180 SY-VLINE.
        ENDLOOP . "t_log
        FORMAT COLOR COL_NORMAL OFF.
        CLEAR T_LOG.
        REFRESH T_LOG.
      ENDIF.
      IF SY-SUBRC NE 0.
        CASE LD_ERROR.
          WHEN   1.
            V_ERROR =  'too_many_receivers' .
          WHEN   2.
            V_ERROR =  'Email address not found in Customer Master' .
          WHEN   3.
            V_ERROR =  'document_type_not_exist'.
          WHEN   4.
            V_ERROR =  'operation_no_authorization'.
          WHEN   5.
            V_ERROR =  'Email address not found in Customer Master'.
          WHEN   6.
            V_ERROR =   'x_error'.
          WHEN   7.
            V_ERROR =   'enqueue_error'.
          WHEN   8.
            V_ERROR =   'Error in sending email' .
        ENDCASE.
        FORMAT COLOR COL_NEGATIVE ON.
        LOOP AT T_LOG.
          WRITE :/03 T_LOG-VBELN,
             19 SY-VLINE,
             20 T_LOG-KUNNR,
             34 SY-VLINE,
             35 T_LOG-NAME1,
             76 SY-VLINE,
             77 T_LOG-EMAIL,
             110 SY-VLINE,
             111 V_ERROR,
             180 SY-VLINE.
        ENDLOOP . "t_log
        FORMAT COLOR COL_NEGATIVE OFF.
        CLEAR T_LOG.
        REFRESH T_LOG.
      ENDIF.
    ENDFORM.                    " SEND_FILE_AS_EMAIL_ATTACHMENT
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          text
    -->  p1        text
    <--  p2        text
    FORM INITIATE_MAIL_EXECUTE_PROGRAM .
      WAIT UP TO 2 SECONDS.
      SUBMIT RSCONN01 WITH MODE = 'INT'
                    WITH OUTPUT = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    Reward Point If it usefull....
    Cheers,
    Sagun Desai....

  • When I open an encryted pdf file in my Hp  Slate 7 voice Tab it was unable to open the pdf file.Tje same file was opening with other pdf reader software.Kindly Help.

    When I open an encryted pdf file in my Hp  Slate 7 voice Tab it was unable to open the pdf file.Tje same file was opening with other pdf reader software.Kindly Help.
    [spam link removed]

    Could you please send the pdf to [email protected] so that we may investigate the issue?
    Thanks,
    Adobe Reader Team

  • Regarding UCF_AcroForm error displayed when trying to open the pdf form

    Hi,
         Iam receiving the pop up when trying to open the pdf form.The Error is Server Error Class: UCF_AcroForm Method: Error.The Error displayed in some system and in some other system the form is working fine.The Form is created using the Designer 8.0.The form is working fine in reader 8.0.Is there any problem in the reader version.Is there any solution for this problem please provide.
    Thanks and Regards,
    SatheshKumar R

    Sathesh,
    Similar issue has been reported at SDN so searching would have helped you. See below threads for solutions:-
    UCF_AcroForm error
    MSS UCF_AcroForm error displayed when trying to display form in PCR
    Chintan

  • Unable to open the pdf file

    Hi...i am having adobe reader 9 as well as adobe acrobat professional 6 installed in my sytem. i want to open all pdf file should open with adobe reader 9 by default. please help how we can do this. Also i want to open the pdf file in adobe reader 9 during net surfing. please help. thanks in advance...
    rajesh

    You need to let Windows know what is the default for opening PDFs. That can be done by right clicking on a PDF and selecting open with and selecting the open always option with Reader. However, if Acrobat is running in the background -- the default for Acrobat and Reader to leave part running, then your selection may be ignored. In that case, stop Acrobat.exe in the task list.

  • Im unable to open the pdf file for the code to redeem Mountain Lion:the '*****'file could not be opened. it may be damaged or in a format that preview doesn't recognise

    I've tried opening the file in ibooks, on ipad, in Safari, and straight from e-mail, but it can't open the .pdf file. Could it be corrupted? I'm brand new to the MBP so may be missing something obvious!

    If Preview won't read the pdf file, try Adobe Reader. It is possible, of course, that the file may actually be damaged, as Preview should be able to open the file.
    Clinton

  • I am unable to open my PDF attachment in mail.

    I cannot open my PDF attachment in mail. I am able to on all of my other apple products but not my air. Is there a setting that i might have wrong?

    If it is your own pdf and you are unsure of your password, you are out of luck. You will need to create a new file from the original documents. I suggest using password managers, if you need to create many different documents with different passwords.

  • Error while opening the PDF attachment

    HI SDN's
    I have to send order confirmation thru mail as a pdf attachment as soon as order has been saved.
    I have written the code and assigned to output type.
    Here I am getting an error opening a converted pdf file with Adobe Reader
    The error message reads:
    Adobe Reader could not open "filename.PDF" 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).
    Any help would be appreciated.
    Thanks in advance
    VR

    hello, i have the same problem as VR's. The pdf file sent to my email is not able to open. You mentioned that this is only supported by early releases of Adobe. But anyhow, I followed your advice to have my spool converted to PDF, instead of OTF to PDF. But I get this error: Spool request 23595 contains no ABAP list data.
    What exactly my transaction does is that, it makes use of a sapscript layout via VL02N using an output type. I retrieve the OTF data in CLOSE_FORM function module. OTF is then converted to PDF via SX_OBJECT_CONVERT_OTF_PDF, then send via email through SO_NEW_DOCUMENT_ATT_SEND_API1.
    When I view the sent PDF file in my email, It cannot be opened.
    I would appreciate your help guys! thank you very much.

  • Unable to open the pdf in the mail.

    Hi Experts,
      I was sending a smartform through a mail. I am getting the mail but its not opening. it is giving an error
    "Too few operands". I am also sending my code for this program. 
    REPORT  zmaha_background_invoice LINE-SIZE 190.
    TABLES : vbrk,
             vbrp,
             vbpa,
             vbkd,
             kna1.
    DATA: BEGIN OF it_kna1 OCCURS 0,
           vbeln like kna1-vbeln,
            kunnr LIKE kna1-kunnr,
            land1 LIKE kna1-land1,
            ort01 LIKE kna1-ort01,
            pstlz LIKE kna1-pstlz,
            regio LIKE kna1-regio,
          END OF it_kna1.
    DATA: BEGIN OF it_vbrk OCCURS 0,
            kunag LIKE vbrk-kunag,
            vbeln LIKE vbrk-vbeln,
            fkdat LIKE vbrk-fkdat,
            bstnk_vf LIKE vbrk-bstnk_vf,
          END OF it_vbrk.
    DATA: BEGIN OF it_vbpa OCCURS 0,
            vbeln LIKE vbpa-vbeln,
            posnr LIKE vbpa-posnr,
            parvw LIKE vbpa-parvw,
            parnr LIKE vbpa-parnr,
            adrnr LIKE vbpa-adrnr,
            land1 LIKE vbpa-land1,
          END OF it_vbpa.
    DATA: BEGIN OF it_vbkd OCCURS 0,
            vbeln LIKE vbkd-vbeln,
           POSNR like VBKD-POSNR,
            prsdt LIKE vbkd-prsdt,
            fkdat LIKE vbkd-fkdat,
          END OF it_vbkd.
    DATA: BEGIN OF it_vbrp OCCURS 0,
            vbeln LIKE vbrp-vbeln,
            posnr LIKE vbrp-posnr,
          END OF it_vbrp.
    DATA : BEGIN OF it_final OCCURS 0.
            INCLUDE STRUCTURE zit_final_struc.
    DATA : END OF it_final.
    DATA: w_filesize TYPE string.
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_vbeln FOR vbrk-vbeln.
    SELECTION-SCREEN : END OF BLOCK b1.
    SELECT kunag vbeln fkdat bstnk_vf
           FROM vbrk
           INTO TABLE it_vbrk
           WHERE vbeln IN s_vbeln.
    IF NOT it_vbrk[] IS INITIAL.
    *select  KUNNR LAND1 ORT01 PSTLZ REGIO
          from kna1
          into table it_kna1
          for all entries in it_vbrk
          where kunnr = it_vbrk-kunag.
      SELECT vbeln posnr parvw parnr adrnr land1
             FROM vbpa
             INTO TABLE it_vbpa
             FOR ALL ENTRIES IN it_vbrk
             WHERE vbeln = it_vbrk-vbeln.
      SELECT vbeln prsdt fkdat
             FROM vbkd
             INTO TABLE it_vbkd
             FOR ALL ENTRIES IN it_vbrk
             WHERE vbeln = it_vbrk-vbeln.
      SELECT vbeln posnr
             FROM vbrp
             INTO TABLE it_vbrp
             FOR ALL ENTRIES IN it_vbrk
             WHERE vbeln = it_vbrk-vbeln.
    ENDIF.
    LOOP AT it_vbrk.
      SELECT SINGLE * FROM kna1
             WHERE kunnr = it_vbrk-kunag.
      IF sy-subrc = 0.
        it_final-kunnr = kna1-kunnr.
        it_final-land1 = kna1-land1.
        it_final-ort01 = kna1-ort01.
        it_final-pstlz = kna1-pstlz.
        it_final-regio = kna1-regio.
      ENDIF.
    read table it_kna1 with key vbeln = it_vbrk-vbeln.
      READ TABLE it_vbpa WITH KEY vbeln = it_vbrk-vbeln.
      READ TABLE it_vbkd WITH KEY vbeln = it_vbrk-vbeln.
      READ TABLE it_vbrp WITH KEY vbeln = it_vbrk-vbeln.
      it_final-vbeln = it_vbrk-vbeln.
      it_final-fkdat = it_vbrk-fkdat.
      it_final-bstnk_vf = it_vbrk-bstnk_vf.
    it_final-vbeln = it_kna1-vbeln.
    it_final-KUNNR = it_kna1-kunnr.
    it_final-LAND1 = it_kna1-land1.
    it_final-ORT01 = it_kna1-ort01.
    it_final-PSTLZ = it_kna1-pstlz.
    it_final-REGIO = it_kna1-regio.
      it_final-vbeln = it_vbpa-vbeln.
    it_final-POSNR = it_vbpa-posnr.
      it_final-parvw = it_vbpa-parvw.
      it_final-parnr = it_vbpa-parnr.
      it_final-adrnr = it_vbpa-adrnr.
      it_final-land1 = it_vbpa-land1.
      it_final-vbeln = it_vbkd-vbeln.
    it_final-POSNR = it_vbkd-posnr.
      it_final-prsdt = it_vbkd-prsdt.
    it_final-FKDAT = it_vbkd-fkdat.
      it_final-vbeln = it_vbrp-vbeln.
      it_final-posnr = it_vbrp-posnr.
      APPEND it_final.
      CLEAR it_final.
    ENDLOOP.
    loop at it_final.
    write : / it_final-vbeln, it_final-posnr, it_final-parvw,
    *it_final-prsdt, it_final-kunnr.
    *endloop.
    *DATA : FM_NAME TYPE RS38L_FNAM.
    DATA: cparam TYPE ssfctrlop,
          outop TYPE ssfcompop,
          fm_name TYPE rs38l_fnam.
    DATA : tab_otf_data TYPE ssfcrescl,
         pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,
          tab_otf_final TYPE itcoo OCCURS 0 WITH HEADER LINE,
          file_size TYPE i,
          bin_filesize TYPE i.
    outop-tddest = 'LP01'.
    cparam-no_dialog = 'X'.
    cparam-preview = space.
    cparam-getotf = 'X'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        formname                 = 'ZMAHA_BACKGROUND_INVOICE'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
       fm_name                  = 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 FUNCTION fm_name   "'/1BCDWB/SF00000127'
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       control_parameters         = cparam
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       output_options             = outop
       user_settings              = 'X'"space
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       job_output_info            = tab_otf_data
      JOB_OUTPUT_OPTIONS         =
      TABLES
        it_final                   = it_final
    EXCEPTIONS
      FORMATTING_ERROR           = 1
      INTERNAL_ERROR             = 2
      SEND_ERROR                 = 3
      USER_CANCELED              = 4
      OTHERS                     = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    tab_otf_final[] = tab_otf_data-otfdata.
    DATA : i_tline TYPE TABLE OF tline WITH HEADER LINE.
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
       format                      = 'PDF'
       max_linewidth               = 132
      ARCHIVE_INDEX               = ' '
      COPYNUMBER                  = 0
      ASCII_BIDI_VIS2LOG          = ' '
    IMPORTING
       bin_filesize                = bin_filesize
      BIN_FILE                    =
      TABLES
        otf                         = tab_otf_final
        lines                       = i_tline
    EXCEPTIONS
      ERR_MAX_LINEWIDTH           = 1
      ERR_FORMAT                  = 2
      ERR_CONV_NOT_POSSIBLE       = 3
      ERR_BAD_OTF                 = 4
      OTHERS                      = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    *DATA:i_doc TYPE TABLE OF docs.
    *CALL FUNCTION 'CONVERT_OTF_2_PDF'
    EXPORTING
      use_otf_mc_cmd               = 'X'
      ARCHIVE_INDEX                =
    IMPORTING
      bin_filesize                 = bin_filesize
    TABLES
       otf                          = tab_otf_final
       doctab_archive               = i_doc
       lines                        = i_tline
    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.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
       bin_filesize                    = bin_filesize
       filename = 'C:Documents and settingsmm0998desktopmsma.pdf'
       filetype                        = 'BIN'
      TABLES
        data_tab                        = i_tline[]
    IF sy-subrc = 0.
      WRITE : / 'Successfully downlaoded'.
    ENDIF.
    *CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE                    = BIN_FILESIZE
       FILENAME = 'C:Documents and settingssg0888Desktopmstest6.pdf'
      FILETYPE                        = 'BIN'
    TABLES
       DATA_TAB                        = I_TLINE[]
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    sending thru mail
    DATA: i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
          i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
    DATA: wa_buffer TYPE string,
          wa_objhead TYPE soli_tab,
          wa_doc_chng TYPE sodocchgi1.
    DATA: objbin LIKE solix OCCURS 10 WITH HEADER LINE.
    Variables declarations
    DATA: v_lines_txt TYPE i,
          v_lines_bin TYPE i.
    LOOP AT i_tline.
      TRANSLATE i_tline USING '~'.
      CONCATENATE wa_buffer i_tline INTO wa_buffer.
    *translate wa_buffer using '~'.
    ENDLOOP.
    TRANSLATE wa_buffer USING '~'.
    DO.
      i_record = wa_buffer.
      APPEND i_record.
      SHIFT wa_buffer LEFT BY 255 PLACES.
      IF wa_buffer IS INITIAL.
        EXIT.
      ENDIF.
    ENDDO.
    Attachment
    REFRESH:
    i_reclist,
    i_objtxt,
    i_objbin,
    i_objpack.
    CLEAR wa_objhead.
    i_objbin[] = i_record[].
    Create Message Body
    Title and Description
    i_objtxt = 'Dear,Please find the document test with pdf-Attachment!'.
    APPEND i_objtxt.
    DESCRIBE TABLE i_objtxt LINES v_lines_txt.
    READ TABLE i_objtxt INDEX v_lines_txt.
    wa_doc_chng-obj_name = 'smartform'.
    wa_doc_chng-expiry_dat = sy-datum + 10.
    wa_doc_chng-obj_descr = 'smartform for BG_INVOICE by Maha'.
    wa_doc_chng-sensitivty = 'F'.
    wa_doc_chng-doc_size = v_lines_txt * 255.
    Main Text
    wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + strlen( i_objtxt
    CLEAR i_objpack-transf_bin.
    i_objpack-head_start = 1.
    i_objpack-head_num = 0.
    i_objpack-body_start = 1.
    i_objpack-body_num = v_lines_txt.
    i_objpack-doc_type = 'RAW'.
    APPEND i_objpack.
    Attachment
    (pdf-Attachment)
    i_objpack-transf_bin = 'X'.
    i_objpack-head_start = 1.
    i_objpack-head_num = 1.
    i_objpack-body_start = 1.
    Länge des Attachment ermitteln
    DESCRIBE TABLE i_objbin LINES v_lines_bin.
    READ TABLE i_objbin INDEX v_lines_bin.
    i_objpack-doc_size = v_lines_bin * 255 .
    i_objpack-body_num = v_lines_bin.
    i_objpack-doc_type = 'PDF'.
    i_objpack-obj_name = 'smart'.
    i_objpack-obj_descr = 'Background invoice'.
    APPEND i_objpack.
    CLEAR i_reclist.
    i_reclist-receiver = '[email protected]'.
    i_reclist-rec_type = 'U'.
    i_reclist-express = 'X'.
    *i_reclist-rec_type = 'U'.
    *i_reclist-notif_del = 'X'. " request delivery notification
    *i_reclist-notif_ndel = 'X'. " request not delivered notification
    *append reclist.
    APPEND i_reclist.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data                    = wa_doc_chng
       put_in_outbox                    = 'X'
      TABLES
        packing_list                     = i_objpack
       object_header                     = wa_objhead
       contents_bin                      = i_objbin
       contents_txt                      = i_objtxt
       contents_hex                       = objbin
      OBJECT_PARA                      =
      OBJECT_PARB                      =
        receivers                        = i_reclist
    EXCEPTIONS
       too_many_receivers               = 1
       document_not_sent                = 2
       document_type_not_exist          = 3
       operation_no_authorization       = 4
       parameter_error                  = 5
       x_error                          = 6
       enqueue_error                    = 7
       OTHERS                           = 8
    IF sy-subrc = 0.
      WRITE: / 'succesfully sent '.
    ENDIF.
    Please help me.
    Regards,
    Maha.

    Hi shiva,
                No, "<b>25090 bytes passed</b>" is populating in the footer. But PDF is throughing a message "<b>too few operands</b>". I have Acrabat reader 7.0 version in my machine.
    Regards,
    Maha.

  • Error while opening the Pdf Attachment  at the time sending mail ..

    Hi Frn's ,
       i am sending a mail with pdf attachment ... but the pdf is not opening ...it is giving error "There was and error opening this document . This file can not be open because it has no page ."
    Please resolve the problem ...below is the code pasted ..
    REPORT  ZPRI_TEST_LDB.
    DATA: it_pdf LIKE tline OCCURS 0 WITH HEADER LINE .
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    DATA:  w_recsize TYPE i.
    DATA: gd_recsize TYPE i.
    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:     gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    PARAMETER: p_email1 LIKE somlreci1-receiver
                                        DEFAULT 'abc,
              p_sender LIKE somlreci1-receiver
                                        DEFAULT 'abc'.
    perform write_output .
    perform create_pdf .
    PERFORM process_email .
    FORM WRITE_OUTPUT .
      write:'Listed below are the employees in your area who are due a Performance Appraisal'.
      write:'during the month of May 2009 .A performance appraisal form can be found on-line'.
      write: 'in the MUD template section .The Performance Appraisal is to be completed and' .
      write:'discussed with the employee by the immediate supervisor .Signed forms should be '.
      write: 'returned to the Human Resource Department by May 31,2009 .'.
      skip 2 .
      write: 'employee name' .
      write: 'Job Date' .
      write: 'Date of last appraisal' .
    ENDFORM.                    " WRITE_OUTPUT
    FORM CREATE_PDF .
      DATA:  spoolno LIKE tsp01-rqident.
      DATA : p_repid LIKE sy-repid .
      DATA: v_len  TYPE i , v_len1  TYPE i .
      DATA: v_temp(8) TYPE c .
      DATA: p_uname LIKE sy-uname .
      DATA: it_tsp01 TYPE STANDARD TABLE OF tsp01 WITH HEADER LINE .
    DATA: it_pdf LIKE tline OCCURS 0 WITH HEADER LINE .
      TABLES: tsp01.
      data: var  type c .
    *-- STRUCTURES
      DATA:
        lc_rq2name LIKE tsp01-rq2name.
      DATA:
        mstr_print_parms LIKE pri_params,
        mc_valid(1)      TYPE c,
        mi_bytecount     TYPE i,
        mi_length        TYPE i,
        mi_rqident       LIKE tsp01-rqident.
    *-- INTERNAL TABLES
      DATA:
        mtab_pdf    LIKE tline OCCURS 0 WITH HEADER LINE,
        mc_filename LIKE rlgrap-filename.
    *-- SELECTION SCREEN
      DATA:
        p_linsz LIKE sy-linsz VALUE 132, " Line size
        p_paart LIKE sy-paart VALUE 'X_65_132'.  " Paper Format
    *-- Setup the Print Parmaters
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          authority              = space
          copies                 = '1'
          cover_page             = space
          data_set               = space
          department             = space
          destination            = space
          expiration             = '1'
          immediately            = space
          new_list_id            = 'X'
          no_dialog              = 'X'
          user                   = sy-uname
        IMPORTING
          out_parameters         = mstr_print_parms
          valid                  = mc_valid
        EXCEPTIONS
          archive_info_not_found = 1
          invalid_print_params   = 2
          invalid_archive_params = 3
          OTHERS                 = 4.
    *-- Explicitly set line width, and output format so that
    *-- the PDF conversion comes out OK
      mstr_print_parms-linsz = p_linsz.
      mstr_print_parms-paart = p_paart.
    importing variable value set at first time to restrict the infinite loop .
      IMPORT var FROM MEMORY ID 'abc' .
      var = var + 1 .
      p_uname = sy-uname .
      p_repid = sy-repid .
    *checking variable to restricted scecond time exction of this block of code
      IF var = 1 .
       v_memid = 1 .
        EXPORT var TO MEMORY ID 'abc' .
    start ----p3d(02/13/2009)
    EXPORT it_pernr it_pernr_quali v_memid it_pernr_status
               p_file  p_file1 rb_pres rb_app rb2 TO MEMORY ID 'bcd' .
       EXPORT it_pernr it_pernr_quali v_memid it_pernr_status it_notqualified
                        p_file  p_file1 rb_pres rb_app rb1 rb2 rb3 rb4 TO MEMORY ID 'bcd' .
        EXPORT it_pernr it_pernr_quali v_memid it_pernr_status it_notqualified
                    p_file  p_file1 rb_pres rb_app rb3 rb4 TO MEMORY ID 'bcd' .
    end ----p3d(02/13/2009)
    submitting the spool request
        SUBMIT (p_repid) TO SAP-SPOOL
                         SPOOL PARAMETERS mstr_print_parms
                         WITHOUT SPOOL DYNPRO
                         AND RETURN.
      ENDIF.
      FREE MEMORY ID 'abc'.
      FREE MEMORY ID 'bcd'.
    *Calculating the lenth of report name
      v_len = STRLEN( p_repid ) .
    *consutrucing the database variable  rq2name to search the spool request
      IF v_len >= 9 .
        CONCATENATE p_repid+0(9)
                    p_uname+0(3) INTO lc_rq2name .
      ELSE.
        v_len1 = 9 - v_len .
        DO v_len1 TIMES .
          CONCATENATE v_temp '_' INTO v_temp .
        ENDDO.
        CONCATENATE p_repid v_temp
                    p_uname INTO lc_rq2name .
      ENDIF.
    *selecting the spool request using the above consructed varibale
      SELECT * FROM tsp01 INTO TABLE it_tsp01
              WHERE rq2name = lc_rq2name .
    *sorting the interbla table
      SORT  it_tsp01 BY rqcretime DESCENDING .
    *reading the first spool request
      READ TABLE it_tsp01 INDEX 1.
    *converting the spool request into pdf
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          src_spoolid              = it_tsp01-rqident
         dst_device               = 'LP01'
        TABLES
          pdf                      = it_pdf
        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.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf.
        TRANSLATE it_pdf USING ' ~'.
        CONCATENATE gd_buffer it_pdf INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.                    " CREATE_PDF
    FORM SEND_eMAIL using p_email .
    REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.                    " SEND_MAIL
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email using p_email1 . .
    perform send_email using p_email2.
    ENDFORM.
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_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.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    Thanks and Regards ..
    Priyank

    hi this is the part of code ...
    PERFORM process_email .
    CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf.
        TRANSLATE it_pdf USING ' ~'.
        CONCATENATE gd_buffer it_pdf INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.                    " CREATE_PDF
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email using p_email1 . .
    perform send_email using p_email2.
    ENDFORM.
    FORM SEND_eMAIL using p_email .
    REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.                    " SEND_MAIL
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_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.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.

  • Reg : Unable to open the PDF when opening Notification documents

    Hi All,
    I used QM03 and then I type in a notification number and then I hit return I get a series of screens and then I click on documents.  I then get to the document tree and then open the RPC file.  from that I get a pdf file.  I click open but I get an error message.
    I have recently installed Adobe 7.0 in my system.From that time I am getting this error message.
    I f any idea, please help me out.
    Thanks&Regards,
    Sreeharsha Singuru

    Could you please send the pdf to [email protected] so that we may investigate the issue?
    Thanks,
    Adobe Reader Team

  • Problem while opening the PDF

    Hi All,
    Iam having an issue while opening the PDF-Attachment in which iam sending it as attachment to the mail.While opening the PDF iam getting the error that "Aodbe Reader could not open the document because it is either not a supported file type or because the file has been damaged(for example,it was sent as an email attachment and was'nt correctly decoded)".
    The function-module "SO_NEW_DOCUMENT_ATT_SEND_API1" is getting use to send the attachment.
    First iam converting the internal table data into PDF and then am sending the mail with PDF-attchment.
    Thanks,
    Asmitha.

    Even i had a smilar problem. The reason is perhaps the data in internal table doesnt get converted into PDF corectly. In my case i had to convert into PDF and download on local machine. Attching below code for it.Maybe u can get pointers to your problem.
      REPORT sy-repid
           NO STANDARD PAGE HEADING
           LINE-COUNT 74
           LINE-SIZE  200
           MESSAGE-ID zz.
      PARAMETERS : pcfile LIKE rlgrap-filename LOWER CASE.
      DATA :textlines LIKE tline OCCURS 100 WITH HEADER LINE.
      DATA otf LIKE itcoo OCCURS 1000 WITH HEADER LINE.
      DATA it_lines LIKE tline OCCURS 100 WITH HEADER LINE.
      DATA options LIKE itcpo.
      DATA header LIKE thead.
      DATA result LIKE itcpp.
      DATA: bin_filesize TYPE i.
      DATA: filesize TYPE i,
      convcount TYPE i,
      cancel(1).
      AT SELECTION-SCREEN ON VALUE-REQUEST FOR pcfile.
        CALL FUNCTION 'WS_FILENAME_GET'
          EXPORTING
            mask     = ',*.*,*.*.'
          IMPORTING
            filename = pcfile
          EXCEPTIONS
            OTHERS   = 1.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      START-OF-SELECTION.
        DATA : BEGIN OF itab OCCURS 0,
                matnr TYPE mara-matnr,
                END OF itab.
        SELECT matnr FROM mara UP TO 10 ROWS INTO TABLE itab.
        LOOP AT itab.
          textlines-tdformat = '*'.
          textlines-tdline = itab-matnr.       APPEND textlines.
        ENDLOOP.
        options-tdgetotf = 'X'.
        options-tdnoprev = 'X'.
        CALL FUNCTION 'PRINT_TEXT'
          EXPORTING
            dialog                   = ' '
            header                   = header
            OPTIONS                  = options
          IMPORTING
            RESULT                   = RESULT
          tables
            lines                    = textlines
            otfdata                  = otf
          EXCEPTIONS
            canceled                 = 1
            device                   = 2
            form                     = 3
            OPTIONS                  = 4
            unclosed                 = 5
            unknown                  = 6
            format                   = 7
            textformat               = 8
            communication            = 9
            bad_pageformat_for_print = 10
            OTHERS                   = 11.
        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'
          IMPORTING
            bin_filesize          = filesize
          TABLES
            otf                   = otf
            lines                 = it_lines
          EXCEPTIONS
            err_conv_not_possible = 1
            err_bad_otf           = 2.
        DATA : g_file TYPE string.
        g_file = pcfile.
        CALL FUNCTION 'GUI_DOWNLOAD'
          EXPORTING
            bin_filesize            = bin_filesize
            filename                = g_file
            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.
    Regards,
    Mansi

  • Cannot open the pdf when using the xml publisher to generate rtf report

    Hello Everyone,
    I followed the below link to generate a pdf using xml publisher in OAF.
    http://apps2fusion.com/at/ps/260-integrating-xml-publisher-and-oa-framework
    When i try to save the pdf and open it, i get the below error:
    Adobe Reader could not open the pdf because it is either not a supported file type or because the file has been damaged(for example, it was sent as an email attachment and wasn't correctly decoded).
    Below is the code in CO.
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am= (OAApplicationModule)pageContext.getApplicationModule(webBean);
    String event = pageContext.getParameter("event");
    if("GenerateReport".equals(event))
    // 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(outputStream.toString());//Testing the output by printing the contents in the outputstream.
    ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
    ByteArrayOutputStream pdfFile = new ByteArrayOutputStream();
    // System.out.println("language is "+pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getLanguage());
    // System.out.println("country is "+pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().geCountry());
    //Generate the PDF Report.
    TemplateHelper.processTemplate(
    ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getAppsContext(),
    // APP_NAME,
    "PER",
    // TEMPLATE_CODE,
    "Emp_Template",
    // ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getLanguage(),
    "English",
    // ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getCountry(),
    "United States",
    inputStream,
    TemplateHelper.OUTPUT_TYPE_PDF,
    null,
    pdfFile);
    // Write the PDF Report to the HttpServletResponse object and flush.
    byte[] b = pdfFile.toByteArray();
    response.setContentLength(b.length);
    os.write(b, 0, b.length);
    os.flush();
    os.close();
    pdfFile.flush();
    pdfFile.close();
    catch(Exception e)
    response.setContentType("application/pdf");
    throw new OAException(e.getMessage(), OAException.ERROR);
    pageContext.setDocumentRendered(false);
    Any suggestions on this would be great!
    Thanks
    Kumar

    Below is the code. Can you change so that that the output can be seen in HTML? I checked the language, country etc and they are fine.
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am= (OAApplicationModule)pageContext.getApplicationModule(webBean);
    String event = pageContext.getParameter("event");
    if("GenerateReport".equals(event))
    // 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=PrintPage.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(outputStream.toString());//Testing the output by printing the contents in the outputstream.
    ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
    ByteArrayOutputStream pdfFile = new ByteArrayOutputStream();
    // System.out.println("language is "+pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getLanguage());
    // System.out.println("country is "+pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().geCountry());
    //Generate the PDF Report.
    TemplateHelper.processTemplate(
    ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getAppsContext(),
    // APP_NAME,
    "PER",
    // TEMPLATE_CODE,
    "Emp_Template",
    // ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getLanguage(),
    "en",
    // ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getCountry(),
    "US",
    inputStream,
    TemplateHelper.OUTPUT_TYPE_PDF,
    null,
    pdfFile);
    // Write the PDF Report to the HttpServletResponse object and flush.
    byte[] b = pdfFile.toByteArray();
    response.setContentLength(b.length);
    os.write(b, 0, b.length);
    os.flush();
    os.close();
    pdfFile.flush();
    pdfFile.close();
    catch(Exception e)
    response.setContentType("text/html");
    throw new OAException(e.getMessage(), OAException.ERROR);
    pageContext.setDocumentRendered(true);
    Thanks

  • Fail Safe adding database to group gives error "FS-10006: Unable to open.."

    Environment:
    Fail Safe 3.4.2
    Oracle 11.2.0.1 64bit
    Windows 2008 Server 64bit
    Two nodes in an active/passive cluster using windows clustering and oracle fail safe.
    Problem:
    We have created the windows cluster, installed fail safe on both clustered nodes, installed the database software, verified the cluster, created a group and added a virtual address to the group. We also managed to verify the stand alone database instance without any issues. However, when we try to add the database to the group we get the following errors:
    Versions:  client = 3.4.1    server = 3.4.2    OS = 
    Operation:   Adding resource "THORD" to group "EO_THORD_GRP" 
    Starting Time:   Jul 26, 2010   16:23:04
    Elapsed Time:   0 minutes, 2 seconds
    1   16:23:04  Starting clusterwide operation
    2   16:23:05  FS-10370: Adding the resource THORD to group EO_THORD_GRP
    3   16:23:05  FS-10371: ClusterNode1 : Performing initialization processing
    4   16:23:05  FS-10371: ClusterNode2 : Performing initialization processing
    5   16:23:05  FS-10372: ClusterNode1 : Gathering resource owner information
    6   16:23:05  FS-10372: ClusterNode2 : Gathering resource owner information
    7   16:23:05  FS-10373: ClusterNode1 : Determining owner node of resource THORD
    8   16:23:05  FS-10374: ClusterNode1 : Gathering cluster information needed to perform the specified operation
    9   16:23:05  FS-10374: ClusterNode2 : Gathering cluster information needed to perform the specified operation
    10  16:23:05  FS-10375: ClusterNode1 : Analyzing cluster information needed to perform the specified operation
    11  16:23:05   >>> FS-10652: ClusterNode1 has Oracle Database version 11.2.0.1 installed in OraDb11g_home1
    12  16:23:05   >>> FS-10652: ClusterNode2 has Oracle Database version 11.2.0.1 installed in OraDb11g_home1
    13  16:23:05  FS-10376: ClusterNode1 : Starting configuration of resource THORD
    14  16:23:05  FS-10378: ClusterNode1 : Preparing for configuration of resource THORD
    15  16:23:05  FS-10380: ClusterNode1 : Configuring virtual server information for resource THORD
    16  16:23:05    ** ERROR : 0x138F: The cluster resource could not be found.
    17  16:23:06    ** ERROR : FS-10006: Unable to open the resource
    18  16:23:06    ** ERROR : FS-10012: Failed to bring the cluster resource  online. Check the Windows event log for messages
    19  16:23:06    ** ERROR : FS-10784: The Oracle Database resource provider failed to configure the virtual server for resource THORD
    20  16:23:06    ** ERROR : FS-10890: Oracle Services for MSCS failed during the add operation
    21  16:23:06    ** ERROR : FS-10497: Starting clusterwide rollback of the operation
    22  16:23:06  FS-10488: ClusterNode1 : Starting rollback of operation
    23  16:23:06  FS-10489: ClusterNode1 : Completed rollback of operation
    24  16:23:06    ** ERROR : FS-10495: Clusterwide rollback of the operation has been completed
    25  16:23:06  Please check your Windows Application log using the Event Viewer for any additional errors
    26  16:23:06  The clusterwide operation failed !
    FS-10006: Unable to open the resourceAll the cluster resources seem to be online. We're all out of ideas here, can someone please shead some light on this or have any ideas how we can go on about this.
    Your help is highly appreciated.
    Thanks

    I am getting into the issue (step-6) when I run standalone resource verify after successful step-5 and need your advice.
    I will give you information about the infrastructure -
    NODE1-2K8-ORADBND1
    NODE2-2K8-ORADBND2
    Cluster IP-
    Virtual IP on NODE1 and NODE2 host file -
    OS - Windows 2008 R2 64 bit
    Oracle Database - 11gR2
    Oracle FailSafe - 3.4.1.6
    Oracle SID- ORA11
    (ORA11 is up and running on NODE1 active node while running add to group option from - Groups/Standalone Resources to verify the instance and it gets error)
    Here is the error log -
    Versions: client = 3.3.3 ; server = 3.4.1 ; OS =
    Operation: Adding resource "ORA11" to group "Available Storage"
    Starting Time: Sep 02, 2010 12:50:06
    Elapsed Time: 0 minutes, 1 seconds
    1 12:50:06 Starting clusterwide operation
    2 12:50:06 FS-10370: Adding the resource ORA11 to group Available Storage
    3 12:50:06 FS-10371: 2K8-ORADBND1 : Performing initialization processing
    4 12:50:06 FS-10371: 2K8-ORADBND2 : Performing initialization processing
    5 12:50:07 FS-10372: 2K8-ORADBND1 : Gathering resource owner information
    6 12:50:07 FS-10372: 2K8-ORADBND2 : Gathering resource owner information
    7 12:50:07 FS-10373: 2K8-ORADBND1 : Determining owner node of resource ORA11
    8 12:50:07 FS-10374: 2K8-ORADBND1 : Gathering cluster information needed to perform the specified operation
    9 12:50:07 ** ERROR : FS-10791: The Oracle Database resource provider failed while gathering cluster information for resource ORA11
    10 12:50:07 ** ERROR : FS-10890: Oracle Services for MSCS failed during the add operation
    11 12:50:07 Please check your Windows Application log using the Event Viewer for any additional errors
    12 12:50:07 The clusterwide operation failed !
    Thanks for your help!

  • Acrobat cannot open the file attachment because your PDF file attachment settings do not allow......

    I have an email with an attachment that requires a password the open.  I can open the file but embedded in the attachment is another attachment.  When I double click attachment I get the following error message.  Acrobat cannot open the file attachment because your PDF file attachment settings do not allow this file type to be opened.

    You would need to make a change to your registry; see http://www.adobe.com/devnet-docs/acrobatetk/tools/AppSec/attachments.html
    Basically you would need to add the .pdf with the permission 2.
    Let us know if you need help with that.  Either way, make sure to create a System Restore Point before editing the registry.

Maybe you are looking for

  • Word 2007 to PDF conversion

    Hi, when I save a MS Word 2K7 document to PDF, it opens in PDF with a yellow background. Has anyone else experienced this, or know what the problem/solution is? thx.

  • Fonts not appearing in CC, but are shown in CS5.5

    I'm having an issue where fonts are not appearing in CC, when they are active in CS5.5. There's even fonts which do show up in CC but not all the weights. For example: ITC Lubalin Graph. It has several weights. All appear in CS5.5 but only 'book' in

  • What does the yellow "other" category mean when syncing my iPhone

    i am trying to sync my iPhone with my itunes on my computer.  there is not enough space to sync my iphone.  i know i can limit the amount of music i sync but i don't understand what the yellow "other" category means and it is taking up a lot of space

  • Rac one node in windows 2003?

    Hi, Do RAC one node support windows 2003 64 bit? I could find neither the patch 9004119 nor documentation for windows. All are about RAC one node in linux. Thanks Vincent

  • Performance (help to me and help to you) (LAPTOP VERSION!)

    Lets start this! Help to you! (2) 1. First thing is that you must update your drivers like: Graphics, processor or anything else. Go to the makers website and download the drivers from there. (2) 2. DirectX. Windows XP has DX9, Windows Vista has DX10