Skip to Content
0
Former Member
Feb 13, 2008 at 06:33 AM

regarding the uploading the pdf file to the application server

102 Views

hi,

iam getting this error while uploading the pdf file to the applicatioin server.

"There was an error while trying to parse an image"

to convert smartform into PDF file we ll use convert_otf FM.

If see that FM data ll be stored in it_tline structure ok.

For sending to application server we ll use

OPEN DATASET p_arch for OUTPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.

LOOP AT it_tline.

TRANSFER it_tline to p_arch.

ENDLOOP.

CLOSE DATASET p_arch.

Ok

For getting data from internal table we ll use

OPEN DATASET p_arch FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS

do.

READ DATASET p_arch INTO it_tline.

if sy-subrc = 0.

APPEND it_tline.

ELSE .

exit.

endif.

enddo.

CLOSE DATASET p_arch.

LOOP AT it_tline.

TRANSLATE it_tline USING '~'.

CONCATENATE wa_buffer it_tline INTO wa_buffer.

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 = 'COMMERCIAL INVOICE'.

              APPEND i_objtxt.

              DESCRIBE TABLE i_objtxt LINES v_lines_txt.

              READ TABLE i_objtxt INDEX v_lines_txt.

              wa_doc_chng-obj_name = 'COMMERCIAL INVOICE'.

              wa_doc_chng-expiry_dat = sy-datum + 10.

              wa_doc_chng-obj_descr = 'COMMERCIAL INVOICE'.

              wa_doc_chng-sensitivty = 'F'.

              wa_doc_chng-doc_size = v_lines_txt * 255.

              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 = 0.

                  i_objpack-body_start = 1.

                  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 = 'COMMERCIAL INVOICE'.

                  i_objpack-obj_descr = 'COMMERCIAL INVOICE'.

                  APPEND i_objpack.

                  BREAK-POINT.

                  IF it_adr6[] IS NOT INITIAL.

                  LOOP AT it_adr6 INTO wa_adr6.

                  CLEAR i_reclist.

                  i_reclist-receiver = wa_adr6-smtp_addr.

                  i_reclist-rec_type = 'U'.

                  i_reclist-com_type = 'INT'.

                  APPEND i_reclist.

                  ENDLOOP.

                  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

                  receivers = i_reclist.

                  ENDIF.

                  The above error I am getting.

                  Please give your suggestions

                  Thanks in advance