cancel
Showing results for 
Search instead for 
Did you mean: 

what are the mandatory para SO_NEW_DOCUMENT_ATT_SEND_API1

Former Member
0 Kudos

Hii All,

what r the mandary parameters that i hv to gv for this Fm SO_NEW_DOCUMENT_ATT_SEND_API1.

for mail..

i hv done till converting OTF data to PDF format n now my requiremnet is to send attachment through mail.

so how to use SO_NEW_DOCUMENT_ATT_SEND_API1 this FM..

n what sdl i declare before using this FM.?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

In the FM, also make,

<b>commit_work = 'X'</b>

Regards,

Pritha.

gopi_narendra
Active Contributor
0 Kudos

Check this sample code

  data : it_docdata     like sodocchgi1 occurs 0 with header line,
         it_objpacklist like sopcklsti1 occurs 0 with header line,
         it_contentbin  like solisti1   occurs 0 with header line,
         it_contenttxt  like solisti1   occurs 0 with header line,
         it_reclist     like somlreci1  occurs 0 with header line.

  data : l_lines type i.

  refresh : it_docdata, it_objpacklist, " it_objheader
            it_contentbin, it_contenttxt, it_reclist.

* Text contents of the email
  it_contenttxt-line = text-003.
  append it_contenttxt.
  clear : it_contenttxt.

* Contents of the Excel File
  move it_text[] to it_contentbin[].

* Attributes of new document
  it_docdata-obj_name  = 'Message'.
  it_docdata-obj_descr = text-002.
  append it_docdata.
  clear : it_docdata.

* For Email message
  describe table it_contenttxt lines l_lines.
  it_objpacklist-transf_bin = 'X'.
  it_objpacklist-head_start = 1.
  it_objpacklist-head_num   = 0.
  it_objpacklist-body_start = 1.
  it_objpacklist-body_num   = l_lines.
  it_objpacklist-doc_type   = 'TXT'.
  it_objpacklist-obj_name   = 'Message'.
  it_objpacklist-doc_size   = l_lines * 255.
  append it_objpacklist.
  clear : it_objpacklist.

* For Email attachment
  clear : l_lines.
  describe table it_text lines l_lines.
  it_objpacklist-transf_bin = 'X'.
  it_objpacklist-head_start = 1.
  it_objpacklist-head_num   = 0.
  it_objpacklist-body_start = 1.
  it_objpacklist-body_num   = l_lines.
  it_objpacklist-doc_type   = 'XLS'.
  it_objpacklist-obj_name   = 'Attachment'.
  concatenate 'Performance Analysis of ' p_user ' in this server'
              into it_objpacklist-obj_descr.
  append it_objpacklist.
  clear : it_objpacklist.

* Receivers list
  it_reclist-receiver = email.
  it_reclist-rec_type = 'U'.
  append it_reclist.
  clear : it_reclist.

  call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
       exporting
            document_data              = it_docdata
            put_in_outbox              = 'X'
       tables
            packing_list               = it_objpacklist
            contents_bin               = it_contentbin
            contents_txt               = it_contenttxt
            receivers                  = it_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.
  if sy-subrc <> 0.
    write 😕 'Error sending Email to ' , p_email.
  else.
    write 😕 'Mail successfully sent to ' , p_email.
  endif.

Regards

Gopi