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: 

what if attachment is more than 255 char while sending an-email

Former Member
0 Kudos
1,159

Hello Experts,

I am sending my report with XLS file attachment via e-mail.

I have declared attachment as t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,

now 'solisti1' contains only 255 characters where as my attachment records are more than 255 characters.

So, In my XLS attachment i am not getting records which have more than 255 characters and i want to display whole records.

Is there ant configuration of 'SO_NEW_DOCUMENT_ATT_SEND_API1' funcation or any idea to increase size so i can display whole records in attachment.

Points rewarded ASAP.

Regards,

Nimesh

1 ACCEPTED SOLUTION

Former Member
0 Kudos
201

This will increase the length of the record .. ie. more than 255 characters.. it will convert the xls in to XML and will display the XLS file..

CALL TRANSFORMATION id SOURCE source = i_final

RESULT XML i_attach.

the i_final is the internal table where ur records are stored..

and the i_attach is the internal table which you need to pass to the FM

READ TABLE fp_i_attach INTO l_wa_attach INDEX l_v_cnt.

l_wa_doc_data-doc_size =

( l_v_cnt - 1 ) * 255 + STRLEN( l_wa_attach ).

l_wa_doc_data-obj_langu = sy-langu.

l_wa_doc_data-obj_name = l_c_objname. "'SAPRPT'.

l_wa_doc_data-obj_descr = l_v_mtitle.

l_wa_doc_data-sensitivty = l_c_f. "'F'.

CLEAR l_i_attachment.

REFRESH l_i_attachment.

l_i_attachment = fp_i_attach.

  • Describe the body of the message

CLEAR l_wa_packing_list.

REFRESH l_i_packing_list.

*Flag for indicating an obj. to be transported in binary form

l_wa_packing_list-transf_bin = space.

*Start line of object header in transport packet

l_wa_packing_list-head_start = 1.

*Number of lines of an object header in object packet

l_wa_packing_list-head_num = 0.

*Start line of object contents in an object packet

l_wa_packing_list-body_start = 1.

DESCRIBE TABLE fp_i_msgbody LINES l_wa_packing_list-body_num.

*Code for document class

l_wa_packing_list-doc_type = l_c_doctype. "'RAW'.

APPEND l_wa_packing_list TO l_i_packing_list.

  • Create attachment notification

l_wa_packing_list-transf_bin = c_x.

l_wa_packing_list-head_start = 1.

l_wa_packing_list-head_num = 1.

l_wa_packing_list-body_start = 1.

DESCRIBE TABLE l_i_attachment LINES l_wa_packing_list-body_num.

l_wa_packing_list-doc_type = l_v_format.

l_wa_packing_list-obj_descr = l_v_attdescription.

l_wa_packing_list-obj_name = l_v_attfilename.

l_wa_packing_list-doc_size = l_wa_packing_list-body_num * 255.

APPEND l_wa_packing_list TO l_i_packing_list.

  • Add the recipients email address

CLEAR l_wa_receivers.

REFRESH l_i_receivers.

*SAPoffice: Name of the recipient of a document (also ext.)

l_wa_receivers-receiver = l_v_email.

*Specification of recipient type

l_wa_receivers-rec_type = l_c_rectype.

*Transmission Method (Fax, Telex, ...)

l_wa_receivers-com_type = space. "'INT'.

*Acknowledgment of receipt expected

l_wa_receivers-notif_del = c_x.

*Acknowledgment of receipt expected

l_wa_receivers-notif_ndel = c_x.

APPEND l_wa_receivers TO l_i_receivers.

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

document_data = l_wa_doc_data

put_in_outbox = c_x

sender_address = l_v_sender_address

sender_address_type = l_v_sender_address_type

commit_work = c_x

  • IMPORTING

  • sent_to_all = l_v_sent_all

TABLES

packing_list = l_i_packing_list

contents_bin = l_i_attachment

contents_txt = fp_i_msgbody

receivers = l_i_receivers

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

document_type_not_exist = 3

operation_no_authorization = 4

parameter_error = 5

x_error = 6

enqueue_error = 7

OTHERS = 8.

Reward Points if useful...

Edited by: Vivek Shah on Jan 23, 2008 11:36 AM

5 REPLIES 5

Former Member
0 Kudos
201

YOH MAN,

WILL U SPECIFY THE FUNCTION MODULE U R USING....

ANYWAYZZ DO ONE THING U MAKE AN OBJECT OF UR 255 CHAR. LINETYPE AND THEN CONCATE UR ATTACHMENT THROUGH LOOP..

FROM THIS WHEN LOOP WILL FINISH UR WHOLE MESSAGE WILL ATTACHED......

I DID IT AND ITS REALLY WORKING....

PLZ REWARD ME POINTS IF U CAN UNDERSTAND.

REGARDS,

BHUMIT MEHTA

Former Member
0 Kudos
201

Hi,

we have another requirement, how to increase the length of the subject line?

points will be rewarded generousely.

thanks

Sajjan

Former Member
0 Kudos
201

hi,

this can be handled two ways

1. manually make a chunks of 255 charc and pass to the it_attachment

2. convert the file into Hex using FM: SO_SOLITAB_TO_SOLIXTAB

and pass the resultant hex to the contents_hex of the FM

SO_NEW_DOCUMENT_ATT_SEND_API1

Former Member
0 Kudos
202

This will increase the length of the record .. ie. more than 255 characters.. it will convert the xls in to XML and will display the XLS file..

CALL TRANSFORMATION id SOURCE source = i_final

RESULT XML i_attach.

the i_final is the internal table where ur records are stored..

and the i_attach is the internal table which you need to pass to the FM

READ TABLE fp_i_attach INTO l_wa_attach INDEX l_v_cnt.

l_wa_doc_data-doc_size =

( l_v_cnt - 1 ) * 255 + STRLEN( l_wa_attach ).

l_wa_doc_data-obj_langu = sy-langu.

l_wa_doc_data-obj_name = l_c_objname. "'SAPRPT'.

l_wa_doc_data-obj_descr = l_v_mtitle.

l_wa_doc_data-sensitivty = l_c_f. "'F'.

CLEAR l_i_attachment.

REFRESH l_i_attachment.

l_i_attachment = fp_i_attach.

  • Describe the body of the message

CLEAR l_wa_packing_list.

REFRESH l_i_packing_list.

*Flag for indicating an obj. to be transported in binary form

l_wa_packing_list-transf_bin = space.

*Start line of object header in transport packet

l_wa_packing_list-head_start = 1.

*Number of lines of an object header in object packet

l_wa_packing_list-head_num = 0.

*Start line of object contents in an object packet

l_wa_packing_list-body_start = 1.

DESCRIBE TABLE fp_i_msgbody LINES l_wa_packing_list-body_num.

*Code for document class

l_wa_packing_list-doc_type = l_c_doctype. "'RAW'.

APPEND l_wa_packing_list TO l_i_packing_list.

  • Create attachment notification

l_wa_packing_list-transf_bin = c_x.

l_wa_packing_list-head_start = 1.

l_wa_packing_list-head_num = 1.

l_wa_packing_list-body_start = 1.

DESCRIBE TABLE l_i_attachment LINES l_wa_packing_list-body_num.

l_wa_packing_list-doc_type = l_v_format.

l_wa_packing_list-obj_descr = l_v_attdescription.

l_wa_packing_list-obj_name = l_v_attfilename.

l_wa_packing_list-doc_size = l_wa_packing_list-body_num * 255.

APPEND l_wa_packing_list TO l_i_packing_list.

  • Add the recipients email address

CLEAR l_wa_receivers.

REFRESH l_i_receivers.

*SAPoffice: Name of the recipient of a document (also ext.)

l_wa_receivers-receiver = l_v_email.

*Specification of recipient type

l_wa_receivers-rec_type = l_c_rectype.

*Transmission Method (Fax, Telex, ...)

l_wa_receivers-com_type = space. "'INT'.

*Acknowledgment of receipt expected

l_wa_receivers-notif_del = c_x.

*Acknowledgment of receipt expected

l_wa_receivers-notif_ndel = c_x.

APPEND l_wa_receivers TO l_i_receivers.

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

document_data = l_wa_doc_data

put_in_outbox = c_x

sender_address = l_v_sender_address

sender_address_type = l_v_sender_address_type

commit_work = c_x

  • IMPORTING

  • sent_to_all = l_v_sent_all

TABLES

packing_list = l_i_packing_list

contents_bin = l_i_attachment

contents_txt = fp_i_msgbody

receivers = l_i_receivers

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

document_type_not_exist = 3

operation_no_authorization = 4

parameter_error = 5

x_error = 6

enqueue_error = 7

OTHERS = 8.

Reward Points if useful...

Edited by: Vivek Shah on Jan 23, 2008 11:36 AM

Former Member
0 Kudos
201

Thanks