Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding FILE SIZE Sending Mail

Former Member
0 Kudos

Hi,

while sending a mail through my report file size is getting increased...i.e if i run the program for 3 employees for 1st employee the file size is 12 KB for 2nd employee the file size is getting increased to 35 KB and for the 3rd employee again the file Size is getting increased to 65 KB......plz suggest me...

Thanks and Regards,

bharathi.

5 REPLIES 5

Former Member
0 Kudos

dear friend ,

pls check your code , in that code u have to use refresh and free other wise clear statement as per u r condition ,

clear ur t internal table if it is there.

0 Kudos

Hi Friend,

While Comin to the functional Module 'convert_otf' eventhough i have cleared its taking only 35kb for the second employee...

thanks and regards,

K.Srinath.

0 Kudos

hi ,

how u are sending the email ? any FMs like SO_NEW_DOCUMENT_ATT_SEND_API1 ?, u need to clear all internal tables used for sending emails ?

regards

Prabhu

0 Kudos

Hi Prabu,

I have Cleared But still Its Not Working...

I Will Send U the Code..

i_otf[] = w_return-otfdata[].

free : v_len_in,i_tline.

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

IMPORTING

  • bin_filesize = sf_file_size

bin_filesize = v_len_in

TABLES

otf = i_otf

lines = i_tline

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

OTHERS = 4.

IF sy-subrc <> 0.

  • MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

  • WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

  • v_len_in = sf_file_size.

  • Convert PDF from 132 to 255.

LOOP AT i_tline.

  • Replacing space by ~

TRANSLATE i_tline USING ' ~'.

CONCATENATE w_buffer i_tline INTO w_buffer.

ENDLOOP.

  • replacing ~ by space

TRANSLATE w_buffer USING '~ '.

DO.

i_record = w_buffer.

  • Appending 255 characters as a record

APPEND i_record.

SHIFT w_buffer LEFT BY 255 PLACES.

IF w_buffer IS INITIAL.

EXIT.

ENDIF.

ENDDO.

REFRESH: i_reclist,

i_objtxt,

i_objbin,

i_objpack.

CLEAR w_objhead.

  • Object with PDF.

i_objbin[] = i_record[].

DESCRIBE TABLE i_objbin LINES v_lines_bin.

  • object with main text of the mail.

i_objtxt = 'Find attached Your Payslip.'.

APPEND i_objtxt.

i_objtxt = 'Regards,'.

APPEND i_objtxt.

i_objtxt = sy-uname. "p0001-ename..

APPEND i_objtxt.

  • -------------------------------

  • DESCRIBE TABLE i_objbin LINES v_lines_bin.

  • -----------------------

DESCRIBE TABLE i_objtxt LINES v_lines_txt.

READ TABLE i_objtxt INDEX v_lines_txt.

  • Document information.

  • w_doc_chng-obj_name = 'Smartform'.

w_doc_chng-obj_name = 'Payslip'.

w_doc_chng-expiry_dat = sy-datum + 10.

  • w_doc_chng-obj_descr = 'Smart form output'.

w_doc_chng-obj_descr = 'Payslip'.

w_doc_chng-sensitivty = 'F'. "Functional object

w_doc_chng-doc_size = v_lines_txt * 255.

  • Pack to main body as RAW.

  • Obj. to be transported not in binary form

CLEAR i_objpack-transf_bin.

  • Start line of object header in transport packet

i_objpack-head_start = 1.

  • Number of lines of an object header in object packet

i_objpack-head_num = 0.

  • Start line of object contents in an object packet

i_objpack-body_start = 1.

  • Number of lines of the object contents in an object packet

i_objpack-body_num = v_lines_txt.

  • Code for document class

i_objpack-doc_type = 'RAW'.

APPEND i_objpack.

  • Packing as PDF.

i_objpack-transf_bin = 'X'.

i_objpack-head_start = 1.

i_objpack-head_num = 1.

i_objpack-body_start = 1.

i_objpack-body_num = v_lines_bin.

i_objpack-doc_type = 'PDF'.

i_objpack-obj_name = 'Form 16'.

CONCATENATE 'Payslip' '.pdf'

INTO i_objpack-obj_descr.

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 = 'Payslip'.

APPEND i_objpack.

  • Document information.

CLEAR i_reclist.

  • e-mail receivers.

TRANSLATE p0105-usrid_long TO LOWER CASE.

TRANSLATE p0105-usrid TO LOWER CASE.

i_reclist-receiver = p0105-usrid_long.

  • IF i_reclist-receiver IS INITIAL.

  • i_reclist-receiver = p0105-usrid.

  • ENDIF.

i_reclist-express = 'X'.

i_reclist-rec_type = 'U'. "Internet address

APPEND i_reclist.

  • Sending mail.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = w_doc_chng

put_in_outbox = 'X'

commit_work = 'X'

TABLES

packing_list = i_objpack

object_header = w_objhead

contents_bin = i_objbin

contents_txt = i_objtxt

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:/ 'Error When Sending the File', sy-subrc.

ELSE.

WRITE:/ 'Mail sent'.

ENDIF.

CLEAR: i_reclist,i_reclist[],i_objpack,i_otf,i_tline,v_len_in,i_objbin

.

0 Kudos

Hi

Thanks. Its resolved.