cancel
Showing results for 
Search instead for 
Did you mean: 

spool pdf mail

Former Member
0 Kudos

Hi,

I am having the spool number. i am converting that to pdf using 'CONVERT_ABAPSPOOLJOB_2_PDF' and ' CONVERT_OTFSPOOLJOB_2_PDF'. do i need to use the below code for the function modules.

  • Transfer the 132-long strings to 255-long strings

LOOP AT it_pdf_output.

TRANSLATE it_pdf_output USING ' ~'.

CONCATENATE gd_buffer it_pdf_output 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.

After this i am using the function moudle 'SO_DOCUMENT_SEND_API1' t osend mail.

Iam able to recieve the mail but i am not able to open the pdf file. it is giving a popup "the file is damaged , it should be repaired" . .

Can any body help me out.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I you're using FB SO_DOCUMENT_SEND_API1 to email the PDF make sure that the doc_size in the corresponding line of  packing_list is correct. Many code examples on the net use something like number_of_table_lines * 255 but on a unicode system for obvious reasons this will not work and you'll get a truncated file.   There might be more sophisticated methods to determine the documentsize but just doubling the number will also work in probably all cases.

Regards, Joop

Former Member
0 Kudos

hi

Check this program RSTXPDFT4

Regards

Gregory

Former Member
0 Kudos

how to decode the OTF spool

Former Member
0 Kudos

Hi Guy,

Check this piece of code :


  DATA: pdf_size TYPE i,                             " PDF Size
        pdf_itab_size TYPE i,                        " Attachment size
        mailtxt_size TYPE i,                         " Text in mail size
        l_vbeln LIKE vbdka-vbeln.                    " Order Doc
  DATA:
  it_mailtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,    " Mail Text
  it_pdf TYPE TABLE OF tline WITH HEADER LINE,           " OTF output
  it_mailpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE, " Dist details
  it_mailhead LIKE solisti1   OCCURS  1 WITH HEADER LINE," Header data
  it_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,   " Rec List
  it_pdfdata LIKE solix OCCURS 0 WITH HEADER LINE.  " Attachment data
  DATA: it_doc_att LIKE sodocchgi1.                 " Attri of new doc
  DATA: BEGIN OF it_pdfout OCCURS 0,                " PDF in 255 length
           tline TYPE char255,
        END OF it_pdfout.

  DATA: otfdata LIKE soli OCCURS 0 WITH HEADER LINE.
  DATA: pdfdata LIKE solisti1 OCCURS 0 WITH HEADER LINE.
  DATA: pdf_filesize LIKE sood-objlen.
  DATA: bin_filesize TYPE i.
  DATA: w_otf TYPE itcoo. "For OTF
  DATA: w_pdf TYPE solisti1. "For PDF
  DATA: i_content_txt TYPE soli_tab. "Content
  DATA: w_transfer_bin TYPE sx_boolean. "Content
  DATA: i_content_bin TYPE solix_tab, "Content
  i_objhead TYPE soli_tab.

  DATA: v_len_in TYPE so_obj_len,
  v_size TYPE i.

...

* Convert OTF to PDF
  LOOP AT otf_data INTO w_otf.
    CONCATENATE w_otf-tdprintcom w_otf-tdprintpar
    INTO w_pdf.
    APPEND w_pdf TO i_content_txt.
  ENDLOOP.
  CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
    EXPORTING
      format_src      = 'OTF'
      format_dst      = 'PDF'
    CHANGING
      transfer_bin    = w_transfer_bin
      content_txt     = i_content_txt
      content_bin     = i_content_bin
      objhead         = i_objhead
      len             = v_len_in
    EXCEPTIONS
      err_conv_failed = 1
      OTHERS          = 2.

Hope this helps,

Erwan