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

Explain Packing_List parameter in SO_OBJECT_SEND

Former Member
0 Likes
991

Hi Experts,

I do not understand the parameters that need to be passed to FM SO_OBJECT_SEND.

I've set all the parameters for the FM, still the email is not sent. I am trying to attach an XLS file using this FM. I also need to encrypt the mail.

Can anyone provide me with a program which sends an XLS file using the said FM.

I've got programs sending a PDF using this FM which does not really help me.

Please reply asap.

Thanks in advance.

Regards,

Aparna.

2 REPLIES 2
Read only

Former Member
0 Likes
613

Hi,

Fill the document data.
  gd_doc_data-doc_size = 1.

* Populate the subject/generic message attributes
  gd_doc_data-obj_langu = sy-langu. "language
  gd_doc_data-obj_name  = 'SAPRPT'. " file name
  gd_doc_data-obj_descr = psubject. "mail subject
  gd_doc_data-sensitivty = 'F'.  

* Describe the body of the message
  clear it_packing_list.
  refresh it_packing_list.
  it_packing_list-transf_bin = space.
  it_packing_list-head_start = 1. "start position
  it_packing_list-head_num = 0.  "Start Number 
  it_packing_list-body_start = 1. "Body start Position
  describe table it_message lines it_packing_list-body_num.
  it_packing_list-doc_type = 'RAW'. " doc type RAW for Text *XLS for excel
  append it_packing_list.

U play around with these parameters u will get idea of packing list.

Regards,

Balakumar.G

Reward Points if helpful.

Read only

Former Member
0 Likes
613

Hi,

Parameter Descriptions

Either RECEPIENT or DLI must be specified. If the mail should be sent to several people, create a distribution list and supply its name for DLI.

Internal table TEXT should contain the body of the mail message.

While this function module can be used as it is, it is just an example. SO_OBJECT_SEND is very comprehensive and many of the features are omitted from this example. You are encouraged to examine SO_OBJECT_SEND, see all the available features, and change this function module to suit your requirements.

data:

i_objpack like standard table " Packing list

of sopcklsti1

initial size 0

with header line,

i_objbin like standard table " Contents in binary format

of solisti1

initial size 0

with header line,

i_reclist like standard table " Recipients list

of somlreci1

initial size 0

with header line,

data: w_tab_lines like sy-tabix. " No. of lines

  • Here Fill in the recipient list in table with I_reclist with receiver type

as "U" (i_reclist-rec_type = 'U') for Internet addresses.

data: lfs_doc_chng like sodocchgi1. " Mail attributes

fs_doc_chng-obj_descr = 'Mail with attach ment'.

i_objpack-head_start = 1.

i_objpack-head_num = 0.

i_objpack-body_start = 1.

i_objpack-body_num = 0.

i_objpack-doc_type = 'RAW'.

append i_objpack.

  • Here Store the contents of the attachment to be sent in the table

I_objbin.

describe table i_objbin lines w_tab_lines.

i_objpack-transf_bin = 'X'.

i_objpack-head_start = 1.

i_objpack-head_num = 1.

i_objpack-body_start = 1.

i_objpack-body_num = w_tab_lines.

i_objpack-doc_type = 'XLS'.

i_objpack-obj_descr = 'Attachment'.

i_objpack-obj_name = ' Attachment'.

i_objpack-doc_size = w_tab_lines * 255.

append i_objpack.

call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'

exporting

document_data = fs_doc_chng

put_in_outbox = 'X'

tables

packing_list = i_objpack

contents_bin = i_objbin

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.

case sy-subrc.

when 0.

message s017 with 'Email sent'(053).

when others.

message i017 with 'Mail delivery unsuccessful'(049).

endcase. " CASE sy-subrc.

Reward if helpful

Regards