Application Development and Automation 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: 
Read only

please help on SO_NEW_DOCUMENT_ATT_SEND_API1

Former Member
0 Likes
1,054

Hi Gurus I have to attach data in excel format, but getting a pbm here. I am using the following code..

can anyone suggest on this please..

docdata-obj_name = 'AUTOSEND'(m01).

docdata-obj_descr = trpt-text. "report title

docdata-expiry_dat = docdata-obj_expdat = sy-datum + 14.

  • Recepient's eMail message body text:

IF msgtab[] IS INITIAL. "no message body passed

PERFORM std_msg_body_for_report. "use standard for any report

ELSE.

READ TABLE msgtab INDEX 1.

docdata-obj_descr = msgtab. "1st line as title

objtxt[] = msgtab[]. "message text as passed

ENDIF.

  • Write Message Body to Packing List (Main)

PERFORM write_msg_body_to_pack_list.

OBJBIN = '|'.

APPEND OBJBIN.

DESCRIBE TABLE objbin LINES tab_lines. "rpt attachment lines

READ TABLE objbin INDEX tab_lines.

objpack-doc_size = tab_lines * 255.

objpack-transf_bin = 'X'.

objpack-head_start = 1.

objpack-head_num = 1.

objpack-body_start = 1.

objpack-body_num = tab_lines.

objpack-doc_type = '.csv'. "attachment type

objpack-obj_name = p_repid.

IF msgtab[] IS INITIAL.

objpack-obj_descr = trpt-text. "report title

ELSE.

objpack-obj_descr = msgtab. "1st passed message line

ENDIF.

APPEND objpack.

  • Create receiver list

reclist-receiver = p_recvr. "external email address

reclist-rec_type = 'U'. "(internet addr)

APPEND reclist.

  • Send Message

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = docdata

commit_work = 'X'

*>>>>>>>>> put_in_outbox = 'X' "sy-uname gets copy

TABLES

packing_list = objpack

object_header = objhead

contents_bin = objbin "rpt attachment

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.

1 ACCEPTED SOLUTION
Read only

robert_altenstraer
Active Participant
0 Likes
800

Hi...

objpack-doc_type = '.csv'. "attachment type

try that:


 objpack-transf_bin = ''.                  
 objpack-doc_type = 'RAW'.     " the description of file: objpack-doc_type = 'CSV'.

bestreg robert

Hi Gurus I have to attach data in excel format, but getting a pbm here. I am using the following code..

can anyone suggest on this please..

docdata-obj_name = 'AUTOSEND'(m01).

docdata-obj_descr = trpt-text. "report title

docdata-expiry_dat = docdata-obj_expdat = sy-datum + 14.

  • Recepient's eMail message body text:

IF msgtab[] IS INITIAL. "no message body passed

PERFORM std_msg_body_for_report. "use standard for any report

ELSE.

READ TABLE msgtab INDEX 1.

docdata-obj_descr = msgtab. "1st line as title

objtxt[] = msgtab[]. "message text as passed

ENDIF.

  • Write Message Body to Packing List (Main)

PERFORM write_msg_body_to_pack_list.

OBJBIN = '|'.

APPEND OBJBIN.

DESCRIBE TABLE objbin LINES tab_lines. "rpt attachment lines

READ TABLE objbin INDEX tab_lines.

objpack-doc_size = tab_lines * 255.

objpack-transf_bin = 'X'.

objpack-head_start = 1.

objpack-head_num = 1.

objpack-body_start = 1.

objpack-body_num = tab_lines.

objpack-doc_type = '.csv'. "attachment type

objpack-obj_name = p_repid.

IF msgtab[] IS INITIAL.

objpack-obj_descr = trpt-text. "report title

ELSE.

objpack-obj_descr = msgtab. "1st passed message line

ENDIF.

APPEND objpack.

  • Create receiver list

reclist-receiver = p_recvr. "external email address

reclist-rec_type = 'U'. "(internet addr)

APPEND reclist.

  • Send Message

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = docdata

commit_work = 'X'

*>>>>>>>>> put_in_outbox = 'X' "sy-uname gets copy

TABLES

packing_list = objpack

object_header = objhead

contents_bin = objbin "rpt attachment

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.

3 REPLIES 3
Read only

robert_altenstraer
Active Participant
0 Likes
801

Hi...

objpack-doc_type = '.csv'. "attachment type

try that:


 objpack-transf_bin = ''.                  
 objpack-doc_type = 'RAW'.     " the description of file: objpack-doc_type = 'CSV'.

bestreg robert

Read only

Former Member
0 Likes
800

Hi try this

objpack-doc_type = 'XLS' instead of objpack-doc_type = 'CSV'

Read only

0 Likes
800

Hi,

check this link,

try to search what you want first in SCN,,,

and your Query has been asked many times in SCN,,,

[link1|;

[link2|]

[link3|]

[link4|]

All these links got again many sub links,,,

check the ablove links to solve your problem.

Thanks & regards,

Dileep .C