Skip to Content
Former Member
Apr 17, 2008 at 08:11 AM

Problem when sending mails with excel attached



I'm tryin to send mails via SAPOffice with attached excel documents. I'm using FM SO_NEW_DOCUMENT_ATT_SEND_API1. I have a problem with the code. Here I post it:

DATA: ti_objbin LIKE solisti1 OCCURS 150 WITH HEADER LINE,

ti_objhex LIKE solix OCCURS 150 WITH HEADER LINE.

DATA: BEGIN OF i_excel,

sobid(8) TYPE c,

tab1 TYPE X VALUE 09, "tab code

name(80) TYPE c,

tab2 TYPE X VALUE 09, "tab code

city(40) TYPE c,

tab3 TYPE X VALUE 09, "tab code

kostl(10) TYPE c,

tab4 TYPE X VALUE 09, "tab code

ktext(20) TYPE c,

tab5 TYPE X VALUE 09, "tab code

fasig(10) TYPE c,

tab6 TYPE X VALUE 09, "tab code

ruta(255) TYPE c,

fin TYPE X VALUE 13, "carriage return

END OF i_excel.

i_excel-sobid = wa_datos-sobid.

i_excel-name = wa_datos-name.

i_excel-city = wa_datos-city.

i_excel-kostl = wa_datos-kostl.

i_excel-ktext = wa_datos-ktext.

i_excel-fasig = wa_datos-fasig.

i_excel-ruta = wa_datos-ruta.

WRITE i_excel TO ti_objbin-line.

APPEND ti_objbin.

CLEAR ti_objbin.



document_data = docdata

put_in_outbox = 'X'


packing_list = ti_objpack

object_header = ti_objhead

contents_bin = ti_objbin

contents_txt = ti_objtxt

* contents_hex = ti_objhex

receivers = ti_reclist


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


I have used this code before, in 4.6C release and it works fine, but now I'm on ECC5.0 and when i check the code, the next error message is generated: ""I_EXCEL" cannot be converted to a character-type field." If i try using MOVE i_excel TO i_objbin-line instead of WRITE, the error message changes to: ""TI_OBJBIN-LINE" and "I_EXCEL" are not mutually convertible in a Unicode program. program.". I have tried using ti_objhex table instead of ti_objbin in order to use 'context_hex' parameter (instead of 'context_bin') on FM, but i get the same result.

I've been searching any other FM to do this, and i've found more FM of SOI1 function group but i didn´t get the expected result. So i need to send the message with the excel attached, using this FM or any other, but I need some help. Anyone can help me?

Thanks and Regards