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: 

Problem with SO_NEW_DOCUMENT_ATT_SEND_API1

Former Member
0 Kudos
141

I am trying to send a comma separated file as attachement in email using function module SO_NEW_DOCUMENT_ATT_SEND_API1.

I am filling OBJBIN table with the comman separated content and attribute OBJPACK-DOCTYPE = 'XLS'

I am getting data as attachement in mail but file is not in desire format. I am facing two problem

1. Every character in Attached file is separated by a space for example if I inserted 'Material,Vendor' in table OBJBIN. I am getting 'M a t e r i a l , V e n d o r' in attached file.

2. Each record which I want to insert in OBJBIN table has length 550 but the length of table OBJBIN is 255 characters .

Waiting for your help.....

Thanks,

Pawan.

2 REPLIES 2

Former Member
0 Kudos
64

1. are u compressing the table or not ?

2. check what is the OBJPACK_doc size.

<b>objpack-doc_size = ( tab_lines - 1 ) * 2560 + strlen( objbin ).</b>

LOOP AT t_raw .
CLEAR objbin----><b>objbin max length is 255 ? so try to compress table t_raw.</b> .
* CONCATENATE t_raw-line
* cl_abap_char_utilities=>newline
* INTO objbin .
MOVE t_raw-line TO objbin .
APPEND objbin .
ENDLOOP.

try with Fm <b>TABLE_COMPRESS</b>

Regards

Prabhu

Message was edited by: Prabhu Peram

0 Kudos
64

This is what I am doing, Am I missing anything?

LOOP AT t_raw .

CLEAR objbin .

  • CONCATENATE t_raw-line

  • cl_abap_char_utilities=>newline

  • INTO objbin .

MOVE t_raw-line TO objbin .

APPEND objbin .

ENDLOOP.

  • Title and Description

docdata-obj_name = 'TEST'.

docdata-obj_descr = 'Test including Attachment'.

  • Main Text

objtxt = 'Test Document.'.

APPEND objtxt.

objtxt = 'You will find an attachment in this message.'.

APPEND objtxt.

objtxt = 'Have a nice day.'.

APPEND objtxt.

  • Write Packing List (Main)

DESCRIBE TABLE objtxt LINES tab_lines.

READ TABLE objtxt INDEX tab_lines.

docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).

CLEAR objpack-transf_bin.

objpack-head_start = 1.

objpack-head_num = 0.

objpack-body_start = 1.

objpack-body_num = tab_lines.

objpack-doc_type = 'RAW'.

APPEND objpack.

  • Create Message Attachment

att_type = 'XLS'.

DESCRIBE TABLE objbin LINES tab_lines.

READ TABLE objbin INDEX tab_lines.

objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).

objpack-transf_bin = 'X'.

objpack-head_start = 1.

objpack-head_num = 0.

objpack-body_start = 1.

objpack-body_num = tab_lines.

objpack-doc_type = att_type.

objpack-obj_name = 'ATTACHMENT'.

objpack-obj_descr = 'Attached Document'.

APPEND objpack.

  • Create receiver list

reclist-receiver = 'pawan.kesari@atosorigin.com'.

reclist-rec_type = 'U'.

APPEND reclist.

  • Send Message

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = docdata

put_in_outbox = 'X'

commit_work = 'X'

TABLES

packing_list = objpack

object_header = objhead

contents_bin = objbin

contents_txt = objtxt

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